From 703ccd150f75967e91ef714ea37e63dcdf91a19f Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Mon, 5 Sep 2016 15:18:22 +0200 Subject: [PATCH] Renaming and split of test files. --- script/build/test_slice_tests.sh | 192 +++++--- ...est.rb => agent_ticket_attachment_test.rb} | 2 +- ...gent_ticket_email_reply_keep_body_test.rb} | 2 +- ...b => agent_ticket_email_signature_test.rb} | 2 +- test/browser/agent_ticket_link_test.rb | 106 +++++ test/browser/agent_ticket_macro_test.rb | 34 ++ ...el1_test.rb => agent_ticket_merge_test.rb} | 2 +- ... agent_ticket_online_notification_test.rb} | 2 +- ...evel8_test.rb => agent_ticket_tag_test.rb} | 139 +----- ...st.rb => agent_ticket_text_module_test.rb} | 2 +- test/browser/agent_ticket_update1_test.rb | 54 +++ ...3_test.rb => agent_ticket_update2_test.rb} | 54 +-- ...2_test.rb => agent_ticket_update3_test.rb} | 3 +- ...=> agent_ticket_update_and_reload_test.rb} | 2 +- test/browser/maintenance_app_version_test.rb | 37 ++ .../browser/maintenance_login_message_test.rb | 70 +++ test/browser/maintenance_mode_test.rb | 161 +++++++ .../maintenance_session_message_test.rb | 175 +++++++ test/browser/maintenance_test.rb | 426 ------------------ test/browser/manage_test.rb | 48 +- ...s_test.rb => preferences_language_test.rb} | 143 +----- .../preferences_permission_check_test.rb | 68 +++ test/browser/preferences_token_access_test.rb | 85 ++++ test/browser/switch_to_user_test.rb | 12 +- 24 files changed, 951 insertions(+), 870 deletions(-) rename test/browser/{agent_ticket_actions_level6_test.rb => agent_ticket_attachment_test.rb} (99%) rename test/browser/{agent_ticket_actions_level7_test.rb => agent_ticket_email_reply_keep_body_test.rb} (96%) rename test/browser/{agent_ticket_actions_level5_test.rb => agent_ticket_email_signature_test.rb} (99%) create mode 100644 test/browser/agent_ticket_link_test.rb create mode 100644 test/browser/agent_ticket_macro_test.rb rename test/browser/{agent_ticket_actions_level1_test.rb => agent_ticket_merge_test.rb} (98%) rename test/browser/{agent_ticket_actions_level9_test.rb => agent_ticket_online_notification_test.rb} (99%) rename test/browser/{agent_ticket_actions_level8_test.rb => agent_ticket_tag_test.rb} (79%) rename test/browser/{agent_ticket_actions_level0_test.rb => agent_ticket_text_module_test.rb} (99%) create mode 100644 test/browser/agent_ticket_update1_test.rb rename test/browser/{agent_ticket_actions_level3_test.rb => agent_ticket_update2_test.rb} (86%) rename test/browser/{agent_ticket_actions_level2_test.rb => agent_ticket_update3_test.rb} (99%) rename test/browser/{agent_ticket_actions_level4_test.rb => agent_ticket_update_and_reload_test.rb} (98%) create mode 100644 test/browser/maintenance_app_version_test.rb create mode 100644 test/browser/maintenance_login_message_test.rb create mode 100644 test/browser/maintenance_mode_test.rb create mode 100644 test/browser/maintenance_session_message_test.rb delete mode 100644 test/browser/maintenance_test.rb rename test/browser/{preferences_test.rb => preferences_language_test.rb} (66%) create mode 100644 test/browser/preferences_permission_check_test.rb create mode 100644 test/browser/preferences_token_access_test.rb diff --git a/script/build/test_slice_tests.sh b/script/build/test_slice_tests.sh index 42bcb6ca5..58f16c5cc 100755 --- a/script/build/test_slice_tests.sh +++ b/script/build/test_slice_tests.sh @@ -18,18 +18,21 @@ if [ "$LEVEL" == '1' ]; then rm test/browser/admin_object_manager_test.rb rm test/browser/admin_overview_test.rb # test/browser/agent_navigation_and_title_test.rb - rm test/browser/agent_ticket_actions_level0_test.rb - rm test/browser/agent_ticket_actions_level1_test.rb - rm test/browser/agent_ticket_actions_level2_test.rb - rm test/browser/agent_ticket_actions_level3_test.rb - rm test/browser/agent_ticket_actions_level4_test.rb - rm test/browser/agent_ticket_actions_level5_test.rb - rm test/browser/agent_ticket_actions_level6_test.rb - rm test/browser/agent_ticket_actions_level7_test.rb - rm test/browser/agent_ticket_actions_level8_test.rb - rm test/browser/agent_ticket_actions_level9_test.rb + rm test/browser/agent_ticket_attachment_test.rb + rm test/browser/agent_ticket_email_reply_keep_body_test.rb + rm test/browser/agent_ticket_email_signature_test.rb + rm test/browser/agent_ticket_link_test.rb + rm test/browser/agent_ticket_macro_test.rb + rm test/browser/agent_ticket_merge_test.rb + rm test/browser/agent_ticket_online_notification_test.rb rm test/browser/agent_ticket_overview_level0_test.rb rm test/browser/agent_ticket_overview_level1_test.rb + rm test/browser/agent_ticket_tag_test.rb + rm test/browser/agent_ticket_text_module_test.rb + rm test/browser/agent_ticket_update1_test.rb + rm test/browser/agent_ticket_update2_test.rb + rm test/browser/agent_ticket_update3_test.rb + rm test/browser/agent_ticket_update_and_reload_test.rb rm test/browser/agent_user_manage_test.rb rm test/browser/agent_user_profile_test.rb # test/browser/auth_test.rb @@ -39,8 +42,13 @@ if [ "$LEVEL" == '1' ]; then # test/browser/form_test.rb rm test/browser/integration_test.rb rm test/browser/keyboard_shortcuts_test.rb - # test/browser/maintenance_test.rb - rm test/browser/preferences_test.rb + # test/browser/maintenance_app_version_test.rb + # test/browser/maintenance_login_message_test.rb + # test/browser/maintenance_mode_test.rb + # test/browser/maintenance_session_message_test.rb + rm test/browser/preferences_language_test.rb + rm test/browser/preferences_permission_check_test.rb + rm test/browser/preferences_token_access_test.rb rm test/browser/setting_test.rb # test/browser/signup_password_change_and_reset_test.rb # test/browser/swich_to_user_test.rb @@ -62,18 +70,21 @@ elif [ "$LEVEL" == '2' ]; then rm test/browser/admin_overview_test.rb rm test/browser/agent_navigation_and_title_test.rb rm test/browser/agent_organization_profile_test.rb - # test/browser/agent_ticket_actions_level0_test.rb - # test/browser/agent_ticket_actions_level1_test.rb - # test/browser/agent_ticket_actions_level2_test.rb - # test/browser/agent_ticket_actions_level3_test.rb - # test/browser/agent_ticket_actions_level4_test.rb - rm test/browser/agent_ticket_actions_level5_test.rb - rm test/browser/agent_ticket_actions_level6_test.rb - rm test/browser/agent_ticket_actions_level7_test.rb - rm test/browser/agent_ticket_actions_level8_test.rb - rm test/browser/agent_ticket_actions_level9_test.rb + rm test/browser/agent_ticket_attachment_test.rb + rm test/browser/agent_ticket_email_reply_keep_body_test.rb + rm test/browser/agent_ticket_email_signature_test.rb + rm test/browser/agent_ticket_link_test.rb + rm test/browser/agent_ticket_macro_test.rb + # test/browser/agent_ticket_merge_test.rb + rm test/browser/agent_ticket_online_notification_test.rb rm test/browser/agent_ticket_overview_level0_test.rb rm test/browser/agent_ticket_overview_level1_test.rb + rm test/browser/agent_ticket_tag_test.rb + # test/browser/agent_ticket_text_module_test.rb + # test/browser/agent_ticket_update1_test.rb + # test/browser/agent_ticket_update2_test.rb + # test/browser/agent_ticket_update3_test.rb + # test/browser/agent_ticket_update_and_reload_test.rb rm test/browser/agent_user_manage_test.rb rm test/browser/agent_user_profile_test.rb rm test/browser/auth_test.rb @@ -83,9 +94,14 @@ elif [ "$LEVEL" == '2' ]; then rm test/browser/form_test.rb rm test/browser/integration_test.rb rm test/browser/keyboard_shortcuts_test.rb - rm test/browser/maintenance_test.rb + rm test/browser/maintenance_app_version_test.rb + rm test/browser/maintenance_login_message_test.rb + rm test/browser/maintenance_mode_test.rb + rm test/browser/maintenance_session_message_test.rb rm test/browser/manage_test.rb - rm test/browser/preferences_test.rb + rm test/browser/preferences_language_test.rb + rm test/browser/preferences_permission_check_test.rb + rm test/browser/preferences_token_access_test.rb rm test/browser/setting_test.rb rm test/browser/signup_password_change_and_reset_test.rb rm test/browser/switch_to_user_test.rb @@ -107,18 +123,21 @@ elif [ "$LEVEL" == '3' ]; then rm test/browser/admin_overview_test.rb rm test/browser/agent_navigation_and_title_test.rb rm test/browser/agent_organization_profile_test.rb - rm test/browser/agent_ticket_actions_level0_test.rb - rm test/browser/agent_ticket_actions_level1_test.rb - rm test/browser/agent_ticket_actions_level2_test.rb - rm test/browser/agent_ticket_actions_level3_test.rb - rm test/browser/agent_ticket_actions_level4_test.rb - # test/browser/agent_ticket_actions_level5_test.rb - # test/browser/agent_ticket_actions_level6_test.rb - # test/browser/agent_ticket_actions_level7_test.rb - # test/browser/agent_ticket_actions_level8_test.rb - rm test/browser/agent_ticket_actions_level9_test.rb + # test/browser/agent_ticket_attachment_test.rb + # test/browser/agent_ticket_email_reply_keep_body_test.rb + # test/browser/agent_ticket_email_signature_test.rb + # test/browser/agent_ticket_link_test.rb + # test/browser/agent_ticket_macro_test.rb + rm test/browser/agent_ticket_merge_test.rb + rm test/browser/agent_ticket_online_notification_test.rb rm test/browser/agent_ticket_overview_level0_test.rb rm test/browser/agent_ticket_overview_level1_test.rb + # test/browser/agent_ticket_tag_test.rb + rm test/browser/agent_ticket_text_module_test.rb + rm test/browser/agent_ticket_update1_test.rb + rm test/browser/agent_ticket_update2_test.rb + rm test/browser/agent_ticket_update3_test.rb + rm test/browser/agent_ticket_update_and_reload_test.rb rm test/browser/agent_user_manage_test.rb rm test/browser/agent_user_profile_test.rb rm test/browser/auth_test.rb @@ -128,9 +147,14 @@ elif [ "$LEVEL" == '3' ]; then rm test/browser/form_test.rb rm test/browser/integration_test.rb rm test/browser/keyboard_shortcuts_test.rb - rm test/browser/maintenance_test.rb + rm test/browser/maintenance_app_version_test.rb + rm test/browser/maintenance_login_message_test.rb + rm test/browser/maintenance_mode_test.rb + rm test/browser/maintenance_session_message_test.rb rm test/browser/manage_test.rb - rm test/browser/preferences_test.rb + rm test/browser/preferences_language_test.rb + rm test/browser/preferences_permission_check_test.rb + rm test/browser/preferences_token_access_test.rb rm test/browser/setting_test.rb rm test/browser/signup_password_change_and_reset_test.rb rm test/browser/switch_to_user_test.rb @@ -152,18 +176,21 @@ elif [ "$LEVEL" == '4' ]; then rm test/browser/admin_overview_test.rb rm test/browser/agent_navigation_and_title_test.rb rm test/browser/agent_organization_profile_test.rb - rm test/browser/agent_ticket_actions_level0_test.rb - rm test/browser/agent_ticket_actions_level1_test.rb - rm test/browser/agent_ticket_actions_level2_test.rb - rm test/browser/agent_ticket_actions_level3_test.rb - rm test/browser/agent_ticket_actions_level4_test.rb - rm test/browser/agent_ticket_actions_level5_test.rb - rm test/browser/agent_ticket_actions_level6_test.rb - rm test/browser/agent_ticket_actions_level7_test.rb - rm test/browser/agent_ticket_actions_level8_test.rb - # test/browser/agent_ticket_actions_level9_test.rb + rm test/browser/agent_ticket_attachment_test.rb + rm test/browser/agent_ticket_email_reply_keep_body_test.rb + rm test/browser/agent_ticket_email_signature_test.rb + rm test/browser/agent_ticket_link_test.rb + rm test/browser/agent_ticket_macro_test.rb + rm test/browser/agent_ticket_merge_test.rb + # test/browser/agent_ticket_online_notification_test.rb # test/browser/agent_ticket_overview_level0_test.rb # test/browser/agent_ticket_overview_level1_test.rb + rm test/browser/agent_ticket_tag_test.rb + rm test/browser/agent_ticket_text_module_test.rb + rm test/browser/agent_ticket_update1_test.rb + rm test/browser/agent_ticket_update2_test.rb + rm test/browser/agent_ticket_update3_test.rb + rm test/browser/agent_ticket_update_and_reload_test.rb rm test/browser/agent_user_manage_test.rb rm test/browser/agent_user_profile_test.rb rm test/browser/auth_test.rb @@ -173,9 +200,14 @@ elif [ "$LEVEL" == '4' ]; then rm test/browser/form_test.rb rm test/browser/integration_test.rb rm test/browser/keyboard_shortcuts_test.rb - rm test/browser/maintenance_test.rb + rm test/browser/maintenance_app_version_test.rb + rm test/browser/maintenance_login_message_test.rb + rm test/browser/maintenance_mode_test.rb + rm test/browser/maintenance_session_message_test.rb rm test/browser/manage_test.rb - rm test/browser/preferences_test.rb + rm test/browser/preferences_language_test.rb + rm test/browser/preferences_permission_check_test.rb + rm test/browser/preferences_token_access_test.rb rm test/browser/setting_test.rb rm test/browser/signup_password_change_and_reset_test.rb rm test/browser/switch_to_user_test.rb @@ -196,18 +228,21 @@ elif [ "$LEVEL" == '5' ]; then # test/browser/admin_overview_test.rb rm test/browser/agent_navigation_and_title_test.rb # test/browser/agent_organization_profile_test.rb - rm test/browser/agent_ticket_actions_level0_test.rb - rm test/browser/agent_ticket_actions_level1_test.rb - rm test/browser/agent_ticket_actions_level2_test.rb - rm test/browser/agent_ticket_actions_level3_test.rb - rm test/browser/agent_ticket_actions_level4_test.rb - rm test/browser/agent_ticket_actions_level5_test.rb - rm test/browser/agent_ticket_actions_level6_test.rb - rm test/browser/agent_ticket_actions_level7_test.rb - rm test/browser/agent_ticket_actions_level8_test.rb - rm test/browser/agent_ticket_actions_level9_test.rb + rm test/browser/agent_ticket_attachment_test.rb + rm test/browser/agent_ticket_email_reply_keep_body_test.rb + rm test/browser/agent_ticket_email_signature_test.rb + rm test/browser/agent_ticket_link_test.rb + rm test/browser/agent_ticket_macro_test.rb + rm test/browser/agent_ticket_merge_test.rb + rm test/browser/agent_ticket_online_notification_test.rb rm test/browser/agent_ticket_overview_level0_test.rb rm test/browser/agent_ticket_overview_level1_test.rb + rm test/browser/agent_ticket_tag_test.rb + rm test/browser/agent_ticket_text_module_test.rb + rm test/browser/agent_ticket_update1_test.rb + rm test/browser/agent_ticket_update2_test.rb + rm test/browser/agent_ticket_update3_test.rb + rm test/browser/agent_ticket_update_and_reload_test.rb # test/browser/agent_user_manage_test.rb # test/browser/agent_user_profile_test.rb rm test/browser/auth_test.rb @@ -217,9 +252,14 @@ elif [ "$LEVEL" == '5' ]; then rm test/browser/form_test.rb rm test/browser/integration_test.rb rm test/browser/keyboard_shortcuts_test.rb - rm test/browser/maintenance_*.rb + rm test/browser/maintenance_app_version_test.rb + rm test/browser/maintenance_login_message_test.rb + rm test/browser/maintenance_mode_test.rb + rm test/browser/maintenance_session_message_test.rb rm test/browser/manage_test.rb - rm test/browser/preferences_test.rb + rm test/browser/preferences_language_test.rb + rm test/browser/preferences_permission_check_test.rb + rm test/browser/preferences_token_access_test.rb rm test/browser/setting_test.rb rm test/browser/signup_password_change_and_reset_test.rb rm test/browser/switch_to_user_test.rb @@ -243,18 +283,21 @@ elif [ "$LEVEL" == '6' ]; then rm test/browser/admin_overview_test.rb rm test/browser/agent_navigation_and_title_test.rb rm test/browser/agent_organization_profile_test.rb - rm test/browser/agent_ticket_actions_level0_test.rb - rm test/browser/agent_ticket_actions_level1_test.rb - rm test/browser/agent_ticket_actions_level2_test.rb - rm test/browser/agent_ticket_actions_level3_test.rb - rm test/browser/agent_ticket_actions_level4_test.rb - rm test/browser/agent_ticket_actions_level5_test.rb - rm test/browser/agent_ticket_actions_level6_test.rb - rm test/browser/agent_ticket_actions_level7_test.rb - rm test/browser/agent_ticket_actions_level8_test.rb - rm test/browser/agent_ticket_actions_level9_test.rb + rm test/browser/agent_ticket_attachment_test.rb + rm test/browser/agent_ticket_email_reply_keep_body_test.rb + rm test/browser/agent_ticket_email_signature_test.rb + rm test/browser/agent_ticket_link_test.rb + rm test/browser/agent_ticket_macro_test.rb + rm test/browser/agent_ticket_merge_test.rb + rm test/browser/agent_ticket_online_notification_test.rb rm test/browser/agent_ticket_overview_level0_test.rb rm test/browser/agent_ticket_overview_level1_test.rb + rm test/browser/agent_ticket_tag_test.rb + rm test/browser/agent_ticket_text_module_test.rb + rm test/browser/agent_ticket_update1_test.rb + rm test/browser/agent_ticket_update2_test.rb + rm test/browser/agent_ticket_update3_test.rb + rm test/browser/agent_ticket_update_and_reload_test.rb rm test/browser/agent_user_manage_test.rb rm test/browser/agent_user_profile_test.rb rm test/browser/auth_test.rb @@ -264,9 +307,14 @@ elif [ "$LEVEL" == '6' ]; then rm test/browser/form_test.rb # test/browser/integration_test.rb # test/browser/keyboard_shortcuts_test.rb - rm test/browser/maintenance_*.rb + rm test/browser/maintenance_app_version_test.rb + rm test/browser/maintenance_login_message_test.rb + rm test/browser/maintenance_mode_test.rb + rm test/browser/maintenance_session_message_test.rb rm test/browser/manage_test.rb - # test/browser/preferences_test.rb + # test/browser/preferences_language_test.rb + # test/browser/preferences_permission_check_test.rb + # test/browser/preferences_token_access_test.rb # test/browser/setting_test.rb rm test/browser/signup_password_change_and_reset_test.rb rm test/browser/switch_to_user_test.rb diff --git a/test/browser/agent_ticket_actions_level6_test.rb b/test/browser/agent_ticket_attachment_test.rb similarity index 99% rename from test/browser/agent_ticket_actions_level6_test.rb rename to test/browser/agent_ticket_attachment_test.rb index 462928de7..cc888df1b 100644 --- a/test/browser/agent_ticket_actions_level6_test.rb +++ b/test/browser/agent_ticket_attachment_test.rb @@ -1,7 +1,7 @@ # encoding: utf-8 require 'browser_test_helper' -class AgentTicketActionLevel6Test < TestCase +class AgentTicketAttachmentTest < TestCase def test_ticket @browser = browser_instance diff --git a/test/browser/agent_ticket_actions_level7_test.rb b/test/browser/agent_ticket_email_reply_keep_body_test.rb similarity index 96% rename from test/browser/agent_ticket_actions_level7_test.rb rename to test/browser/agent_ticket_email_reply_keep_body_test.rb index 706552d5b..20f793241 100644 --- a/test/browser/agent_ticket_actions_level7_test.rb +++ b/test/browser/agent_ticket_email_reply_keep_body_test.rb @@ -1,7 +1,7 @@ # encoding: utf-8 require 'browser_test_helper' -class AgentTicketActionLevel7Test < TestCase +class AgentTicketEmailReplyKeepBodyTest < TestCase def test_reply_message_keep_body # merge ticket with closed tab diff --git a/test/browser/agent_ticket_actions_level5_test.rb b/test/browser/agent_ticket_email_signature_test.rb similarity index 99% rename from test/browser/agent_ticket_actions_level5_test.rb rename to test/browser/agent_ticket_email_signature_test.rb index 71b8f877f..e4165af8f 100644 --- a/test/browser/agent_ticket_actions_level5_test.rb +++ b/test/browser/agent_ticket_email_signature_test.rb @@ -1,7 +1,7 @@ # encoding: utf-8 require 'browser_test_helper' -class AgentTicketActionLevel5Test < TestCase +class AgentTicketEmailSignatureTest < TestCase def test_agent_signature_check suffix = rand(99_999_999_999_999_999).to_s diff --git a/test/browser/agent_ticket_link_test.rb b/test/browser/agent_ticket_link_test.rb new file mode 100644 index 000000000..60769d51d --- /dev/null +++ b/test/browser/agent_ticket_link_test.rb @@ -0,0 +1,106 @@ +# encoding: utf-8 +require 'browser_test_helper' + +class AgentTicketLinkTest < TestCase + + def test_c_link + @browser = browser_instance + login( + username: 'agent1@example.com', + password: 'test', + url: browser_url, + ) + tasks_close_all() + + ticket1 = ticket_create( + data: { + customer: 'nico', + group: 'Users', + title: 'some subject - link#1', + body: 'some body - link#1', + }, + ) + + ticket2 = ticket_create( + data: { + customer: 'nico', + group: 'Users', + title: 'some subject - link#2', + body: 'some body - link#2', + }, + ) + + # verify changes in second browser + browser2 = browser_instance + login( + browser: browser2, + username: 'master@example.com', + password: 'test', + url: browser_url, + ) + ticket_open_by_search( + browser: browser2, + number: ticket1[:number], + ) + + click( + css: '.content.active .links .js-add', + ) + sleep 2 + + set( + css: '.content.active .modal-body [name="ticket_number"]', + value: ticket1[:number], + ) + select( + css: '.content.active .modal-body [name="link_type"]', + value: 'Normal', + ) + click( + css: '.content.active .modal-footer .js-submit', + ) + + watch_for( + css: '.content.active .ticketLinks', + value: ticket1[:title], + ) + + watch_for( + browser: browser2, + css: '.content.active .ticketLinks', + value: ticket2[:title], + ) + + reload() + + watch_for( + css: '.content.active .ticketLinks', + value: ticket1[:title], + ) + click( + css: '.content.active .ticketLinks .js-delete' + ) + watch_for_disappear( + css: '.content.active .ticketLinks', + value: ticket1[:title], + ) + watch_for_disappear( + browser: browser2, + css: '.content.active .ticketLinks', + value: ticket2[:title], + ) + + reload() + + watch_for_disappear( + css: '.content.active .ticketLinks', + value: ticket1[:title], + ) + watch_for_disappear( + browser: browser2, + css: '.content.active .ticketLinks', + value: ticket2[:title], + ) + end + +end diff --git a/test/browser/agent_ticket_macro_test.rb b/test/browser/agent_ticket_macro_test.rb new file mode 100644 index 000000000..aeff466a0 --- /dev/null +++ b/test/browser/agent_ticket_macro_test.rb @@ -0,0 +1,34 @@ +# encoding: utf-8 +require 'browser_test_helper' + +class AgentTicketMacroTest < TestCase + def test_macro + @browser = browser_instance + login( + username: 'agent1@example.com', + password: 'test', + url: browser_url, + ) + tasks_close_all() + + ticket1 = ticket_create( + data: { + customer: 'nico', + group: 'Users', + title: 'some subject - macro#1', + body: 'some body - macro#1', + }, + ) + + click(css: '.active.content .js-submitDropdown .js-openDropdownMacro') + click(css: '.active.content .js-submitDropdown .js-dropdownActionMacro') + + # verify tags + tags_verify( + tags: { + 'spam' => true, + 'tag1' => false, + } + ) + end +end diff --git a/test/browser/agent_ticket_actions_level1_test.rb b/test/browser/agent_ticket_merge_test.rb similarity index 98% rename from test/browser/agent_ticket_actions_level1_test.rb rename to test/browser/agent_ticket_merge_test.rb index 0ab026727..4582aa2f0 100644 --- a/test/browser/agent_ticket_actions_level1_test.rb +++ b/test/browser/agent_ticket_merge_test.rb @@ -1,7 +1,7 @@ # encoding: utf-8 require 'browser_test_helper' -class AgentTicketActionLevel1Test < TestCase +class AgentTicketMergeTest < TestCase def test_agent_ticket_merge_closed_tab # merge ticket with closed tab diff --git a/test/browser/agent_ticket_actions_level9_test.rb b/test/browser/agent_ticket_online_notification_test.rb similarity index 99% rename from test/browser/agent_ticket_actions_level9_test.rb rename to test/browser/agent_ticket_online_notification_test.rb index e2c0f752c..7300e6560 100644 --- a/test/browser/agent_ticket_actions_level9_test.rb +++ b/test/browser/agent_ticket_online_notification_test.rb @@ -1,7 +1,7 @@ # encoding: utf-8 require 'browser_test_helper' -class AgentTicketActionLevel9Test < TestCase +class AgentTicketOnlineNotificationTest < TestCase def test_online_notifications diff --git a/test/browser/agent_ticket_actions_level8_test.rb b/test/browser/agent_ticket_tag_test.rb similarity index 79% rename from test/browser/agent_ticket_actions_level8_test.rb rename to test/browser/agent_ticket_tag_test.rb index ea1d19da8..eb2c60ec4 100644 --- a/test/browser/agent_ticket_actions_level8_test.rb +++ b/test/browser/agent_ticket_tag_test.rb @@ -1,9 +1,8 @@ # encoding: utf-8 require 'browser_test_helper' -class AgentTicketActionLevel8Test < TestCase +class AgentTicketTagTest < TestCase def test_a_tags - @browser = browser_instance login( username: 'agent1@example.com', @@ -344,7 +343,6 @@ class AgentTicketActionLevel8Test < TestCase 'TAGXX' => true, } ) - end def test_b_tags @@ -511,140 +509,5 @@ class AgentTicketActionLevel8Test < TestCase css: '#content .js-newTagSetting', type: 'on', ) - end - - def test_c_link - - @browser = browser_instance - login( - username: 'agent1@example.com', - password: 'test', - url: browser_url, - ) - tasks_close_all() - - ticket1 = ticket_create( - data: { - customer: 'nico', - group: 'Users', - title: 'some subject - link#1', - body: 'some body - link#1', - }, - ) - - ticket2 = ticket_create( - data: { - customer: 'nico', - group: 'Users', - title: 'some subject - link#2', - body: 'some body - link#2', - }, - ) - - # verify changes in second browser - browser2 = browser_instance - login( - browser: browser2, - username: 'master@example.com', - password: 'test', - url: browser_url, - ) - ticket_open_by_search( - browser: browser2, - number: ticket1[:number], - ) - - click( - css: '.content.active .links .js-add', - ) - sleep 2 - - set( - css: '.content.active .modal-body [name="ticket_number"]', - value: ticket1[:number], - ) - select( - css: '.content.active .modal-body [name="link_type"]', - value: 'Normal', - ) - click( - css: '.content.active .modal-footer .js-submit', - ) - - watch_for( - css: '.content.active .ticketLinks', - value: ticket1[:title], - ) - - watch_for( - browser: browser2, - css: '.content.active .ticketLinks', - value: ticket2[:title], - ) - - reload() - - watch_for( - css: '.content.active .ticketLinks', - value: ticket1[:title], - ) - click( - css: '.content.active .ticketLinks .js-delete' - ) - watch_for_disappear( - css: '.content.active .ticketLinks', - value: ticket1[:title], - ) - watch_for_disappear( - browser: browser2, - css: '.content.active .ticketLinks', - value: ticket2[:title], - ) - - reload() - - watch_for_disappear( - css: '.content.active .ticketLinks', - value: ticket1[:title], - ) - watch_for_disappear( - browser: browser2, - css: '.content.active .ticketLinks', - value: ticket2[:title], - ) - end - - def test_d_macro - - @browser = browser_instance - login( - username: 'agent1@example.com', - password: 'test', - url: browser_url, - ) - tasks_close_all() - - ticket1 = ticket_create( - data: { - customer: 'nico', - group: 'Users', - title: 'some subject - macro#1', - body: 'some body - macro#1', - }, - ) - - click(css: '.active.content .js-submitDropdown .js-openDropdownMacro') - click(css: '.active.content .js-submitDropdown .js-dropdownActionMacro') - - # verify tags - tags_verify( - tags: { - 'spam' => true, - 'tag1' => false, - } - ) - - end - end diff --git a/test/browser/agent_ticket_actions_level0_test.rb b/test/browser/agent_ticket_text_module_test.rb similarity index 99% rename from test/browser/agent_ticket_actions_level0_test.rb rename to test/browser/agent_ticket_text_module_test.rb index b7c277dc8..4a32f5c8b 100644 --- a/test/browser/agent_ticket_actions_level0_test.rb +++ b/test/browser/agent_ticket_text_module_test.rb @@ -1,7 +1,7 @@ # encoding: utf-8 require 'browser_test_helper' -class AgentTicketActionLevel0Test < TestCase +class AgentTicketTextModuleTest < TestCase def test_text_modules random = 'text_module_test_' + rand(99_999_999).to_s random2 = 'text_module_test_' + rand(99_999_999).to_s diff --git a/test/browser/agent_ticket_update1_test.rb b/test/browser/agent_ticket_update1_test.rb new file mode 100644 index 000000000..c758ee841 --- /dev/null +++ b/test/browser/agent_ticket_update1_test.rb @@ -0,0 +1,54 @@ +# encoding: utf-8 +require 'browser_test_helper' + +class AgentTicketUpdate1Test < TestCase + def test_check_changes + @browser = browser_instance + login( + username: 'agent1@example.com', + password: 'test', + url: browser_url, + ) + tasks_close_all() + + # confirm on create + ticket_create( + data: { + customer: 'nico', + group: 'Users', + title: 'some changes', + body: 'some body 123äöü - changes', + }, + do_not_submit: true, + ) + close_task( + data: { + title: 'some changes', + }, + discard_changes: true, + ) + sleep 1 + + # confirm on zoom + ticket1 = ticket_create( + data: { + customer: 'nico', + group: 'Users', + title: 'some changes', + body: 'some body 123äöü - changes', + }, + ) + ticket_update( + data: { + body: 'some note', + }, + do_not_submit: true, + ) + close_task( + data: { + title: 'some changes', + }, + discard_changes: true, + ) + end +end diff --git a/test/browser/agent_ticket_actions_level3_test.rb b/test/browser/agent_ticket_update2_test.rb similarity index 86% rename from test/browser/agent_ticket_actions_level3_test.rb rename to test/browser/agent_ticket_update2_test.rb index ae6402a34..44b1dd075 100644 --- a/test/browser/agent_ticket_actions_level3_test.rb +++ b/test/browser/agent_ticket_update2_test.rb @@ -1,60 +1,8 @@ # encoding: utf-8 require 'browser_test_helper' -class AgentTicketActionsLevel3Test < TestCase - def test_check_changes - @browser = browser_instance - login( - username: 'agent1@example.com', - password: 'test', - url: browser_url, - ) - tasks_close_all() - - # confirm on create - ticket_create( - data: { - customer: 'nico', - group: 'Users', - title: 'some changes', - body: 'some body 123äöü - changes', - }, - do_not_submit: true, - ) - close_task( - data: { - title: 'some changes', - }, - discard_changes: true, - ) - sleep 1 - - # confirm on zoom - ticket1 = ticket_create( - data: { - customer: 'nico', - group: 'Users', - title: 'some changes', - body: 'some body 123äöü - changes', - }, - ) - ticket_update( - data: { - body: 'some note', - }, - do_not_submit: true, - ) - close_task( - data: { - title: 'some changes', - }, - discard_changes: true, - ) - - end - +class AgentTicketUpdate2Test < TestCase def test_work_with_two_browser_on_same_ticket_edit - browser1 = browser_instance login( browser: browser1, diff --git a/test/browser/agent_ticket_actions_level2_test.rb b/test/browser/agent_ticket_update3_test.rb similarity index 99% rename from test/browser/agent_ticket_actions_level2_test.rb rename to test/browser/agent_ticket_update3_test.rb index 7df40ad20..ddf3b9dd7 100644 --- a/test/browser/agent_ticket_actions_level2_test.rb +++ b/test/browser/agent_ticket_update3_test.rb @@ -1,11 +1,10 @@ # encoding: utf-8 require 'browser_test_helper' -class AgentTicketActionsLevel2Test < TestCase +class AgentTicketUpdate3Test < TestCase def test_work_with_two_browser_on_same_ticket # work on one ticket with two browsers - browser1 = browser_instance login( browser: browser1, diff --git a/test/browser/agent_ticket_actions_level4_test.rb b/test/browser/agent_ticket_update_and_reload_test.rb similarity index 98% rename from test/browser/agent_ticket_actions_level4_test.rb rename to test/browser/agent_ticket_update_and_reload_test.rb index e5185f6d7..823477cf1 100644 --- a/test/browser/agent_ticket_actions_level4_test.rb +++ b/test/browser/agent_ticket_update_and_reload_test.rb @@ -1,7 +1,7 @@ # encoding: utf-8 require 'browser_test_helper' -class AgentTicketActionLevel4Test < TestCase +class AgentTicketUpdateAndReloadTest < TestCase def test_agent_ticket_create_with_reload @browser = browser_instance diff --git a/test/browser/maintenance_app_version_test.rb b/test/browser/maintenance_app_version_test.rb new file mode 100644 index 000000000..e8d322cc8 --- /dev/null +++ b/test/browser/maintenance_app_version_test.rb @@ -0,0 +1,37 @@ +# encoding: utf-8 +require 'browser_test_helper' + +class MaintenanceAppVersionTest < TestCase + + def test_app_version + @browser = browser_instance + login( + username: 'master@example.com', + password: 'test', + url: browser_url, + ) + + sleep 8 + + execute( + js: 'App.Event.trigger("maintenance", {type:"app_version", app_version:"1234:false"} )', + ) + sleep 8 + + match_not( + css: 'body', + value: 'new version', + ) + + execute( + js: 'App.Event.trigger("maintenance", {type:"app_version", app_version:"1235:true"}) ', + ) + sleep 5 + + match( + css: 'body', + value: 'new version', + ) + end + +end diff --git a/test/browser/maintenance_login_message_test.rb b/test/browser/maintenance_login_message_test.rb new file mode 100644 index 000000000..d72973f8b --- /dev/null +++ b/test/browser/maintenance_login_message_test.rb @@ -0,0 +1,70 @@ +# encoding: utf-8 +require 'browser_test_helper' + +class MaintenanceLoginMessageTest < TestCase + + def test_login_message + browser1 = browser_instance + login( + browser: browser1, + username: 'master@example.com', + password: 'test', + url: browser_url, + ) + + click( + browser: browser1, + css: 'a[href="#manage"]', + ) + click( + browser: browser1, + css: 'a[href="#system/maintenance"]', + ) + + string = rand(99_999_999_999_999_999).to_s + message = "test #{string}" + set( + browser: browser1, + css: '#content .js-loginPreview [data-name="message"]', + value: message, + ) + click( + browser: browser1, + css: '#global-search', + ) + + browser2 = browser_instance + location( + browser: browser2, + url: browser_url, + ) + exists_not( + browser: browser2, + css: '.js-maintenanceLogin', + ) + + switch( + browser: browser1, + css: '#content .js-loginSetting', + type: 'on', + ) + + watch_for( + browser: browser2, + css: '.js-maintenanceLogin', + value: message + ) + + switch( + browser: browser1, + css: '#content .js-loginSetting', + type: 'off', + ) + + watch_for_disappear( + browser: browser2, + css: '.js-maintenanceLogin', + ) + end + +end diff --git a/test/browser/maintenance_mode_test.rb b/test/browser/maintenance_mode_test.rb new file mode 100644 index 000000000..a2cec131f --- /dev/null +++ b/test/browser/maintenance_mode_test.rb @@ -0,0 +1,161 @@ +# encoding: utf-8 +require 'browser_test_helper' + +class MaintenanceModeTest < TestCase + + def test_mode + browser1 = browser_instance + login( + browser: browser1, + username: 'master@example.com', + password: 'test', + url: browser_url, + ) + + browser2 = browser_instance + location( + browser: browser2, + url: browser_url, + ) + click( + browser: browser1, + css: 'a[href="#manage"]', + ) + click( + browser: browser1, + css: 'a[href="#system/maintenance"]', + ) + + exists_not( + browser: browser2, + css: '.js-maintenanceMode', + ) + + switch( + browser: browser1, + css: '#content .js-modeSetting', + type: 'on', + no_check: true, + ) + + # check warning + watch_for( + browser: browser1, + css: '#content .modal .modal-header', + value: 'confirm', + ) + click( + browser: browser1, + css: '#content .modal .js-submit', + ) + + watch_for( + browser: browser2, + css: '.js-maintenanceMode', + ) + + # try to logon with normal agent, should not work + login( + browser: browser2, + username: 'agent1@example.com', + password: 'test', + url: browser_url, + success: false, + ) + login( + browser: browser2, + username: 'nicole.braun@zammad.org', + password: 'test', + url: browser_url, + success: false, + ) + + # logout with admin and logon again + logout( + browser: browser1, + ) + sleep 4 + login( + browser: browser1, + username: 'master@example.com', + password: 'test', + url: browser_url, + ) + click( + browser: browser1, + css: 'a[href="#manage"]', + ) + click( + browser: browser1, + css: 'a[href="#system/maintenance"]', + ) + + switch( + browser: browser1, + css: '#content .js-modeSetting', + type: 'off', + ) + + watch_for_disappear( + browser: browser2, + css: '.js-maintenanceMode', + ) + + # try to logon with normal agent, should work again + login( + browser: browser2, + username: 'agent1@example.com', + password: 'test', + url: browser_url, + ) + logout( + browser: browser2, + ) + sleep 4 + login( + browser: browser2, + username: 'nicole.braun@zammad.org', + password: 'test', + url: browser_url, + ) + + switch( + browser: browser1, + css: '#content .js-modeSetting', + type: 'on', + no_check: true, + ) + + # check warning + watch_for( + browser: browser1, + css: '#content .modal .modal-header', + value: 'confirm', + ) + click( + browser: browser1, + css: '#content .modal .js-submit', + ) + + watch_for( + browser: browser2, + css: '#login', + ) + watch_for( + browser: browser2, + css: '.js-maintenanceMode', + ) + + switch( + browser: browser1, + css: '#content .js-modeSetting', + type: 'off', + ) + + watch_for_disappear( + browser: browser2, + css: '.js-maintenanceMode', + ) + end + +end diff --git a/test/browser/maintenance_session_message_test.rb b/test/browser/maintenance_session_message_test.rb new file mode 100644 index 000000000..d61a4ffb8 --- /dev/null +++ b/test/browser/maintenance_session_message_test.rb @@ -0,0 +1,175 @@ +# encoding: utf-8 +require 'browser_test_helper' + +class MaintenanceSessionMessageTest < TestCase + def test_message + string = rand(99_999_999_999_999_999).to_s + title_html = "test #{string}" + title_text = "test #{string}<\/b>" + message_html = "message 1äöüß #{string}\n\n\nhttp://zammad.org" + message_text = "message 1äöüß #{string}\n\n\nhttp://zammad.org" + + # check #1 + browser1 = browser_instance + login( + browser: browser1, + username: 'master@example.com', + password: 'test', + url: browser_url, + ) + + browser2 = browser_instance + login( + browser: browser2, + username: 'agent1@example.com', + password: 'test', + url: browser_url, + ) + click( + browser: browser1, + css: 'a[href="#manage"]', + ) + click( + browser: browser1, + css: 'a[href="#system/maintenance"]', + ) + + set( + browser: browser1, + css: '#content .js-Message input[name="head"]', + value: title_html, + ) + set( + browser: browser1, + css: '#content .js-Message .js-textarea[data-name="message"]', + value: message_html, + ) + + click( + browser: browser1, + css: '#content .js-Message button.js-submit', + ) + + watch_for( + browser: browser2, + css: '.modal', + value: title_text, + ) + watch_for( + browser: browser2, + css: '.modal', + value: message_text, + ) + + match_not( + browser: browser1, + css: 'body', + value: message_text, + ) + + click( + browser: browser2, + css: 'div.modal-header .js-close', + ) + + # check #2 + click( + browser: browser1, + css: 'a[href="#manage"]', + ) + click( + browser: browser1, + css: 'a[href="#system/maintenance"]', + ) + + set( + browser: browser1, + css: '#content .js-Message input[name="head"]', + value: title_html + ' #2', + ) + set( + browser: browser1, + css: '#content .js-Message .js-textarea[data-name="message"]', + value: message_html + ' #2', + ) + + click( + browser: browser1, + css: '#content .js-Message button.js-submit', + ) + + watch_for( + browser: browser2, + css: '.modal', + value: title_text + ' #2', + ) + watch_for( + browser: browser2, + css: '.modal', + value: message_text + ' #2', + ) + + match_not( + browser: browser1, + css: 'body', + value: message_text, + ) + + click( + browser: browser2, + css: 'div.modal-header .js-close', + ) + + # check #3 + click( + browser: browser1, + css: 'a[href="#manage"]', + ) + click( + browser: browser1, + css: 'a[href="#system/maintenance"]', + ) + + set( + browser: browser1, + css: '#content .js-Message input[name="head"]', + value: title_html + ' #3', + ) + set( + browser: browser1, + css: '#content .js-Message .js-textarea[data-name="message"]', + value: message_html + ' #3', + ) + click( + browser: browser1, + css: '#content .js-Message input[name="reload"] + .icon-checkbox.icon-unchecked', + ) + click( + browser: browser1, + css: '#content .js-Message button.js-submit', + ) + + watch_for( + browser: browser2, + css: '.modal', + value: title_text + ' #3', + ) + watch_for( + browser: browser2, + css: '.modal', + value: message_text + ' #3', + ) + watch_for( + browser: browser2, + css: '.modal', + value: 'Continue session', + ) + + match_not( + browser: browser1, + css: 'body', + value: message_text, + ) + end + +end diff --git a/test/browser/maintenance_test.rb b/test/browser/maintenance_test.rb deleted file mode 100644 index bb26a7939..000000000 --- a/test/browser/maintenance_test.rb +++ /dev/null @@ -1,426 +0,0 @@ -# encoding: utf-8 -require 'browser_test_helper' - -class MaintenanceTest < TestCase - def test_message - string = rand(99_999_999_999_999_999).to_s - title_html = "test #{string}" - title_text = "test #{string}<\/b>" - message_html = "message 1äöüß #{string}\n\n\nhttp://zammad.org" - message_text = "message 1äöüß #{string}\n\n\nhttp://zammad.org" - - # check #1 - browser1 = browser_instance - login( - browser: browser1, - username: 'master@example.com', - password: 'test', - url: browser_url, - ) - - browser2 = browser_instance - login( - browser: browser2, - username: 'agent1@example.com', - password: 'test', - url: browser_url, - ) - click( - browser: browser1, - css: 'a[href="#manage"]', - ) - click( - browser: browser1, - css: 'a[href="#system/maintenance"]', - ) - - set( - browser: browser1, - css: '#content .js-Message input[name="head"]', - value: title_html, - ) - set( - browser: browser1, - css: '#content .js-Message .js-textarea[data-name="message"]', - value: message_html, - ) - - click( - browser: browser1, - css: '#content .js-Message button.js-submit', - ) - - watch_for( - browser: browser2, - css: '.modal', - value: title_text, - ) - watch_for( - browser: browser2, - css: '.modal', - value: message_text, - ) - - match_not( - browser: browser1, - css: 'body', - value: message_text, - ) - - click( - browser: browser2, - css: 'div.modal-header .js-close', - ) - - # check #2 - click( - browser: browser1, - css: 'a[href="#manage"]', - ) - click( - browser: browser1, - css: 'a[href="#system/maintenance"]', - ) - - set( - browser: browser1, - css: '#content .js-Message input[name="head"]', - value: title_html + ' #2', - ) - set( - browser: browser1, - css: '#content .js-Message .js-textarea[data-name="message"]', - value: message_html + ' #2', - ) - - click( - browser: browser1, - css: '#content .js-Message button.js-submit', - ) - - watch_for( - browser: browser2, - css: '.modal', - value: title_text + ' #2', - ) - watch_for( - browser: browser2, - css: '.modal', - value: message_text + ' #2', - ) - - match_not( - browser: browser1, - css: 'body', - value: message_text, - ) - - click( - browser: browser2, - css: 'div.modal-header .js-close', - ) - - # check #3 - click( - browser: browser1, - css: 'a[href="#manage"]', - ) - click( - browser: browser1, - css: 'a[href="#system/maintenance"]', - ) - - set( - browser: browser1, - css: '#content .js-Message input[name="head"]', - value: title_html + ' #3', - ) - set( - browser: browser1, - css: '#content .js-Message .js-textarea[data-name="message"]', - value: message_html + ' #3', - ) - click( - browser: browser1, - css: '#content .js-Message input[name="reload"] + .icon-checkbox.icon-unchecked', - ) - click( - browser: browser1, - css: '#content .js-Message button.js-submit', - ) - - watch_for( - browser: browser2, - css: '.modal', - value: title_text + ' #3', - ) - watch_for( - browser: browser2, - css: '.modal', - value: message_text + ' #3', - ) - watch_for( - browser: browser2, - css: '.modal', - value: 'Continue session', - ) - - match_not( - browser: browser1, - css: 'body', - value: message_text, - ) - end - - def test_login_message - browser1 = browser_instance - login( - browser: browser1, - username: 'master@example.com', - password: 'test', - url: browser_url, - ) - - click( - browser: browser1, - css: 'a[href="#manage"]', - ) - click( - browser: browser1, - css: 'a[href="#system/maintenance"]', - ) - - string = rand(99_999_999_999_999_999).to_s - message = "test #{string}" - set( - browser: browser1, - css: '#content .js-loginPreview [data-name="message"]', - value: message, - ) - click( - browser: browser1, - css: '#global-search', - ) - - browser2 = browser_instance - location( - browser: browser2, - url: browser_url, - ) - exists_not( - browser: browser2, - css: '.js-maintenanceLogin', - ) - - switch( - browser: browser1, - css: '#content .js-loginSetting', - type: 'on', - ) - - watch_for( - browser: browser2, - css: '.js-maintenanceLogin', - value: message - ) - - switch( - browser: browser1, - css: '#content .js-loginSetting', - type: 'off', - ) - - watch_for_disappear( - browser: browser2, - css: '.js-maintenanceLogin', - ) - end - - def test_mode - browser1 = browser_instance - login( - browser: browser1, - username: 'master@example.com', - password: 'test', - url: browser_url, - ) - - browser2 = browser_instance - location( - browser: browser2, - url: browser_url, - ) - click( - browser: browser1, - css: 'a[href="#manage"]', - ) - click( - browser: browser1, - css: 'a[href="#system/maintenance"]', - ) - - exists_not( - browser: browser2, - css: '.js-maintenanceMode', - ) - - switch( - browser: browser1, - css: '#content .js-modeSetting', - type: 'on', - no_check: true, - ) - - # check warning - watch_for( - browser: browser1, - css: '#content .modal .modal-header', - value: 'confirm', - ) - click( - browser: browser1, - css: '#content .modal .js-submit', - ) - - watch_for( - browser: browser2, - css: '.js-maintenanceMode', - ) - - # try to logon with normal agent, should not work - login( - browser: browser2, - username: 'agent1@example.com', - password: 'test', - url: browser_url, - success: false, - ) - login( - browser: browser2, - username: 'nicole.braun@zammad.org', - password: 'test', - url: browser_url, - success: false, - ) - - # logout with admin and logon again - logout( - browser: browser1, - ) - sleep 4 - login( - browser: browser1, - username: 'master@example.com', - password: 'test', - url: browser_url, - ) - click( - browser: browser1, - css: 'a[href="#manage"]', - ) - click( - browser: browser1, - css: 'a[href="#system/maintenance"]', - ) - - switch( - browser: browser1, - css: '#content .js-modeSetting', - type: 'off', - ) - - watch_for_disappear( - browser: browser2, - css: '.js-maintenanceMode', - ) - - # try to logon with normal agent, should work again - login( - browser: browser2, - username: 'agent1@example.com', - password: 'test', - url: browser_url, - ) - logout( - browser: browser2, - ) - sleep 4 - login( - browser: browser2, - username: 'nicole.braun@zammad.org', - password: 'test', - url: browser_url, - ) - - switch( - browser: browser1, - css: '#content .js-modeSetting', - type: 'on', - no_check: true, - ) - - # check warning - watch_for( - browser: browser1, - css: '#content .modal .modal-header', - value: 'confirm', - ) - click( - browser: browser1, - css: '#content .modal .js-submit', - ) - - watch_for( - browser: browser2, - css: '#login', - ) - watch_for( - browser: browser2, - css: '.js-maintenanceMode', - ) - - switch( - browser: browser1, - css: '#content .js-modeSetting', - type: 'off', - ) - - watch_for_disappear( - browser: browser2, - css: '.js-maintenanceMode', - ) - end - - def test_app_version - @browser = browser_instance - login( - username: 'master@example.com', - password: 'test', - url: browser_url, - ) - - sleep 8 - - execute( - js: 'App.Event.trigger("maintenance", {type:"app_version", app_version:"1234:false"} )', - ) - sleep 8 - - match_not( - css: 'body', - value: 'new version', - ) - - execute( - js: 'App.Event.trigger("maintenance", {type:"app_version", app_version:"1235:true"}) ', - ) - sleep 5 - - match( - css: 'body', - value: 'new version', - ) - - end - -end diff --git a/test/browser/manage_test.rb b/test/browser/manage_test.rb index d69e11e9a..631114ee4 100644 --- a/test/browser/manage_test.rb +++ b/test/browser/manage_test.rb @@ -3,7 +3,7 @@ require 'browser_test_helper' class ManageTest < TestCase def test_user - random = 'manage-test-' + rand(999_999).to_s + random = "manage-test-#{rand(999_999)}" user_email = random + '@example.com' # user management @@ -14,37 +14,37 @@ class ManageTest < TestCase url: browser_url, ) - click( css: 'a[href="#manage"]' ) - click( css: 'a[href="#manage/users"]' ) + click(css: 'a[href="#manage"]') + click(css: 'a[href="#manage/users"]') user_create( data: { - login: 'some login' + random, - firstname: 'Manage Firstname' + random, - lastname: 'Manage Lastname' + random, + login: "some login#{random}", + firstname: "Manage Firstname#{random}", + lastname: "Manage Lastname#{random}", email: user_email, password: 'some-pass', } ) - click( css: '.table-overview tr:last-child td' ) + click(css: '.table-overview tr:last-child td') sleep 2 set( css: '.modal input[name="lastname"]', - value: '2Manage Lastname' + random, + value: "2Manage Lastname#{random}", ) - click( css: '.modal button.js-submit' ) + click(css: '.modal button.js-submit') watch_for( css: 'body', - value: '2Manage Lastname' + random, + value: "2Manage Lastname#{random}", ) # sla sla_create( data: { - name: 'some sla' + random, + name: "some sla#{random}", first_response_time_in_text: '1:01' } ) @@ -54,52 +54,52 @@ class ManageTest < TestCase ) sleep 1 - click( css: '.content:not(.hide) .action:last-child .js-edit' ) + click(css: '.content:not(.hide) .action:last-child .js-edit') sleep 1 set( css: '.modal input[name=name]', - value: 'some sla update ' + random, + value: "some sla update #{random}", ) set( css: '.modal input[name="first_response_time_in_text"]', value: '2:01', ) - click( css: '.modal button.js-submit' ) + click(css: '.modal button.js-submit') watch_for( css: 'body', - value: 'some sla update ' + random, + value: "some sla update #{random}", ) sleep 4 - click( css: '.content:not(.hide) .action:last-child .js-delete' ) + click(css: '.content:not(.hide) .action:last-child .js-delete') sleep 2 - click( css: '.modal button.js-submit' ) + click(css: '.modal button.js-submit') sleep 4 match_not( css: 'body', - value: 'some sla update ' + random, + value: "some sla update #{random}", ) - click( css: 'a[href="#manage"]' ) - click( css: 'a[href="#manage/slas"]' ) + click(css: 'a[href="#manage"]') + click(css: 'a[href="#manage/slas"]') sleep 2 match_not( css: 'body', - value: 'some sla update ' + random, + value: "some sla update #{random}", ) reload() sleep 2 - click( css: 'a[href="#manage"]' ) - click( css: 'a[href="#manage/slas"]' ) + click(css: 'a[href="#manage"]') + click(css: 'a[href="#manage/slas"]') sleep 2 match_not( css: 'body', - value: 'some sla update ' + random, + value: "some sla update #{random}", ) end end diff --git a/test/browser/preferences_test.rb b/test/browser/preferences_language_test.rb similarity index 66% rename from test/browser/preferences_test.rb rename to test/browser/preferences_language_test.rb index f6856e554..1a8d5e161 100644 --- a/test/browser/preferences_test.rb +++ b/test/browser/preferences_language_test.rb @@ -1,69 +1,7 @@ # encoding: utf-8 require 'browser_test_helper' -class PreferencesTest < TestCase - - def test_permission_agent - @browser = browser_instance - login( - username: 'master@example.com', - password: 'test', - url: browser_url, - ) - click(css: 'a[href="#current_user"]') - click(css: 'a[href="#profile"]') - match( - css: '.content .NavBarProfile', - value: 'Password', - ) - match( - css: '.content .NavBarProfile', - value: 'Language', - ) - match( - css: '.content .NavBarProfile', - value: 'Notifications', - ) - match( - css: '.content .NavBarProfile', - value: 'Calendar', - ) - match( - css: '.content .NavBarProfile', - value: 'Token Access', - ) - end - - def test_permission_customer - @browser = browser_instance - login( - username: 'nicole.braun@zammad.org', - password: 'test', - url: browser_url, - ) - click(css: 'a[href="#current_user"]') - click(css: 'a[href="#profile"]') - match( - css: '.content .NavBarProfile', - value: 'Password', - ) - match( - css: '.content .NavBarProfile', - value: 'Language', - ) - match_not( - css: '.content .NavBarProfile', - value: 'Notifications', - ) - match_not( - css: '.content .NavBarProfile', - value: 'Calendar', - ) - match_not( - css: '.content .NavBarProfile', - value: 'Token Access', - ) - end +class PreferencesLanguageTest < TestCase def test_lang_change @browser = browser_instance @@ -395,83 +333,4 @@ class PreferencesTest < TestCase end - def test_token_access - @browser = browser_instance - login( - username: 'agent1@example.com', - password: 'test', - url: browser_url, - ) - tasks_close_all() - click(css: 'a[href="#current_user"]') - click(css: 'a[href="#profile"]') - click(css: 'a[href="#profile/token_access"]') - - click(css: '#content .js-create') - watch_for( - css: '.modal .modal-title', - value: 'Add a Personal Access Token' - ) - - set( - css: '#content .modal .js-input', - value: 'Some App#1', - ) - set( - css: '#content .modal .js-datepicker', - value: '05/15/2022', - ) - sendkey(value: :tab) - click(css: '#content .modal input[value="ticket.agent"] ~ .label-text') - click(css: '#content .modal .js-submit') - watch_for( - css: '.modal .modal-title', - value: 'Your New Personal Access Token' - ) - click(css: '.modal .js-submit') - watch_for( - css: '#content .js-tokenList', - value: 'Some App#1' - ) - watch_for( - css: '#content .js-tokenList', - value: '05/15/2022' - ) - - click(css: '#content .js-create') - watch_for( - css: '.modal .modal-title', - value: 'Add a Personal Access Token' - ) - set( - css: '#content .modal .js-input', - value: 'Some App#2', - ) - click(css: '#content .modal input[value="ticket.agent"] ~ .label-text') - click(css: '#content .modal .js-submit') - - watch_for( - css: '.modal .modal-title', - value: 'Your New Personal Access Token' - ) - click(css: '.modal .js-submit') - watch_for( - css: '#content .js-tokenList', - value: 'Some App#2' - ) - - click(css: '#content .js-tokenList a') - watch_for( - css: '#content .modal .modal-header', - value: 'confirm', - ) - click( - css: '#content .modal .js-submit', - ) - watch_for_disappear( - css: '#content .js-tokenList', - value: 'Some App#2' - ) - - end end diff --git a/test/browser/preferences_permission_check_test.rb b/test/browser/preferences_permission_check_test.rb new file mode 100644 index 000000000..3723708a3 --- /dev/null +++ b/test/browser/preferences_permission_check_test.rb @@ -0,0 +1,68 @@ +# encoding: utf-8 +require 'browser_test_helper' + +class PreferencesPermissionCheckTest < TestCase + + def test_permission_agent + @browser = browser_instance + login( + username: 'master@example.com', + password: 'test', + url: browser_url, + ) + click(css: 'a[href="#current_user"]') + click(css: 'a[href="#profile"]') + match( + css: '.content .NavBarProfile', + value: 'Password', + ) + match( + css: '.content .NavBarProfile', + value: 'Language', + ) + match( + css: '.content .NavBarProfile', + value: 'Notifications', + ) + match( + css: '.content .NavBarProfile', + value: 'Calendar', + ) + match( + css: '.content .NavBarProfile', + value: 'Token Access', + ) + end + + def test_permission_customer + @browser = browser_instance + login( + username: 'nicole.braun@zammad.org', + password: 'test', + url: browser_url, + ) + click(css: 'a[href="#current_user"]') + click(css: 'a[href="#profile"]') + match( + css: '.content .NavBarProfile', + value: 'Password', + ) + match( + css: '.content .NavBarProfile', + value: 'Language', + ) + match_not( + css: '.content .NavBarProfile', + value: 'Notifications', + ) + match_not( + css: '.content .NavBarProfile', + value: 'Calendar', + ) + match_not( + css: '.content .NavBarProfile', + value: 'Token Access', + ) + end + +end diff --git a/test/browser/preferences_token_access_test.rb b/test/browser/preferences_token_access_test.rb new file mode 100644 index 000000000..58053b1ca --- /dev/null +++ b/test/browser/preferences_token_access_test.rb @@ -0,0 +1,85 @@ +# encoding: utf-8 +require 'browser_test_helper' + +class PreferencesTokenAccessTest < TestCase + + def test_token_access + @browser = browser_instance + login( + username: 'agent1@example.com', + password: 'test', + url: browser_url, + ) + tasks_close_all() + click(css: 'a[href="#current_user"]') + click(css: 'a[href="#profile"]') + click(css: 'a[href="#profile/token_access"]') + + click(css: '#content .js-create') + watch_for( + css: '.modal .modal-title', + value: 'Add a Personal Access Token' + ) + + set( + css: '#content .modal .js-input', + value: 'Some App#1', + ) + set( + css: '#content .modal .js-datepicker', + value: '05/15/2022', + ) + sendkey(value: :tab) + click(css: '#content .modal input[value="ticket.agent"] ~ .label-text') + click(css: '#content .modal .js-submit') + watch_for( + css: '.modal .modal-title', + value: 'Your New Personal Access Token' + ) + click(css: '.modal .js-submit') + watch_for( + css: '#content .js-tokenList', + value: 'Some App#1' + ) + watch_for( + css: '#content .js-tokenList', + value: '05/15/2022' + ) + + click(css: '#content .js-create') + watch_for( + css: '.modal .modal-title', + value: 'Add a Personal Access Token' + ) + set( + css: '#content .modal .js-input', + value: 'Some App#2', + ) + click(css: '#content .modal input[value="ticket.agent"] ~ .label-text') + click(css: '#content .modal .js-submit') + + watch_for( + css: '.modal .modal-title', + value: 'Your New Personal Access Token' + ) + click(css: '.modal .js-submit') + watch_for( + css: '#content .js-tokenList', + value: 'Some App#2' + ) + + click(css: '#content .js-tokenList a') + watch_for( + css: '#content .modal .modal-header', + value: 'confirm', + ) + click( + css: '#content .modal .js-submit', + ) + watch_for_disappear( + css: '#content .js-tokenList', + value: 'Some App#2' + ) + + end +end diff --git a/test/browser/switch_to_user_test.rb b/test/browser/switch_to_user_test.rb index d64246524..f41e1a0ff 100644 --- a/test/browser/switch_to_user_test.rb +++ b/test/browser/switch_to_user_test.rb @@ -11,8 +11,8 @@ class SwitchToUserTest < TestCase ) tasks_close_all() - click( css: 'a[href="#manage"]' ) - click( css: 'a[href="#manage/users"]' ) + click(css: 'a[href="#manage"]') + click(css: 'a[href="#manage/users"]') set( css: '#content .js-search', @@ -20,7 +20,7 @@ class SwitchToUserTest < TestCase ) sleep 3 - @browser.mouse.move_to( @browser.find_elements( { css: '#content .table-overview tbody tr:first-child' } )[0] ) + @browser.mouse.move_to(@browser.find_elements({ css: '#content .table-overview tbody tr:first-child' } )[0]) sleep 0.5 click( css: '#content .icon-switchView', @@ -35,12 +35,12 @@ class SwitchToUserTest < TestCase css: '.switchBackToUser', value: 'Nicole', ) - login = @browser.find_elements( { css: '.user-menu .user a' } )[0].attribute('title') + login = @browser.find_elements({ css: '.user-menu .user a' })[0].attribute('title') assert_equal(login, 'nicole.braun@zammad.org') - click( css: '.switchBackToUser .js-close' ) + click(css: '.switchBackToUser .js-close') sleep 5 - login = @browser.find_elements( { css: '.user-menu .user a' } )[0].attribute('title') + login = @browser.find_elements({ css: '.user-menu .user a' })[0].attribute('title') assert_equal(login, 'master@example.com') end