Skip to content

Commit

Permalink
Environment variable for different hosts and headless options
Browse files Browse the repository at this point in the history
  • Loading branch information
blacksmith-welder committed Aug 28, 2024
1 parent 17ecfe5 commit 5e7a1d6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/cucumber-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,4 @@ jobs:
bundle config path vendor/bundle
bundle install --jobs 4 --retry 3
- name: Run tests
run: bundle exec cucumber

run: bundle exec cucumber HEADLESS=true
22 changes: 18 additions & 4 deletions env.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,27 @@
require 'capybara/cucumber'
require 'selenium-webdriver'

BASE_URL = 'https://e2e.archivesspace.org'
PUBLIC_URL = BASE_URL.freeze
STAFF_URL = "#{BASE_URL}/staff".freeze
case ENV['HOST']
when 'localhost', 'http://localhost:8080'
BASE_URL = 'http://localhost:8080'
PUBLIC_URL = 'http://localhost:8081'
STAFF_URL = "#{BASE_URL}".freeze
else
BASE_URL = 'https://e2e.archivesspace.org'
PUBLIC_URL = BASE_URL.freeze
STAFF_URL = "#{BASE_URL}/staff".freeze
end

case ENV['HEADLESS']
when 'true'
HEADLESS = '--headless'
else
HEADLESS = ''
end

Capybara.register_driver :firefox do |app|
options = Selenium::WebDriver::Firefox::Options.new
options.add_argument("--headless")
options.add_argument(HEADLESS)

Capybara::Selenium::Driver.new(app, browser: :firefox, options:)
end
Expand Down

0 comments on commit 5e7a1d6

Please sign in to comment.