garnet_spec
Version, currently 0.4.08 versions
github.com/amberframework/garnet-spec
Extends Crystal Spec for testing web applications
Nothing has been indexed for 0.4.0 yet. The tag is recorded, its shard.yml has not been read, so the manifest and dependency list below are empty because they are unknown rather than because they are absent.
Installation
# Add this to your shard.yml
dependencies:
garnet_spec:
github: amberframework/garnet-spec
version: ~> 0.4.0Then run:
shards installshard.yml
No shard.yml has been indexed for 0.4.0. You can read it on the repository.
Dependencies
Unknown: the shard.yml for this version has not been read yet.
README
This README is the one indexed from the repository at its latest ref, not from the tag for this version.
Test Framework for Web Apps
A Crystal library to perform system and controller tests for Web Applications.
System Testing is a level of the software testing where a complete and integrated software is tested. The purpose of a system test is to evaluate the system’s compliance with the specified requirements.
System Tests aka (Browser Tests, Feature Tests)
When is it performed?
System Testing is performed after Integration Testing and before Acceptance Testing.
Installation
Add this to your application's shard.yml:
dependencies:
garnet_spec:
github: amberframework/garnet-spec
Installing java
MacOS: brew cask install java then java --version to verify installation.
Usage
Before running your tests ensure you have installed the chromedriver in your system path
For MacOS you can install the driver using Homebrew with the following command:
brew install chromedriver
This will install the chrome driver on the system path /usr/local/bin/chromedriver
If you're running in a different OS such a Linux you can specify the chromedriver path as such
With Amber Framework
# spec/spec_helper.cr
require "amber"
require "garnet_spec"
handler = Amber::Server.instance.handler
handler.prepare_pipelines
module GarnetSpec
HANDLER = handler
end
Standalone
class FakeHandler
def call(context)
response = { headers: context.request.headers.to_h }.to_json
context.response.write(response.to_slice)
end
end
module GarnetSpec
HANDLER = FakeHandler.new
end
Write Your Tests
require "./spec_helper"
class SomeFeature < GarnetSpec::SystemTest
describe "Amber Framework website" do
scenario "user visits amber framework and sees getting started button" do
visit "http://www.amberframework.org"
element(:tag_name, "body").text.should contain "Fork the project"
end
scenario "user visits amberframwork homepage and sees logo" do
visit "http://www.amberframework.org"
element(:class_name, "img-amber-logo").attribute("src").should match(
%r(https://amberframework.org/assets/img/amber-logo-t-bg.png)
)
end
end
end
Run your crystal spec
crystal spec
Development
- [ ] Add support for other webdrivers
- [ ] Add more dsl methods similar to https://gist.github.com/zhengjia/428105
- [ ] Add support for Chrome webdriver Desired Capabilities
- [ ] Add support for headless chrome
- [ ] Make it more configurable
Contributing
- Fork it ( https://github.com/amberframework/garnet-spec/fork )
- Create your feature branch (git checkout -b my-new-feature)
- Commit your changes (git commit -am 'Add some feature')
- Push to the branch (git push origin my-new-feature)
- Create a new Pull Request
Contributors
Documentation
Built from the current release. The first visit to a release nobody has asked for starts its build.
Links
This release
- Version
0.4.0- Tagged
- May 20, 2023
- Commit
da30504b61ed- Indexed
- not yet
Dependents
- ratmachine
- crystal-amber-url-shortener
- api_milenio
- ai_chat
- ratmachine
- amber
- prismalytics
- authy-example
- todo
- nocturne
- amber-example-01
- praesentia
and 33 more
Repository
github.com/amberframework/garnet-spec
Metadata
- Created
- Aug 12, 2026
- Updated
- Sep 24, 2026
- Synced
- Sep 24, 2026
- Versions
- 8