X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/40df5992d4d8071a6e10a20ecdeb0470a80764cc..f824f854b26dbf5e6c1d10dc3eb4689349dd71fe:/apps/workbench/test/integration/logins_test.rb diff --git a/apps/workbench/test/integration/logins_test.rb b/apps/workbench/test/integration/logins_test.rb index be7e4e15a5..0d6514d75d 100644 --- a/apps/workbench/test/integration/logins_test.rb +++ b/apps/workbench/test/integration/logins_test.rb @@ -1,21 +1,22 @@ require 'integration_helper' class LoginsTest < ActionDispatch::IntegrationTest + setup do + need_javascript + end + test "login with api_token works after redirect" do visit page_with_token('active_trustedclient') - assert page.has_text?('Recent jobs'), "Missing 'Recent jobs' from page" + assert page.has_text?('Recent pipelines and processes'), "Missing 'Recent pipelines and processes' from page" assert_no_match(/\bapi_token=/, current_path) end - test "can't use expired token" do - visit page_with_token('expired_trustedclient') - assert page.has_text? 'Log in' - end - - test "expired token yields login page, not error page" do + test "trying to use expired token redirects to login page" do visit page_with_token('expired_trustedclient') - # Even the error page has a "Log in" link. We should look for - # something that only appears the real login page. - assert page.has_text? ' Log in Oh... fiddlesticks. Sorry, I had some trouble handling your request' + buttons = all("a.btn", text: /Log in/) + assert_equal(1, buttons.size, "Failed to find one login button") + login_link = buttons.first[:href] + assert_match(%r{//[^/]+/login}, login_link) + assert_no_match(/\bapi_token=/, login_link) end end