Fixed issue #1957 - "Create new Customer" form delayed display.

This commit is contained in:
Martin Edenhofer 2018-05-25 07:59:20 +02:00
parent c46cf246b9
commit de36ffcd8a
5 changed files with 169 additions and 33 deletions

View file

@ -51,7 +51,7 @@ test:rspec:mysql:
- rake db:create - rake db:create
- rake db:migrate - rake db:migrate
- rake db:seed - rake db:seed
- rspec - bundle exec rspec
- rake db:drop - rake db:drop
test:rspec:postgresql: test:rspec:postgresql:
@ -64,7 +64,7 @@ test:rspec:postgresql:
- rake db:create - rake db:create
- rake db:migrate - rake db:migrate
- rake db:seed - rake db:seed
- rspec - bundle exec rspec
- rake db:drop - rake db:drop
test:unit:mysql: test:unit:mysql:
@ -410,7 +410,7 @@ test:browser:integration:api_client_ruby:
- cd zammad-api-client-ruby - cd zammad-api-client-ruby
- bundle install --jobs 8 - bundle install --jobs 8
- export TEST_URL=http://$IP:$BROWSER_PORT/ - export TEST_URL=http://$IP:$BROWSER_PORT/
- rspec || (cd .. && script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1) - bundle exec rspec || (cd .. && script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 1 1)
- cd .. && script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1 - cd .. && script/build/test_shutdown.sh $RAILS_ENV $BROWSER_PORT $WS_PORT 0 1
test:browser:integration:api_client_php: test:browser:integration:api_client_php:

View file

@ -676,6 +676,7 @@ class App.ControllerModal extends App.Controller
closeOnAnyClick: false closeOnAnyClick: false
initalFormParams: {} initalFormParams: {}
initalFormParamsIgnore: false initalFormParamsIgnore: false
showTrySupport: false
showTryMax: 10 showTryMax: 10
showTrydelay: 1000 showTrydelay: 1000
@ -722,7 +723,7 @@ class App.ControllerModal extends App.Controller
content = @contentInline content = @contentInline
else else
content = @content() content = @content()
modal = $(App.view('modal') modal = $(App.view('modal')(
head: @head head: @head
headPrefix: @headPrefix headPrefix: @headPrefix
message: @message message: @message
@ -734,7 +735,7 @@ class App.ControllerModal extends App.Controller
buttonClass: @buttonClass buttonClass: @buttonClass
centerButtons: @centerButtons centerButtons: @centerButtons
leftButtons: @leftButtons leftButtons: @leftButtons
) ))
modal.find('.modal-body').html(content) modal.find('.modal-body').html(content)
if !@initRenderingDone if !@initRenderingDone
@initRenderingDone = true @initRenderingDone = true
@ -750,7 +751,7 @@ class App.ControllerModal extends App.Controller
@el @el
render: => render: =>
if @modalAlreadyExists() && @showTryCount <= @showTryMax if @showTrySupport is true && @modalAlreadyExists() && @showTryCount <= @showTryMax
@showDelayed() @showDelayed()
return return
@ -827,7 +828,7 @@ class App.ControllerModal extends App.Controller
localOnClosed: (e) => localOnClosed: (e) =>
@onClosed(e) @onClosed(e)
$('.modal').remove() @el.modal('remove')
onClosed: (e) -> onClosed: (e) ->
# do nothing # do nothing
@ -851,6 +852,8 @@ class App.ControllerModal extends App.Controller
@onSubmit(e) @onSubmit(e)
class App.SessionMessage extends App.ControllerModal class App.SessionMessage extends App.ControllerModal
showTrySupport: true
onCancel: (e) => onCancel: (e) =>
if @forceReload if @forceReload
@windowReload(e) @windowReload(e)

View file

@ -3,6 +3,7 @@ class App.ControllerGenericNew extends App.ControllerModal
buttonCancel: true buttonCancel: true
buttonSubmit: true buttonSubmit: true
headPrefix: 'New' headPrefix: 'New'
showTrySupport: true
content: => content: =>
@head = @pageData.head || @pageData.object @head = @pageData.head || @pageData.object
@ -236,6 +237,7 @@ class App.ControllerGenericDescription extends App.ControllerModal
class App.ControllerModalLoading extends App.Controller class App.ControllerModalLoading extends App.Controller
className: 'modal fade' className: 'modal fade'
showTrySupport: true
constructor: -> constructor: ->
super super
@ -322,6 +324,7 @@ class App.ControllerErrorModal extends App.ControllerModal
head: 'Error' head: 'Error'
#small: true #small: true
#shown: true #shown: true
showTrySupport: true
content: -> content: ->
@message @message

View file

@ -182,6 +182,13 @@
}) })
} }
// me - 2018-05-24
// cleanup element on hide - cleanup dom with old modal dialogs
Modal.prototype.remove = function () {
console.log('remove', this.$element)
this.$element.remove()
}
Modal.prototype.removeBackdrop = function () { Modal.prototype.removeBackdrop = function () {
this.$backdrop && this.$backdrop.remove() this.$backdrop && this.$backdrop.remove()
this.$backdrop = null this.$backdrop = null

View file

@ -2,7 +2,7 @@
require 'browser_test_helper' require 'browser_test_helper'
class AgentUserManageTest < TestCase class AgentUserManageTest < TestCase
def test_agent_user def test_agent_customer_ticket_create
customer_user_email = 'customer-test-' + rand(999_999).to_s + '@example.com' customer_user_email = 'customer-test-' + rand(999_999).to_s + '@example.com'
firstname = 'Customer Firstname' firstname = 'Customer Firstname'
lastname = 'Customer Lastname' lastname = 'Customer Lastname'
@ -16,12 +16,16 @@ class AgentUserManageTest < TestCase
) )
tasks_close_all() tasks_close_all()
sleep 1
# create customer # create customer
click(css: 'a[href="#new"]', only_if_exists: true) click(css: 'a[href="#new"]', only_if_exists: true)
click(css: 'a[href="#ticket/create"]') click(css: 'a[href="#ticket/create"]')
click(css: '.active .newTicket [name="customer_id_completion"]')
watch_for(
css: '.content.active .newTicket',
timeout: 1,
)
click(css: '.content.active .newTicket [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
@browser.execute_script("$('.active .newTicket .js-recipientDropdown').addClass('open')") @browser.execute_script("$('.active .newTicket .js-recipientDropdown').addClass('open')")
@ -29,45 +33,49 @@ class AgentUserManageTest < TestCase
sleep 1 sleep 1
sendkey(value: :arrow_down) sendkey(value: :arrow_down)
sleep 0.5 sleep 0.5
click(css: '.active .newTicket .recipientList-entry.js-objectNew') click(css: '.content.active .newTicket .recipientList-entry.js-objectNew')
sleep 1
watch_for(
css: '.content.active .modal',
timeout: 1,
)
set( set(
css: '.modal input[name="firstname"]', css: '.content.active .modal input[name="firstname"]',
value: firstname, value: firstname,
) )
set( set(
css: '.modal input[name="lastname"]', css: '.content.active .modal input[name="lastname"]',
value: lastname, value: lastname,
) )
set( set(
css: '.modal input[name="email"]', css: '.content.active .modal input[name="email"]',
value: customer_user_email, value: customer_user_email,
) )
click(css: '.modal button.js-submit') click(css: '.content.active .modal button.js-submit')
sleep 4 sleep 4
# check is used to check selected # check is used to check selected
match( match(
css: '.active input[name="customer_id"]', css: '.content.active .newTicket input[name="customer_id"]',
value: '^\d+$', value: '^\d+$',
no_quote: true, no_quote: true,
) )
match( match(
css: '.active input[name="customer_id_completion"]', css: '.content.active .newTicket input[name="customer_id_completion"]',
value: firstname, value: firstname,
) )
match( match(
css: '.active input[name="customer_id_completion"]', css: '.content.active .newTicket input[name="customer_id_completion"]',
value: lastname, value: lastname,
) )
match( match(
css: '.active input[name="customer_id_completion"]', css: '.content.active .newTicket input[name="customer_id_completion"]',
value: customer_user_email, value: customer_user_email,
) )
match( match(
css: '.active input[name="customer_id_completion"]', css: '.content.active .newTicket input[name="customer_id_completion"]',
value: fullname, value: fullname,
) )
sleep 4 sleep 4
@ -77,47 +85,162 @@ class AgentUserManageTest < TestCase
click(css: 'a[href="#new"]', only_if_exists: true) click(css: 'a[href="#new"]', only_if_exists: true)
click(css: 'a[href="#ticket/create"]') click(css: 'a[href="#ticket/create"]')
sleep 2
watch_for(
css: '.content.active .newTicket',
timeout: 1,
)
match( match(
css: '.active input[name="customer_id"]', css: '.content.active .newTicket input[name="customer_id"]',
value: '', value: '',
) )
match( match(
css: '.active input[name="customer_id_completion"]', css: '.content.active .newTicket input[name="customer_id_completion"]',
value: '', value: '',
) )
set( set(
css: '.active .newTicket input[name="customer_id_completion"]', css: '.content.active .newTicket input[name="customer_id_completion"]',
value: customer_user_email, value: customer_user_email,
) )
sleep 3 sleep 3
click(css: '.active .newTicket .recipientList-entry.js-object.is-active') click(css: '.content.active .newTicket .recipientList-entry.js-object.is-active')
sleep 1 sleep 1
# check is used to check selected # check is used to check selected
match( match(
css: '.active input[name="customer_id"]', css: '.content.active .newTicket input[name="customer_id"]',
value: '^\d+$', value: '^\d+$',
no_quote: true, no_quote: true,
) )
match( match(
css: '.active input[name="customer_id_completion"]', css: '.content.active .newTicket input[name="customer_id_completion"]',
value: firstname, value: firstname,
) )
match( match(
css: '.active input[name="customer_id_completion"]', css: '.content.active .newTicket input[name="customer_id_completion"]',
value: lastname, value: lastname,
) )
match( match(
css: '.active input[name="customer_id_completion"]', css: '.content.active .newTicket input[name="customer_id_completion"]',
value: customer_user_email, value: customer_user_email,
) )
match( match(
css: '.active input[name="customer_id_completion"]', css: '.content.active .newTicket input[name="customer_id_completion"]',
value: fullname, value: fullname,
) )
end end
def test_agent_customer_ticket_zoom
customer_user_email = 'customer-test-' + rand(999_999).to_s + '@example.com'
firstname = 'Customer Firstname'
lastname = 'Customer Lastname'
fullname = "#{firstname} #{lastname} <#{customer_user_email}>"
@browser = browser_instance
login(
username: 'agent1@example.com',
password: 'test',
url: browser_url,
)
tasks_close_all()
ticket_create(
data: {
customer: 'nico',
group: 'Users',
title: 'some changes',
body: 'some body',
},
)
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: 'Nicole Braun',
)
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"]')
watch_for(
css: '.content.active .modal',
)
click(css: '.content.active .modal [name="customer_id_completion"]')
# check if pulldown is open, it's not working stable via selenium
@browser.execute_script("$('.active .modal .js-recipientDropdown').addClass('open')")
sleep 1
sendkey(value: :arrow_down)
sleep 0.5
click(css: '.content.active .modal .recipientList-entry.js-objectNew')
watch_for(
css: '.content.active .modal input[name="firstname"]',
timeout: 1,
)
set(
css: '.content.active .modal input[name="firstname"]',
value: firstname,
)
set(
css: '.content.active .modal input[name="lastname"]',
value: lastname,
)
set(
css: '.content.active .modal input[name="email"]',
value: customer_user_email,
)
# there are 2 models, take the correct one
#click(css: '.content.active .modal button.js-submit')
@browser.execute_script("$('.content.active .modal input[name=\"firstname\"]').closest('form').find('button.js-submit').click()")
# check is used to check selected
watch_for(
css: '.content.active .modal input[name="customer_id"]',
value: '^\d+$',
no_quote: true,
)
match(
css: '.content.active .modal input[name="customer_id_completion"]',
value: firstname,
)
match(
css: '.content.active .modal input[name="customer_id_completion"]',
value: lastname,
)
match(
css: '.content.active .modal input[name="customer_id_completion"]',
value: customer_user_email,
)
match(
css: '.content.active .modal input[name="customer_id_completion"]',
value: fullname,
)
click(css: '.content.active .modal button.js-submit')
watch_for_disappear(
css: '.content.active .modal',
)
watch_for(
css: '.content.active .tabsSidebar .sidebar[data-tab="customer"]',
value: customer_user_email,
timeout: 4,
)
end
end end