Fixed issue #2104 - image modal not closed when opening new ticket
This commit is contained in:
commit
bc489aecef
4 changed files with 133 additions and 0 deletions
|
@ -291,6 +291,7 @@ class App.TicketZoom extends App.Controller
|
|||
|
||||
hide: =>
|
||||
@activeState = false
|
||||
$('body > .modal').modal('hide')
|
||||
@positionPageHeaderStop()
|
||||
@autosaveStop()
|
||||
@shortcutNavigationstop()
|
||||
|
|
|
@ -52,6 +52,7 @@ if [ "$LEVEL" == '1' ]; then
|
|||
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_and_reload_test.rb
|
||||
rm test/browser/agent_ticket_zoom_hide_test.rb
|
||||
rm test/browser/agent_user_manage_test.rb
|
||||
rm test/browser/agent_user_profile_test.rb
|
||||
# test/browser/auth_test.rb
|
||||
|
@ -129,6 +130,7 @@ elif [ "$LEVEL" == '2' ]; then
|
|||
# rm test/browser/agent_ticket_update5_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_zoom_hide_test.rb
|
||||
rm test/browser/agent_user_manage_test.rb
|
||||
rm test/browser/agent_user_profile_test.rb
|
||||
rm test/browser/auth_test.rb
|
||||
|
@ -206,6 +208,7 @@ elif [ "$LEVEL" == '3' ]; then
|
|||
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_and_reload_test.rb
|
||||
rm test/browser/agent_ticket_zoom_hide_test.rb
|
||||
rm test/browser/agent_user_manage_test.rb
|
||||
rm test/browser/agent_user_profile_test.rb
|
||||
rm test/browser/auth_test.rb
|
||||
|
@ -283,6 +286,7 @@ elif [ "$LEVEL" == '4' ]; then
|
|||
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_and_reload_test.rb
|
||||
rm test/browser/agent_ticket_zoom_hide_test.rb
|
||||
rm test/browser/agent_user_manage_test.rb
|
||||
rm test/browser/agent_user_profile_test.rb
|
||||
rm test/browser/auth_test.rb
|
||||
|
@ -359,6 +363,7 @@ elif [ "$LEVEL" == '5' ]; then
|
|||
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_and_reload_test.rb
|
||||
rm test/browser/agent_ticket_zoom_hide_test.rb
|
||||
# test/browser/agent_user_manage_test.rb
|
||||
# test/browser/agent_user_profile_test.rb
|
||||
rm test/browser/auth_test.rb
|
||||
|
@ -438,6 +443,7 @@ elif [ "$LEVEL" == '6' ]; then
|
|||
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_and_reload_test.rb
|
||||
rm test/browser/agent_ticket_zoom_hide_test.rb
|
||||
rm test/browser/agent_user_manage_test.rb
|
||||
rm test/browser/agent_user_profile_test.rb
|
||||
rm test/browser/auth_test.rb
|
||||
|
|
73
test/browser/agent_ticket_zoom_hide_test.rb
Normal file
73
test/browser/agent_ticket_zoom_hide_test.rb
Normal file
|
@ -0,0 +1,73 @@
|
|||
require 'browser_test_helper'
|
||||
|
||||
class AgentTicketZoomHideTest < TestCase
|
||||
|
||||
def setup
|
||||
# Enable attachment image preview
|
||||
set_setting('ui_ticket_zoom_attachments_preview', true)
|
||||
end
|
||||
|
||||
def test_ticket_zoom_hide_closes_all_modals
|
||||
# since selenium webdriver with firefox is not able to upload files, skip here
|
||||
# https://github.com/w3c/webdriver/issues/1230
|
||||
return if browser == 'firefox'
|
||||
|
||||
@browser = browser_instance
|
||||
|
||||
login(
|
||||
username: 'agent1@example.com',
|
||||
password: 'test',
|
||||
url: browser_url,
|
||||
)
|
||||
|
||||
# create two tickets
|
||||
ticket1 = ticket_create(
|
||||
data: {
|
||||
customer: 'Nico',
|
||||
group: 'Users',
|
||||
title: 'Ticket 1',
|
||||
body: 'some body 123äöü - changes',
|
||||
}
|
||||
)
|
||||
|
||||
ticket2 = ticket_create(
|
||||
data: {
|
||||
customer: 'Nico',
|
||||
group: 'Users',
|
||||
title: 'Ticket 2',
|
||||
body: 'some body 123äöü - changes',
|
||||
}
|
||||
)
|
||||
|
||||
# Upload attachment and submit update
|
||||
ticket_update(
|
||||
data: {
|
||||
body: 'added image attachment',
|
||||
files: [Rails.root.join('test', 'data', 'upload', 'upload2.jpg')],
|
||||
},
|
||||
)
|
||||
|
||||
# Open the attachment preview modal
|
||||
click(
|
||||
css: '.attachment-icon img',
|
||||
)
|
||||
|
||||
watch_for(
|
||||
css: 'body > .modal',
|
||||
)
|
||||
|
||||
# Now go to a previous ticket and confirm that the modal disappears
|
||||
location(
|
||||
url: browser_url + '/#ticket/zoom/1',
|
||||
)
|
||||
sleep 2
|
||||
exists_not(
|
||||
css: 'body > .modal',
|
||||
)
|
||||
end
|
||||
|
||||
def teardown
|
||||
# Disable attachment image preview
|
||||
set_setting('ui_ticket_zoom_attachments_preview', false)
|
||||
end
|
||||
end
|
|
@ -2,6 +2,9 @@ ENV['RAILS_ENV'] = 'test'
|
|||
# rubocop:disable HandleExceptions, NonLocalExitFromIterator, Style/GuardClause, Lint/MissingCopEnableDirective
|
||||
require File.expand_path('../config/environment', __dir__)
|
||||
require 'selenium-webdriver'
|
||||
require 'json'
|
||||
require 'net/http'
|
||||
require 'uri'
|
||||
|
||||
class TestCase < Test::Unit::TestCase
|
||||
|
||||
|
@ -2327,6 +2330,13 @@ wait untill text in selector disabppears
|
|||
)
|
||||
end
|
||||
|
||||
if data[:files]
|
||||
file_upload(
|
||||
css: '.content.active .attachmentPlaceholder-inputHolder input',
|
||||
files: data[:files],
|
||||
)
|
||||
end
|
||||
|
||||
params[:custom_data_select]&.each do |local_key, local_value|
|
||||
select(
|
||||
browser: instance,
|
||||
|
@ -4131,4 +4141,47 @@ wait untill text in selector disabppears
|
|||
def checkbox_is_selected(scope, value)
|
||||
scope.find_element(css: "input[value=#{value}]").property('checked')
|
||||
end
|
||||
|
||||
=begin
|
||||
|
||||
Retrieve a hash of all the avaiable Zammad settings and their current values.
|
||||
|
||||
settings = fetch_settings()
|
||||
|
||||
=end
|
||||
|
||||
def fetch_settings
|
||||
url = URI.parse(browser_url)
|
||||
req = Net::HTTP::Get.new(browser_url + '/api/v1/settings/')
|
||||
req.basic_auth('master@example.com', 'test')
|
||||
|
||||
res = Net::HTTP.start(url.host, url.port) do |http|
|
||||
http.request(req)
|
||||
end
|
||||
raise "HTTP error #{res.code} while fetching #{browser_url}/api/v1/settings/" if res.code != '200'
|
||||
JSON.parse(res.body)
|
||||
end
|
||||
|
||||
=begin
|
||||
|
||||
Enable or disable Zammad experiemental features remotely.
|
||||
|
||||
set_setting('ui_ticket_zoom_attachments_preview', true)
|
||||
|
||||
=end
|
||||
|
||||
def set_setting(name, value)
|
||||
name_to_id = fetch_settings.map { |s| [s['name'], s['id']] }.to_h
|
||||
id = name_to_id[name]
|
||||
|
||||
url = URI.parse(browser_url)
|
||||
req = Net::HTTP::Put.new("#{browser_url}/api/v1/settings/#{id}")
|
||||
req['Content-Type'] = 'application/json'
|
||||
req.basic_auth('master@example.com', 'test')
|
||||
req.body = { 'state_current' => { 'value' => value } }.to_json
|
||||
res = Net::HTTP.start(url.host, url.port) do |http|
|
||||
http.request(req)
|
||||
end
|
||||
raise "HTTP error #{res.code} while POSTing to #{browser_url}/api/v1/settings/" if res.code != '200'
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue