Fix tests
Some checks failed
/ Run tests (push) Failing after 55s
/ Run system tests (push) Failing after 55s
/ Build, push and deploy image (push) Has been skipped

This commit is contained in:
david 2024-09-22 22:49:53 +02:00
parent fbf6923835
commit 6e1a17281d
22 changed files with 235 additions and 13 deletions

View file

@ -7,10 +7,29 @@ class ApplicationSystemTestCase < ActionDispatch::SystemTestCase
options: { browser: :remote,
url: ENV.fetch("SELENIUM_REMOTE_URL", nil) })
def setup
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
super
def app_host
"http://#{IPSocket.getaddress(Socket.gethostname)}"
end
def login(email, password)
visit "/login"
fill_in "Login", with: email
fill_in "Password", with: password
click_button "Login"
end
def logout
visit "/logout"
click_on "Log out"
end
def login_test
Account.create(email: "test@example.com", password: "password")
login("test@example.com", "password")
end
end