Merge branch '8784-dir-listings'
[arvados.git] / apps / workbench / test / integration / logins_test.rb
1 # Copyright (C) The Arvados Authors. All rights reserved.
2 #
3 # SPDX-License-Identifier: AGPL-3.0
4
5 require 'integration_helper'
6
7 class LoginsTest < ActionDispatch::IntegrationTest
8   setup do
9     need_javascript
10   end
11
12   test "login with api_token works after redirect" do
13     visit page_with_token('active_trustedclient')
14     assert page.has_text?('Recent pipelines and processes'), "Missing 'Recent pipelines and processes' from page"
15     assert_no_match(/\bapi_token=/, current_path)
16   end
17
18   test "trying to use expired token redirects to login page" do
19     visit page_with_token('expired_trustedclient')
20     buttons = all("a.btn", text: /Log in/)
21     assert_equal(1, buttons.size, "Failed to find one login button")
22     login_link = buttons.first[:href]
23     assert_match(%r{//[^/]+/login}, login_link)
24     assert_no_match(/\bapi_token=/, login_link)
25   end
26 end