123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177 |
- # encoding: utf-8
- require 'browser_test_helper'
- class AuthCustomerTest < TestCase
- def test_authentication
- tests = [
- {
- :name => 'start',
- :instance => browser_instance,
- :url => browser_url,
- :action => [
- {
- :execute => 'check',
- :css => '#login',
- :result => true,
- },
- {
- :execute => 'check',
- :css => '#login button',
- :result => true,
- },
- {
- :execute => 'click',
- :css => '#login button',
- },
- {
- :execute => 'wait',
- :value => 5,
- },
- {
- :execute => 'check',
- :css => '#login',
- :result => true,
- },
- ],
- },
- {
- :name => 'login',
- :action => [
- {
- :execute => 'check',
- :css => '#login',
- :result => true,
- },
- {
- :execute => 'set',
- :css => 'input[name="username"]',
- :value => 'nicole.braun@zammad.org',
- },
- {
- :execute => 'set',
- :css => 'input[name="password"]',
- :value => 'test'
- },
- {
- :execute => 'click',
- :css => '#login button',
- },
- {
- :execute => 'wait',
- :value => 5,
- },
- # check action
- {
- :execute => 'check',
- :css => '#login',
- :result => false,
- },
- {
- :execute => 'watch_for',
- :area => 'body',
- :value => 'nicole.braun@zammad.org',
- },
- {
- :execute => 'reload',
- },
- {
- :execute => 'watch_for',
- :area => 'body',
- :value => 'nicole.braun@zammad.org',
- },
- {
- :execute => 'match',
- :element => :cookie,
- :value => 'expires=>nil',
- },
- ],
- },
- ]
- browser_single_test(tests)
- end
- def test_authentication_new_browser_without_permanent_cookie_no_session_should_be
- tests = [
- {
- :name => 'start',
- :instance => browser_instance,
- :url => browser_url,
- :action => [
- {
- :execute => 'check',
- :css => '#login',
- :result => true,
- },
- {
- :execute => 'check',
- :css => '#login button',
- :result => true,
- },
- ],
- },
- ]
- browser_single_test(tests)
- end
- def test_new_browser_with_permanent_cookie_login
- tests = [
- {
- :name => 'start',
- :instance => browser_instance,
- :url => browser_url,
- :action => [
- {
- :execute => 'check',
- :css => '#login',
- :result => true,
- },
- {
- :execute => 'set',
- :css => 'input[name="username"]',
- :value => 'nicole.braun@zammad.org',
- },
- {
- :execute => 'set',
- :css => 'input[name="password"]',
- :value => 'test'
- },
- {
- :execute => 'click',
- :css => '#login [name="remember_me"]',
- },
- {
- :execute => 'click',
- :css => '#login button',
- },
- {
- :execute => 'wait',
- :value => 6,
- },
- # check action
- {
- :execute => 'check',
- :css => '#login',
- :result => false,
- },
- {
- :execute => 'watch_for',
- :area => 'body',
- :value => 'nicole.braun@zammad.org',
- },
- {
- :execute => 'match',
- :element => :cookie,
- :value => 'expires=>.+?\d{4}.+?,',
- },
- {
- :execute => 'logout',
- },
- ],
- },
- ]
- browser_single_test(tests)
- end
- end
|