Skip to content

Instantly share code, notes, and snippets.

@RubyRebbe
Created November 4, 2018 19:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RubyRebbe/3fad39a333c20d25a9844005824aec70 to your computer and use it in GitHub Desktop.
Save RubyRebbe/3fad39a333c20d25a9844005824aec70 to your computer and use it in GitHub Desktop.
```crystal
ENV["AMBER_ENV"] ||= "test"
require "amber"
require "spec"
require "micrate"
require "garnet_spec"
require "../config/*"
Micrate::DB.connection_url = Amber.settings.database_url
# Automatically run migrations on the test database
Micrate::Cli.run_up
# Disable Granite logs in tests
Granite.settings.logger = Logger.new nil
module SystemTest
DRIVER = :chrome
PATH = "/usr/local/bin/chromedriver"
end
```
```crystal
require "../spec_helper"
class HomePageSpec < GarnetSpec::System::Test
@@root = "http://localhost:3000/"
describe "Home Page" do
it "can see the welcome text" do
visit @@root
e = page.find_element( :tag_name, "h2" )
e.text.should eq "Welcome to Amber Framework!"
sleep 5
end
it "xcan visit items page" do
visit @@root
items_link = page.find_element(:link_text, "Items" )
items_link.click
sleep 5
end
end # describe
end # class
```
```
No active session with ID d2838aebc16f40935cc17da483b96198 (Selenium::NoSuchDriver)
from lib/selenium/src/webdriver.cr:91:23 in 'failure'
from lib/selenium/src/webdriver.cr:65:9 in 'post'
from lib/selenium/src/webdriver/session.cr:176:18 in 'post'
from lib/selenium/src/webdriver/session.cr:61:7 in 'url='
from lib/garnet_spec/src/garnet_spec/system/page.cr:39:7 in 'visit'
from spec/system/homepage_spec.cr:5:1 in 'visit'
from spec/system/homepage_spec.cr:20:17 in '->'
from /home/tsvi/Downloads/crystal-0.26.1-1-linux-x86_64/crystal-0.26.1-1/share/crystal/src/spec/methods.cr:255:3 in 'it'
from spec/system/homepage_spec.cr:17:3 in '->'
from /home/tsvi/Downloads/crystal-0.26.1-1-linux-x86_64/crystal-0.26.1-1/share/crystal/src/spec/context.cr:255:3 in 'describe'
from /home/tsvi/Downloads/crystal-0.26.1-1-linux-x86_64/crystal-0.26.1-1/share/crystal/src/spec/methods.cr:16:5 in 'describe'
from spec/system/homepage_spec.cr:8:2 in '__crystal_main'
from /home/tsvi/Downloads/crystal-0.26.1-1-linux-x86_64/crystal-0.26.1-1/share/crystal/src/crystal/main.cr:97:5 in 'main_user_code'
from /home/tsvi/Downloads/crystal-0.26.1-1-linux-x86_64/crystal-0.26.1-1/share/crystal/src/crystal/main.cr:86:7 in 'main'
from /home/tsvi/Downloads/crystal-0.26.1-1-linux-x86_64/crystal-0.26.1-1/share/crystal/src/crystal/main.cr:106:3 in 'main'
from __libc_start_main
from _start
from ???
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment