a11yist/test/application_system_test_case.rb
david c35c7da6e0
Some checks failed
/ Run tests (push) Successful in 2m51s
/ Run system tests (push) Failing after 3m29s
/ Build, push and deploy image (push) Has been cancelled
Migrate to Rais 8.0
- Remove all Rodauth stuff and implement simple custom auth
- Migrate from sprockets to propshaft, hack some bootstrap stuff
2024-11-08 22:05:31 +01:00

39 lines
1.1 KiB
Ruby

# frozen_string_literal: true
require "test_helper"
class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
driven_by(:selenium, using: :headless_chrome,
options: { browser: :remote,
url: ENV.fetch("SELENIUM_REMOTE_URL", nil) })
setup do
Capybara.server_host = "0.0.0.0" # bind to all interfaces
Capybara.app_host = "http://#{IPSocket.getaddress(Socket.gethostname)}" if ENV["SELENIUM_REMOTE_URL"].present?
end
def app_host
"http://#{IPSocket.getaddress(Socket.gethostname)}"
end
def login(email, password)
visit "/session/new"
assert_selector("h1", text: "Login")
fill_in "Login", with: email
fill_in "Passwort", with: password
click_button "Login"
assert_text("Dashboard")
save_screenshot "after_login.png"
end
def logout
Session.destroy_all
end
def login_test
user = User.find_or_initialize_by(email_address: "test@example.com")
user.update!(password: "password")
login(user.email_address, user.password)
save_screenshot "login.png"
end
end