123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344 |
- # encoding: utf-8
- require 'browser_test_helper'
- class AgentTicketActionsLevel3Test < TestCase
- def test_work_with_two_browser_on_same_ticket_edit
- message = 'message 3 äöüß ' + rand(99999999999999999).to_s
- tests = [
- {
- :name => 'start',
- :instance1 => browser_instance,
- :instance2 => browser_instance,
- :instance1_username => 'master@example.com',
- :instance1_password => 'test',
- :instance2_username => 'agent1@example.com',
- :instance2_password => 'test',
- :url => browser_url,
- :action => [
- {
- :where => :instance1,
- :execute => 'close_all_tasks',
- },
- {
- :where => :instance2,
- :execute => 'close_all_tasks',
- },
- # create ticket
- {
- :where => :instance1,
- :execute => 'create_ticket',
- :group => 'Users',
- :subject => 'some level 3 <b>subject</b> 123äöü',
- :body => 'some level 3 <b>body</b> 123äöü',
- },
- # check ticket
- {
- :where => :instance1,
- :execute => 'match',
- :css => '.active div.ticket-article',
- :value => 'some level 3 <b>body</b> 123äöü',
- :match_result => true,
- },
- # remember old ticket where we want to merge to
- {
- :where => :instance1,
- :execute => 'match',
- :css => '.active .ticket_info h3',
- :value => '^#(.*)$',
- :no_quote => true,
- :match_result => true,
- },
- # open ticket in second browser
- {
- :execute => 'wait',
- :value => 1,
- },
- {
- :where => :instance2,
- :execute => 'set',
- :css => '#global-search',
- :value => '###stack###',
- },
- {
- :execute => 'wait',
- :value => 3,
- },
- {
- :where => :instance2,
- :execute => 'click',
- :link => '###stack###',
- # :css => 'a:contains(\'###stack###\')',
- },
- {
- :execute => 'wait',
- :value => 3,
- },
- {
- :where => :instance2,
- :execute => 'match',
- :css => '.active div.ticket-article',
- :value => 'some level 3 <b>body</b> 123äöü',
- :match_result => true,
- },
- # change edit screen in instance 1
- {
- :where => :instance1,
- :execute => 'set',
- :css => '.active .ticket-answer textarea[name="body"]',
- :value => 'some level 3 <b>body</b> in instance 1',
- },
- {
- :execute => 'wait',
- :value => 3,
- },
- # update ticket in instance 2
- {
- :where => :instance2,
- :execute => 'set',
- :css => '.active .ticket-answer textarea[name="body"]',
- :value => 'some level 3 <b>body</b> in instance 2',
- },
- {
- :execute => 'wait',
- :value => 5,
- },
- {
- :where => :instance2,
- :execute => 'match',
- :css => '.content_permanent.active .reset-message',
- :value => '(Discard your unsaved changes.|Verwerfen der)',
- :no_quote => true,
- :match_result => true,
- },
- {
- :where => :instance2,
- :execute => 'click',
- :css => '.active .edit button[type="submit"]',
- },
- {
- :execute => 'wait',
- :value => 12,
- },
- {
- :where => :instance2,
- :execute => 'match',
- :css => '.content_permanent.active .reset-message',
- :value => '(Discard your unsaved changes.|Verwerfen der)',
- :no_quote => true,
- :match_result => false,
- },
- # check content and edit screen in instance 1
- {
- :where => :instance1,
- :execute => 'match',
- :css => '.active div.ticket-article-view',
- :value => 'some level 3 <b>body</b> in instance 2',
- :match_result => true,
- },
- {
- :where => :instance1,
- :execute => 'match',
- :css => '.active .ticket-answer textarea[name="body"]',
- :value => 'some level 3 <b>body</b> in instance 1',
- :match_result => true,
- },
- {
- :where => :instance1,
- :execute => 'match',
- :css => '.content_permanent.active .reset-message',
- :value => '(Discard your unsaved changes.|Verwerfen der)',
- :no_quote => true,
- :match_result => true,
- },
- # check edit screen in instance 2
- {
- :where => :instance2,
- :execute => 'match',
- :css => '.active .ticket-answer textarea[name="body"]',
- :value => '^$',
- :no_quote => true,
- :match_result => true,
- },
- # update ticket in instance 1
- {
- :where => :instance1,
- :execute => 'click',
- :css => '.active .edit button[type="submit"]',
- },
- {
- :execute => 'wait',
- :value => 16,
- },
- # check content in instance 2
- {
- :where => :instance2,
- :execute => 'match',
- :css => '.active div.ticket-article-view',
- :value => 'some level 3 <b>body</b> in instance 1',
- :match_result => true,
- },
- {
- :where => :instance2,
- :execute => 'match',
- :css => '.active div.ticket-article-view',
- :value => 'some level 3 <b>body</b> in instance 2',
- :match_result => true,
- },
- # check content and edit screen in instance 1+2
- {
- :where => :instance1,
- :execute => 'match',
- :css => '.active .ticket-answer textarea[name="body"]',
- :value => '^$',
- :no_quote => true,
- :match_result => true,
- },
- {
- :where => :instance1,
- :execute => 'match',
- :css => '.content_permanent.active .reset-message',
- :value => '(Discard your unsaved changes.|Verwerfen der)',
- :no_quote => true,
- :match_result => false,
- },
- {
- :where => :instance2,
- :execute => 'match',
- :css => '.active .ticket-answer textarea[name="body"]',
- :value => '^$',
- :no_quote => true,
- :match_result => true,
- },
- {
- :where => :instance2,
- :execute => 'match',
- :css => '.content_permanent.active .reset-message',
- :value => '(Discard your unsaved changes.|Verwerfen der)',
- :no_quote => true,
- :match_result => false,
- },
- # reload instances, verify again
- {
- :where => :instance1,
- :execute => 'reload',
- },
- {
- :where => :instance2,
- :execute => 'reload',
- },
- # check content and edit screen in instance 1+2
- {
- :where => :instance1,
- :execute => 'match',
- :css => '.active .ticket-answer textarea[name="body"]',
- :value => '^$',
- :no_quote => true,
- :match_result => true,
- },
- {
- :where => :instance1,
- :execute => 'match',
- :css => '.content_permanent.active .reset-message',
- :value => '(Discard your unsaved changes.|Verwerfen der)',
- :no_quote => true,
- :match_result => false,
- },
- {
- :where => :instance2,
- :execute => 'match',
- :css => '.active .ticket-answer textarea[name="body"]',
- :value => '^$',
- :no_quote => true,
- :match_result => true,
- },
- {
- :where => :instance2,
- :execute => 'match',
- :css => '.content_permanent.active .reset-message',
- :value => '(Discard your unsaved changes.|Verwerfen der)',
- :no_quote => true,
- :match_result => false,
- },
- # change form of ticket in instance 2
- {
- :where => :instance2,
- :execute => 'set',
- :css => '.active .ticket-answer textarea[name="body"]',
- :value => '22 some level 3 <b>body</b> in instance 2',
- },
- {
- :execute => 'wait',
- :value => 4,
- },
- {
- :where => :instance2,
- :execute => 'match',
- :css => '.content_permanent.active .reset-message',
- :value => '(Discard your unsaved changes.|Verwerfen der)',
- :no_quote => true,
- :match_result => true,
- },
- {
- :where => :instance2,
- :execute => 'reload',
- },
- {
- :where => :instance2,
- :execute => 'match',
- :css => '.active .ticket-answer textarea[name="body"]',
- :value => '22 some level 3 <b>body</b> in instance 2',
- :match_result => true,
- },
- {
- :where => :instance2,
- :execute => 'match',
- :css => '.content_permanent.active .reset-message',
- :value => '(Discard your unsaved changes.|Verwerfen der)',
- :no_quote => true,
- :match_result => true,
- },
- {
- :where => :instance2,
- :execute => 'click',
- :css => '.active .edit button[type="submit"]',
- },
- {
- :execute => 'wait',
- :value => 8,
- },
- {
- :where => :instance2,
- :execute => 'match',
- :css => '.content_permanent.active',
- :css => '.content_permanent.active .reset-message',
- :value => '(Discard your unsaved changes.|Verwerfen der)',
- :no_quote => true,
- :match_result => false,
- },
- {
- :where => :instance2,
- :execute => 'match',
- :css => '.active div.ticket-article-view',
- :value => '22 some level 3 <b>body</b> in instance 2',
- :match_result => true,
- },
- ],
- },
- ]
- browser_double_test(tests)
- end
- end
|