Maintenance: Port agent ticket update tests to capybara.

This commit is contained in:
Dominik Klein 2021-09-27 12:49:55 +02:00
parent 9689d3d97e
commit 5222f4ba6d
12 changed files with 326 additions and 897 deletions

View file

@ -41,11 +41,6 @@ if [ "$LEVEL" == '1' ]; then
rm test/browser/agent_ticket_task_changed_test.rb rm test/browser/agent_ticket_task_changed_test.rb
rm test/browser/agent_ticket_text_module_test.rb rm test/browser/agent_ticket_text_module_test.rb
rm test/browser/agent_ticket_time_accounting_test.rb rm test/browser/agent_ticket_time_accounting_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_update4_test.rb
rm test/browser/agent_ticket_update5_test.rb
rm test/browser/agent_ticket_update_with_attachment_refresh_test.rb rm test/browser/agent_ticket_update_with_attachment_refresh_test.rb
rm test/browser/agent_ticket_update_and_reload_test.rb rm test/browser/agent_ticket_update_and_reload_test.rb
rm test/browser/agent_ticket_zoom_hide_test.rb rm test/browser/agent_ticket_zoom_hide_test.rb
@ -106,11 +101,6 @@ elif [ "$LEVEL" == '2' ]; then
rm test/browser/agent_ticket_task_changed_test.rb rm test/browser/agent_ticket_task_changed_test.rb
# test/browser/agent_ticket_text_module_test.rb # test/browser/agent_ticket_text_module_test.rb
# test/browser/agent_ticket_time_accounting_test.rb # test/browser/agent_ticket_time_accounting_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_update4_test.rb
# rm test/browser/agent_ticket_update5_test.rb
# rm test/browser/agent_ticket_update_with_attachment_refresh_test.rb # rm test/browser/agent_ticket_update_with_attachment_refresh_test.rb
# test/browser/agent_ticket_update_and_reload_test.rb # test/browser/agent_ticket_update_and_reload_test.rb
# test/browser/agent_ticket_zoom_hide_test.rb # test/browser/agent_ticket_zoom_hide_test.rb
@ -171,11 +161,6 @@ elif [ "$LEVEL" == '3' ]; then
# test/browser/agent_ticket_task_changed_test.rb # test/browser/agent_ticket_task_changed_test.rb
rm test/browser/agent_ticket_text_module_test.rb rm test/browser/agent_ticket_text_module_test.rb
rm test/browser/agent_ticket_time_accounting_test.rb rm test/browser/agent_ticket_time_accounting_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_update4_test.rb
rm test/browser/agent_ticket_update5_test.rb
rm test/browser/agent_ticket_update_with_attachment_refresh_test.rb rm test/browser/agent_ticket_update_with_attachment_refresh_test.rb
rm test/browser/agent_ticket_update_and_reload_test.rb rm test/browser/agent_ticket_update_and_reload_test.rb
rm test/browser/agent_ticket_zoom_hide_test.rb rm test/browser/agent_ticket_zoom_hide_test.rb
@ -236,11 +221,6 @@ elif [ "$LEVEL" == '4' ]; then
rm test/browser/agent_ticket_task_changed_test.rb rm test/browser/agent_ticket_task_changed_test.rb
rm test/browser/agent_ticket_text_module_test.rb rm test/browser/agent_ticket_text_module_test.rb
rm test/browser/agent_ticket_time_accounting_test.rb rm test/browser/agent_ticket_time_accounting_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_update4_test.rb
rm test/browser/agent_ticket_update5_test.rb
rm test/browser/agent_ticket_update_with_attachment_refresh_test.rb rm test/browser/agent_ticket_update_with_attachment_refresh_test.rb
rm test/browser/agent_ticket_update_and_reload_test.rb rm test/browser/agent_ticket_update_and_reload_test.rb
rm test/browser/agent_ticket_zoom_hide_test.rb rm test/browser/agent_ticket_zoom_hide_test.rb
@ -300,11 +280,6 @@ elif [ "$LEVEL" == '5' ]; then
rm test/browser/agent_ticket_task_changed_test.rb rm test/browser/agent_ticket_task_changed_test.rb
rm test/browser/agent_ticket_text_module_test.rb rm test/browser/agent_ticket_text_module_test.rb
rm test/browser/agent_ticket_time_accounting_test.rb rm test/browser/agent_ticket_time_accounting_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_update4_test.rb
rm test/browser/agent_ticket_update5_test.rb
rm test/browser/agent_ticket_update_with_attachment_refresh_test.rb rm test/browser/agent_ticket_update_with_attachment_refresh_test.rb
rm test/browser/agent_ticket_update_and_reload_test.rb rm test/browser/agent_ticket_update_and_reload_test.rb
rm test/browser/agent_ticket_zoom_hide_test.rb rm test/browser/agent_ticket_zoom_hide_test.rb
@ -367,11 +342,6 @@ elif [ "$LEVEL" == '6' ]; then
rm test/browser/agent_ticket_task_changed_test.rb rm test/browser/agent_ticket_task_changed_test.rb
rm test/browser/agent_ticket_text_module_test.rb rm test/browser/agent_ticket_text_module_test.rb
rm test/browser/agent_ticket_time_accounting_test.rb rm test/browser/agent_ticket_time_accounting_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_update4_test.rb
rm test/browser/agent_ticket_update5_test.rb
rm test/browser/agent_ticket_update_with_attachment_refresh_test.rb rm test/browser/agent_ticket_update_with_attachment_refresh_test.rb
rm test/browser/agent_ticket_update_and_reload_test.rb rm test/browser/agent_ticket_update_and_reload_test.rb
rm test/browser/agent_ticket_zoom_hide_test.rb rm test/browser/agent_ticket_zoom_hide_test.rb

View file

@ -275,7 +275,6 @@ module CommonActions
# #
# @example # @example
# popover_on_hover(page.find('button.hover_me')) # popover_on_hover(page.find('button.hover_me'))
#
def popover_on_hover(element, wait_for_popover_killer: true) def popover_on_hover(element, wait_for_popover_killer: true)
# wait for popover killer to pass # wait for popover killer to pass
sleep 3 if wait_for_popover_killer sleep 3 if wait_for_popover_killer
@ -294,6 +293,30 @@ module CommonActions
page.execute_script("document.querySelector('#{css_selector}').scrollIntoView(#{position == :top})") page.execute_script("document.querySelector('#{css_selector}').scrollIntoView(#{position == :top})")
sleep 0.3 sleep 0.3
end end
# Close a tab in the taskbar.
#
# @param discard_changes [Boolean] if true, discard changes
#
# @example
# taskbar_tab_close('Ticket-2')
#
def taskbar_tab_close(tab_data_key, discard_changes: true)
retry_on_stale do
taskbar_entry = find(:task_with, tab_data_key)
move_mouse_to(taskbar_entry)
move_mouse_by(5, 5)
click ".tasks .task[data-key='#{tab_data_key}'] .js-close"
return if !discard_changes
in_modal do
click '.js-submit'
end
end
end
end end
RSpec.configure do |config| RSpec.configure do |config|

View file

@ -0,0 +1,34 @@
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
module FieldActions
delegate :app_host, to: Capybara
# Check the field value of a form date field.
#
# @example
# check_date_field_value('date_field_name', '20/12/2020')
#
def check_date_field_value(name, value)
date_attribute_field = find("div[data-name='#{name}'] input[data-item='date']")
expect(date_attribute_field.value).to eq(value)
end
# Set the field value of a form date field.
#
# @example
# set_date_field_value('date_field_name', '20/12/2020')
#
def set_date_field_value(name, value)
# We need a special handling for a blank value, to trigger a correct update.
if value.blank?
find("div[data-name='#{name}'] input[data-item='date']").send_keys :backspace
end
find("div[data-name='#{name}'] .js-datepicker").fill_in with: value
end
end
RSpec.configure do |config|
config.include FieldActions, type: :system
end

View file

@ -3,7 +3,6 @@
require 'rails_helper' require 'rails_helper'
RSpec.describe 'Chat Handling', type: :system do RSpec.describe 'Chat Handling', type: :system do
let(:admin) { create(:admin) }
let(:agent_chat_switch_selector) { '#navigation .js-chatMenuItem .js-switch' } let(:agent_chat_switch_selector) { '#navigation .js-chatMenuItem .js-switch' }
let(:chat_url) { "/assets/chat/#{chat_url_type}.html?port=#{ENV['WS_PORT']}" } let(:chat_url) { "/assets/chat/#{chat_url_type}.html?port=#{ENV['WS_PORT']}" }
let(:chat_url_type) { 'znuny' } let(:chat_url_type) { 'znuny' }

View file

@ -471,6 +471,18 @@ RSpec.describe 'Ticket Create', type: :system do
end end
end end
context 'when closing taskbar tab for new ticket creation' do
it 'close task bar entry after some changes in ticket create form' do
visit 'ticket/create'
within(:active_content) do
find('[name=title]').fill_in with: 'Title'
end
taskbar_tab_close(find(:task_active)['data-key'])
end
end
describe 'customer selection to check the field search' do describe 'customer selection to check the field search' do
before do before do
create(:customer, active: true) create(:customer, active: true)

View file

@ -0,0 +1,179 @@
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
require 'rails_helper'
RSpec.describe 'Ticket > Update > Simultaneously with two different user', type: :system do
let(:group) { Group.find_by(name: 'Users') }
let(:ticket) { create(:ticket, group: group) }
let(:agent) { User.find_by(login: 'agent1@example.com') }
def check_avatar(text, changed: true)
changed_class = changed ? 'changed' : 'not-changed'
within(:active_content) do
expect(page).to have_css(".js-attributeBar .js-avatar .avatar--#{changed_class}", text: text)
end
end
def check_taskbar_tab(ticket_id, title: nil, modified: false)
tab_data_key = "Ticket-#{ticket_id}"
if title
taskbar_tab = find(".tasks .task[data-key='#{tab_data_key}']")
expect(taskbar_tab).to have_css('.nav-tab-name', text: title)
end
if modified
expect(page).to have_css(".tasks .task[data-key='#{tab_data_key}'].is-modified")
else
expect(page).to have_no_css(".tasks .task[data-key='#{tab_data_key}'].is-modified")
end
end
context 'when two different users are simultaneously in one ticket' do
before do
visit "#ticket/zoom/#{ticket.id}"
using_session(:second_browser) do
login(
username: agent.login,
password: 'test',
)
visit "#ticket/zoom/#{ticket.id}"
end
end
it 'avatar from other user should be visible in ticket zoom' do
check_avatar('AT', changed: false)
using_session(:second_browser) do
check_avatar('TA', changed: false)
end
end
it 'check changes from the first user and added changes from the second user' do
within(:active_content) do
find('.js-textarea').send_keys('some note')
expect(page).to have_css('.js-reset')
end
check_avatar('AT', changed: false)
using_session(:second_browser) do
check_avatar('TA', changed: true)
within(:active_content) do
find('.js-textarea').send_keys('some other note')
expect(page).to have_css('.js-reset')
end
end
check_avatar('AT', changed: true)
using_session(:second_browser) do
within(:active_content) do
click '.js-attributeBar .js-submit'
expect(page).to have_no_css('.js-reset')
expect(page).to have_css('.article-content', text: 'some other note')
end
check_avatar('TA', changed: true)
end
check_avatar('AT', changed: false)
check_taskbar_tab(ticket.id, title: ticket.title, modified: true)
within(:active_content) do
expect(page).to have_css('.article-content', text: 'some other note')
click '.js-attributeBar .js-submit'
expect(page).to have_no_css('.js-reset')
expect(page).to have_css('.article-content', text: 'some note')
end
using_session(:second_browser) do
check_avatar('TA', changed: false)
expect(page).to have_css('.article-content', text: 'some note')
check_taskbar_tab(ticket.id, title: ticket.title, modified: true)
end
# Reload browsers and check if state is correct.
refresh
using_session(:second_browser) do
refresh
check_avatar('TA', changed: false)
expect(page).to have_no_css('.js-reset')
end
check_avatar('AT', changed: false)
expect(page).to have_no_css('.js-reset')
end
it 'check refresh for unsaved changes and reset after refresh' do
using_session(:second_browser) do
within(:active_content) do
find('.js-textarea').send_keys('some other note')
expect(page).to have_css('.js-reset')
end
check_avatar('TA', changed: false)
# We need to wait for the auto save feature.
wait.until do
Taskbar.find_by(key: "Ticket-#{ticket.id}", user_id: agent.id).state_changed?
end
refresh
end
check_avatar('AT', changed: true)
using_session(:second_browser) do
refresh
within(:active_content) do
click '.js-reset'
expect(page).to have_css('.js-textarea', text: '')
end
end
check_avatar('AT', changed: false)
end
it 'change title with second user' do
find('.js-textarea').send_keys('some note')
using_session(:second_browser) do
find('.js-textarea').send_keys('some other note')
find('.js-objectTitle').set('TTTsome level 2 <b>subject</b> 123äöü')
# Click in the body field, to trigger the title update.
click '.js-textarea'
expect(page).to have_css('.js-objectTitle', text: 'TTTsome level 2 <b>subject</b> 123äöü')
check_taskbar_tab(ticket.id, title: 'TTTsome level 2 <b>subject</b> 123äöü')
expect(page).to have_css('.js-textarea', text: 'some other note')
end
expect(page).to have_css('.js-objectTitle', text: 'TTTsome level 2 <b>subject</b> 123äöü')
expect(page).to have_css('.js-textarea', text: 'some note')
check_taskbar_tab(ticket.id, title: 'TTTsome level 2 <b>subject</b> 123äöü', modified: true)
# Refresh and check that modified flag is gone
refresh
check_taskbar_tab(ticket.id, title: 'TTTsome level 2 <b>subject</b> 123äöü', modified: false)
end
end
end

View file

@ -54,6 +54,56 @@ RSpec.describe 'Ticket Update', type: :system do
end end
end end
context 'when updating a ticket date attribute', db_strategy: :reset do
let!(:date_attribute) do
create_attribute(
:object_manager_attribute_date,
name: 'example_date',
screens: {
create: {
'ticket.agent' => {
shown: true
},
},
edit: {
'ticket.agent' => {
shown: true
}
},
view: {
'ticket.agent' => {
shown: true
},
}
},
data_option: {
'future' => true,
'past' => false,
'diff' => 0,
'null' => true,
}
)
end
let(:ticket) { create(:ticket, group: group, "#{date_attribute.name}": '2018-02-28') }
it 'set date attribute to empty' do
visit "#ticket/zoom/#{ticket.id}"
within(:active_content) do
check_date_field_value(date_attribute.name, '02/28/2018')
set_date_field_value(date_attribute.name, '')
click('.js-attributeBar .js-submit')
expect(page).to have_no_css('.js-submitDropdown .js-submit[disabled]', wait: 10)
ticket.reload
expect(ticket[date_attribute.name]).to eq(nil)
end
end
end
context 'when updating a ticket with macro' do context 'when updating a ticket with macro' do
context 'when required tree_select field is present' do context 'when required tree_select field is present' do
it 'performs no validation (#2492)', db_strategy: :reset do it 'performs no validation (#2492)', db_strategy: :reset do
@ -251,6 +301,18 @@ RSpec.describe 'Ticket Update', type: :system do
end end
end end
context 'when closing taskbar tab for ticket' do
it 'close task bar entry after some changes in ticket update form' do
visit "#ticket/zoom/#{ticket.id}"
within(:active_content) do
find('.js-textarea').send_keys('some note')
end
taskbar_tab_close("Ticket-#{ticket.id}")
end
end
context 'when using text modules' do context 'when using text modules' do
include_examples 'text modules', path: "#ticket/zoom/#{Ticket.first.id}" include_examples 'text modules', path: "#ticket/zoom/#{Ticket.first.id}"
end end
@ -258,4 +320,19 @@ RSpec.describe 'Ticket Update', type: :system do
context 'when using macros' do context 'when using macros' do
include_examples 'macros', path: "#ticket/zoom/#{Ticket.first.id}" include_examples 'macros', path: "#ticket/zoom/#{Ticket.first.id}"
end end
context 'when group will be changed' do
let(:user) { create(:user) }
let(:ticket) { create(:ticket, group: group, owner: user) }
it 'check that owner is resetet after group change' do
visit "#ticket/zoom/#{ticket.id}"
expect(page).to have_field('owner_id', with: user.id)
find('[name=group_id]').select '-'
expect(page).to have_field('owner_id', with: '')
end
end
end end

View file

@ -1,55 +0,0 @@
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
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
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

View file

@ -1,404 +0,0 @@
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
require 'browser_test_helper'
class AgentTicketUpdate2Test < TestCase
def test_work_with_two_browser_on_same_ticket_edit
browser1 = browser_instance
login(
browser: browser1,
username: 'admin@example.com',
password: 'test',
url: browser_url,
)
tasks_close_all(browser: browser1)
browser2 = browser_instance
login(
browser: browser2,
username: 'agent1@example.com',
password: 'test',
url: browser_url,
)
tasks_close_all(browser: browser2)
# create ticket
ticket1 = ticket_create(
browser: browser1,
data: {
group: 'Users',
customer: 'nicole',
title: 'some level 3 <b>subject</b> 123äöü',
body: 'some level 3 <b>body</b> 123äöü',
}
)
# open ticket in second browser
ticket_open_by_search(
browser: browser2,
number: ticket1[:number],
)
watch_for(
browser: browser2,
css: '.active div.ticket-article',
value: 'some level 3 <b>body</b> 123äöü',
)
watch_for(
browser: browser1,
css: '.content.active .js-attributeBar .js-avatar .avatar--not-changed',
value: 'AT', # agent1
)
watch_for(
browser: browser2,
css: '.content.active .js-attributeBar .js-avatar .avatar--not-changed',
value: 'TA', # master
)
# change edit screen in instance 1
ticket_update(
browser: browser1,
data: {
body: 'some level 3 <b>body</b> in instance 1',
},
do_not_submit: true,
)
watch_for(
browser: browser1,
css: '.content.active .js-reset',
value: '(Discard your unsaved changes.|Verwerfen der)',
no_quote: true,
)
watch_for(
browser: browser1,
css: '.content.active .js-attributeBar .js-avatar .avatar--not-changed',
value: 'AT', # agent1
)
watch_for(
browser: browser2,
css: '.content.active .js-attributeBar .js-avatar .avatar--changed',
value: 'TA', # master
)
# update ticket in instance 2
ticket_update(
browser: browser2,
data: {
body: 'some level 3 <b>body</b> in instance 2',
},
do_not_submit: true,
)
watch_for(
browser: browser2,
css: '.content.active .js-reset',
value: '(Discard your unsaved changes.|Verwerfen der)',
no_quote: true,
)
watch_for(
browser: browser1,
css: '.content.active .js-attributeBar .js-avatar .avatar--changed',
value: 'AT', # agent1
)
watch_for(
browser: browser2,
css: '.content.active .js-attributeBar .js-avatar .avatar--changed',
value: 'TA', # master
)
click(
browser: browser2,
css: '.active .js-submit',
)
# discard changes should gone away
watch_for_disappear(
browser: browser2,
css: '.content.active .js-reset',
value: '(Discard your unsaved changes.|Verwerfen der)',
no_quote: true,
)
ticket_verify(
browser: browser2,
data: {
body: '',
},
)
watch_for(
browser: browser1,
css: '.content.active .js-attributeBar .js-avatar .avatar--not-changed',
value: 'AT', # agent1
)
watch_for(
browser: browser2,
css: '.content.active .js-attributeBar .js-avatar .avatar--changed',
value: 'TA', # master
)
# check content and edit screen in instance 1
watch_for(
browser: browser2,
css: '.active div.ticket-article',
value: 'some level 3 <b>body</b> in instance 2',
timeout: 1,
)
ticket_verify(
browser: browser1,
data: {
body: 'some level 3 <b>body</b> in instance 1',
},
)
# update ticket in instance 1
click(
browser: browser1,
css: '.active .js-submit',
)
watch_for(
browser: browser1,
css: '.active div.ticket-article',
value: 'some level 3 <b>body</b> in instance 2',
)
sleep 2
match_not(
browser: browser1,
css: '.content.active .js-reset',
value: '(Discard your unsaved changes.|Verwerfen der)',
no_quote: true,
)
watch_for(
browser: browser1,
css: '.content.active .js-attributeBar .js-avatar .avatar--not-changed',
value: 'AT', # agent1
)
watch_for(
browser: browser2,
css: '.content.active .js-attributeBar .js-avatar .avatar--not-changed',
value: 'TA', # master
)
# check content in instance 2
watch_for(
browser: browser2,
css: '.active div.ticket-article',
value: 'some level 3 <b>body</b> in instance 1',
)
# check content and edit screen in instance 1+2
ticket_verify(
browser: browser1,
data: {
body: '',
},
)
match_not(
browser: browser1,
css: '.content.active .js-reset',
value: '(Discard your unsaved changes.|Verwerfen der)',
no_quote: true,
)
ticket_verify(
browser: browser2,
data: {
body: '',
},
)
match_not(
browser: browser2,
css: '.content.active .js-reset',
value: '(Discard your unsaved changes.|Verwerfen der)',
no_quote: true,
)
watch_for(
browser: browser1,
css: '.content.active .js-attributeBar .js-avatar .avatar--not-changed',
value: 'AT', # agent1
)
watch_for(
browser: browser2,
css: '.content.active .js-attributeBar .js-avatar .avatar--not-changed',
value: 'TA', # master
)
# reload instances, verify again
reload(
browser: browser1,
)
reload(
browser: browser2,
)
# check content and edit screen in instance 1+2
ticket_verify(
browser: browser1,
data: {
body: '',
},
)
match_not(
browser: browser1,
css: '.content.active .js-reset',
value: '(Discard your unsaved changes.|Verwerfen der)',
no_quote: true,
)
ticket_verify(
browser: browser2,
data: {
body: '',
},
)
match_not(
browser: browser2,
css: '.content.active .js-reset',
value: '(Discard your unsaved changes.|Verwerfen der)',
no_quote: true,
)
watch_for(
browser: browser1,
css: '.content.active .js-attributeBar .js-avatar .avatar--not-changed',
value: 'AT', # agent1
)
watch_for(
browser: browser2,
css: '.content.active .js-attributeBar .js-avatar .avatar--not-changed',
value: 'TA', # master
)
# change form of ticket, reset, reload and verify in instance 2
ticket_update(
browser: browser2,
data: {
body: '22 some level 3 <b>body</b> in instance 2',
},
do_not_submit: true,
)
watch_for(
browser: browser2,
css: '.content.active .js-reset',
value: '(Discard your unsaved changes.|Verwerfen der)',
no_quote: true,
)
sleep 3
reload(
browser: browser2,
)
sleep 3
click(
css: '.content.active .js-reset',
browser: browser2,
)
sleep 4
ticket_verify(
browser: browser2,
data: {
body: '',
},
)
# change form of ticket in instance 2
ticket_update(
browser: browser2,
data: {
body: '22 some level 3 <b>body</b> in instance 2',
},
do_not_submit: true,
)
watch_for(
browser: browser2,
css: '.content.active .js-reset',
value: '(Discard your unsaved changes.|Verwerfen der)',
no_quote: true,
)
sleep 2
watch_for(
browser: browser1,
css: '.content.active .js-attributeBar .js-avatar .avatar--changed',
value: 'AT', # agent1
)
watch_for(
browser: browser2,
css: '.content.active .js-attributeBar .js-avatar .avatar--not-changed',
value: 'TA', # master
)
reload(
browser: browser2,
)
ticket_verify(
browser: browser2,
data: {
body: '22 some level 3 <b>body</b> in instance 2',
},
)
watch_for(
browser: browser2,
css: '.content.active .js-reset',
value: '(Discard your unsaved changes.|Verwerfen der)',
no_quote: true,
)
watch_for(
browser: browser1,
css: '.content.active .js-attributeBar .js-avatar .avatar--changed',
value: 'AT', # agent1
)
watch_for(
browser: browser2,
css: '.content.active .js-attributeBar .js-avatar .avatar--not-changed',
value: 'TA', # master
)
task_type(
browser: browser2,
type: 'stayOnTab',
)
click(
browser: browser2,
css: '.active .js-submit',
)
# discard changes should gone away
watch_for_disappear(
browser: browser2,
css: '.content.active .js-reset',
value: '(Discard your unsaved changes.|Verwerfen der)',
no_quote: true,
)
watch_for(
browser: browser1,
css: '.content.active .js-attributeBar .js-avatar .avatar--not-changed',
value: 'AT', # agent1
)
watch_for(
browser: browser2,
css: '.content.active .js-attributeBar .js-avatar .avatar--not-changed',
value: 'TA', # master
)
# check if new article is empty
ticket_verify(
browser: browser2,
data: {
body: '',
},
)
watch_for(
browser: browser2,
css: '.active div.ticket-article',
value: '22 some level 3 <b>body</b> in instance 2',
)
end
end

View file

@ -1,276 +0,0 @@
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
require 'browser_test_helper'
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,
username: 'admin@example.com',
password: 'test',
url: browser_url,
)
tasks_close_all(browser: browser1)
browser2 = browser_instance
login(
browser: browser2,
username: 'agent1@example.com',
password: 'test',
url: browser_url,
)
tasks_close_all(browser: browser2)
# create ticket
ticket1 = ticket_create(
browser: browser1,
data: {
group: 'Users',
customer: 'nicole',
title: 'some level 2 <b>subject</b> 123äöü',
body: 'some level 2 <b>body</b> 123äöü',
}
)
# open ticket in second browser
ticket_open_by_search(
browser: browser2,
number: ticket1[:number],
)
watch_for(
browser: browser2,
css: '.active div.ticket-article',
value: 'some level 2 <b>body</b> 123äöü',
)
# set body in edit area in second
ticket_update(
browser: browser2,
data: {
body: 'some level 2 <b>body</b> in instance 2',
},
do_not_submit: true,
)
# set body in edit area in first
ticket_update(
browser: browser1,
data: {
body: 'some level 2 <b>body</b> in instance 1',
},
do_not_submit: true,
)
# change title in second browser
ticket_update(
browser: browser2,
data: {
title: 'TTTsome level 2 <b>subject</b> 123äöü',
},
do_not_submit: true,
)
sleep 2
# verify title in second and first browser
verify_title(
browser: browser2,
value: 'TTTsome level 2 <b>subject<\/b> 123äöü',
)
ticket_verify(
browser: browser2,
data: {
title: 'TTTsome level 2 <b>subject<\/b> 123äöü',
},
)
verify_task(
browser: browser2,
data: {
title: 'TTTsome level 2 <b>subject<\/b> 123äöü',
modified: false,
}
)
sleep 4
verify_title(
browser: browser1,
value: 'TTTsome level 2 <b>subject<\/b> 123äöü',
)
ticket_verify(
browser: browser1,
data: {
title: 'TTTsome level 2 <b>subject<\/b> 123äöü',
},
)
verify_task(
browser: browser1,
data: {
title: 'TTTsome level 2 <b>subject<\/b> 123äöü',
modified: true,
}
)
# verify text in input body, if still exists
ticket_verify(
browser: browser1,
data: {
body: 'some level 2 <b>body</b> in instance 1',
},
)
ticket_verify(
browser: browser2,
data: {
body: 'some level 2 <b>body</b> in instance 2',
},
)
# set body in edit area in second
ticket_update(
browser: browser1,
data: {
body: 'some update 4711',
},
)
watch_for(
browser: browser1,
css: '.active div.ticket-article',
value: 'some update 4711',
)
verify_task(
browser: browser1,
data: {
title: 'TTTsome level 2 <b>subject<\/b> 123äöü',
modified: false,
}
)
# verify if text in input body is now empty
ticket_verify(
browser: browser1,
data: {
body: '',
},
)
# check if body is still in second browser
ticket_verify(
browser: browser2,
data: {
body: 'some level 2 <b>body</b> in instance 2',
},
)
# verify task
verify_task(
browser: browser2,
data: {
title: 'TTTsome level 2 <b>subject<\/b> 123äöü',
modified: true,
}
)
# reload instances, verify again
reload(
browser: browser1,
)
reload(
browser: browser2,
)
# wait till application become ready
sleep 8
verify_title(
browser: browser2,
value: 'TTTsome level 2 <b>subject<\/b> 123äöü',
)
ticket_verify(
browser: browser2,
data: {
title: 'TTTsome level 2 <b>subject<\/b> 123äöü',
},
)
verify_task(
browser: browser2,
data: {
title: 'TTTsome level 2 <b>subject<\/b> 123äöü',
modified: false, # modify was muted at reload ticket tab
}
)
verify_title(
browser: browser1,
value: 'TTTsome level 2 <b>subject<\/b> 123äöü',
)
ticket_verify(
browser: browser1,
data: {
title: 'TTTsome level 2 <b>subject<\/b> 123äöü',
},
)
verify_task(
browser: browser1,
data: {
title: 'TTTsome level 2 <b>subject<\/b> 123äöü',
modified: false,
}
)
# verify if update is on ticket in each browser
watch_for(
browser: browser1,
css: '.active div.ticket-article',
value: 'some update 4711',
)
watch_for(
browser: browser2,
css: '.active div.ticket-article',
value: 'some update 4711',
)
# verify if text in input body is now empty
ticket_verify(
browser: browser1,
data: {
body: '',
},
)
# check if body is still in second browser
ticket_verify(
browser: browser2,
data: {
body: 'some level 2 <b>body</b> in instance 2',
},
)
# modify ticket again and erase modified via mouse click on .active.content
ticket_update(
browser: browser1,
data: {
body: 'some update 4711/2',
},
)
sleep 4
verify_task(
browser: browser2,
data: {
title: 'TTTsome level 2 <b>subject<\/b> 123äöü',
modified: true,
}
)
click(
browser: browser2,
css: '.active.content',
)
sleep 4
verify_task(
browser: browser2,
data: {
title: 'TTTsome level 2 <b>subject<\/b> 123äöü',
modified: false,
}
)
end
end

View file

@ -1,79 +0,0 @@
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
require 'browser_test_helper'
class AgentTicketUpdate4Test < TestCase
def test_update_date_object_for_ticket
@browser = browser_instance
login(
username: 'admin@example.com',
password: 'test',
url: browser_url,
)
tasks_close_all
# date object
object_manager_attribute_create(
data: {
name: 'date1',
display: "Date-#{SecureRandom.uuid}",
data_type: 'Date',
},
)
watch_for(
css: '.content.active',
value: 'Database Update required',
)
click(css: '.content.active .tab-pane.active div.js-execute')
watch_for(
css: '.modal',
value: 'restart',
)
watch_for_disappear(
css: '.modal',
timeout: 240,
)
sleep 5
watch_for(
css: '.content.active',
)
# create new ticket
ticket = ticket_create(
data: {
customer: 'nico',
group: 'Users',
priority: '2 normal',
state: 'open',
title: 'ticket attribute test #1',
body: 'ticket attribute test #1',
},
custom_data_date: {
date1: '02/28/2018',
},
disable_group_check: true,
)
ticket_open_by_search(
browser: @browser,
number: ticket[:number],
)
ticket_update(
data: {},
custom_data_date: {
date1: '',
},
)
click(css: '.content.active .js-submit')
match_not(
css: '.active .sidebar div[data-name="date1"] input[data-item="date"]',
value: '02/28/2018',
)
end
end

View file

@ -1,51 +0,0 @@
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
require 'browser_test_helper'
class AgentTicketUpdate5Test < TestCase
def test_check_changes
@browser = browser_instance
login(
username: 'agent1@example.com',
password: 'test',
url: browser_url,
)
# create ticket
ticket_create(
data: {
customer: 'Nico',
group: 'Users',
title: 'some changes',
body: 'some body 123äöü - changes',
}
)
select(
css: '.content.active .sidebar select[name="owner_id"]',
value: 'Agent 1 Test',
)
click(css: '.content.active .js-attributeBar .js-submit', wait: 2)
select(
css: '.content.active .sidebar select[name="group_id"]',
value: '-',
)
select(
css: '.content.active .sidebar select[name="group_id"]',
value: 'Users',
)
sleep 1
match(
css: '.content.active .sidebar select[name="owner_id"]',
value: '-'
)
end
end