Merge branch 'develop' of git.znuny.com:zammad/zammad into develop

This commit is contained in:
Martin Edenhofer 2018-07-26 09:06:29 +02:00
commit 525086d09c
28 changed files with 246 additions and 246 deletions

View file

@ -302,7 +302,7 @@ test:integration:otrs_6_mysql:
- mysql - mysql
script: script:
- export RAILS_ENV=test - export RAILS_ENV=test
- export IMPORT_OTRS_ENDPOINT="http://vz1185.test.znuny.com/otrs/public.pl?Action=ZammadMigrator" - export IMPORT_OTRS_ENDPOINT="https://vz1185.test.znuny.com/otrs/public.pl?Action=ZammadMigrator"
- rake db:create - rake db:create
- rake db:migrate - rake db:migrate
- ruby -I test/ test/integration/otrs_import_test.rb - ruby -I test/ test/integration/otrs_import_test.rb
@ -315,7 +315,7 @@ test:integration:otrs_6_postgresql:
- postgresql - postgresql
script: script:
- export RAILS_ENV=test - export RAILS_ENV=test
- export IMPORT_OTRS_ENDPOINT="http://vz1185.test.znuny.com/otrs/public.pl?Action=ZammadMigrator" - export IMPORT_OTRS_ENDPOINT="https://vz1185.test.znuny.com/otrs/public.pl?Action=ZammadMigrator"
- rake db:create - rake db:create
- rake db:migrate - rake db:migrate
- ruby -I test/ test/integration/otrs_import_test.rb - ruby -I test/ test/integration/otrs_import_test.rb

View file

@ -17,8 +17,9 @@ RSpec.describe Sessions::Backend::ActivityStream do
end end
it 'manages race condition' do it 'manages race condition' do
Thread.new { associated_tickets.each(&:destroy) } thread = Thread.new { associated_tickets.each(&:destroy) }
expect { subject.load }.not_to raise_error expect { subject.load }.not_to raise_error
thread.join
end end
end end
end end

View file

@ -691,6 +691,25 @@ RSpec.describe User do
end end
end end
context 'falsely added on update (change: [nil, ""])' do
let(:orig_number) { nil }
let(:new_number) { '' }
before { subject } # create user
it 'does not attempt to update CallerId record' do
allow(Cti::CallerId).to receive(:build).with(any_args)
expect(Cti::CallerId.where(object: 'User', o_id: subject.id).count)
.to eq(0)
expect { subject.update(phone: new_number) }
.to change { Cti::CallerId.where(object: 'User', o_id: subject.id).count }.by(0)
expect(Cti::CallerId).not_to have_received(:build)
end
end
context 'removed on update' do context 'removed on update' do
let(:orig_number) { '1234567890' } let(:orig_number) { '1234567890' }
let(:new_number) { nil } let(:new_number) { nil }

View file

@ -94,24 +94,11 @@ class AdminOverviewTest < TestCase
} }
) )
click( overview_open(
browser: instance, name: name
css: 'a[href="#ticket/view"]',
mute_log: true,
)
click(
browser: instance,
css: "div.overview-header a[href='#ticket/view/#{name}']",
mute_log: true,
) )
# Sort the tickets according to their onscreen Y location assert_equal(ticket_titles.reverse, ordered_ticket_titles(ticket_titles))
tickets_low_to_high = ticket_titles.map do |title|
[title,
get_location( css: "td[title='#{title}']").y]
end
tickets_low_to_high = tickets_low_to_high.sort_by { |x| -x[1] }.map { |x| x[0] }
assert_equal(ticket_titles, tickets_low_to_high)
# Update overview to sort groups from low to high # Update overview to sort groups from low to high
overview_update( overview_update(
@ -121,23 +108,21 @@ class AdminOverviewTest < TestCase
} }
) )
click( overview_open(
browser: instance, name: name
css: 'a[href="#ticket/view"]',
mute_log: true,
)
click(
browser: instance,
css: "div.overview-header a[href='#ticket/view/#{name}']",
mute_log: true,
) )
# Sort the tickets according to their onscreen Y location # wait till the scheduler pushed
tickets_high_to_low = ticket_titles.map do |title| # the changes to the FE
sleep 5
assert_equal(ticket_titles, ordered_ticket_titles(ticket_titles))
end
def ordered_ticket_titles(ticket_titles)
ticket_titles.map do |title|
[title, [title,
get_location( css: "td[title='#{title}']").y] get_location( css: "td[title='#{title}']").y]
end end.sort_by { |x| x[1] }.map { |x| x[0] }
tickets_high_to_low = tickets_high_to_low.sort_by { |x| x[1] }.map { |x| x[0] }
assert_equal(ticket_titles, tickets_high_to_low)
end end
end end

View file

@ -47,10 +47,7 @@ class AgentOrganizationProfileTest < TestCase
click(css: '.active .js-action .icon-arrow-down', fast: true) click(css: '.active .js-action .icon-arrow-down', fast: true)
click(css: '.active .js-action [data-type="edit"]') click(css: '.active .js-action [data-type="edit"]')
watch_for( modal_ready()
css: '.active .modal',
value: 'note',
)
watch_for( watch_for(
css: '.active .modal', css: '.active .modal',
value: note, value: note,
@ -65,6 +62,7 @@ class AgentOrganizationProfileTest < TestCase
value: 'some note abc', value: 'some note abc',
) )
click(css: '.active .modal button.js-submit') click(css: '.active .modal button.js-submit')
modal_disappear()
watch_for( watch_for(
css: '.active .profile-window', css: '.active .profile-window',
@ -80,15 +78,14 @@ class AgentOrganizationProfileTest < TestCase
# change lastname back # change lastname back
click(css: '.active .js-action .icon-arrow-down', fast: true) click(css: '.active .js-action .icon-arrow-down', fast: true)
click(css: '.active .js-action [data-type="edit"]') click(css: '.active .js-action [data-type="edit"]')
watch_for(
css: '.active .modal', modal_ready()
value: 'note',
)
set( set(
css: '.modal [name="name"]', css: '.modal [name="name"]',
value: 'Zammad Foundation', value: 'Zammad Foundation',
) )
click(css: '.active .modal button.js-submit') click(css: '.active .modal button.js-submit')
modal_disappear()
verify_task( verify_task(
data: { data: {

View file

@ -162,15 +162,15 @@ class AgentTicketAttachmentTest < TestCase
# submit form # submit form
click(css: '.content.active .js-submit') click(css: '.content.active .js-submit')
sleep 2
# check warning # check warning
modal_ready()
match( match(
css: '.content.active .modal', css: '.content.active .modal',
value: 'missing', value: 'missing',
) )
click(css: '.content.active .modal .js-cancel') click(css: '.content.active .modal .js-cancel')
sleep 2 modal_disappear()
ticket_update( ticket_update(
data: { data: {
@ -259,7 +259,7 @@ class AgentTicketAttachmentTest < TestCase
# modify customer # modify customer
click(browser: browser1, css: '.content.active .sidebar[data-tab="customer"] .js-actions .dropdown-toggle') click(browser: browser1, css: '.content.active .sidebar[data-tab="customer"] .js-actions .dropdown-toggle')
click(browser: browser1, css: '.content.active .sidebar[data-tab="customer"] .js-actions [data-type="customer-edit"]') click(browser: browser1, css: '.content.active .sidebar[data-tab="customer"] .js-actions [data-type="customer-edit"]')
sleep 2 modal_ready(browser: browser1)
set(browser: browser1, css: '.modal [name="address"]', value: 'some new address') set(browser: browser1, css: '.modal [name="address"]', value: 'some new address')
click(browser: browser1, css: '.modal .js-submit') click(browser: browser1, css: '.modal .js-submit')
modal_disappear(browser: browser1) modal_disappear(browser: browser1)
@ -279,7 +279,7 @@ class AgentTicketAttachmentTest < TestCase
# change org of customer, check if org is shown in sidebar # change org of customer, check if org is shown in sidebar
click(browser: browser1, css: '.content.active .sidebar[data-tab="customer"] .js-actions .dropdown-toggle') click(browser: browser1, css: '.content.active .sidebar[data-tab="customer"] .js-actions .dropdown-toggle')
click(browser: browser1, css: '.content.active .sidebar[data-tab="customer"] .js-actions [data-type="customer-edit"]') click(browser: browser1, css: '.content.active .sidebar[data-tab="customer"] .js-actions [data-type="customer-edit"]')
sleep 2 modal_ready(browser: browser1)
set(browser: browser1, css: '.modal .js-input', value: 'zammad') set(browser: browser1, css: '.modal .js-input', value: 'zammad')
click(browser: browser1, css: '.modal .js-input') click(browser: browser1, css: '.modal .js-input')
click(browser: browser1, css: '.modal .js-option') click(browser: browser1, css: '.modal .js-option')
@ -329,14 +329,15 @@ class AgentTicketAttachmentTest < TestCase
# First test the attachment uploading for new tickets # First test the attachment uploading for new tickets
file_upload( file_upload(
css: '.content.active .attachmentPlaceholder-inputHolder input', css: '.content.active .attachmentPlaceholder-inputHolder input',
files: [Rails.root.join('test', 'data', 'upload', 'upload2.jpg')], files: [large_file],
no_sleep: true, no_sleep: true,
) )
exists( exists(
css: '.content.active .js-submit:disabled', css: '.content.active .js-submit:disabled',
) )
watch_for_disappear( watch_for_disappear(
css: '.content.active .js-submit:disabled', css: '.content.active .js-submit:disabled',
timeout: 4.minutes,
) )
exists( exists(
css: '.content.active .js-submit', css: '.content.active .js-submit',
@ -355,14 +356,23 @@ class AgentTicketAttachmentTest < TestCase
) )
file_upload( file_upload(
css: '.content.active .attachmentPlaceholder-inputHolder input', css: '.content.active .attachmentPlaceholder-inputHolder input',
files: [Rails.root.join('test', 'data', 'upload', 'upload2.jpg')], files: [large_file],
no_sleep: true, no_sleep: true,
) )
exists( exists(
css: '.content.active .js-submit:disabled', css: '.content.active .js-submit:disabled',
) )
watch_for_disappear( watch_for_disappear(
css: '.content.active .js-submit:disabled', css: '.content.active .js-submit:disabled',
timeout: 4.minutes,
) )
end end
def large_file
file = Tempfile.new
file.binmode
file.write(SecureRandom.random_bytes(6.megabyte))
file.close
file.path
end
end end

View file

@ -177,9 +177,7 @@ class AgentTicketCreateResetCustomerSelectionTest < TestCase
click(css: '.content.active .tabsSidebar .sidebar[data-tab="customer"] .js-actions') 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"]') click(css: '.content.active .tabsSidebar .sidebar[data-tab="customer"] .js-actions li[data-type="customer-change"]')
watch_for( modal_ready()
css: '.content.active .modal',
)
exists_not( exists_not(
css: '.content.active .modal .user_autocompletion.form-group.has-error', css: '.content.active .modal .user_autocompletion.form-group.has-error',

View file

@ -46,7 +46,8 @@ class AgentTicketLinkTest < TestCase
click( click(
css: '.content.active .links .js-add', css: '.content.active .links .js-add',
) )
sleep 2
modal_ready()
set( set(
css: '.content.active .modal-body [name="ticket_number"]', css: '.content.active .modal-body [name="ticket_number"]',

View file

@ -113,7 +113,10 @@ class AgentTicketMacroTest < TestCase
perform_macro(name: macro_name) perform_macro(name: macro_name)
exists_not(css: '.tasks > a') watch_for_disappear(
css: '.tasks > a',
timeout: 5,
)
end end
def test_ux_flow_next_up_advance_to_next_ticket_from_overview def test_ux_flow_next_up_advance_to_next_ticket_from_overview

View file

@ -58,11 +58,8 @@ class AgentTicketMergeTest < TestCase
# merge tickets # merge tickets
click( css: '.active div[data-tab="ticket"] .js-actions .icon-arrow-down' ) click( css: '.active div[data-tab="ticket"] .js-actions .icon-arrow-down' )
click( css: '.active div[data-tab="ticket"] .js-actions [data-type="ticket-merge"]' ) click( css: '.active div[data-tab="ticket"] .js-actions [data-type="ticket-merge"]' )
watch_for(
css: '.modal',
value: 'merge',
)
modal_ready()
set( set(
css: '.modal input[name="master_ticket_number"]', css: '.modal input[name="master_ticket_number"]',
value: ticket1[:number], value: ticket1[:number],
@ -115,11 +112,8 @@ class AgentTicketMergeTest < TestCase
# merge tickets # merge tickets
click( css: '.active div[data-tab="ticket"] .js-actions .icon-arrow-down' ) click( css: '.active div[data-tab="ticket"] .js-actions .icon-arrow-down' )
click( css: '.active div[data-tab="ticket"] .js-actions [data-type="ticket-merge"]' ) click( css: '.active div[data-tab="ticket"] .js-actions [data-type="ticket-merge"]' )
watch_for(
css: '.modal',
value: 'merge',
)
modal_ready()
set( set(
css: '.modal input[name="master_ticket_number"]', css: '.modal input[name="master_ticket_number"]',
value: ticket3[:number], value: ticket3[:number],

View file

@ -96,10 +96,8 @@ class AgentTicketOverviewLevel0Test < TestCase
# click options and enable number and article count # click options and enable number and article count
click(css: '.content.active [data-type="settings"]') click(css: '.content.active [data-type="settings"]')
watch_for( modal_ready()
css: '.modal h1',
value: 'Edit',
)
check( check(
css: '.modal input[value="number"]', css: '.modal input[value="number"]',
) )
@ -156,10 +154,8 @@ class AgentTicketOverviewLevel0Test < TestCase
# disable number and article count # disable number and article count
click(css: '.content.active [data-type="settings"]') click(css: '.content.active [data-type="settings"]')
watch_for( modal_ready()
css: '.modal h1',
value: 'Edit',
)
uncheck( uncheck(
css: '.modal input[value="number"]', css: '.modal input[value="number"]',
) )

View file

@ -254,7 +254,11 @@ class AgentTicketTagTest < TestCase
browser: browser2, browser: browser2,
js: "$('.content.active .js-name:contains(\"tag3\")').click()", js: "$('.content.active .js-name:contains(\"tag3\")').click()",
) )
sleep 2
modal_ready(
browser: browser2,
)
set( set(
browser: browser2, browser: browser2,
css: '.modal [name="name"]', css: '.modal [name="name"]',
@ -308,7 +312,11 @@ class AgentTicketTagTest < TestCase
browser: browser2, browser: browser2,
js: "$('.content.active .js-name:contains(\"tag5\")').closest('tr').find('.js-delete').click()", js: "$('.content.active .js-name:contains(\"tag5\")').closest('tr').find('.js-delete').click()",
) )
sleep 2
modal_ready(
browser: browser2,
)
click( click(
browser: browser2, browser: browser2,
css: '.modal .js-submit', css: '.modal .js-submit',

View file

@ -227,7 +227,8 @@ class AgentTicketTextModuleTest < TestCase
browser: browser2, browser: browser2,
css: '.active div[data-tab="ticket"] .js-actions [data-type="customer-change"]', css: '.active div[data-tab="ticket"] .js-actions [data-type="customer-change"]',
) )
sleep 1
modal_ready(browser: browser2)
ticket_customer_select( ticket_customer_select(
browser: browser2, browser: browser2,
@ -240,10 +241,7 @@ class AgentTicketTextModuleTest < TestCase
css: '.modal-content .js-submit', css: '.modal-content .js-submit',
) )
watch_for_disappear( modal_disappear(browser: browser2)
browser: browser2,
css: '.modal',
)
set( set(
browser: browser2, browser: browser2,

View file

@ -41,11 +41,7 @@ class AgentTicketTimeAccountingTest < TestCase
click( click(
css: '.active .js-submit', css: '.active .js-submit',
) )
modal_ready()
watch_for(
css: '.content.active .modal',
value: 'Time Accounting',
)
set( set(
css: '.content.active .modal [name=time_unit]', css: '.content.active .modal [name=time_unit]',
value: '4', value: '4',
@ -53,10 +49,8 @@ class AgentTicketTimeAccountingTest < TestCase
click( click(
css: '.content.active .modal .js-submit', css: '.content.active .modal .js-submit',
) )
watch_for_disappear( modal_disappear()
css: '.content.active .modal',
value: 'Time Accounting',
)
watch_for( watch_for(
css: '.content.active .js-timeUnit', css: '.content.active .js-timeUnit',
value: '4', value: '4',
@ -80,11 +74,7 @@ class AgentTicketTimeAccountingTest < TestCase
click( click(
css: '.active .js-submit', css: '.active .js-submit',
) )
modal_ready()
watch_for(
css: '.content.active .modal',
value: 'Time Accounting',
)
set( set(
css: '.content.active .modal [name=time_unit]', css: '.content.active .modal [name=time_unit]',
value: '4,6', value: '4,6',
@ -92,10 +82,8 @@ class AgentTicketTimeAccountingTest < TestCase
click( click(
css: '.content.active .modal .js-submit', css: '.content.active .modal .js-submit',
) )
watch_for_disappear( modal_disappear()
css: '.content.active .modal',
value: 'Time Accounting',
)
watch_for( watch_for(
css: '.content.active .js-timeUnit', css: '.content.active .js-timeUnit',
value: '4.6', value: '4.6',
@ -111,10 +99,7 @@ class AgentTicketTimeAccountingTest < TestCase
css: '.active .js-submit', css: '.active .js-submit',
) )
watch_for( modal_ready()
css: '.content.active .modal',
value: 'Time Accounting',
)
set( set(
css: '.content.active .modal [name=time_unit]', css: '.content.active .modal [name=time_unit]',
value: '4abc', value: '4abc',
@ -132,10 +117,7 @@ class AgentTicketTimeAccountingTest < TestCase
click( click(
css: '.content.active .modal .js-submit', css: '.content.active .modal .js-submit',
) )
watch_for_disappear( modal_disappear()
css: '.content.active .modal',
value: 'Time Accounting',
)
watch_for( watch_for(
css: '.content.active .js-timeUnit', css: '.content.active .js-timeUnit',
value: '8.6', value: '8.6',
@ -198,29 +180,18 @@ class AgentTicketTimeAccountingTest < TestCase
click( click(
css: '.active .js-submit', css: '.active .js-submit',
) )
modal_ready()
watch_for(
css: '.content.active .modal',
value: 'Time Accounting',
)
# Click outside the modal to make it disappear # Click outside the modal to make it disappear
execute( execute(
js: 'document.elementFromPoint(300, 100).click();', js: 'document.elementFromPoint(300, 100).click();',
) )
watch_for_disappear( modal_disappear()
css: '.content.active .modal',
value: 'Time Accounting',
)
click( click(
css: '.active .js-submit', css: '.active .js-submit',
) )
watch_for( modal_ready()
css: '.content.active .modal',
value: 'Time Accounting',
)
set( set(
css: '.content.active .modal [name=time_unit]', css: '.content.active .modal [name=time_unit]',
value: '4', value: '4',
@ -228,10 +199,7 @@ class AgentTicketTimeAccountingTest < TestCase
click( click(
css: '.content.active .modal .js-submit', css: '.content.active .modal .js-submit',
) )
watch_for_disappear( modal_disappear()
css: '.content.active .modal',
value: 'Time Accounting',
)
# disable time accounting # disable time accounting
click( click(

View file

@ -52,18 +52,14 @@ class AgentTicketZoomHideTest < TestCase
css: '.attachment-icon img', css: '.attachment-icon img',
) )
watch_for( modal_ready()
css: 'body > .modal',
)
# Now go to a previous ticket and confirm that the modal disappears # Now go to a previous ticket and confirm that the modal disappears
location( location(
url: browser_url + '/#ticket/zoom/1', url: browser_url + '/#ticket/zoom/1',
) )
sleep 2 sleep 2
exists_not( modal_disappear()
css: 'body > .modal',
)
end end
def teardown def teardown

View file

@ -35,11 +35,7 @@ class AgentUserManageTest < TestCase
sleep 0.5 sleep 0.5
click(css: '.content.active .newTicket .recipientList-entry.js-objectNew') click(css: '.content.active .newTicket .recipientList-entry.js-objectNew')
watch_for( modal_ready()
css: '.content.active .modal',
timeout: 1,
)
set( set(
css: '.content.active .modal input[name="firstname"]', css: '.content.active .modal input[name="firstname"]',
value: firstname, value: firstname,
@ -54,6 +50,8 @@ class AgentUserManageTest < TestCase
) )
click(css: '.content.active .modal button.js-submit') click(css: '.content.active .modal button.js-submit')
modal_disappear()
sleep 4 sleep 4
# check is used to check selected # check is used to check selected
@ -170,10 +168,7 @@ class AgentUserManageTest < TestCase
click(css: '.content.active .tabsSidebar .sidebar[data-tab="customer"] .js-actions') 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"]') click(css: '.content.active .tabsSidebar .sidebar[data-tab="customer"] .js-actions li[data-type="customer-change"]')
watch_for( modal_ready()
css: '.content.active .modal',
)
click(css: '.content.active .modal [name="customer_id_completion"]') click(css: '.content.active .modal [name="customer_id_completion"]')
# check if pulldown is open, it's not working stable via selenium # check if pulldown is open, it's not working stable via selenium
@ -230,10 +225,7 @@ class AgentUserManageTest < TestCase
) )
click(css: '.content.active .modal button.js-submit') click(css: '.content.active .modal button.js-submit')
modal_disappear()
watch_for_disappear(
css: '.content.active .modal',
)
watch_for( watch_for(
css: '.content.active .tabsSidebar .sidebar[data-tab="customer"]', css: '.content.active .tabsSidebar .sidebar[data-tab="customer"]',

View file

@ -43,10 +43,7 @@ class AgentUserProfileTest < TestCase
click(css: '.active .js-action .icon-arrow-down', fast: true) click(css: '.active .js-action .icon-arrow-down', fast: true)
click(css: '.active .js-action [data-type="edit"]') click(css: '.active .js-action [data-type="edit"]')
watch_for( modal_ready()
css: '.active .modal',
value: 'note',
)
watch_for( watch_for(
css: '.active .modal', css: '.active .modal',
value: 'some note 123', value: 'some note 123',
@ -61,6 +58,7 @@ class AgentUserProfileTest < TestCase
value: 'some note abc', value: 'some note abc',
) )
click(css: '.active .modal button.js-submit') click(css: '.active .modal button.js-submit')
modal_disappear()
watch_for( watch_for(
css: '.active .profile-window', css: '.active .profile-window',
@ -76,15 +74,14 @@ class AgentUserProfileTest < TestCase
# change lastname back # change lastname back
click(css: '.active .js-action .icon-arrow-down', fast: true) click(css: '.active .js-action .icon-arrow-down', fast: true)
click(css: '.active .js-action [data-type="edit"]') click(css: '.active .js-action [data-type="edit"]')
watch_for(
css: '.active .modal', modal_ready()
value: 'note',
)
set( set(
css: '.modal [name="lastname"]', css: '.modal [name="lastname"]',
value: 'Braun', value: 'Braun',
) )
click(css: '.active .modal button.js-submit') click(css: '.active .modal button.js-submit')
modal_disappear()
verify_task( verify_task(
data: { data: {

View file

@ -462,6 +462,8 @@ class ChatTest < TestCase
browser: agent, browser: agent,
css: '.active .js-settings', css: '.active .js-settings',
) )
modal_ready(browser: agent)
set( set(
browser: agent, browser: agent,
css: '.modal [name="chat::phrase::1"]', css: '.modal [name="chat::phrase::1"]',

View file

@ -23,7 +23,9 @@ class FirstStepsTest < TestCase
# invite agent (with more then one group) # invite agent (with more then one group)
click(css: '.active.content .js-inviteAgent') click(css: '.active.content .js-inviteAgent')
sleep 4
modal_ready()
set( set(
css: '.modal [name="firstname"]', css: '.modal [name="firstname"]',
value: 'Bob', value: 'Bob',
@ -49,10 +51,11 @@ class FirstStepsTest < TestCase
css: 'body div.modal', css: 'body div.modal',
value: 'Sending', value: 'Sending',
) )
modal_disappear()
# invite customer # invite customer
click(css: '.active.content .js-inviteCustomer') click(css: '.active.content .js-inviteCustomer')
sleep 4 modal_ready()
set( set(
css: '.modal [name="firstname"]', css: '.modal [name="firstname"]',
value: 'Client', value: 'Client',
@ -81,12 +84,14 @@ class FirstStepsTest < TestCase
css: 'body div.modal', css: 'body div.modal',
value: 'Sending', value: 'Sending',
) )
modal_disappear()
# test ticket # test ticket
click( click(
css: '.active.content .js-testTicket', css: '.active.content .js-testTicket',
fast: true, fast: true,
) )
modal_ready()
watch_for( watch_for(
css: 'body div.modal', css: 'body div.modal',
value: 'A Test Ticket has been created', value: 'A Test Ticket has been created',
@ -99,6 +104,8 @@ class FirstStepsTest < TestCase
css: 'body div.modal', css: 'body div.modal',
value: 'Test Ticket', value: 'Test Ticket',
) )
modal_disappear()
execute( execute(
js: '$(".active.content .sidebar").show()', js: '$(".active.content .sidebar").show()',
) )

View file

@ -37,27 +37,15 @@ class KeyboardShortcutsTest < TestCase
shortcut(key: 'h') shortcut(key: 'h')
end end
end end
watch_for(
css: '.modal',
value: 'Keyboard Shortcuts',
timeout: 6,
)
modal_ready()
# hide shortkeys # hide shortkeys
shortcut(key: 'h') shortcut(key: 'h')
watch_for_disappear( modal_disappear()
css: '.modal',
value: 'Keyboard Shortcuts',
timeout: 2,
)
# show shortkeys # show shortkeys
shortcut(key: 'h') shortcut(key: 'h')
watch_for( modal_ready()
css: '.modal',
value: 'Keyboard Shortcuts',
timeout: 2,
)
# show notifications # show notifications
shortcut(key: 'a') shortcut(key: 'a')

View file

@ -39,15 +39,12 @@ class MaintenanceModeTest < TestCase
) )
# check warning # check warning
watch_for( modal_ready(browser: browser1)
browser: browser1,
css: '.content.active .modal .modal-header',
value: 'confirm',
)
click( click(
browser: browser1, browser: browser1,
css: '.content.active .modal .js-submit', css: '.content.active .modal .js-submit',
) )
modal_disappear(browser: browser1)
watch_for( watch_for(
browser: browser2, browser: browser2,
@ -127,15 +124,12 @@ class MaintenanceModeTest < TestCase
) )
# check warning # check warning
watch_for( modal_ready(browser: browser1)
browser: browser1,
css: '.content.active .modal .modal-header',
value: 'confirm',
)
click( click(
browser: browser1, browser: browser1,
css: '.content.active .modal .js-submit', css: '.content.active .modal .js-submit',
) )
modal_disappear(browser: browser1)
watch_for( watch_for(
browser: browser2, browser: browser2,

View file

@ -50,6 +50,7 @@ class MaintenanceSessionMessageTest < TestCase
css: '.content.active .js-Message button.js-submit', css: '.content.active .js-Message button.js-submit',
) )
modal_ready(browser: browser2)
watch_for( watch_for(
browser: browser2, browser: browser2,
css: '.modal', css: '.modal',
@ -71,6 +72,7 @@ class MaintenanceSessionMessageTest < TestCase
browser: browser2, browser: browser2,
css: 'div.modal-header .js-close', css: 'div.modal-header .js-close',
) )
modal_disappear(browser: browser2)
# check #2 # check #2
click( click(
@ -98,6 +100,7 @@ class MaintenanceSessionMessageTest < TestCase
css: '.content.active .js-Message button.js-submit', css: '.content.active .js-Message button.js-submit',
) )
modal_ready(browser: browser2)
watch_for( watch_for(
browser: browser2, browser: browser2,
css: '.modal', css: '.modal',
@ -119,6 +122,7 @@ class MaintenanceSessionMessageTest < TestCase
browser: browser2, browser: browser2,
css: 'div.modal-header .js-close', css: 'div.modal-header .js-close',
) )
modal_disappear(browser: browser2)
# check #3 # check #3
click( click(
@ -149,6 +153,7 @@ class MaintenanceSessionMessageTest < TestCase
css: '.content.active .js-Message button.js-submit', css: '.content.active .js-Message button.js-submit',
) )
modal_ready(browser: browser2)
watch_for( watch_for(
browser: browser2, browser: browser2,
css: '.modal', css: '.modal',

View file

@ -28,13 +28,14 @@ class ManageTest < TestCase
) )
click(css: '.table-overview tr:last-child td') click(css: '.table-overview tr:last-child td')
sleep 2
modal_ready()
set( set(
css: '.modal input[name="lastname"]', 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')
modal_disappear()
watch_for( watch_for(
css: 'body', css: 'body',
@ -55,8 +56,8 @@ class ManageTest < TestCase
sleep 1 sleep 1
click(css: '.content:not(.hide) .action:last-child .js-edit') click(css: '.content:not(.hide) .action:last-child .js-edit')
sleep 1
modal_ready()
set( set(
css: '.modal input[name=name]', css: '.modal input[name=name]',
value: "some sla update #{random}", value: "some sla update #{random}",
@ -66,6 +67,7 @@ class ManageTest < TestCase
value: '2:01', value: '2:01',
) )
click(css: '.modal button.js-submit') click(css: '.modal button.js-submit')
modal_disappear()
watch_for( watch_for(
css: 'body', css: 'body',

View file

@ -16,11 +16,8 @@ class PreferencesTokenAccessTest < TestCase
click(css: 'a[href="#profile/token_access"]') click(css: 'a[href="#profile/token_access"]')
click(css: '.content.active .js-create') click(css: '.content.active .js-create')
watch_for(
css: '.modal .modal-title',
value: 'Add a Personal Access Token'
)
modal_ready()
set( set(
css: '.content.active .modal .js-input', css: '.content.active .modal .js-input',
value: 'Some App#1', value: 'Some App#1',
@ -37,6 +34,8 @@ class PreferencesTokenAccessTest < TestCase
value: 'Your New Personal Access Token' value: 'Your New Personal Access Token'
) )
click(css: '.modal .js-submit') click(css: '.modal .js-submit')
modal_disappear()
watch_for( watch_for(
css: '.content.active .js-tokenList', css: '.content.active .js-tokenList',
value: 'Some App#1' value: 'Some App#1'
@ -47,10 +46,8 @@ class PreferencesTokenAccessTest < TestCase
) )
click(css: '.content.active .js-create') click(css: '.content.active .js-create')
watch_for(
css: '.modal .modal-title', modal_ready()
value: 'Add a Personal Access Token'
)
set( set(
css: '.content.active .modal .js-input', css: '.content.active .modal .js-input',
value: 'Some App#2', value: 'Some App#2',
@ -63,12 +60,16 @@ class PreferencesTokenAccessTest < TestCase
value: 'Your New Personal Access Token' value: 'Your New Personal Access Token'
) )
click(css: '.modal .js-submit') click(css: '.modal .js-submit')
modal_disappear()
watch_for( watch_for(
css: '.content.active .js-tokenList', css: '.content.active .js-tokenList',
value: 'Some App#2' value: 'Some App#2'
) )
click(css: '.content.active .js-tokenList a') click(css: '.content.active .js-tokenList a')
modal_ready()
watch_for( watch_for(
css: '.content.active .modal .modal-header', css: '.content.active .modal .modal-header',
value: 'confirm', value: 'confirm',
@ -76,6 +77,7 @@ class PreferencesTokenAccessTest < TestCase
click( click(
css: '.content.active .modal .js-submit', css: '.content.active .modal .js-submit',
) )
modal_disappear()
watch_for_disappear( watch_for_disappear(
css: '.content.active .js-tokenList', css: '.content.active .js-tokenList',
value: 'Some App#2' value: 'Some App#2'

View file

@ -31,9 +31,11 @@ class SignupPasswordChangeAndResetTest < TestCase
value: 'some-pass', value: 'some-pass',
) )
click(css: 'button.js-submit') click(css: 'button.js-submit')
sleep 5
exists_not(css: '.signup') watch_for_disappear(
css: '.signup',
timeout: 10,
)
match( match(
css: '.user-menu .user a', css: '.user-menu .user a',
@ -61,11 +63,9 @@ class SignupPasswordChangeAndResetTest < TestCase
execute( execute(
js: 'App.Event.trigger("user_signup_verify", App.Session.get())', js: 'App.Event.trigger("user_signup_verify", App.Session.get())',
) )
watch_for( modal_ready()
css: '.modal',
value: 'Account not verified',
)
click(css: '.modal .js-submit') click(css: '.modal .js-submit')
execute( execute(
js: 'App.Auth.logout()', js: 'App.Auth.logout()',
) )
@ -81,9 +81,7 @@ class SignupPasswordChangeAndResetTest < TestCase
css: '#content', css: '#content',
value: 'Your email address has been verified', value: 'Your email address has been verified',
) )
exists_not( modal_disappear()
css: '.modal',
)
sleep 2 sleep 2
# change password # change password

View file

@ -283,13 +283,14 @@ class TranslationTest < TestCase
) )
click(css: '.content.active .js-syncChanges') click(css: '.content.active .js-syncChanges')
modal_ready()
watch_for( watch_for(
css: '.content.active .modal', css: '.content.active .modal',
value: 'Letzte Übersetzung laden', value: 'Letzte Übersetzung laden',
) )
watch_for_disappear( modal_disappear(
css: '.content.active .modal', timeout: 6.minutes,
timeout: 6 * 60,
) )
click(css: 'a[href="#current_user"]') click(css: 'a[href="#current_user"]')

View file

@ -38,10 +38,7 @@ class AgentProfilePermissionsTest < TestCase
click(css: '.content.active .js-action .icon-arrow-down', fast: true) click(css: '.content.active .js-action .icon-arrow-down', fast: true)
click(css: '.content.active .js-action [data-type="edit"]') click(css: '.content.active .js-action [data-type="edit"]')
watch_for( modal_ready()
css: '.content.active .modal',
value: 'note',
)
watch_for( watch_for(
css: '.content.active .modal', css: '.content.active .modal',
value: 'some note 123', value: 'some note 123',
@ -56,6 +53,7 @@ class AgentProfilePermissionsTest < TestCase
value: 'some note abc', value: 'some note abc',
) )
click(css: '.content.active .modal button.js-submit') click(css: '.content.active .modal button.js-submit')
modal_disappear()
watch_for( watch_for(
css: '.content.active .profile-window', css: '.content.active .profile-window',
@ -71,15 +69,14 @@ class AgentProfilePermissionsTest < TestCase
# change lastname back # change lastname back
click(css: '.content.active .js-action .icon-arrow-down', fast: true) click(css: '.content.active .js-action .icon-arrow-down', fast: true)
click(css: '.content.active .js-action [data-type="edit"]') click(css: '.content.active .js-action [data-type="edit"]')
watch_for(
css: '.content.active .modal', modal_ready()
value: 'note',
)
set( set(
css: '.modal [name="lastname"]', css: '.modal [name="lastname"]',
value: 'Braun', value: 'Braun',
) )
click(css: '.content.active .modal button.js-submit') click(css: '.content.active .modal button.js-submit')
modal_disappear()
verify_task( verify_task(
data: { data: {
@ -190,17 +187,17 @@ class AgentProfilePermissionsTest < TestCase
click(css: '.content.active .sidebar[data-tab="customer"] .js-actions .dropdown-toggle') click(css: '.content.active .sidebar[data-tab="customer"] .js-actions .dropdown-toggle')
click(css: '.content.active .sidebar[data-tab="customer"] .js-actions [data-type="customer-edit"]') click(css: '.content.active .sidebar[data-tab="customer"] .js-actions [data-type="customer-edit"]')
modal_ready()
set( set(
css: '.modal [name="lastname"]', css: '.modal [name="lastname"]',
value: 'B2', value: 'B2',
) )
set( set(
css: '.modal [data-name="note"]', css: '.modal [data-name="note"]',
value: 'some note abc', value: 'some note abc',
) )
click(css: '.content.active .modal button.js-submit') click(css: '.content.active .modal button.js-submit')
modal_disappear()
watch_for( watch_for(
css: '.content.active .sidebar[data-tab="customer"] .sidebar-block [data-name="note"]', css: '.content.active .sidebar[data-tab="customer"] .sidebar-block [data-name="note"]',
@ -212,16 +209,11 @@ class AgentProfilePermissionsTest < TestCase
value: 'Nicole B2', value: 'Nicole B2',
) )
sleep 2
# change lastname back # change lastname back
click(css: '.content.active .sidebar[data-tab="customer"] .js-actions') click(css: '.content.active .sidebar[data-tab="customer"] .js-actions')
click(css: 'li[data-type="customer-edit"]') click(css: 'li[data-type="customer-edit"]')
watch_for( modal_ready()
css: '.content.active .modal',
value: 'note',
)
set( set(
css: '.modal [name="lastname"]', css: '.modal [name="lastname"]',
value: 'Braun', value: 'Braun',
@ -231,6 +223,7 @@ class AgentProfilePermissionsTest < TestCase
value: 'some note abc', value: 'some note abc',
) )
click(css: '.content.active .modal button.js-submit') click(css: '.content.active .modal button.js-submit')
modal_disappear()
watch_for( watch_for(
css: '.content.active .sidebar[data-tab="customer"] .sidebar-block [data-name="note"]', css: '.content.active .sidebar[data-tab="customer"] .sidebar-block [data-name="note"]',
@ -283,11 +276,7 @@ class AgentProfilePermissionsTest < TestCase
click(css: '.content.active .js-action .dropdown-toggle') click(css: '.content.active .js-action .dropdown-toggle')
click(css: '.content.active .js-action [data-type="edit"]') click(css: '.content.active .js-action [data-type="edit"]')
watch_for( modal_ready()
css: '.content.active .modal',
value: 'note',
)
set( set(
css: '.modal [name="lastname"]', css: '.modal [name="lastname"]',
value: 'B2', value: 'B2',
@ -297,6 +286,7 @@ class AgentProfilePermissionsTest < TestCase
value: 'some note abc', value: 'some note abc',
) )
click(css: '.content.active .modal button.js-submit') click(css: '.content.active .modal button.js-submit')
modal_disappear()
watch_for( watch_for(
css: '.content.active .profile-window', css: '.content.active .profile-window',
@ -313,10 +303,7 @@ class AgentProfilePermissionsTest < TestCase
click(css: '.content.active .js-action .dropdown-toggle') click(css: '.content.active .js-action .dropdown-toggle')
click(css: '.content.active .js-action [data-type="edit"]') click(css: '.content.active .js-action [data-type="edit"]')
watch_for( modal_ready()
css: '.content.active .modal',
value: 'note',
)
set( set(
css: '.modal [name="lastname"]', css: '.modal [name="lastname"]',
value: 'Braun', value: 'Braun',
@ -326,6 +313,7 @@ class AgentProfilePermissionsTest < TestCase
value: 'note', value: 'note',
) )
click(css: '.content.active .modal button.js-submit') click(css: '.content.active .modal button.js-submit')
modal_disappear()
verify_task( verify_task(
data: { data: {
@ -361,17 +349,25 @@ class AgentProfilePermissionsTest < TestCase
exists(css: '.content.active .sidebar[data-tab="customer"] .js-actions .dropdown-toggle') exists(css: '.content.active .sidebar[data-tab="customer"] .js-actions .dropdown-toggle')
exists_not(css: '.content.active .sidebar[data-tab="customer"] .js-actions [data-type="customer-edit"]') exists_not(css: '.content.active .sidebar[data-tab="customer"] .js-actions [data-type="customer-edit"]')
# scroll to the Avatar at the top of the zoom view and click it begin
# scrolling is needed because the browser might have scrolled down retries ||= 0
# caused by a undeliverable email (of the created ticket)
zoom_top_avatar_selector = '.content.active .tabsSidebar-holder .js-avatar'
scroll_to(
position: 'botton',
css: zoom_top_avatar_selector,
)
click(css: zoom_top_avatar_selector)
click(css: '.content.active .js-action .icon-arrow-down', fast: true) # scroll to the Avatar at the top of the zoom view and click it
exists_not(css: '.content.active .js-action [data-type="edit"]') # scrolling is needed because the browser might have scrolled down
# caused by a undeliverable email (of the created ticket)
zoom_top_avatar_selector = '.content.active .tabsSidebar-holder .js-avatar'
scroll_to(
position: 'botton',
css: zoom_top_avatar_selector,
)
click(css: zoom_top_avatar_selector)
click(css: '.content.active .js-action .icon-arrow-down', fast: true)
exists_not(css: '.content.active .js-action [data-type="edit"]')
rescue Selenium::WebDriver::Error::UnknownError
sleep retries
retries += 1
retry if retries < 3
end
end end
end end

View file

@ -552,7 +552,12 @@ class TestCase < Test::Unit::TestCase
log('modal_ready', params) log('modal_ready', params)
instance = params[:browser] || @browser instance = params[:browser] || @browser
sleep 3
watch_for(
browser: instance,
css: '.modal.in',
timeout: params[:timeout] || 4,
)
end end
=begin =begin
@ -2497,6 +2502,53 @@ wait untill text in selector disabppears
true true
end end
=begin
overview_open(
browser: browser2,
name: overview_name,
)
overview_open(
browser: browser2,
link: "#ticket/view/some_special_name",
)
=end
def overview_open(params)
switch_window_focus(params)
log('overview_open', params)
instance = params[:browser] || @browser
# click on overview task in sidebar
instance.find_elements(css: '.js-overviewsMenuItem')[0].click
# show larger overview selection list
sleep 0.5
execute(
browser: instance,
js: '$(".content.active .sidebar").css("display", "block")',
)
link = if params[:link]
params[:link]
elsif params[:name]
"\#ticket/view/#{params[:name]}"
end
# switch to overview
instance.find_elements(css: ".content.active .sidebar a[href=\"#{link}\"]")[0].click
# hide larger overview selection list again
sleep 0.5
execute(
browser: instance,
js: '$(".content.active .sidebar").css("display", "none")',
)
end
=begin =begin
ticket_open_by_overview( ticket_open_by_overview(
@ -2520,18 +2572,8 @@ wait untill text in selector disabppears
instance = params[:browser] || @browser instance = params[:browser] || @browser
instance.find_elements(css: '.js-overviewsMenuItem')[0].click overview_open(params)
sleep 0.5
execute(
browser: instance,
js: '$(".content.active .sidebar").css("display", "block")',
)
instance.find_elements(css: ".content.active .sidebar a[href=\"#{params[:link]}\"]")[0].click
sleep 0.5
execute(
browser: instance,
js: '$(".content.active .sidebar").css("display", "none")',
)
if params[:title] if params[:title]
element = instance.find_element(css: '.content.active').find_element(partial_link_text: params[:title]) element = instance.find_element(css: '.content.active').find_element(partial_link_text: params[:title])
if !element if !element