2021-06-01 12:20:20 +00:00
|
|
|
# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
|
|
|
|
|
2015-02-20 13:40:51 +00:00
|
|
|
require 'browser_test_helper'
|
|
|
|
|
|
|
|
class AgentTicketOverviewLevel0Test < TestCase
|
2018-05-21 22:57:26 +00:00
|
|
|
def test_bulk_close
|
2015-02-22 12:28:34 +00:00
|
|
|
@browser = browser_instance
|
|
|
|
login(
|
2021-08-17 12:10:02 +00:00
|
|
|
username: 'admin@example.com',
|
2015-04-27 13:42:53 +00:00
|
|
|
password: 'test',
|
2018-12-19 17:31:51 +00:00
|
|
|
url: browser_url,
|
2015-02-22 12:28:34 +00:00
|
|
|
)
|
2021-07-16 13:29:38 +00:00
|
|
|
tasks_close_all
|
2015-02-20 13:40:51 +00:00
|
|
|
|
2015-02-24 20:22:45 +00:00
|
|
|
# test bulk action
|
|
|
|
|
|
|
|
# create new ticket
|
|
|
|
ticket1 = ticket_create(
|
2015-04-27 13:42:53 +00:00
|
|
|
data: {
|
2016-03-14 22:29:39 +00:00
|
|
|
customer: 'nico',
|
2018-12-19 17:31:51 +00:00
|
|
|
group: 'Users',
|
|
|
|
title: 'overview count test #1',
|
|
|
|
body: 'overview count test #1',
|
2015-02-24 20:22:45 +00:00
|
|
|
}
|
|
|
|
)
|
|
|
|
ticket2 = ticket_create(
|
2015-04-27 13:42:53 +00:00
|
|
|
data: {
|
2016-03-14 22:29:39 +00:00
|
|
|
customer: 'nico',
|
2018-12-19 17:31:51 +00:00
|
|
|
group: 'Users',
|
|
|
|
title: 'overview count test #2',
|
|
|
|
body: 'overview count test #2',
|
2015-02-24 20:22:45 +00:00
|
|
|
}
|
|
|
|
)
|
2016-03-12 16:23:51 +00:00
|
|
|
click(text: 'Overviews')
|
2015-11-05 12:34:22 +00:00
|
|
|
|
|
|
|
# enable full overviews
|
|
|
|
execute(
|
|
|
|
js: '$(".content.active .sidebar").css("display", "block")',
|
|
|
|
)
|
|
|
|
|
2016-03-12 16:23:51 +00:00
|
|
|
click(text: 'Unassigned & Open')
|
2018-05-21 22:57:26 +00:00
|
|
|
watch_for(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active',
|
2018-05-21 22:57:26 +00:00
|
|
|
value: 'overview count test #2',
|
|
|
|
)
|
2015-02-24 20:22:45 +00:00
|
|
|
|
|
|
|
# select both via bulk action
|
|
|
|
click(
|
2021-07-28 14:05:34 +00:00
|
|
|
css: %(.content.active table tr td input[value="#{ticket1[:id]}"]),
|
2015-04-27 13:42:53 +00:00
|
|
|
fast: true,
|
2015-02-24 20:22:45 +00:00
|
|
|
)
|
2015-11-17 18:57:15 +00:00
|
|
|
|
|
|
|
# scroll to reply - needed for chrome
|
|
|
|
scroll_to(
|
|
|
|
position: 'top',
|
2021-07-28 14:05:34 +00:00
|
|
|
css: %(.content.active table tr td input[value="#{ticket2[:id]}"]),
|
2015-11-17 18:57:15 +00:00
|
|
|
)
|
2015-02-24 20:22:45 +00:00
|
|
|
click(
|
2021-07-28 14:05:34 +00:00
|
|
|
css: %(.content.active table tr td input[value="#{ticket2[:id]}"]),
|
2015-04-27 13:42:53 +00:00
|
|
|
fast: true,
|
2015-02-24 20:22:45 +00:00
|
|
|
)
|
2015-11-17 09:03:51 +00:00
|
|
|
|
2015-02-24 20:22:45 +00:00
|
|
|
exists(
|
2020-09-30 09:07:01 +00:00
|
|
|
css: %(.content.active table tr td input[value="#{ticket1[:id]}"][type="checkbox"]:checked),
|
2015-02-24 20:22:45 +00:00
|
|
|
)
|
|
|
|
exists(
|
2020-09-30 09:07:01 +00:00
|
|
|
css: %(.content.active table tr td input[value="#{ticket2[:id]}"][type="checkbox"]:checked),
|
2015-02-24 20:22:45 +00:00
|
|
|
)
|
|
|
|
|
2021-06-15 06:26:52 +00:00
|
|
|
# remember current overview count
|
2021-07-16 13:29:38 +00:00
|
|
|
overview_counter_before = overview_counter
|
2021-06-15 06:26:52 +00:00
|
|
|
|
2015-02-24 20:22:45 +00:00
|
|
|
# select close state & submit
|
|
|
|
select(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .bulkAction [name="state_id"]',
|
2015-04-27 13:42:53 +00:00
|
|
|
value: 'closed',
|
2015-02-24 20:22:45 +00:00
|
|
|
)
|
|
|
|
click(
|
2018-05-21 22:57:26 +00:00
|
|
|
css: '.content.active .bulkAction .js-confirm',
|
2015-02-24 20:22:45 +00:00
|
|
|
)
|
|
|
|
click(
|
2018-05-21 22:57:26 +00:00
|
|
|
css: '.content.active .bulkAction .js-submit',
|
|
|
|
)
|
|
|
|
|
|
|
|
watch_for_disappear(
|
2020-09-30 09:07:01 +00:00
|
|
|
css: %(.content.active table tr td input[value="#{ticket2[:id]}"]),
|
2018-05-21 22:57:26 +00:00
|
|
|
timeout: 6,
|
2015-02-24 20:22:45 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
exists_not(
|
2020-09-30 09:07:01 +00:00
|
|
|
css: %(.content.active table tr td input[value="#{ticket1[:id]}"]),
|
2015-02-24 20:22:45 +00:00
|
|
|
)
|
|
|
|
exists_not(
|
2020-09-30 09:07:01 +00:00
|
|
|
css: %(.content.active table tr td input[value="#{ticket2[:id]}"]),
|
2015-02-24 20:22:45 +00:00
|
|
|
)
|
|
|
|
|
2015-02-22 12:28:34 +00:00
|
|
|
# remember current overview count
|
2021-06-15 06:26:52 +00:00
|
|
|
await_overview_counter(view: '#ticket/view/all_unassigned', count: overview_counter_before['#ticket/view/all_unassigned'] - 2)
|
2021-07-16 13:29:38 +00:00
|
|
|
overview_counter_before = overview_counter
|
2015-02-20 13:40:51 +00:00
|
|
|
|
2015-02-24 20:22:45 +00:00
|
|
|
# click options and enable number and article count
|
2018-05-21 22:57:26 +00:00
|
|
|
click(css: '.content.active [data-type="settings"]')
|
2015-02-24 20:22:45 +00:00
|
|
|
|
2021-07-16 13:29:38 +00:00
|
|
|
modal_ready
|
2018-07-25 07:27:36 +00:00
|
|
|
|
2015-02-24 20:22:45 +00:00
|
|
|
check(
|
2015-04-27 13:42:53 +00:00
|
|
|
css: '.modal input[value="number"]',
|
2015-02-24 20:22:45 +00:00
|
|
|
)
|
2015-03-01 23:16:36 +00:00
|
|
|
check(
|
2015-04-27 13:42:53 +00:00
|
|
|
css: '.modal input[value="title"]',
|
2015-03-01 23:16:36 +00:00
|
|
|
)
|
|
|
|
check(
|
2015-04-27 13:42:53 +00:00
|
|
|
css: '.modal input[value="customer"]',
|
2015-03-01 23:16:36 +00:00
|
|
|
)
|
|
|
|
check(
|
2015-04-27 13:42:53 +00:00
|
|
|
css: '.modal input[value="group"]',
|
2015-03-01 23:16:36 +00:00
|
|
|
)
|
|
|
|
check(
|
2015-04-27 13:42:53 +00:00
|
|
|
css: '.modal input[value="created_at"]',
|
2015-03-01 23:16:36 +00:00
|
|
|
)
|
2015-02-24 20:22:45 +00:00
|
|
|
check(
|
2015-04-27 13:42:53 +00:00
|
|
|
css: '.modal input[value="article_count"]',
|
2015-02-24 20:22:45 +00:00
|
|
|
)
|
2016-03-12 16:23:51 +00:00
|
|
|
click(css: '.modal .js-submit')
|
2017-06-16 20:43:09 +00:00
|
|
|
modal_disappear
|
2015-02-24 20:22:45 +00:00
|
|
|
|
|
|
|
# check if number and article count is shown
|
|
|
|
match(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active table th:nth-child(3)',
|
2015-04-27 13:42:53 +00:00
|
|
|
value: '#',
|
2015-02-24 20:22:45 +00:00
|
|
|
)
|
|
|
|
match(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active table th:nth-child(4)',
|
2015-09-29 06:24:51 +00:00
|
|
|
value: 'Title',
|
|
|
|
)
|
|
|
|
match(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active table th:nth-child(7)',
|
2015-04-27 13:42:53 +00:00
|
|
|
value: 'Article#',
|
2015-02-24 20:22:45 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
# reload browser
|
2021-07-16 13:29:38 +00:00
|
|
|
reload
|
2015-03-01 23:16:36 +00:00
|
|
|
sleep 4
|
2015-02-24 20:22:45 +00:00
|
|
|
|
|
|
|
# check if number and article count is shown
|
|
|
|
match(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active table th:nth-child(3)',
|
2015-04-27 13:42:53 +00:00
|
|
|
value: '#',
|
2015-02-24 20:22:45 +00:00
|
|
|
)
|
|
|
|
match(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active table th:nth-child(4)',
|
2015-09-29 06:24:51 +00:00
|
|
|
value: 'Title',
|
|
|
|
)
|
|
|
|
match(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active table th:nth-child(7)',
|
2015-04-27 13:42:53 +00:00
|
|
|
value: 'Article#',
|
2015-02-24 20:22:45 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
# disable number and article count
|
2018-05-21 22:57:26 +00:00
|
|
|
click(css: '.content.active [data-type="settings"]')
|
2015-02-24 20:22:45 +00:00
|
|
|
|
2021-07-16 13:29:38 +00:00
|
|
|
modal_ready
|
2018-07-25 07:27:36 +00:00
|
|
|
|
2015-02-24 20:22:45 +00:00
|
|
|
uncheck(
|
2015-04-27 13:42:53 +00:00
|
|
|
css: '.modal input[value="number"]',
|
2015-02-24 20:22:45 +00:00
|
|
|
)
|
|
|
|
uncheck(
|
2015-04-27 13:42:53 +00:00
|
|
|
css: '.modal input[value="article_count"]',
|
2015-02-24 20:22:45 +00:00
|
|
|
)
|
2016-03-12 16:23:51 +00:00
|
|
|
click(css: '.modal .js-submit')
|
2017-06-16 20:43:09 +00:00
|
|
|
modal_disappear
|
2015-02-24 20:22:45 +00:00
|
|
|
|
|
|
|
# check if number and article count is gone
|
|
|
|
match_not(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active table th:nth-child(3)',
|
2015-04-27 13:42:53 +00:00
|
|
|
value: '#',
|
2015-02-24 20:22:45 +00:00
|
|
|
)
|
2015-09-29 06:24:51 +00:00
|
|
|
match(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active table th:nth-child(3)',
|
2015-09-29 06:24:51 +00:00
|
|
|
value: 'Title',
|
|
|
|
)
|
2015-02-24 20:22:45 +00:00
|
|
|
exists_not(
|
2018-05-21 22:57:26 +00:00
|
|
|
css: '.content.active table th:nth-child(8)',
|
2015-02-24 20:22:45 +00:00
|
|
|
)
|
|
|
|
|
2015-02-22 12:28:34 +00:00
|
|
|
# create new ticket
|
2015-02-24 20:22:45 +00:00
|
|
|
ticket3 = ticket_create(
|
2015-04-27 13:42:53 +00:00
|
|
|
data: {
|
2016-03-14 22:29:39 +00:00
|
|
|
customer: 'nico',
|
2018-12-19 17:31:51 +00:00
|
|
|
group: 'Users',
|
|
|
|
title: 'overview count test #3',
|
|
|
|
body: 'overview count test #3',
|
2015-02-22 12:28:34 +00:00
|
|
|
}
|
|
|
|
)
|
2015-02-20 13:40:51 +00:00
|
|
|
|
2015-02-22 12:28:34 +00:00
|
|
|
# get new overview count
|
2021-06-15 06:26:52 +00:00
|
|
|
await_overview_counter(view: '#ticket/view/all_unassigned', count: overview_counter_before['#ticket/view/all_unassigned'] + 1)
|
2015-02-20 13:40:51 +00:00
|
|
|
|
2015-02-22 12:28:34 +00:00
|
|
|
# open ticket by search
|
|
|
|
ticket_open_by_search(
|
2015-04-27 13:42:53 +00:00
|
|
|
number: ticket3[:number],
|
2015-02-22 12:28:34 +00:00
|
|
|
)
|
2015-02-23 09:21:39 +00:00
|
|
|
sleep 1
|
2015-02-20 13:40:51 +00:00
|
|
|
|
2015-02-22 12:28:34 +00:00
|
|
|
# close ticket
|
|
|
|
ticket_update(
|
2015-04-27 13:42:53 +00:00
|
|
|
data: {
|
|
|
|
state: 'closed',
|
2015-02-22 12:28:34 +00:00
|
|
|
}
|
|
|
|
)
|
2015-02-20 13:40:51 +00:00
|
|
|
|
2015-02-22 12:28:34 +00:00
|
|
|
# get current overview count
|
2021-06-15 06:26:52 +00:00
|
|
|
await_overview_counter(view: '#ticket/view/all_unassigned', count: overview_counter_before['#ticket/view/all_unassigned'])
|
2015-03-01 23:16:36 +00:00
|
|
|
|
|
|
|
# cleanup
|
2021-07-16 13:29:38 +00:00
|
|
|
tasks_close_all
|
2015-02-20 13:40:51 +00:00
|
|
|
end
|
2018-05-21 22:57:26 +00:00
|
|
|
|
|
|
|
def test_bulk_pending
|
|
|
|
@browser = browser_instance
|
|
|
|
login(
|
2021-08-17 12:10:02 +00:00
|
|
|
username: 'admin@example.com',
|
2018-05-21 22:57:26 +00:00
|
|
|
password: 'test',
|
2018-12-19 17:31:51 +00:00
|
|
|
url: browser_url,
|
2018-05-21 22:57:26 +00:00
|
|
|
)
|
2021-07-16 13:29:38 +00:00
|
|
|
tasks_close_all
|
2018-05-21 22:57:26 +00:00
|
|
|
|
|
|
|
# test bulk action
|
|
|
|
|
|
|
|
# create new ticket
|
|
|
|
ticket1 = ticket_create(
|
|
|
|
data: {
|
|
|
|
customer: 'nico',
|
2018-12-19 17:31:51 +00:00
|
|
|
group: 'Users',
|
|
|
|
title: 'overview count test #3',
|
|
|
|
body: 'overview count test #3',
|
2018-05-21 22:57:26 +00:00
|
|
|
}
|
|
|
|
)
|
|
|
|
ticket2 = ticket_create(
|
|
|
|
data: {
|
|
|
|
customer: 'nico',
|
2018-12-19 17:31:51 +00:00
|
|
|
group: 'Users',
|
|
|
|
title: 'overview count test #4',
|
|
|
|
body: 'overview count test #4',
|
2018-05-21 22:57:26 +00:00
|
|
|
}
|
|
|
|
)
|
|
|
|
click(text: 'Overviews')
|
|
|
|
|
|
|
|
# enable full overviews
|
|
|
|
execute(
|
|
|
|
js: '$(".content.active .sidebar").css("display", "block")',
|
|
|
|
)
|
|
|
|
|
|
|
|
click(text: 'Unassigned & Open')
|
|
|
|
watch_for(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active',
|
|
|
|
value: 'overview count test #4',
|
2018-05-21 22:57:26 +00:00
|
|
|
timeout: 8,
|
|
|
|
)
|
|
|
|
|
|
|
|
# remember current overview count
|
2021-07-16 13:29:38 +00:00
|
|
|
overview_counter_before = overview_counter
|
2018-05-21 22:57:26 +00:00
|
|
|
|
|
|
|
# select both via bulk action
|
|
|
|
click(
|
2021-07-28 14:05:34 +00:00
|
|
|
css: %(.content.active table tr td input[value="#{ticket1[:id]}"]),
|
2018-05-21 22:57:26 +00:00
|
|
|
fast: true,
|
|
|
|
)
|
|
|
|
|
|
|
|
# scroll to reply - needed for chrome
|
|
|
|
scroll_to(
|
|
|
|
position: 'top',
|
2021-07-28 14:05:34 +00:00
|
|
|
css: %(.content.active table tr td input[value="#{ticket2[:id]}"]),
|
2018-05-21 22:57:26 +00:00
|
|
|
)
|
|
|
|
click(
|
2021-07-28 14:05:34 +00:00
|
|
|
css: %(.content.active table tr td input[value="#{ticket2[:id]}"]),
|
2018-05-21 22:57:26 +00:00
|
|
|
fast: true,
|
|
|
|
)
|
|
|
|
|
|
|
|
exists(
|
2020-09-30 09:07:01 +00:00
|
|
|
css: %(.content.active table tr td input[value="#{ticket1[:id]}"][type="checkbox"]:checked),
|
2018-05-21 22:57:26 +00:00
|
|
|
)
|
|
|
|
exists(
|
2020-09-30 09:07:01 +00:00
|
|
|
css: %(.content.active table tr td input[value="#{ticket2[:id]}"][type="checkbox"]:checked),
|
2018-05-21 22:57:26 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
exists(
|
|
|
|
displayed: false,
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .bulkAction [data-name="pending_time"]',
|
2018-05-21 22:57:26 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
select(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .bulkAction [name="state_id"]',
|
2018-05-21 22:57:26 +00:00
|
|
|
value: 'pending close',
|
|
|
|
)
|
|
|
|
|
|
|
|
exists(
|
|
|
|
displayed: true,
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .bulkAction [data-name="pending_time"]',
|
2018-05-21 22:57:26 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
set(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .bulkAction [data-item="date"]',
|
2018-05-23 06:51:41 +00:00
|
|
|
value: '05/23/2037',
|
2018-05-21 22:57:26 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
select(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .bulkAction [name="group_id"]',
|
2018-05-21 22:57:26 +00:00
|
|
|
value: 'Users',
|
|
|
|
)
|
|
|
|
|
|
|
|
select(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .bulkAction [name="owner_id"]',
|
2021-08-20 08:56:23 +00:00
|
|
|
value: 'Test Admin Agent',
|
2018-05-21 22:57:26 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
click(
|
|
|
|
css: '.content.active .bulkAction .js-confirm',
|
|
|
|
)
|
|
|
|
click(
|
|
|
|
css: '.content.active .bulkAction .js-submit',
|
|
|
|
)
|
|
|
|
|
|
|
|
watch_for_disappear(
|
2020-09-30 09:07:01 +00:00
|
|
|
css: %(.content.active table tr td input[value="#{ticket2[:id]}"]),
|
2018-05-21 22:57:26 +00:00
|
|
|
timeout: 12,
|
|
|
|
)
|
|
|
|
|
|
|
|
exists_not(
|
2020-09-30 09:07:01 +00:00
|
|
|
css: %(.content.active table tr td input[value="#{ticket1[:id]}"]),
|
2018-05-21 22:57:26 +00:00
|
|
|
)
|
|
|
|
exists_not(
|
2020-09-30 09:07:01 +00:00
|
|
|
css: %(.content.active table tr td input[value="#{ticket2[:id]}"]),
|
2018-05-21 22:57:26 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
# get new overview count
|
2021-06-15 06:26:52 +00:00
|
|
|
await_overview_counter(view: '#ticket/view/all_unassigned', count: overview_counter_before['#ticket/view/all_unassigned'] - 2)
|
2018-05-21 22:57:26 +00:00
|
|
|
|
|
|
|
# open ticket by search
|
|
|
|
ticket_open_by_search(
|
|
|
|
number: ticket1[:number],
|
|
|
|
)
|
|
|
|
sleep 1
|
|
|
|
|
|
|
|
# close ticket
|
|
|
|
ticket_update(
|
|
|
|
data: {
|
|
|
|
state: 'closed',
|
|
|
|
}
|
|
|
|
)
|
|
|
|
|
|
|
|
# open ticket by search
|
|
|
|
ticket_open_by_search(
|
|
|
|
number: ticket2[:number],
|
|
|
|
)
|
|
|
|
sleep 1
|
|
|
|
|
|
|
|
# close ticket
|
|
|
|
ticket_update(
|
|
|
|
data: {
|
|
|
|
state: 'closed',
|
|
|
|
}
|
|
|
|
)
|
|
|
|
|
|
|
|
# cleanup
|
2021-07-16 13:29:38 +00:00
|
|
|
tasks_close_all
|
2018-05-21 22:57:26 +00:00
|
|
|
end
|
2018-08-06 13:02:16 +00:00
|
|
|
|
|
|
|
# verify correct behaviour for issue #1864 - Bulk-Action: Not possible to change owner
|
|
|
|
def test_bulk_owner_change
|
|
|
|
@browser = browser_instance
|
|
|
|
login(
|
2021-08-17 12:10:02 +00:00
|
|
|
username: 'admin@example.com',
|
2018-08-06 13:02:16 +00:00
|
|
|
password: 'test',
|
2018-12-19 17:31:51 +00:00
|
|
|
url: browser_url,
|
2018-08-06 13:02:16 +00:00
|
|
|
)
|
2021-07-16 13:29:38 +00:00
|
|
|
tasks_close_all
|
2018-08-06 13:02:16 +00:00
|
|
|
|
|
|
|
# test bulk action
|
|
|
|
|
|
|
|
# create new ticket
|
|
|
|
ticket1 = ticket_create(
|
|
|
|
data: {
|
|
|
|
customer: 'nico',
|
2018-12-19 17:31:51 +00:00
|
|
|
group: 'Users',
|
|
|
|
title: 'overview owner change test #1',
|
|
|
|
body: 'overview owner change #1',
|
2018-08-06 13:02:16 +00:00
|
|
|
}
|
|
|
|
)
|
|
|
|
ticket2 = ticket_create(
|
|
|
|
data: {
|
|
|
|
customer: 'nico',
|
2018-12-19 17:31:51 +00:00
|
|
|
group: 'Users',
|
|
|
|
title: 'overview owner change #2',
|
|
|
|
body: 'overview owner change #2',
|
2018-08-06 13:02:16 +00:00
|
|
|
}
|
|
|
|
)
|
|
|
|
|
2018-08-20 11:53:44 +00:00
|
|
|
overview_open(
|
|
|
|
link: '#ticket/view/all_unassigned',
|
2018-08-06 13:02:16 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
watch_for(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active',
|
|
|
|
value: 'overview owner change #2',
|
2018-08-06 13:02:16 +00:00
|
|
|
timeout: 8,
|
|
|
|
)
|
|
|
|
|
|
|
|
# remember current overview count
|
2021-07-16 13:29:38 +00:00
|
|
|
overview_counter_before = overview_counter
|
2018-08-06 13:02:16 +00:00
|
|
|
|
|
|
|
# select both via bulk action
|
|
|
|
click(
|
2021-07-28 14:05:34 +00:00
|
|
|
css: %(.content.active table tr td input[value="#{ticket1[:id]}"]),
|
2018-08-06 13:02:16 +00:00
|
|
|
fast: true,
|
|
|
|
)
|
|
|
|
|
|
|
|
# scroll to reply - needed for chrome
|
|
|
|
scroll_to(
|
|
|
|
position: 'top',
|
2021-07-28 14:05:34 +00:00
|
|
|
css: %(.content.active table tr td input[value="#{ticket2[:id]}"]),
|
2018-08-06 13:02:16 +00:00
|
|
|
)
|
|
|
|
click(
|
2021-07-28 14:05:34 +00:00
|
|
|
css: %(.content.active table tr td input[value="#{ticket2[:id]}"]),
|
2018-08-06 13:02:16 +00:00
|
|
|
fast: true,
|
|
|
|
)
|
|
|
|
|
|
|
|
exists(
|
2020-09-30 09:07:01 +00:00
|
|
|
css: %(.content.active table tr td input[value="#{ticket1[:id]}"][type="checkbox"]:checked),
|
2018-08-06 13:02:16 +00:00
|
|
|
)
|
|
|
|
exists(
|
2020-09-30 09:07:01 +00:00
|
|
|
css: %(.content.active table tr td input[value="#{ticket2[:id]}"][type="checkbox"]:checked),
|
2018-08-06 13:02:16 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
select(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .bulkAction [name="owner_id"]',
|
2021-08-20 08:56:23 +00:00
|
|
|
value: 'Test Admin Agent',
|
2018-08-06 13:02:16 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
select(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .bulkAction [name="state_id"]',
|
2018-08-06 13:02:16 +00:00
|
|
|
value: 'closed',
|
|
|
|
)
|
|
|
|
|
|
|
|
click(
|
|
|
|
css: '.content.active .bulkAction .js-confirm',
|
|
|
|
)
|
|
|
|
click(
|
|
|
|
css: '.content.active .bulkAction .js-submit',
|
|
|
|
)
|
|
|
|
|
|
|
|
watch_for_disappear(
|
2020-09-30 09:07:01 +00:00
|
|
|
css: %(.content.active table tr td input[value="#{ticket2[:id]}"]),
|
2018-08-06 13:02:16 +00:00
|
|
|
timeout: 12,
|
|
|
|
)
|
|
|
|
|
|
|
|
exists_not(
|
2020-09-30 09:07:01 +00:00
|
|
|
css: %(.content.active table tr td input[value="#{ticket1[:id]}"]),
|
2018-08-06 13:02:16 +00:00
|
|
|
)
|
|
|
|
exists_not(
|
2020-09-30 09:07:01 +00:00
|
|
|
css: %(.content.active table tr td input[value="#{ticket2[:id]}"]),
|
2018-08-06 13:02:16 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
# get new overview count
|
2021-06-15 06:26:52 +00:00
|
|
|
await_overview_counter(view: '#ticket/view/all_unassigned', count: overview_counter_before['#ticket/view/all_unassigned'] - 2)
|
2018-08-06 13:02:16 +00:00
|
|
|
|
|
|
|
# cleanup
|
2021-07-16 13:29:38 +00:00
|
|
|
tasks_close_all
|
2018-08-06 13:02:16 +00:00
|
|
|
end
|
2018-08-07 12:15:53 +00:00
|
|
|
|
|
|
|
# verify fix for issue #2026 - Bulk action should not be shown if user has no change permissions
|
|
|
|
def test_no_bulk_action_when_missing_change_permission
|
|
|
|
@browser = browser_instance
|
|
|
|
login(
|
2021-08-17 12:10:02 +00:00
|
|
|
username: 'admin@example.com',
|
2018-08-07 12:15:53 +00:00
|
|
|
password: 'test',
|
2018-12-19 17:31:51 +00:00
|
|
|
url: browser_url,
|
2018-08-07 12:15:53 +00:00
|
|
|
)
|
2021-07-16 13:29:38 +00:00
|
|
|
tasks_close_all
|
2018-08-07 12:15:53 +00:00
|
|
|
|
|
|
|
# create new group
|
|
|
|
group_create(
|
|
|
|
data: {
|
|
|
|
name: 'some group2',
|
|
|
|
},
|
|
|
|
)
|
|
|
|
|
2018-10-12 08:28:37 +00:00
|
|
|
role_edit(
|
|
|
|
data: {
|
2018-12-19 17:31:51 +00:00
|
|
|
name: 'Agent',
|
2018-10-12 08:28:37 +00:00
|
|
|
group_permissions: { 2 => ['full'],
|
|
|
|
3 => ['full'], }
|
|
|
|
},
|
2018-08-07 12:15:53 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
user_edit(
|
|
|
|
data: {
|
2021-08-17 12:10:02 +00:00
|
|
|
login: 'admin@example.com',
|
2018-08-07 12:15:53 +00:00
|
|
|
permissions: { 1 => ['full'],
|
|
|
|
2 => ['full'],
|
|
|
|
3 => ['full'], }
|
|
|
|
},
|
|
|
|
)
|
|
|
|
|
|
|
|
user_create(
|
|
|
|
data: {
|
|
|
|
firstname: 'Tester',
|
|
|
|
lastname: 'Agent 2',
|
|
|
|
email: 'agent2@example.com',
|
|
|
|
password: 'test',
|
|
|
|
role: 'Agent',
|
2018-10-12 08:28:37 +00:00
|
|
|
permissions: { 1 => %w[read create overview] }
|
2018-08-07 12:15:53 +00:00
|
|
|
},
|
|
|
|
)
|
|
|
|
|
|
|
|
# create new tickets
|
|
|
|
can_change_ticket = ticket_create(
|
|
|
|
data: {
|
|
|
|
customer: 'nico',
|
2018-12-19 17:31:51 +00:00
|
|
|
group: 'some group2',
|
|
|
|
title: 'overview test #5',
|
|
|
|
body: 'overview test #5',
|
2018-08-07 12:15:53 +00:00
|
|
|
}
|
|
|
|
)
|
|
|
|
cannot_change_ticket = ticket_create(
|
|
|
|
data: {
|
|
|
|
customer: 'nico',
|
2018-12-19 17:31:51 +00:00
|
|
|
group: 'Users',
|
|
|
|
title: 'overview test #6',
|
|
|
|
body: 'overview test #6',
|
2018-08-07 12:15:53 +00:00
|
|
|
}
|
|
|
|
)
|
|
|
|
|
2021-08-17 12:10:02 +00:00
|
|
|
logout # logout as admin@example.com then login as agent2@example.com
|
2018-08-07 12:15:53 +00:00
|
|
|
login(
|
|
|
|
username: 'agent2@example.com',
|
|
|
|
password: 'test',
|
2018-12-19 17:31:51 +00:00
|
|
|
url: browser_url,
|
2018-08-07 12:15:53 +00:00
|
|
|
)
|
2021-07-16 13:29:38 +00:00
|
|
|
tasks_close_all
|
2018-08-07 12:15:53 +00:00
|
|
|
|
|
|
|
# open Overview menu tab
|
|
|
|
click(
|
|
|
|
css: '.js-menu .js-overviewsMenuItem',
|
|
|
|
)
|
|
|
|
|
|
|
|
# enable full overviews
|
|
|
|
execute(
|
|
|
|
js: '$(".content.active .sidebar").css("display", "block")',
|
|
|
|
)
|
|
|
|
|
|
|
|
# click Unassigned & Open tab
|
|
|
|
click(
|
|
|
|
css: '.content.active [href="#ticket/view/all_unassigned"]',
|
|
|
|
)
|
|
|
|
|
|
|
|
watch_for(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active',
|
|
|
|
value: 'overview test #6',
|
2018-08-07 12:15:53 +00:00
|
|
|
timeout: 8,
|
|
|
|
)
|
|
|
|
|
|
|
|
# first select the ticket that we have change rights to
|
|
|
|
check(
|
2020-09-30 09:07:01 +00:00
|
|
|
css: %(.content.active table tr td input[value="#{can_change_ticket[:id]}"]),
|
2018-08-07 12:15:53 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
# check that the bulk action form appears
|
|
|
|
exists(
|
|
|
|
displayed: true,
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .bulkAction',
|
2018-08-07 12:15:53 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
# then select the ticket that we do not have change rights to
|
|
|
|
scroll_to(
|
|
|
|
position: 'top',
|
2021-07-28 14:05:34 +00:00
|
|
|
css: %(.content.active table tr td input[value="#{cannot_change_ticket[:id]}"]),
|
2018-08-07 12:15:53 +00:00
|
|
|
)
|
|
|
|
check(
|
2020-09-30 09:07:01 +00:00
|
|
|
css: %(.content.active table tr td input[value="#{cannot_change_ticket[:id]}"]),
|
2018-08-07 12:15:53 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
# check that the bulk action form disappears
|
|
|
|
exists(
|
|
|
|
displayed: false,
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .bulkAction',
|
2018-08-07 12:15:53 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
# de-select the ticket that we do not have change rights to
|
|
|
|
uncheck(
|
2020-09-30 09:07:01 +00:00
|
|
|
css: %(.content.active table tr td input[value="#{cannot_change_ticket[:id]}"]),
|
2018-08-07 12:15:53 +00:00
|
|
|
fast: true,
|
|
|
|
)
|
|
|
|
|
|
|
|
# check that the bulk action form appears again
|
|
|
|
exists(
|
|
|
|
displayed: true,
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .bulkAction',
|
2018-08-07 12:15:53 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
# de-select the ticket that we have change rights to
|
|
|
|
uncheck(
|
2020-09-30 09:07:01 +00:00
|
|
|
css: %(.content.active table tr td input[value="#{can_change_ticket[:id]}"]),
|
2018-08-07 12:15:53 +00:00
|
|
|
fast: true,
|
|
|
|
)
|
|
|
|
|
|
|
|
# check that the bulk action form disappears again
|
|
|
|
exists(
|
|
|
|
displayed: false,
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .bulkAction',
|
2018-08-07 12:15:53 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
# cleanup
|
2021-07-16 13:29:38 +00:00
|
|
|
tasks_close_all
|
2021-08-17 12:10:02 +00:00
|
|
|
logout # logout as agent2@example.com and then login as admin@example.com to clean up tickets
|
2018-08-07 12:15:53 +00:00
|
|
|
login(
|
2021-08-17 12:10:02 +00:00
|
|
|
username: 'admin@example.com',
|
2018-08-07 12:15:53 +00:00
|
|
|
password: 'test',
|
2018-12-19 17:31:51 +00:00
|
|
|
url: browser_url,
|
2018-08-07 12:15:53 +00:00
|
|
|
)
|
2021-07-16 13:29:38 +00:00
|
|
|
tasks_close_all
|
2018-08-07 12:15:53 +00:00
|
|
|
|
|
|
|
# open ticket by search
|
|
|
|
ticket_open_by_search(
|
|
|
|
number: cannot_change_ticket[:number],
|
|
|
|
)
|
|
|
|
sleep 1
|
|
|
|
|
|
|
|
# close ticket
|
|
|
|
ticket_update(
|
|
|
|
data: {
|
|
|
|
state: 'closed',
|
|
|
|
}
|
|
|
|
)
|
|
|
|
|
|
|
|
# open ticket by search
|
|
|
|
ticket_open_by_search(
|
|
|
|
number: can_change_ticket[:number],
|
|
|
|
)
|
|
|
|
sleep 1
|
|
|
|
|
|
|
|
# close ticket
|
|
|
|
ticket_update(
|
|
|
|
data: {
|
|
|
|
state: 'closed',
|
|
|
|
}
|
|
|
|
)
|
|
|
|
end
|
2015-04-27 14:15:29 +00:00
|
|
|
end
|