2021-06-01 12:20:20 +00:00
|
|
|
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
|
|
|
|
2017-02-05 23:15:28 +00:00
|
|
|
require 'browser_test_helper'
|
|
|
|
|
|
|
|
class AgentTicketTimeAccountingTest < TestCase
|
|
|
|
def test_macro
|
|
|
|
@browser = browser_instance
|
|
|
|
login(
|
2021-08-17 12:10:02 +00:00
|
|
|
username: 'admin@example.com',
|
2017-02-05 23:15:28 +00:00
|
|
|
password: 'test',
|
2018-12-19 17:31:51 +00:00
|
|
|
url: browser_url,
|
2017-02-05 23:15:28 +00:00
|
|
|
)
|
2021-07-16 13:29:38 +00:00
|
|
|
tasks_close_all
|
2017-02-05 23:15:28 +00:00
|
|
|
|
|
|
|
# enable time accounting
|
|
|
|
click(
|
|
|
|
css: 'a[href="#manage"]',
|
|
|
|
)
|
|
|
|
click(
|
|
|
|
css: '.content.active a[href="#manage/time_accounting"]',
|
|
|
|
)
|
|
|
|
switch(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .js-timeAccountingSetting',
|
2017-02-05 23:15:28 +00:00
|
|
|
type: 'on',
|
|
|
|
)
|
|
|
|
|
2019-06-28 11:38:49 +00:00
|
|
|
ticket_create(
|
2017-02-05 23:15:28 +00:00
|
|
|
data: {
|
|
|
|
customer: 'nico',
|
2018-12-19 17:31:51 +00:00
|
|
|
group: 'Users',
|
|
|
|
title: 'some subject - time accounting#1',
|
|
|
|
body: 'some body - time accounting#1',
|
2017-02-05 23:15:28 +00:00
|
|
|
},
|
|
|
|
)
|
|
|
|
|
|
|
|
ticket_update(
|
2018-12-19 17:31:51 +00:00
|
|
|
data: {
|
2017-02-05 23:15:28 +00:00
|
|
|
body: 'some note',
|
|
|
|
},
|
|
|
|
do_not_submit: true,
|
|
|
|
)
|
|
|
|
click(
|
|
|
|
css: '.active .js-submit',
|
|
|
|
)
|
2021-07-16 13:29:38 +00:00
|
|
|
modal_ready
|
2017-02-05 23:15:28 +00:00
|
|
|
set(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .modal [name=time_unit]',
|
2017-02-05 23:15:28 +00:00
|
|
|
value: '4',
|
|
|
|
)
|
|
|
|
click(
|
|
|
|
css: '.content.active .modal .js-submit',
|
|
|
|
)
|
2021-07-16 13:29:38 +00:00
|
|
|
modal_disappear
|
2018-07-25 07:27:36 +00:00
|
|
|
|
2017-02-05 23:15:28 +00:00
|
|
|
watch_for(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .js-timeUnit',
|
2017-02-05 23:15:28 +00:00
|
|
|
value: '4',
|
|
|
|
)
|
|
|
|
|
2019-06-28 11:38:49 +00:00
|
|
|
ticket_create(
|
2017-02-05 23:15:28 +00:00
|
|
|
data: {
|
|
|
|
customer: 'nico',
|
2018-12-19 17:31:51 +00:00
|
|
|
group: 'Users',
|
|
|
|
title: 'some subject - time accounting#2',
|
|
|
|
body: 'some body - time accounting#2',
|
2017-02-05 23:15:28 +00:00
|
|
|
},
|
|
|
|
)
|
|
|
|
|
|
|
|
ticket_update(
|
2018-12-19 17:31:51 +00:00
|
|
|
data: {
|
2017-02-05 23:15:28 +00:00
|
|
|
body: 'some note',
|
|
|
|
},
|
|
|
|
do_not_submit: true,
|
|
|
|
)
|
|
|
|
click(
|
|
|
|
css: '.active .js-submit',
|
|
|
|
)
|
2021-07-16 13:29:38 +00:00
|
|
|
modal_ready
|
2017-02-05 23:15:28 +00:00
|
|
|
set(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .modal [name=time_unit]',
|
2017-02-05 23:15:28 +00:00
|
|
|
value: '4,6',
|
|
|
|
)
|
|
|
|
click(
|
|
|
|
css: '.content.active .modal .js-submit',
|
|
|
|
)
|
2021-07-16 13:29:38 +00:00
|
|
|
modal_disappear
|
2018-07-25 07:27:36 +00:00
|
|
|
|
2017-02-05 23:15:28 +00:00
|
|
|
watch_for(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .js-timeUnit',
|
2017-02-05 23:15:28 +00:00
|
|
|
value: '4.6',
|
|
|
|
)
|
|
|
|
|
|
|
|
ticket_update(
|
2018-12-19 17:31:51 +00:00
|
|
|
data: {
|
2017-02-05 23:15:28 +00:00
|
|
|
body: 'some note2',
|
|
|
|
},
|
|
|
|
do_not_submit: true,
|
|
|
|
)
|
|
|
|
click(
|
|
|
|
css: '.active .js-submit',
|
|
|
|
)
|
|
|
|
|
2021-07-16 13:29:38 +00:00
|
|
|
modal_ready
|
2017-02-05 23:15:28 +00:00
|
|
|
set(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .modal [name=time_unit]',
|
2017-02-05 23:15:28 +00:00
|
|
|
value: '4abc',
|
|
|
|
)
|
|
|
|
click(
|
|
|
|
css: '.content.active .modal .js-submit',
|
|
|
|
)
|
|
|
|
watch_for(
|
|
|
|
css: '.content.active .modal [name=time_unit].has-error',
|
|
|
|
)
|
|
|
|
set(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .modal [name=time_unit]',
|
2017-02-05 23:15:28 +00:00
|
|
|
value: '4 ',
|
|
|
|
)
|
|
|
|
click(
|
|
|
|
css: '.content.active .modal .js-submit',
|
|
|
|
)
|
2021-07-16 13:29:38 +00:00
|
|
|
modal_disappear
|
2017-02-05 23:15:28 +00:00
|
|
|
watch_for(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .js-timeUnit',
|
2017-02-05 23:15:28 +00:00
|
|
|
value: '8.6',
|
|
|
|
)
|
|
|
|
|
|
|
|
# disable time accounting
|
|
|
|
click(
|
|
|
|
css: 'a[href="#manage"]',
|
|
|
|
)
|
|
|
|
click(
|
|
|
|
css: '.content.active a[href="#manage/time_accounting"]',
|
|
|
|
)
|
|
|
|
switch(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .js-timeAccountingSetting',
|
2017-02-05 23:15:28 +00:00
|
|
|
type: 'off',
|
|
|
|
)
|
2018-06-25 13:59:07 +00:00
|
|
|
|
|
|
|
# make sure "off" AJAX request gets completed
|
|
|
|
# otherwise following tests might fail because
|
|
|
|
# off still active timeaccounting
|
2021-07-16 13:29:38 +00:00
|
|
|
logout
|
2017-02-05 23:15:28 +00:00
|
|
|
end
|
2018-07-11 02:48:39 +00:00
|
|
|
|
|
|
|
def test_closing_time_accounting_modal_by_clicking_background
|
|
|
|
@browser = browser_instance
|
|
|
|
login(
|
2021-08-17 12:10:02 +00:00
|
|
|
username: 'admin@example.com',
|
2018-07-11 02:48:39 +00:00
|
|
|
password: 'test',
|
2018-12-19 17:31:51 +00:00
|
|
|
url: browser_url,
|
2018-07-11 02:48:39 +00:00
|
|
|
)
|
2021-07-16 13:29:38 +00:00
|
|
|
tasks_close_all
|
2018-07-11 02:48:39 +00:00
|
|
|
|
|
|
|
# enable time accounting
|
|
|
|
click(
|
|
|
|
css: 'a[href="#manage"]',
|
|
|
|
)
|
|
|
|
click(
|
|
|
|
css: '.content.active a[href="#manage/time_accounting"]',
|
|
|
|
)
|
|
|
|
switch(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .js-timeAccountingSetting',
|
2018-07-11 02:48:39 +00:00
|
|
|
type: 'on',
|
|
|
|
)
|
|
|
|
|
2019-06-28 11:38:49 +00:00
|
|
|
ticket_create(
|
2018-07-11 02:48:39 +00:00
|
|
|
data: {
|
|
|
|
customer: 'nico',
|
2018-12-19 17:31:51 +00:00
|
|
|
group: 'Users',
|
|
|
|
title: 'some subject - time accounting#3',
|
|
|
|
body: 'some body - time accounting#3',
|
2018-07-11 02:48:39 +00:00
|
|
|
},
|
|
|
|
)
|
|
|
|
|
|
|
|
ticket_update(
|
2018-12-19 17:31:51 +00:00
|
|
|
data: {
|
2018-07-11 02:48:39 +00:00
|
|
|
body: 'some note',
|
|
|
|
},
|
|
|
|
do_not_submit: true,
|
|
|
|
)
|
|
|
|
click(
|
|
|
|
css: '.active .js-submit',
|
|
|
|
)
|
2021-07-16 13:29:38 +00:00
|
|
|
modal_ready
|
2018-07-11 02:48:39 +00:00
|
|
|
|
|
|
|
# Click outside the modal to make it disappear
|
|
|
|
execute(
|
|
|
|
js: 'document.elementFromPoint(300, 100).click();',
|
|
|
|
)
|
2021-07-16 13:29:38 +00:00
|
|
|
modal_disappear
|
2018-07-11 02:48:39 +00:00
|
|
|
|
|
|
|
click(
|
|
|
|
css: '.active .js-submit',
|
|
|
|
)
|
2021-07-16 13:29:38 +00:00
|
|
|
modal_ready
|
2018-07-11 02:48:39 +00:00
|
|
|
set(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .modal [name=time_unit]',
|
2018-07-11 02:48:39 +00:00
|
|
|
value: '4',
|
|
|
|
)
|
|
|
|
click(
|
|
|
|
css: '.content.active .modal .js-submit',
|
|
|
|
)
|
2021-07-16 13:29:38 +00:00
|
|
|
modal_disappear
|
2018-07-11 02:48:39 +00:00
|
|
|
|
|
|
|
# disable time accounting
|
|
|
|
click(
|
|
|
|
css: 'a[href="#manage"]',
|
|
|
|
)
|
|
|
|
click(
|
|
|
|
css: '.content.active a[href="#manage/time_accounting"]',
|
|
|
|
)
|
|
|
|
switch(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .js-timeAccountingSetting',
|
2018-07-11 02:48:39 +00:00
|
|
|
type: 'off',
|
|
|
|
)
|
|
|
|
|
|
|
|
# make sure "off" AJAX request gets completed
|
|
|
|
# otherwise following tests might fail because
|
|
|
|
# off still active timeaccounting
|
2021-07-16 13:29:38 +00:00
|
|
|
logout
|
2018-07-11 02:48:39 +00:00
|
|
|
end
|
2017-02-05 23:15:28 +00:00
|
|
|
end
|