From f22a87c99f29637e073a501883fd4bcf76392ac4 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Sun, 12 Oct 2014 01:35:53 +0200 Subject: [PATCH] Some temp. browser test bugfixes. --- .../app/lib/app_post/task_manager.js.coffee | 7 +- .../app/views/customer_ticket_create.jst.eco | 2 +- .../javascripts/app/views/ticket_zoom.jst.eco | 2 +- .../agent_ticket_actions_level1_test.rb | 24 +--- .../agent_ticket_actions_level2_test.rb | 121 +++++------------- .../agent_ticket_actions_level3_test.rb | 94 ++++++-------- .../agent_ticket_actions_level4_test.rb | 2 +- .../agent_ticket_actions_level5_test.rb | 60 +++++++-- test/browser/agent_user_manage_test.rb | 6 +- test/browser/customer_ticket_create_test.rb | 12 +- test/browser/taskbar_task_test.rb | 12 +- test/browser_test_helper.rb | 92 ++++++++++--- 12 files changed, 218 insertions(+), 216 deletions(-) diff --git a/app/assets/javascripts/app/lib/app_post/task_manager.js.coffee b/app/assets/javascripts/app/lib/app_post/task_manager.js.coffee index 48b1fe0ca..e041537a0 100644 --- a/app/assets/javascripts/app/lib/app_post/task_manager.js.coffee +++ b/app/assets/javascripts/app/lib/app_post/task_manager.js.coffee @@ -151,8 +151,7 @@ class _taskManagerSingleton extends App.Controller $('#content').empty() # hide all tasks - $('.content').addClass('hide') - $('.content').removeClass('active') + $('.content').addClass('hide').removeClass('active') # create div for task if not exists if !$("#content_permanent_#{key}")[0] @@ -160,9 +159,9 @@ class _taskManagerSingleton extends App.Controller # set task to shown and active if @activeTask is key - $('#content_permanent_' + key).removeClass('hide') + $('#content_permanent_' + key).removeClass('hide').addClass('active') else - $('#content_permanent_' + key).addClass('hide') + $('#content_permanent_' + key).addClass('hide').removeClass('active') # set all tasks to active false, only new/selected one to active if active diff --git a/app/assets/javascripts/app/views/customer_ticket_create.jst.eco b/app/assets/javascripts/app/views/customer_ticket_create.jst.eco index 0400186d8..3fca4ed1d 100644 --- a/app/assets/javascripts/app/views/customer_ticket_create.jst.eco +++ b/app/assets/javascripts/app/views/customer_ticket_create.jst.eco @@ -5,7 +5,7 @@

<%- @T( 'New Ticket' ) %>

-
+
diff --git a/app/assets/javascripts/app/views/ticket_zoom.jst.eco b/app/assets/javascripts/app/views/ticket_zoom.jst.eco index 3f8c749ac..c24850dd5 100644 --- a/app/assets/javascripts/app/views/ticket_zoom.jst.eco +++ b/app/assets/javascripts/app/views/ticket_zoom.jst.eco @@ -92,7 +92,7 @@
- +
\ No newline at end of file diff --git a/test/browser/agent_ticket_actions_level1_test.rb b/test/browser/agent_ticket_actions_level1_test.rb index e42dae175..2fac7b8e1 100644 --- a/test/browser/agent_ticket_actions_level1_test.rb +++ b/test/browser/agent_ticket_actions_level1_test.rb @@ -43,18 +43,12 @@ class AgentTicketActionLevel1Test < TestCase # :value => 'note', #}, { - :execute => 'check', - :css => '.active [data-name="body"]', - :result => true, - }, - { - :execute => 'set', - :css => '.active [data-name="body"]', - :value => 'some body 1234 äöüß', + :execute => 'set_ticket_attributes', + :body => 'some body 1234 äöüß', }, { :execute => 'click', - :css => '.active input.submit', + :css => '.content.active button.js-submit', }, { :execute => 'wait', @@ -97,18 +91,12 @@ class AgentTicketActionLevel1Test < TestCase # :value => 'note', #}, { - :execute => 'check', - :css => '.content.active [data-name="body"]', - :result => true, - }, - { - :execute => 'set', - :css => '.content.active [data-name="body"]', - :value => 'some body 1234 äöüß 333', + :execute => 'set_ticket_attributes', + :body => 'some body 1234 äöüß 333', }, { :execute => 'click', - :css => '.content.active input.submit', + :css => '.content.active button.js-submit', }, { :execute => 'watch_for', diff --git a/test/browser/agent_ticket_actions_level2_test.rb b/test/browser/agent_ticket_actions_level2_test.rb index 04756c451..dfee58a7d 100644 --- a/test/browser/agent_ticket_actions_level2_test.rb +++ b/test/browser/agent_ticket_actions_level2_test.rb @@ -82,64 +82,29 @@ class AgentTicketActionsLevel2Test < TestCase }, # change title in second browser -# { -# :where => :instance2, -# :execute => 'sendkey', -# :css => '.active .ticket-title-update', -# :value => 'TTT', -# }, -# { -# :where => :instance2, -# :execute => 'sendkey', -# :css => '.active .ticket-title-update', -# :value => :tab, -# }, { - :where => :instance2, - :execute => 'js', - :value => '$(".active .ticket-title .ticket-title-update").focus()', - }, - { - :where => :instance2, - :execute => 'js', - :value => '$(".active .ticket-title .ticket-title-update").html("TTTsome level 2 <b>subject</b> 123äöü")', - }, - { - :where => :instance2, - :execute => 'js', - :value => '$(".active .ticket-title .ticket-title-update").blur()', - }, - { - :where => :instance2, - :execute => 'js', - :value => '$(".active .ticket-title .ticket-title-update").trigger("blur")', - }, - { - :execute => 'wait', - :value => 5, + :where => :instance2, + :execute => 'set_ticket_attributes', + :title => 'TTTsome level 2 subject 123äöü', }, # set body in edit area { :where => :instance2, - :execute => 'set', - :css => '.active [data-name="body"]', - :value => 'some level 2 body in instance 2', + :execute => 'set_ticket_attributes', + :body => 'some level 2 body in instance 2', }, { :where => :instance1, - :execute => 'set', - :css => '.active [data-name="body"]', - :value => 'some level 2 body in instance 1', + :execute => 'set_ticket_attributes', + :body => 'some level 2 body in instance 1', }, # change task and page title in second browser { :where => :instance2, - :execute => 'match', - :css => '.tasks .active', - :value => 'TTTsome level 2 subject 123äöü', - :match_result => true, + :execute => 'verify_task_attributes', + :title => 'TTTsome level 2 subject 123äöü', }, { :where => :instance2, @@ -154,17 +119,13 @@ class AgentTicketActionsLevel2Test < TestCase }, { :where => :instance1, - :execute => 'match', - :css => '.active .ticket-title-update', - :value => 'TTTsome level 2 subject 123äöü', - :match_result => true, + :execute => 'verify_ticket_attributes', + :title => 'TTTsome level 2 subject 123äöü', }, { :where => :instance2, - :execute => 'match', - :css => '.tasks .active', - :value => 'TTTsome level 2 subject 123äöü', - :match_result => true, + :execute => 'verify_task_attributes', + :title => 'TTTsome level 2 subject 123äöü', }, { :where => :instance1, @@ -180,17 +141,13 @@ class AgentTicketActionsLevel2Test < TestCase # verify text in input body { :where => :instance1, - :execute => 'match', - :css => '.active [data-name="body"]', - :value => 'some level 2 body in instance 1', - :match_result => true, + :execute => 'verify_ticket_attributes', + :body => 'some level 2 body in instance 1', }, { :where => :instance2, - :execute => 'match', - :css => '.active [data-name="body"]', - :value => 'some level 2 body in instance 2', - :match_result => true, + :execute => 'verify_ticket_attributes', + :body => 'some level 2 body in instance 2', }, # add new article @@ -202,14 +159,13 @@ class AgentTicketActionsLevel2Test < TestCase #}, { :where => :instance1, - :execute => 'set', - :css => '.active [data-name="body"]', - :value => 'some update 4711', + :execute => 'set_ticket_attributes', + :body => 'some update 4711', }, { :where => :instance1, :execute => 'click', - :css => '.active input.submit', + :css => '.content.active button.js-submit', }, { :where => :instance1, @@ -221,20 +177,15 @@ class AgentTicketActionsLevel2Test < TestCase # verify empty text in input body { :where => :instance1, - :execute => 'match', - :css => '.active [data-name="body"]', - :value => '', - :match_result => true, + :execute => 'verify_ticket_attributes', + :body => '', }, { :where => :instance2, - :execute => 'match', - :css => '.active [data-name="body"]', - :value => 'some level 2 body in instance 2', - :match_result => true, + :execute => 'verify_ticket_attributes', + :body => 'some level 2 body in instance 2', }, - # reload instances, verify again { :where => :instance1, @@ -252,17 +203,13 @@ class AgentTicketActionsLevel2Test < TestCase }, { :where => :instance1, - :execute => 'match', - :css => '.active .ticket-title-update', - :value => 'TTTsome level 2 subject 123äöü', - :match_result => true, + :execute => 'verify_ticket_attributes', + :title => 'TTTsome level 2 subject 123äöü', }, { :where => :instance2, - :execute => 'match', - :css => '.tasks .active', - :value => 'TTTsome level 2 subject 123äöü', - :match_result => true, + :execute => 'verify_task_attributes', + :title => 'TTTsome level 2 subject 123äöü', }, { :where => :instance1, @@ -294,17 +241,13 @@ class AgentTicketActionsLevel2Test < TestCase # verify empty text in input body { :where => :instance1, - :execute => 'match', - :css => '.active [data-name="body"]', - :value => '', - :match_result => true, + :execute => 'verify_ticket_attributes', + :body => '', }, { :where => :instance2, - :execute => 'match', - :css => '.active [data-name="body"]', - :value => 'some level 2 body in instance 2', - :match_result => true, + :execute => 'verify_ticket_attributes', + :body => 'some level 2 body in instance 2', }, ], diff --git a/test/browser/agent_ticket_actions_level3_test.rb b/test/browser/agent_ticket_actions_level3_test.rb index 402e44815..483c6bd97 100644 --- a/test/browser/agent_ticket_actions_level3_test.rb +++ b/test/browser/agent_ticket_actions_level3_test.rb @@ -47,7 +47,7 @@ class AgentTicketActionsLevel3Test < TestCase :where => :instance1, :execute => 'match', :css => '.active .page-header .ticket-number', - :value => '^#(.*)$', + :value => '^(.*)$', :no_quote => true, :match_result => true, }, @@ -88,9 +88,8 @@ class AgentTicketActionsLevel3Test < TestCase # change edit screen in instance 1 { :where => :instance1, - :execute => 'set', - :css => '.active .ticket-edit textarea[name="body"]', - :value => 'some level 3 body in instance 1', + :execute => 'set_ticket_attributes', + :body => 'some level 3 body in instance 1', }, { :execute => 'wait', @@ -100,9 +99,8 @@ class AgentTicketActionsLevel3Test < TestCase # update ticket in instance 2 { :where => :instance2, - :execute => 'set', - :css => '.active .ticket-edit textarea[name="body"]', - :value => 'some level 3 body in instance 2', + :execute => 'set_ticket_attributes', + :body => 'some level 3 body in instance 2', }, { :execute => 'wait', @@ -111,7 +109,7 @@ class AgentTicketActionsLevel3Test < TestCase { :where => :instance2, :execute => 'match', - :css => '.content_permanent.active .reset-message', + :css => '.content.active .js-reset', :value => '(Discard your unsaved changes.|Verwerfen der)', :no_quote => true, :match_result => true, @@ -119,7 +117,7 @@ class AgentTicketActionsLevel3Test < TestCase { :where => :instance2, :execute => 'click', - :css => '.active .edit button[type="submit"]', + :css => '.active button.js-submit', }, { :execute => 'wait', @@ -128,7 +126,7 @@ class AgentTicketActionsLevel3Test < TestCase { :where => :instance2, :execute => 'match', - :css => '.content_permanent.active .reset-message', + :css => '.content.active .js-reset', :value => '(Discard your unsaved changes.|Verwerfen der)', :no_quote => true, :match_result => false, @@ -143,16 +141,14 @@ class AgentTicketActionsLevel3Test < TestCase :match_result => true, }, { - :where => :instance1, - :execute => 'match', - :css => '.active .ticket-edit textarea[name="body"]', - :value => 'some level 3 body in instance 1', - :match_result => true, + :where => :instance1, + :execute => 'verify_ticket_attributes', + :body => 'some level 3 body in instance 1', }, { :where => :instance1, :execute => 'match', - :css => '.content_permanent.active .reset-message', + :css => '.content.active .js-reset', :value => '(Discard your unsaved changes.|Verwerfen der)', :no_quote => true, :match_result => true, @@ -161,18 +157,15 @@ class AgentTicketActionsLevel3Test < TestCase # check edit screen in instance 2 { :where => :instance2, - :execute => 'match', - :css => '.active .ticket-edit textarea[name="body"]', - :value => '^$', - :no_quote => true, - :match_result => true, + :execute => 'verify_ticket_attributes', + :bdoy => '', }, # update ticket in instance 1 { :where => :instance1, :execute => 'click', - :css => '.active .edit button[type="submit"]', + :css => '.active button.js-submit', }, { :execute => 'wait', @@ -198,32 +191,26 @@ class AgentTicketActionsLevel3Test < TestCase # check content and edit screen in instance 1+2 { :where => :instance1, - :execute => 'match', - :css => '.active .ticket-edit textarea[name="body"]', - :value => '^$', - :no_quote => true, - :match_result => true, + :execute => 'verify_ticket_attributes', + :body => '', }, { :where => :instance1, :execute => 'match', - :css => '.content_permanent.active .reset-message', + :css => '.content.active .js-reset', :value => '(Discard your unsaved changes.|Verwerfen der)', :no_quote => true, :match_result => false, }, { :where => :instance2, - :execute => 'match', - :css => '.active .ticket-edit textarea[name="body"]', - :value => '^$', - :no_quote => true, - :match_result => true, + :execute => 'verify_ticket_attributes', + :body => '', }, { :where => :instance2, :execute => 'match', - :css => '.content_permanent.active .reset-message', + :css => '.content.active .js-reset', :value => '(Discard your unsaved changes.|Verwerfen der)', :no_quote => true, :match_result => false, @@ -242,32 +229,26 @@ class AgentTicketActionsLevel3Test < TestCase # check content and edit screen in instance 1+2 { :where => :instance1, - :execute => 'match', - :css => '.active .ticket-edit textarea[name="body"]', - :value => '^$', - :no_quote => true, - :match_result => true, + :execute => 'verify_ticket_attributes', + :body => '', }, { :where => :instance1, :execute => 'match', - :css => '.content_permanent.active .reset-message', + :css => '.content.active .js-reset', :value => '(Discard your unsaved changes.|Verwerfen der)', :no_quote => true, :match_result => false, }, { :where => :instance2, - :execute => 'match', - :css => '.active .ticket-edit textarea[name="body"]', - :value => '^$', - :no_quote => true, - :match_result => true, + :execute => 'verify_ticket_attributes', + :body => '', }, { :where => :instance2, :execute => 'match', - :css => '.content_permanent.active .reset-message', + :css => '.content.active .js-reset', :value => '(Discard your unsaved changes.|Verwerfen der)', :no_quote => true, :match_result => false, @@ -275,10 +256,9 @@ class AgentTicketActionsLevel3Test < TestCase # change form of ticket in instance 2 { - :where => :instance2, - :execute => 'set', - :css => '.active .ticket-edit textarea[name="body"]', - :value => '22 some level 3 body in instance 2', + :where => :instance2, + :execute => 'set_ticket_attributes', + :body => '22 some level 3 body in instance 2', }, { :execute => 'wait', @@ -287,7 +267,7 @@ class AgentTicketActionsLevel3Test < TestCase { :where => :instance2, :execute => 'match', - :css => '.content_permanent.active .reset-message', + :css => '.content.active .js-reset', :value => '(Discard your unsaved changes.|Verwerfen der)', :no_quote => true, :match_result => true, @@ -298,15 +278,13 @@ class AgentTicketActionsLevel3Test < TestCase }, { :where => :instance2, - :execute => 'match', - :css => '.active .ticket-edit textarea[name="body"]', - :value => '22 some level 3 body in instance 2', - :match_result => true, + :execute => 'verify_ticket_attributes', + :body => '22 some level 3 body in instance 2', }, { :where => :instance2, :execute => 'match', - :css => '.content_permanent.active .reset-message', + :css => '.content.active .js-reset', :value => '(Discard your unsaved changes.|Verwerfen der)', :no_quote => true, :match_result => true, @@ -314,7 +292,7 @@ class AgentTicketActionsLevel3Test < TestCase { :where => :instance2, :execute => 'click', - :css => '.active .edit button[type="submit"]', + :css => '.active button.js-submit', }, { :execute => 'wait', @@ -324,7 +302,7 @@ class AgentTicketActionsLevel3Test < TestCase :where => :instance2, :execute => 'match', :css => '.content_permanent.active', - :css => '.content_permanent.active .reset-message', + :css => '.content.active .js-reset', :value => '(Discard your unsaved changes.|Verwerfen der)', :no_quote => true, :match_result => false, diff --git a/test/browser/agent_ticket_actions_level4_test.rb b/test/browser/agent_ticket_actions_level4_test.rb index 36bdaa71e..15ad8e9e6 100644 --- a/test/browser/agent_ticket_actions_level4_test.rb +++ b/test/browser/agent_ticket_actions_level4_test.rb @@ -35,7 +35,7 @@ class AgentTicketActionLevel4Test < TestCase { :execute => 'click', - :css => '.active .form-actions button[type="submit"]', + :css => '.content.active button.submit', }, { :execute => 'wait', diff --git a/test/browser/agent_ticket_actions_level5_test.rb b/test/browser/agent_ticket_actions_level5_test.rb index ed0a26601..e806831b6 100644 --- a/test/browser/agent_ticket_actions_level5_test.rb +++ b/test/browser/agent_ticket_actions_level5_test.rb @@ -134,8 +134,14 @@ class AgentTicketActionLevel5Test < TestCase :match_result => true, }, { - :execute => 'click', - :css => '.-sew-list-item.selected', + :execute => 'sendkey', + :css => '.active .shortcut', + :value => :arrow_down, + }, + { + :execute => 'sendkey', + :css => '.active .shortcut', + :value => :enter, }, { :execute => 'wait', @@ -308,8 +314,15 @@ class AgentTicketActionLevel5Test < TestCase }, { :where => :instance2, - :execute => 'click', - :css => '.-sew-list-item.selected', + :execute => 'sendkey', + :css => '.active .shortcut', + :value => :arrow_down, + }, + { + :where => :instance2, + :execute => 'sendkey', + :css => '.active .shortcut', + :value => :enter, }, { :where => :instance2, @@ -330,7 +343,7 @@ class AgentTicketActionLevel5Test < TestCase { :where => :instance2, :execute => 'set', - :css => '.active .ticket-create input[name="customer_id_completion"]', + :css => '.active .newTicket input[name="customer_id_completion"]', :value => 'nicole', }, { @@ -340,13 +353,13 @@ class AgentTicketActionLevel5Test < TestCase { :where => :instance2, :execute => 'sendkey', - :css => '.active .ticket-create input[name="customer_id_completion"]', + :css => '.active .newTicket input[name="customer_id_completion"]', :value => :arrow_down, }, { :where => :instance2, :execute => 'sendkey', - :css => '.active .ticket-create input[name="customer_id_completion"]', + :css => '.active .newTicket input[name="customer_id_completion"]', :value => :tab, }, { @@ -367,8 +380,15 @@ class AgentTicketActionLevel5Test < TestCase }, { :where => :instance2, - :execute => 'click', - :css => '.-sew-list-item.selected', + :execute => 'sendkey', + :css => '.active .shortcut', + :value => :arrow_down, + }, + { + :where => :instance2, + :execute => 'sendkey', + :css => '.active .shortcut', + :value => :enter, }, { :where => :instance2, @@ -446,8 +466,15 @@ class AgentTicketActionLevel5Test < TestCase }, { :where => :instance2, - :execute => 'click', - :css => '.-sew-list-item.selected', + :execute => 'sendkey', + :css => '.active .shortcut', + :value => :arrow_down, + }, + { + :where => :instance2, + :execute => 'sendkey', + :css => '.active .shortcut', + :value => :enter, }, { :execute => 'wait', @@ -547,8 +574,15 @@ class AgentTicketActionLevel5Test < TestCase # }, { :where => :instance2, - :execute => 'click', - :css => '.-sew-list-item.selected', + :execute => 'sendkey', + :css => '.active .shortcut', + :value => :arrow_down, + }, + { + :where => :instance2, + :execute => 'sendkey', + :css => '.active .shortcut', + :value => :enter, }, { :execute => 'wait', diff --git a/test/browser/agent_user_manage_test.rb b/test/browser/agent_user_manage_test.rb index 6836f84e1..fbca47db9 100644 --- a/test/browser/agent_user_manage_test.rb +++ b/test/browser/agent_user_manage_test.rb @@ -151,7 +151,7 @@ class AgentUserManageTest < TestCase }, { :execute => 'set', - :css => '.active .ticket-create input[name="customer_id_completion"]', + :css => '.active .newTicket input[name="customer_id_completion"]', :value => customer_user_email, }, { @@ -160,12 +160,12 @@ class AgentUserManageTest < TestCase }, { :execute => 'sendkey', - :css => '.active .ticket-create input[name="customer_id_completion"]', + :css => '.active .newTicket input[name="customer_id_completion"]', :value => :arrow_down, }, { :execute => 'sendkey', - :css => '.active .ticket-create input[name="customer_id_completion"]', + :css => '.active .newTicket input[name="customer_id_completion"]', :value => :enter, }, { diff --git a/test/browser/customer_ticket_create_test.rb b/test/browser/customer_ticket_create_test.rb index 4edfc1cf5..8cfe06905 100644 --- a/test/browser/customer_ticket_create_test.rb +++ b/test/browser/customer_ticket_create_test.rb @@ -21,27 +21,27 @@ class CustomerTicketCreateTest < TestCase }, { :execute => 'check', - :css => '.ticket-create', + :css => '.newTicket', :result => true, }, { :execute => 'select', - :css => '.ticket-create select[name="group_id"]', + :css => '.newTicket select[name="group_id"]', :value => 'Users', }, { :execute => 'set', - :css => '.ticket-create input[name="title"]', + :css => '.newTicket input[name="title"]', :value => 'some subject 123äöü', }, { :execute => 'set', - :css => '.ticket-create [data-name="body"]', + :css => '.newTicket [data-name="body"]', :value => 'some body 123äöü', }, { :execute => 'click', - :css => '.ticket-create button[type="submit"]', + :css => '.newTicket button.submit', }, { :execute => 'wait', @@ -74,7 +74,7 @@ class CustomerTicketCreateTest < TestCase }, { :execute => 'click', - :css => '.active input[type="submit"]', + :css => '.active button.js-submit', :type => 'submit', }, { diff --git a/test/browser/taskbar_task_test.rb b/test/browser/taskbar_task_test.rb index b4f7cb6ba..9f9778eec 100644 --- a/test/browser/taskbar_task_test.rb +++ b/test/browser/taskbar_task_test.rb @@ -32,12 +32,12 @@ class TaskbarTaskTest < TestCase }, { :execute => 'check', - :css => '.active .ticket-create', + :css => '.active .newTicket', :result => true, }, { :execute => 'set', - :css => '.active .ticket-create input[name="title"]', + :css => '.active .newTicket input[name="title"]', :value => 'some test AAA', }, { @@ -112,7 +112,7 @@ class TaskbarTaskTest < TestCase }, { :execute => 'set', - :css => '.active .ticket-create input[name="title"]', + :css => '.active .newTicket input[name="title"]', :value => 'INBOUND TEST#1', }, { @@ -121,7 +121,7 @@ class TaskbarTaskTest < TestCase }, { :execute => 'set', - :css => '.active .ticket-create [data-name="body"]', + :css => '.active .newTicket [data-name="body"]', :value => 'INBOUND BODY TEST#1', }, { @@ -138,7 +138,7 @@ class TaskbarTaskTest < TestCase }, { :execute => 'set', - :css => '.active .ticket-create input[name="title"]', + :css => '.active .newTicket input[name="title"]', :value => 'OUTBOUND TEST#1', }, { @@ -147,7 +147,7 @@ class TaskbarTaskTest < TestCase }, { :execute => 'set', - :css => '.active .ticket-create [data-name="body"]', + :css => '.active .newTicket [data-name="body"]', :value => 'OUTBOUND BODY TEST#1', }, { diff --git a/test/browser_test_helper.rb b/test/browser_test_helper.rb index 5882623e0..be69e6a39 100644 --- a/test/browser_test_helper.rb +++ b/test/browser_test_helper.rb @@ -270,9 +270,9 @@ class TestCase < Test::Unit::TestCase sleep 2 instance.find_element( { :css => 'a[data-type="new"]' } ).click sleep 2 - element = instance.find_element( { :css => '.modal input[name=login]' } ) - element.clear - element.send_keys( action[:login] ) + #element = instance.find_element( { :css => '.modal input[name=login]' } ) + #element.clear + #element.send_keys( action[:login] ) element = instance.find_element( { :css => '.modal input[name=firstname]' } ) element.clear element.send_keys( action[:firstname] ) @@ -301,42 +301,100 @@ class TestCase < Test::Unit::TestCase } assert( true, "(#{test[:name]}) user creation failed" ) return + + elsif action[:execute] == 'verify_task_attributes' + if action[:title] + element = instance.find_element( { :css => '.tasks .active' } ) + assert_equal( action[:title], element.text.strip ) + end + return + elsif action[:execute] == 'verify_ticket_attributes' + if action[:title] + element = instance.find_element( { :css => '.content.active .page-header .ticket-title-update' } ) + assert_equal( action[:title], element.text.strip ) + end + if action[:body] + element = instance.find_element( { :css => '.content.active [data-name="body"]' } ) + assert_equal( action[:body], element.text.strip ) + end + return + elsif action[:execute] == 'set_ticket_attributes' + if action[:title] + element = instance.find_element( { :css => '.content.active .page-header .ticket-title-update' } ) + instance.execute_script( '$(".content.active .page-header .ticket-title-update").focus()' ) + instance.execute_script( '$(".content.active .page-header .ticket-title-update").text("' + action[:title] + '")' ) + instance.execute_script( '$(".content.active .page-header .ticket-title-update").blur()' ) + instance.execute_script( '$(".content.active .page-header .ticket-title-update").trigger("blur")' ) +# { +# :where => :instance2, +# :execute => 'sendkey', +# :css => '.content.active .page-header .ticket-title-update', +# :value => 'TTT', +# }, +# { +# :where => :instance2, +# :execute => 'sendkey', +# :css => '.content.active .page-header .ticket-title-update', +# :value => :tab, +# }, + end + if action[:body] + element = instance.find_element( { :css => '.content.active [data-name="body"]' } ) + element.clear + element.send_keys( action[:body] ) + # check if body is filled / in case use workaround + body = element.text + puts "body '#{body}'" + if !body || body.empty? || body == '' || body == ' ' + result = instance.execute_script( '$(".content.active [data-name=body]").text("' + action[:body] + '")' ) + puts "r #{result.inspect}" + end + end + return elsif action[:execute] == 'create_ticket' instance.find_element( { :css => 'a[href="#new"]' } ).click instance.find_element( { :css => 'a[href="#ticket/create"]' } ).click - element = instance.find_element( { :css => '.active .ticket-create' } ) + element = instance.find_element( { :css => '.active .newTicket' } ) if !element assert( false, "(#{test[:name]}) no ticket create screen found!" ) return end sleep 2 - element = instance.find_element( { :css => '.active .ticket-create input[name="customer_id_autocompletion"]' } ) + element = instance.find_element( { :css => '.active .newTicket input[name="customer_id_completion"]' } ) + element.click element.clear element.send_keys( 'nico*' ) sleep 4 - element = instance.find_element( { :css => '.active .ticket-create input[name="customer_id_autocompletion"]' } ) + element = instance.find_element( { :css => '.active .newTicket input[name="customer_id_completion"]' } ) element.send_keys( :arrow_down ) - sleep 0.2 - element = instance.find_element( { :css => '.active .ticket-create input[name="customer_id_autocompletion"]' } ) - element.send_keys( :tab ) - sleep 0.1 - element = instance.find_element( { :css => '.active .ticket-create select[name="group_id"]' } ) + sleep 0.3 + element = instance.find_element( { :css => '.active .newTicket input[name="customer_id_completion"]' } ) + element.send_keys( :enter ) + sleep 0.3 + element = instance.find_element( { :css => '.active .newTicket select[name="group_id"]' } ) dropdown = Selenium::WebDriver::Support::Select.new(element) dropdown.select_by( :text, action[:group]) - sleep 0.1 - element = instance.find_element( { :css => '.active .ticket-create input[name="title"]' } ) + sleep 0.2 + element = instance.find_element( { :css => '.active .newTicket input[name="title"]' } ) element.clear element.send_keys( action[:subject] ) - sleep 0.1 - element = instance.find_element( { :css => '.active .ticket-create textarea[name="body"]' } ) + sleep 0.2 + element = instance.find_element( { :css => '.active .newTicket [data-name="body"]' } ) element.clear element.send_keys( action[:body] ) + # check if body is filled / in case use workaround + body = element.text + puts "body '#{body}'" + if !body || body.empty? || body == '' || body == ' ' + result = instance.execute_script( '$(".content.active .newTicket [data-name=body]").text("' + action[:body] + '")' ) + puts "r #{result.inspect}" + end if action[:do_not_submit] assert( true, "(#{test[:name]}) ticket created without submit" ) return end sleep 0.8 - instance.find_element( { :css => '.active .form-actions button[type="submit"]' } ).click + instance.find_element( { :css => '.content.active button.submit' } ).click sleep 1 (1..14).each {|loop| if instance.current_url =~ /#{Regexp.quote('#ticket/zoom/')}/ @@ -452,6 +510,7 @@ class TestCase < Test::Unit::TestCase elsif action[:css] =~ /(input|textarea)/i text = element.attribute('value') else + puts "'DAT ' #{element.text}" text = element.text end if action[:value] == '###stack###' @@ -459,6 +518,7 @@ class TestCase < Test::Unit::TestCase end match = false if action[:no_quote] + puts "aaaa #{text}/#{action[:value]}" if text =~ /#{action[:value]}/ if $1 @stack = $1