From 369aa7e52da1fcb1a44cd7b9282d52cc5becfe38 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Wed, 28 Jan 2015 23:47:05 +0100 Subject: [PATCH] Added browser test for merge with two open tabs. --- .../agent_ticket_actions_level1_test.rb | 124 +++++++++++++++++- 1 file changed, 122 insertions(+), 2 deletions(-) diff --git a/test/browser/agent_ticket_actions_level1_test.rb b/test/browser/agent_ticket_actions_level1_test.rb index 061f2c6aa..205c551d0 100644 --- a/test/browser/agent_ticket_actions_level1_test.rb +++ b/test/browser/agent_ticket_actions_level1_test.rb @@ -2,7 +2,7 @@ require 'browser_test_helper' class AgentTicketActionLevel1Test < TestCase - def test_agent_ticket_create + def test_agent_ticket_merge_closed_tab tests = [ { :name => 'agent ticket create 1', @@ -171,4 +171,124 @@ class AgentTicketActionLevel1Test < TestCase ] browser_signle_test_with_login(tests, { :username => 'agent1@example.com' }) end -end + + def test_agent_ticket_merge_open_tab + tests = [ + { + :name => 'agent ticket create 1', + :action => [ + { + :execute => 'close_all_tasks', + }, + + # create ticket + { + :execute => 'create_ticket', + :group => 'Users', + :subject => 'some subject 123äöü', + :body => 'some body 123äöü', + }, + + # check ticket + { + :execute => 'match', + :css => '.content.active .ticket-article', + :value => 'some body 123äöü', + :match_result => true, + }, + + # remember old ticket where we want to merge to + { + :execute => 'match', + :css => '.content.active .page-header .ticket-number', + :value => '^(.*)$', + :no_quote => true, + :match_result => true, + }, + + ], + }, + + { + :name => 'agent ticket create 2', + :action => [ + + # create ticket + { + :execute => 'create_ticket', + :group => 'Users', + :subject => 'test to merge', + :body => 'some body 123äöü 222 - test to merge', + }, + + # check ticket + { + :execute => 'watch_for', + :area => '.content.active .ticket-article', + :value => 'some body 123äöü 222 - test to merge', + }, + + # check if task is shown + { + :execute => 'match', + :css => 'body', + :value => 'test to merge', + :match_result => true, + }, + ], + }, + { + :name => 'agent ticket merge', + :action => [ + { + :execute => 'click', + :css => '.active div[data-tab="ticket"] .js-actions .select-arrow', + }, + { + :execute => 'click', + :css => '.active div[data-tab="ticket"] .js-actions a[data-type="ticket-merge"]', + }, + { + :execute => 'wait', + :value => 4, + }, + { + :execute => 'set', + :css => '.modal input[name="master_ticket_number"]', + :value => '###stack###', + }, + { + :execute => 'click', + :css => '.modal button[type="submit"]', + }, + { + :execute => 'wait', + :value => 6, + }, + + # check if merged to ticket is shown now + { + :execute => 'match', + :css => '.active .page-header .ticket-number', + :value => '###stack###', + :match_result => true, + }, + + # check if task is now gone + { + :execute => 'match', + :css => 'body', + :value => 'test to merge', + :match_result => true, + }, + + # close task/cleanup + { + :execute => 'close_all_tasks', + }, + ], + }, + ] + browser_signle_test_with_login(tests, { :username => 'agent1@example.com' }) + end +end \ No newline at end of file