123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246 |
- # encoding: utf-8
- require 'browser_test_helper'
- class TaskbarTaskTest < TestCase
- def test_persistant_task_a
- tests = [
- {
- :name => 'persistant task',
- :action => [
- {
- :execute => 'wait',
- :value => 2,
- },
- {
- :execute => 'close_all_tasks',
- },
- {
- :execute => 'wait',
- :value => 1,
- },
- {
- :execute => 'click',
- :css => 'a[href="#new"]',
- },
- {
- :execute => 'click',
- :css => 'a[href="#ticket/create"]',
- },
- {
- :execute => 'wait',
- :value => 3,
- },
- {
- :execute => 'check',
- :css => '.active .newTicket',
- :result => true,
- },
- {
- :execute => 'set',
- :css => '.active .newTicket input[name="title"]',
- :value => 'some test AAA',
- },
- {
- :execute => 'wait',
- :value => 12,
- },
- ],
- },
- ]
- browser_signle_test_with_login(tests, { :username => 'agent1@example.com' })
- end
- def test_persistant_task_b
- tests = [
- {
- :name => 'persistant task',
- :action => [
- {
- :execute => 'wait',
- :value => 4,
- },
- {
- :execute => 'click',
- :css => '.task',
- },
- {
- :execute => 'wait',
- :value => 1,
- },
- {
- :execute => 'match',
- :css => 'body',
- :value => 'some test AAA',
- :match_result => true,
- },
- {
- :execute => 'close_all_tasks',
- },
- {
- :execute => 'match',
- :css => 'body',
- :value => 'some test AAA',
- :match_result => false,
- },
- ],
- },
- ]
- browser_signle_test_with_login(tests, { :username => 'agent1@example.com' })
- end
- def test_persistant_task_with_relogin
- tests = [
- {
- :name => 'agent1 - create persistant task',
- :action => [
- {
- :execute => 'wait',
- :value => 2,
- },
- {
- :execute => 'close_all_tasks',
- },
- {
- :execute => 'click',
- :css => 'a[href="#new"]',
- },
- {
- :execute => 'click',
- :css => 'a[href="#ticket/create"]',
- },
- {
- :execute => 'wait',
- :value => 2,
- },
- {
- :execute => 'set',
- :css => '.active .newTicket input[name="title"]',
- :value => 'INBOUND TEST#1',
- },
- {
- :execute => 'wait',
- :value => 4,
- },
- {
- :execute => 'set',
- :css => '.active .newTicket [data-name="body"]',
- :value => 'INBOUND BODY TEST#1',
- },
- {
- :execute => 'click',
- :css => 'a[href="#new"]',
- },
- {
- :execute => 'click',
- :css => 'a[href="#ticket/create"]',
- },
- {
- :execute => 'wait',
- :value => 2,
- },
- {
- :execute => 'set',
- :css => '.active .newTicket input[name="title"]',
- :value => 'OUTBOUND TEST#1',
- },
- {
- :execute => 'wait',
- :value => 1,
- },
- {
- :execute => 'set',
- :css => '.active .newTicket [data-name="body"]',
- :value => 'OUTBOUND BODY TEST#1',
- },
- {
- :execute => 'wait',
- :value => 12,
- },
- {
- :execute => 'logout',
- },
- {
- :execute => 'check',
- :css => '#login',
- :result => true,
- },
- {
- :execute => 'wait',
- :value => 10,
- },
- ],
- },
- {
- :name => 'relogin with master - task are not viewable',
- :action => [
- {
- :execute => 'login',
- :username => 'master@example.com',
- :password => 'test',
- },
- {
- :execute => 'wait',
- :value => 6,
- },
- {
- :execute => 'match',
- :css => 'body',
- :value => 'INBOUND TEST#1',
- :match_result => false,
- },
- {
- :execute => 'match',
- :css => 'body',
- :value => 'OUTBOUND TEST#1',
- :match_result => false,
- },
- {
- :execute => 'logout',
- },
- {
- :execute => 'check',
- :css => '#login',
- :result => true,
- },
- {
- :execute => 'match',
- :css => 'body',
- :value => 'INBOUND TEST#1',
- :match_result => false,
- },
- {
- :execute => 'match',
- :css => 'body',
- :value => 'OUTBOUND TEST#1',
- :match_result => false,
- },
- ],
- },
- {
- :name => 'relogin with agent - task are viewable',
- :action => [
- {
- :execute => 'login',
- :username => 'agent1@example.com',
- :password => 'test',
- },
- {
- :execute => 'wait',
- :value => 3,
- },
- {
- :execute => 'match',
- :css => 'body',
- :value => 'INBOUND TEST#1',
- :match_result => true,
- },
- {
- :execute => 'match',
- :css => 'body',
- :value => 'OUTBOUND TEST#1',
- :match_result => true,
- },
- ],
- },
- ]
- browser_signle_test_with_login(tests, { :username => 'agent1@example.com' })
- end
- end
|