1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586 |
- # encoding: utf-8
- 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
- cookie(
- name: '^_zammad.+?',
- should_not_exist: true,
- )
- end
- end
|