2022-01-01 13:38:12 +00:00
|
|
|
# Copyright (C) 2012-2022 Zammad Foundation, https://zammad-foundation.org/
|
2021-06-01 12:20:20 +00:00
|
|
|
|
2018-03-28 05:33:41 +00:00
|
|
|
require 'browser_test_helper'
|
|
|
|
|
|
|
|
class AgentProfilePermissionsTest < TestCase
|
|
|
|
def test_agent_to_edit_customer_profile
|
|
|
|
@browser = browser_instance
|
|
|
|
login(
|
|
|
|
username: 'agent1@example.com',
|
|
|
|
password: 'test',
|
2018-12-19 17:31:51 +00:00
|
|
|
url: browser_url,
|
2018-03-28 05:33:41 +00:00
|
|
|
)
|
2021-07-16 13:29:38 +00:00
|
|
|
tasks_close_all
|
2018-03-28 05:33:41 +00:00
|
|
|
|
2018-06-05 11:58:14 +00:00
|
|
|
user_open_by_search(value: 'Braun')
|
2018-03-28 05:33:41 +00:00
|
|
|
|
|
|
|
verify_task(
|
|
|
|
data: {
|
|
|
|
title: 'Nicole Braun',
|
|
|
|
}
|
|
|
|
)
|
|
|
|
|
|
|
|
watch_for(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .profile-window',
|
2018-03-28 05:33:41 +00:00
|
|
|
value: 'note',
|
|
|
|
)
|
|
|
|
|
|
|
|
watch_for(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .profile-window',
|
2018-03-28 05:33:41 +00:00
|
|
|
value: 'email',
|
|
|
|
)
|
|
|
|
|
|
|
|
set(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active [data-name="note"]',
|
2018-03-28 05:33:41 +00:00
|
|
|
value: 'some note 123',
|
|
|
|
)
|
2021-07-16 13:29:38 +00:00
|
|
|
empty_search
|
2018-03-28 05:33:41 +00:00
|
|
|
|
|
|
|
# check and change note again in edit screen
|
|
|
|
click(css: '.content.active .js-action .icon-arrow-down', fast: true)
|
|
|
|
click(css: '.content.active .js-action [data-type="edit"]')
|
|
|
|
|
2021-07-16 13:29:38 +00:00
|
|
|
modal_ready
|
2018-03-28 05:33:41 +00:00
|
|
|
watch_for(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .modal',
|
2018-03-28 05:33:41 +00:00
|
|
|
value: 'some note 123',
|
|
|
|
)
|
|
|
|
|
|
|
|
set(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.modal [name="lastname"]',
|
2018-03-28 05:33:41 +00:00
|
|
|
value: 'B2',
|
|
|
|
)
|
|
|
|
set(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.modal [data-name="note"]',
|
2018-03-28 05:33:41 +00:00
|
|
|
value: 'some note abc',
|
|
|
|
)
|
|
|
|
click(css: '.content.active .modal button.js-submit')
|
2021-07-16 13:29:38 +00:00
|
|
|
modal_disappear
|
2018-03-28 05:33:41 +00:00
|
|
|
|
|
|
|
watch_for(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .profile-window',
|
2018-03-28 05:33:41 +00:00
|
|
|
value: 'some note abc',
|
|
|
|
)
|
|
|
|
|
|
|
|
verify_task(
|
|
|
|
data: {
|
|
|
|
title: 'Nicole B2',
|
|
|
|
}
|
|
|
|
)
|
|
|
|
|
|
|
|
# change lastname back
|
|
|
|
click(css: '.content.active .js-action .icon-arrow-down', fast: true)
|
|
|
|
click(css: '.content.active .js-action [data-type="edit"]')
|
2018-07-24 16:06:35 +00:00
|
|
|
|
2021-07-16 13:29:38 +00:00
|
|
|
modal_ready
|
2018-03-28 05:33:41 +00:00
|
|
|
set(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.modal [name="lastname"]',
|
2018-03-28 05:33:41 +00:00
|
|
|
value: 'Braun',
|
|
|
|
)
|
|
|
|
click(css: '.content.active .modal button.js-submit')
|
2021-07-16 13:29:38 +00:00
|
|
|
modal_disappear
|
2018-03-28 05:33:41 +00:00
|
|
|
|
|
|
|
verify_task(
|
|
|
|
data: {
|
|
|
|
title: 'Nicole Braun',
|
|
|
|
}
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_agent_edit_admin_profile
|
|
|
|
@browser = browser_instance
|
|
|
|
login(
|
|
|
|
username: 'agent1@example.com',
|
|
|
|
password: 'test',
|
2018-12-19 17:31:51 +00:00
|
|
|
url: browser_url,
|
2018-03-28 05:33:41 +00:00
|
|
|
)
|
2021-07-16 13:29:38 +00:00
|
|
|
tasks_close_all
|
2018-03-28 05:33:41 +00:00
|
|
|
|
2021-08-20 08:56:23 +00:00
|
|
|
user_open_by_search(value: 'Test Admin')
|
2018-03-28 05:33:41 +00:00
|
|
|
|
|
|
|
verify_task(
|
|
|
|
data: {
|
2021-08-20 08:56:23 +00:00
|
|
|
title: 'Test Admin Agent',
|
2018-03-28 05:33:41 +00:00
|
|
|
}
|
|
|
|
)
|
|
|
|
|
|
|
|
watch_for(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .profile-window',
|
2018-03-28 05:33:41 +00:00
|
|
|
value: 'note',
|
|
|
|
)
|
|
|
|
watch_for(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .profile-window',
|
2018-03-28 05:33:41 +00:00
|
|
|
value: 'email',
|
|
|
|
)
|
|
|
|
|
2021-07-16 13:29:38 +00:00
|
|
|
empty_search
|
2018-03-28 05:33:41 +00:00
|
|
|
sleep 2
|
|
|
|
|
|
|
|
click(css: '.content.active .js-action .icon-arrow-down', fast: true)
|
2018-06-05 11:58:14 +00:00
|
|
|
exists_not(css: '.content.active .js-action [data-type="edit"]')
|
2018-03-28 05:33:41 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_agent_to_edit_admin_ticket_user_details
|
|
|
|
@browser = browser_instance
|
|
|
|
login(
|
2021-08-17 12:10:02 +00:00
|
|
|
username: 'admin@example.com',
|
2018-03-28 05:33:41 +00:00
|
|
|
password: 'test',
|
2018-12-19 17:31:51 +00:00
|
|
|
url: browser_url,
|
2018-03-28 05:33:41 +00:00
|
|
|
)
|
2021-07-16 13:29:38 +00:00
|
|
|
tasks_close_all
|
2018-03-28 05:33:41 +00:00
|
|
|
|
|
|
|
ticket1 = ticket_create(
|
|
|
|
data: {
|
2021-08-20 08:56:23 +00:00
|
|
|
customer: 'admin',
|
2018-06-05 11:58:14 +00:00
|
|
|
group: 'Users',
|
|
|
|
title: 'test_user_access_permissions - ticket 1',
|
|
|
|
body: 'test_user_access_permissions - ticket 1',
|
2018-03-28 05:33:41 +00:00
|
|
|
},
|
|
|
|
)
|
|
|
|
|
2021-07-16 13:29:38 +00:00
|
|
|
tasks_close_all
|
2018-03-28 05:33:41 +00:00
|
|
|
|
2021-07-16 13:29:38 +00:00
|
|
|
logout
|
2018-03-28 05:33:41 +00:00
|
|
|
|
|
|
|
login(
|
|
|
|
username: 'agent1@example.com',
|
|
|
|
password: 'test',
|
2018-12-19 17:31:51 +00:00
|
|
|
url: browser_url,
|
2018-03-28 05:33:41 +00:00
|
|
|
)
|
2021-07-16 13:29:38 +00:00
|
|
|
tasks_close_all
|
2018-03-28 05:33:41 +00:00
|
|
|
|
|
|
|
ticket_open_by_search(
|
|
|
|
number: ticket1[:number],
|
|
|
|
)
|
|
|
|
|
|
|
|
watch_for(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .tabsSidebar-holder',
|
2018-03-28 05:33:41 +00:00
|
|
|
value: ticket1[:title],
|
|
|
|
)
|
|
|
|
|
|
|
|
click(css: '.content.active .tabsSidebar .tabsSidebar-tab[data-tab="customer"]')
|
|
|
|
click(css: '.content.active .sidebar[data-tab="customer"] .js-actions .dropdown-toggle')
|
|
|
|
exists_not(css: '.content.active .sidebar[data-tab="customer"] .js-actions [data-type="customer-edit"]')
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_agent_to_edit_customer_ticket
|
|
|
|
@browser = browser_instance
|
|
|
|
|
|
|
|
login(
|
|
|
|
username: 'agent1@example.com',
|
|
|
|
password: 'test',
|
2018-12-19 17:31:51 +00:00
|
|
|
url: browser_url,
|
2018-03-28 05:33:41 +00:00
|
|
|
)
|
2021-07-16 13:29:38 +00:00
|
|
|
tasks_close_all
|
2018-03-28 05:33:41 +00:00
|
|
|
|
|
|
|
ticket1 = ticket_create(
|
|
|
|
data: {
|
|
|
|
customer: 'nico',
|
2018-06-05 11:58:14 +00:00
|
|
|
group: 'Users',
|
|
|
|
title: 'test_user_access_permissions - ticket 2',
|
|
|
|
body: 'test_user_access_permissions - ticket 2',
|
2018-03-28 05:33:41 +00:00
|
|
|
},
|
|
|
|
)
|
|
|
|
ticket_open_by_search(
|
|
|
|
number: ticket1[:number],
|
|
|
|
)
|
|
|
|
|
|
|
|
click(css: '.content.active .tabsSidebar .tabsSidebar-tab[data-tab="customer"]')
|
|
|
|
click(css: '.content.active .sidebar[data-tab="customer"] .js-actions .dropdown-toggle')
|
|
|
|
click(css: '.content.active .sidebar[data-tab="customer"] .js-actions [data-type="customer-edit"]')
|
|
|
|
|
2021-07-16 13:29:38 +00:00
|
|
|
modal_ready
|
2018-03-28 05:33:41 +00:00
|
|
|
set(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.modal [name="lastname"]',
|
2018-03-28 05:33:41 +00:00
|
|
|
value: 'B2',
|
|
|
|
)
|
|
|
|
set(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.modal [data-name="note"]',
|
2018-03-28 05:33:41 +00:00
|
|
|
value: 'some note abc',
|
|
|
|
)
|
|
|
|
click(css: '.content.active .modal button.js-submit')
|
2021-07-16 13:29:38 +00:00
|
|
|
modal_disappear
|
2018-03-28 05:33:41 +00:00
|
|
|
|
|
|
|
watch_for(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .sidebar[data-tab="customer"] .sidebar-block [data-name="note"]',
|
2018-03-28 05:33:41 +00:00
|
|
|
value: 'some note abc',
|
|
|
|
)
|
|
|
|
|
2018-06-05 11:58:14 +00:00
|
|
|
watch_for(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .sidebar[data-tab="customer"] .sidebar-block h3[title="Name"]',
|
2018-06-05 11:58:14 +00:00
|
|
|
value: 'Nicole B2',
|
2018-05-29 08:03:42 +00:00
|
|
|
)
|
|
|
|
|
2018-03-28 05:33:41 +00:00
|
|
|
# change lastname back
|
|
|
|
click(css: '.content.active .sidebar[data-tab="customer"] .js-actions')
|
|
|
|
click(css: 'li[data-type="customer-edit"]')
|
|
|
|
|
2021-07-16 13:29:38 +00:00
|
|
|
modal_ready
|
2018-03-28 05:33:41 +00:00
|
|
|
set(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.modal [name="lastname"]',
|
2018-03-28 05:33:41 +00:00
|
|
|
value: 'Braun',
|
|
|
|
)
|
|
|
|
set(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.modal [data-name="note"]',
|
2018-03-28 05:33:41 +00:00
|
|
|
value: 'some note abc',
|
|
|
|
)
|
|
|
|
click(css: '.content.active .modal button.js-submit')
|
2021-07-16 13:29:38 +00:00
|
|
|
modal_disappear
|
2018-03-28 05:33:41 +00:00
|
|
|
|
|
|
|
watch_for(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .sidebar[data-tab="customer"] .sidebar-block [data-name="note"]',
|
2018-03-28 05:33:41 +00:00
|
|
|
value: 'some note abc',
|
|
|
|
)
|
|
|
|
|
2018-06-05 11:58:14 +00:00
|
|
|
watch_for(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .sidebar[data-tab="customer"] .sidebar-block [title="Name"]',
|
2018-06-05 11:58:14 +00:00
|
|
|
value: 'Nicole Braun',
|
2018-03-28 05:33:41 +00:00
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_agent_to_edit_customer_ticket_details
|
|
|
|
@browser = browser_instance
|
|
|
|
|
|
|
|
login(
|
|
|
|
username: 'agent1@example.com',
|
|
|
|
password: 'test',
|
2018-12-19 17:31:51 +00:00
|
|
|
url: browser_url,
|
2018-03-28 05:33:41 +00:00
|
|
|
)
|
2021-07-16 13:29:38 +00:00
|
|
|
tasks_close_all
|
2018-03-28 05:33:41 +00:00
|
|
|
|
|
|
|
ticket1 = ticket_create(
|
|
|
|
data: {
|
|
|
|
customer: 'nico',
|
2018-06-05 11:58:14 +00:00
|
|
|
group: 'Users',
|
|
|
|
title: 'test_user_access_permissions - ticket 3',
|
|
|
|
body: 'test_user_access_permissions - ticket 3',
|
2018-03-28 05:33:41 +00:00
|
|
|
},
|
|
|
|
)
|
|
|
|
ticket_open_by_search(
|
|
|
|
number: ticket1[:number],
|
|
|
|
)
|
|
|
|
|
2018-06-05 11:58:14 +00:00
|
|
|
exists(css: '.content.active .tabsSidebar .tabsSidebar-tab[data-tab="customer"]')
|
|
|
|
exists(css: '.content.active .sidebar[data-tab="customer"] .js-actions .dropdown-toggle')
|
|
|
|
exists(css: '.content.active .sidebar[data-tab="customer"] .js-actions [data-type="customer-edit"]')
|
|
|
|
|
2018-06-05 14:22:52 +00:00
|
|
|
# scroll to the Avatar at the top of the zoom view and click it
|
|
|
|
# scrolling is needed because the browser might have scrolled down
|
|
|
|
# caused by a undeliverable email (of the created ticket)
|
|
|
|
zoom_top_avatar_selector = '.content.active .tabsSidebar-holder .js-avatar'
|
|
|
|
scroll_to(
|
|
|
|
position: 'botton',
|
|
|
|
css: zoom_top_avatar_selector,
|
|
|
|
)
|
|
|
|
click(css: zoom_top_avatar_selector)
|
2018-06-05 11:58:14 +00:00
|
|
|
|
|
|
|
# check and change note again in edit screen
|
|
|
|
click(css: '.content.active .js-action .dropdown-toggle')
|
|
|
|
click(css: '.content.active .js-action [data-type="edit"]')
|
2018-03-28 05:33:41 +00:00
|
|
|
|
2021-07-16 13:29:38 +00:00
|
|
|
modal_ready
|
2018-03-28 05:33:41 +00:00
|
|
|
set(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.modal [name="lastname"]',
|
2018-03-28 05:33:41 +00:00
|
|
|
value: 'B2',
|
|
|
|
)
|
|
|
|
set(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.modal [data-name="note"]',
|
2018-03-28 05:33:41 +00:00
|
|
|
value: 'some note abc',
|
|
|
|
)
|
|
|
|
click(css: '.content.active .modal button.js-submit')
|
2021-07-16 13:29:38 +00:00
|
|
|
modal_disappear
|
2018-03-28 05:33:41 +00:00
|
|
|
|
|
|
|
watch_for(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .profile-window',
|
2018-03-28 05:33:41 +00:00
|
|
|
value: 'some note abc',
|
|
|
|
)
|
|
|
|
|
|
|
|
verify_task(
|
|
|
|
data: {
|
|
|
|
title: 'Nicole B2',
|
|
|
|
}
|
|
|
|
)
|
|
|
|
|
|
|
|
# change lastname back
|
2018-06-05 11:58:14 +00:00
|
|
|
click(css: '.content.active .js-action .dropdown-toggle')
|
|
|
|
click(css: '.content.active .js-action [data-type="edit"]')
|
2018-03-28 05:33:41 +00:00
|
|
|
|
2021-07-16 13:29:38 +00:00
|
|
|
modal_ready
|
2018-03-28 05:33:41 +00:00
|
|
|
set(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.modal [name="lastname"]',
|
2018-03-28 05:33:41 +00:00
|
|
|
value: 'Braun',
|
|
|
|
)
|
|
|
|
set(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.modal [data-name="note"]',
|
2018-03-28 05:33:41 +00:00
|
|
|
value: 'note',
|
|
|
|
)
|
|
|
|
click(css: '.content.active .modal button.js-submit')
|
2021-07-16 13:29:38 +00:00
|
|
|
modal_disappear
|
2018-03-28 05:33:41 +00:00
|
|
|
|
|
|
|
verify_task(
|
|
|
|
data: {
|
|
|
|
title: 'Nicole Braun',
|
|
|
|
}
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_agent_to_edit_admin_ticket_details
|
|
|
|
@browser = browser_instance
|
|
|
|
|
|
|
|
login(
|
|
|
|
username: 'agent1@example.com',
|
|
|
|
password: 'test',
|
2018-12-19 17:31:51 +00:00
|
|
|
url: browser_url,
|
2018-03-28 05:33:41 +00:00
|
|
|
)
|
2021-07-16 13:29:38 +00:00
|
|
|
tasks_close_all
|
2018-03-28 05:33:41 +00:00
|
|
|
|
|
|
|
ticket1 = ticket_create(
|
|
|
|
data: {
|
2021-08-20 08:56:23 +00:00
|
|
|
customer: 'admin',
|
2018-06-05 11:58:14 +00:00
|
|
|
group: 'Users',
|
|
|
|
title: 'test_user_access_permissions - ticket 4',
|
|
|
|
body: 'test_user_access_permissions - ticket 4',
|
2018-03-28 05:33:41 +00:00
|
|
|
},
|
|
|
|
)
|
|
|
|
|
|
|
|
ticket_open_by_search(
|
|
|
|
number: ticket1[:number],
|
|
|
|
)
|
|
|
|
|
2018-06-05 11:58:14 +00:00
|
|
|
exists(css: '.content.active .tabsSidebar .tabsSidebar-tab[data-tab="customer"]')
|
|
|
|
exists(css: '.content.active .sidebar[data-tab="customer"] .js-actions .dropdown-toggle')
|
|
|
|
exists_not(css: '.content.active .sidebar[data-tab="customer"] .js-actions [data-type="customer-edit"]')
|
2018-03-28 05:33:41 +00:00
|
|
|
|
2018-07-23 18:14:26 +00:00
|
|
|
begin
|
|
|
|
retries ||= 0
|
|
|
|
|
|
|
|
# scroll to the Avatar at the top of the zoom view and click it
|
|
|
|
# scrolling is needed because the browser might have scrolled down
|
|
|
|
# caused by a undeliverable email (of the created ticket)
|
|
|
|
zoom_top_avatar_selector = '.content.active .tabsSidebar-holder .js-avatar'
|
|
|
|
scroll_to(
|
|
|
|
position: 'botton',
|
|
|
|
css: zoom_top_avatar_selector,
|
|
|
|
)
|
|
|
|
click(css: zoom_top_avatar_selector)
|
|
|
|
|
|
|
|
click(css: '.content.active .js-action .icon-arrow-down', fast: true)
|
|
|
|
exists_not(css: '.content.active .js-action [data-type="edit"]')
|
|
|
|
rescue Selenium::WebDriver::Error::UnknownError
|
|
|
|
sleep retries
|
|
|
|
retries += 1
|
|
|
|
retry if retries < 3
|
|
|
|
end
|
2018-03-28 05:33:41 +00:00
|
|
|
end
|
|
|
|
end
|