Improved object manager browser tests.

This commit is contained in:
Martin Edenhofer 2016-05-24 09:47:53 +02:00
parent 740e1dcfe8
commit ed48d92a16
3 changed files with 117 additions and 6 deletions

View file

@ -209,6 +209,7 @@ send via account
# ignore notifications in developer mode
if notification == true && Setting.get('developer_mode') == true
logger.notice "Do not send notification #{mail_params.inspect} because of enabled developer_mode"
return
end
adapter = options[:adapter]

View file

@ -2,8 +2,7 @@
require 'browser_test_helper'
class AdminObjectManagerTest < TestCase
def test_basic
name = "some overview #{rand(99_999_999)}"
def test_basic_a
@browser = browser_instance
login(
@ -114,11 +113,38 @@ class AdminObjectManagerTest < TestCase
click(css: '.modal button.js-submit')
# 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_select: {
# key1: 'some value',
#},
custom_data_input: {
browser_test1: 'some value öäüß',
},
disable_group_check: true,
)
# update ticket
ticket_update(
data: {},
#custom_data_select: {
# key1: 'some value',
#},
custom_data_input: {
browser_test1: 'some value ABC',
},
)
# discard new attribute
click(css: 'a[href="#manage"]')
click(css: 'a[href="#system/object_manager"]')
watch_for(
css: '#content table',
value: 'browser_test1',

View file

@ -1620,6 +1620,25 @@ wait untill text in selector disabppears
title: 'overview #1',
}
ticket = ticket_create(
browser: browser1,
data: {
customer: 'nico',
group: 'Users', # optional / '-NONE-' # if group selection should not be shown
priority: '2 normal',
state: 'open',
title: 'overview #1',
body: 'overview #1',
},
custom_data_select: {
key1: 'some value',
},
custom_data_input: {
key1: 'some value',
},
disable_group_check: true,
)
=end
def ticket_create(params)
@ -1668,8 +1687,10 @@ wait untill text in selector disabppears
else
# check count of agents, should be only 1 / - selection on init screen
if !params[:disable_group_check]
count = instance.find_elements(css: '.active .newTicket select[name="owner_id"] option').count
assert_equal(1, count, 'check if owner selection is empty per default')
end
select(
browser: instance,
css: '.active .newTicket select[name="group_id"]',
@ -1735,6 +1756,28 @@ wait untill text in selector disabppears
sleep 0.4
end
if params[:custom_data_select]
params[:custom_data_select].each {|local_key, local_value|
select(
browser: instance,
css: ".active .newTicket select[name=\"#{local_key}\"]",
value: local_value,
mute_log: true,
)
}
end
if params[:custom_data_input]
params[:custom_data_input].each {|local_key, local_value|
set(
browser: instance,
css: ".active .newTicket input[name=\"#{local_key}\"]",
value: local_value,
clear: true,
mute_log: true,
)
}
end
if data[:attachment]
file_upload(
browser: instance,
@ -1798,6 +1841,25 @@ wait untill text in selector disabppears
do_not_submit: true,
)
ticket_update(
browser: browser1,
data: {
title: '',
customer: 'some_customer@example.com',
body: 'some body',
group: 'some group', # optional
priority: '1 low',
state: 'closed',
},
custom_data_select: {
key1: 'some value',
},
custom_data_input: {
key1: 'some value',
},
do_not_submit: true,
)
=end
def ticket_update(params)
@ -1933,7 +1995,29 @@ wait untill text in selector disabppears
)
end
if data[:state] || data[:group] || data[:body]
if params[:custom_data_select]
params[:custom_data_select].each {|local_key, local_value|
select(
browser: instance,
css: ".active .sidebar select[name=\"#{local_key}\"]",
value: local_value,
mute_log: true,
)
}
end
if params[:custom_data_input]
params[:custom_data_input].each {|local_key, local_value|
set(
browser: instance,
css: ".active .sidebar input[name=\"#{local_key}\"]",
value: local_value,
clear: true,
mute_log: true,
)
}
end
if data[:state] || data[:group] || data[:body] || !params[:custom_data_select].empty? || !params[:custom_data_input].empty?
found = nil
(1..10).each {