123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251 |
- # Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
- require 'browser_test_helper'
- class AgentTicketCreateResetCustomerSelectionTest < TestCase
- def test_clear_customer
- @browser = browser_instance
- login(
- username: 'admin@example.com',
- password: 'test',
- url: browser_url,
- )
- tasks_close_all
- click(css: 'a[href="#new"]', only_if_exists: true)
- click(css: 'a[href="#ticket/create"]')
- watch_for(
- css: '.content.active .newTicket',
- timeout: 3,
- )
- exists(css: '.content.active .newTicket')
- exists(css: '.content.active .tabsSidebar .sidebar[data-tab="template"]')
- exists(css: '.content.active .tabsSidebar .tabsSidebar-tab.active[data-tab="template"]')
- exists_not(css: '.content.active .tabsSidebar .sidebar[data-tab="customer"]')
- exists_not(css: '.content.active .tabsSidebar .tabsSidebar-tab[data-tab="customer"]')
- click(css: '.content.active .newTicket [name="customer_id_completion"]')
- # check if pulldown is open, it's not working stable via selenium
- @browser.execute_script("$('.content.active .newTicket .js-recipientDropdown').addClass('open')")
- set(
- css: '.content.active .newTicket input[name="customer_id_completion"]',
- value: 'nicole',
- )
- watch_for(
- css: '.content.active .newTicket .js-recipientDropdown .recipientList.is-shown',
- value: 'Nicole',
- timeout: 3,
- )
- sendkey(value: :enter)
- sleep 1
- exists(css: '.content.active .newTicket')
- exists(css: '.content.active .tabsSidebar .sidebar[data-tab="template"]')
- exists(css: '.content.active .tabsSidebar .tabsSidebar-tab.active[data-tab="template"]')
- exists(css: '.content.active .tabsSidebar .sidebar[data-tab="customer"]')
- exists(css: '.content.active .tabsSidebar .tabsSidebar-tab[data-tab="customer"]')
- set(
- css: '.content.active .newTicket input[name="customer_id_completion"]',
- value: '',
- )
- sendkey(value: :backspace)
- sleep 1
- exists(css: '.content.active .newTicket')
- exists(css: '.content.active .tabsSidebar .sidebar[data-tab="template"]')
- exists(css: '.content.active .tabsSidebar .tabsSidebar-tab.active[data-tab="template"]')
- exists_not(css: '.content.active .tabsSidebar .sidebar[data-tab="customer"]')
- exists_not(css: '.content.active .tabsSidebar .tabsSidebar-tab[data-tab="customer"]')
- set(
- css: '.content.active .newTicket input[name="title"]',
- value: 'some title',
- )
- set(
- css: '.content.active .newTicket div[data-name="body"]',
- value: 'some body',
- )
- select(
- css: '.content.active .newTicket select[name="group_id"]',
- value: 'Users',
- )
- click(css: '.content.active .newTicket .js-submit')
- watch_for(
- css: '.content.active .newTicket .user_autocompletion.form-group.has-error',
- )
- # cleanup
- tasks_close_all
- end
- def test_clear_customer_use_email
- @browser = browser_instance
- login(
- username: 'admin@example.com',
- password: 'test',
- url: browser_url,
- )
- tasks_close_all
- click(css: 'a[href="#new"]', only_if_exists: true)
- click(css: 'a[href="#ticket/create"]')
- sleep 2
- exists(css: '.content.active .newTicket')
- exists(css: '.content.active .tabsSidebar .sidebar[data-tab="template"]')
- exists(css: '.content.active .tabsSidebar .tabsSidebar-tab.active[data-tab="template"]')
- exists_not(css: '.content.active .tabsSidebar .sidebar[data-tab="customer"]')
- exists_not(css: '.content.active .tabsSidebar .tabsSidebar-tab[data-tab="customer"]')
- click(css: '.content.active .newTicket [name="customer_id_completion"]')
- # check if pulldown is open, it's not working stable via selenium
- @browser.execute_script("$('.content.active .newTicket .js-recipientDropdown').addClass('open')")
- set(
- css: '.content.active .newTicket input[name="customer_id_completion"]',
- value: 'nicole',
- )
- watch_for(
- css: '.content.active .newTicket .js-recipientDropdown .recipientList.is-shown',
- value: 'Nicole',
- timeout: 3,
- )
- sendkey(value: :enter)
- sleep 1
- exists(css: '.content.active .newTicket')
- exists(css: '.content.active .tabsSidebar .sidebar[data-tab="template"]')
- exists(css: '.content.active .tabsSidebar .tabsSidebar-tab.active[data-tab="template"]')
- exists(css: '.content.active .tabsSidebar .sidebar[data-tab="customer"]')
- exists(css: '.content.active .tabsSidebar .tabsSidebar-tab[data-tab="customer"]')
- set(
- css: '.content.active .newTicket input[name="customer_id_completion"]',
- value: '',
- )
- sendkey(value: :backspace)
- sleep 1
- exists(css: '.content.active .newTicket')
- exists(css: '.content.active .tabsSidebar .sidebar[data-tab="template"]')
- exists(css: '.content.active .tabsSidebar .tabsSidebar-tab.active[data-tab="template"]')
- exists_not(css: '.content.active .tabsSidebar .sidebar[data-tab="customer"]')
- exists_not(css: '.content.active .tabsSidebar .tabsSidebar-tab[data-tab="customer"]')
- set(
- css: '.content.active .newTicket input[name="customer_id_completion"]',
- value: 'somecustomer_not_existing_right_now@example.com',
- )
- set(
- css: '.content.active .newTicket input[name="title"]',
- value: 'some title',
- )
- set(
- css: '.content.active .newTicket div[data-name="body"]',
- value: 'some body',
- )
- select(
- css: '.content.active .newTicket select[name="group_id"]',
- value: 'Users',
- )
- click(css: '.content.active .newTicket .js-submit')
- watch_for(
- css: '.content.active .ticketZoom-header .ticket-number',
- value: '\d',
- )
- click(css: '.content.active .tabsSidebar-tabs .tabsSidebar-tab[data-tab="customer"]')
- match(
- css: '.content.active .tabsSidebar .sidebar[data-tab="customer"]',
- value: 'somecustomer_not_existing_right_now@example.com',
- )
- click(css: '.content.active .tabsSidebar .sidebar[data-tab="customer"] .js-actions')
- click(css: '.content.active .tabsSidebar .sidebar[data-tab="customer"] .js-actions li[data-type="customer-change"]')
- modal_ready
- exists_not(
- css: '.content.active .modal .user_autocompletion.form-group.has-error',
- )
- click(css: '.content.active .modal .js-submit')
- watch_for(
- css: '.content.active .modal .user_autocompletion.form-group.has-error',
- )
- set(
- css: '.content.active .modal input[name="customer_id_completion"]',
- value: 'admin',
- )
- click(css: '.content.active .modal .js-submit')
- watch_for(
- css: '.content.active .modal .user_autocompletion.form-group.has-error',
- )
- set(
- css: '.content.active .modal input[name="customer_id_completion"]',
- value: 'admin',
- )
- watch_for(
- css: '.content.active .modal .js-recipientDropdown .recipientList.is-shown',
- value: 'Admin',
- timeout: 3,
- )
- sendkey(value: :enter)
- sleep 1
- set(
- css: '.content.active .modal input[name="customer_id_completion"]',
- value: '',
- )
- sendkey(value: :backspace)
- sleep 1
- click(css: '.content.active .modal .js-submit')
- watch_for(
- css: '.content.active .modal .user_autocompletion.form-group.has-error',
- )
- set(
- css: '.content.active .modal input[name="customer_id_completion"]',
- value: 'admin',
- )
- watch_for(
- css: '.content.active .modal .js-recipientDropdown .recipientList.is-shown',
- value: 'Admin',
- timeout: 3,
- )
- sendkey(value: :enter)
- sleep 1
- click(css: '.content.active .modal .js-submit')
- # click(css: '.content.active .tabsSidebar-tabs .tabsSidebar-tab[data-tab="customer"]')
- watch_for(
- css: '.content.active .tabsSidebar .sidebar[data-tab="customer"]',
- value: 'admin@example.com',
- )
- # cleanup
- tasks_close_all
- end
- end
|