- # 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? 'Please log in'
+ 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)