123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687 |
- require 'browser_test_helper'
- class AuthTest < TestCase
- def test_authentication
- @browser = browser_instance
- location(url: browser_url)
- match(
- css: '#login',
- value: 'username',
- )
- click(css: '#login button')
- sleep 4
- match(
- css: '#login',
- value: 'username',
- )
- # login with username/password
- login(
- username: 'nicole.braun@zammad.org',
- password: 'test',
- )
- tasks_close_all()
- # reload page
- reload()
- # check if cookie is temporarily
- watch_for(
- css: 'body',
- value: 'Overviews',
- )
- # verify session cookie
- cookie(
- name: '^_zammad.+?',
- value: '.+?',
- expires: '',
- )
- end
- def test_authentication_new_browser_without_permanent_cookie_no_session_should_be
- @browser = browser_instance
- location(url: browser_url)
- match(
- css: '#login',
- value: 'username',
- )
- end
- def test_new_browser_with_permanent_cookie_login
- @browser = browser_instance
- location(url: browser_url)
- # login with username/password
- login(
- username: 'nicole.braun@zammad.org',
- password: 'test',
- remember_me: true,
- )
- # check if cookie is temporarily
- watch_for(
- css: 'body',
- value: 'Overviews',
- )
- # verify session cookie
- cookie(
- name: '^_zammad.+?',
- value: '.+?',
- expires: '\d{4}-\d{1,2}-\d{1,2}.+?',
- )
- logout()
- # verify session cookie
- sleep 2
- cookie(
- name: '^_zammad.+?',
- value: '.+?',
- expires: '',
- )
- end
- end
|