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',
|
|
|
|
url: browser_url,
|
|
|
|
)
|
|
|
|
tasks_close_all()
|
|
|
|
|
|
|
|
# search and open user
|
2018-05-29 08:03:42 +00:00
|
|
|
user_open_by_search(value: 'Nicole')
|
2018-03-28 05:33:41 +00:00
|
|
|
|
|
|
|
verify_task(
|
|
|
|
data: {
|
|
|
|
title: 'Nicole Braun',
|
|
|
|
}
|
|
|
|
)
|
|
|
|
|
|
|
|
watch_for(
|
|
|
|
css: '.content.active .profile-window',
|
|
|
|
value: 'note',
|
|
|
|
)
|
|
|
|
|
|
|
|
watch_for(
|
|
|
|
css: '.content.active .profile-window',
|
|
|
|
value: 'email',
|
|
|
|
)
|
|
|
|
|
|
|
|
# update note
|
|
|
|
set(
|
|
|
|
css: '.content.active [data-name="note"]',
|
|
|
|
value: 'some note 123',
|
|
|
|
)
|
|
|
|
empty_search()
|
|
|
|
|
|
|
|
# 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"]')
|
|
|
|
|
|
|
|
watch_for(
|
|
|
|
css: '.content.active .modal',
|
|
|
|
value: 'note',
|
|
|
|
)
|
|
|
|
watch_for(
|
|
|
|
css: '.content.active .modal',
|
|
|
|
value: 'some note 123',
|
|
|
|
)
|
|
|
|
|
|
|
|
set(
|
|
|
|
css: '.modal [name="lastname"]',
|
|
|
|
value: 'B2',
|
|
|
|
)
|
|
|
|
set(
|
|
|
|
css: '.modal [data-name="note"]',
|
|
|
|
value: 'some note abc',
|
|
|
|
)
|
|
|
|
click(css: '.content.active .modal button.js-submit')
|
|
|
|
|
|
|
|
watch_for(
|
|
|
|
css: '.content.active .profile-window',
|
|
|
|
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"]')
|
|
|
|
watch_for(
|
|
|
|
css: '.content.active .modal',
|
|
|
|
value: 'note',
|
|
|
|
)
|
|
|
|
set(
|
|
|
|
css: '.modal [name="lastname"]',
|
|
|
|
value: 'Braun',
|
|
|
|
)
|
|
|
|
click(css: '.content.active .modal button.js-submit')
|
|
|
|
|
|
|
|
verify_task(
|
|
|
|
data: {
|
|
|
|
title: 'Nicole Braun',
|
|
|
|
}
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_agent_edit_admin_profile
|
|
|
|
@browser = browser_instance
|
|
|
|
login(
|
|
|
|
username: 'agent1@example.com',
|
|
|
|
password: 'test',
|
|
|
|
url: browser_url,
|
|
|
|
)
|
|
|
|
tasks_close_all()
|
|
|
|
|
|
|
|
# search and open user
|
|
|
|
user_open_by_search(value: 'Test Master')
|
|
|
|
|
|
|
|
verify_task(
|
|
|
|
data: {
|
|
|
|
title: 'Test Master Agent',
|
|
|
|
}
|
|
|
|
)
|
|
|
|
|
|
|
|
watch_for(
|
|
|
|
css: '.content.active .profile-window',
|
|
|
|
value: 'note',
|
|
|
|
)
|
|
|
|
watch_for(
|
|
|
|
css: '.content.active .profile-window',
|
|
|
|
value: 'email',
|
|
|
|
)
|
|
|
|
|
|
|
|
empty_search()
|
|
|
|
sleep 2
|
|
|
|
|
|
|
|
click(css: '.content.active .js-action .icon-arrow-down', fast: true)
|
|
|
|
|
|
|
|
exists_not(
|
|
|
|
css: '.content.active .js-action [data-type="edit"]'
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
|
|
|
def test_agent_to_edit_admin_ticket_user_details
|
|
|
|
@browser = browser_instance
|
|
|
|
login(
|
|
|
|
username: 'master@example.com',
|
|
|
|
password: 'test',
|
|
|
|
url: browser_url,
|
|
|
|
)
|
|
|
|
tasks_close_all()
|
|
|
|
|
|
|
|
ticket1 = ticket_create(
|
|
|
|
data: {
|
|
|
|
customer: 'master',
|
|
|
|
group: 'Users',
|
2018-05-29 08:03:42 +00:00
|
|
|
title: 'test_user_access_permissions_1 - ticket 1',
|
|
|
|
body: 'test_user_access_permissions_1 - ticket 1',
|
2018-03-28 05:33:41 +00:00
|
|
|
},
|
|
|
|
)
|
|
|
|
|
|
|
|
tasks_close_all()
|
|
|
|
|
|
|
|
logout()
|
|
|
|
|
|
|
|
login(
|
|
|
|
username: 'agent1@example.com',
|
|
|
|
password: 'test',
|
|
|
|
url: browser_url,
|
|
|
|
)
|
|
|
|
tasks_close_all()
|
|
|
|
|
|
|
|
# open ticket#1
|
|
|
|
ticket_open_by_search(
|
|
|
|
number: ticket1[:number],
|
|
|
|
)
|
|
|
|
|
|
|
|
watch_for(
|
|
|
|
css: '.content.active .tabsSidebar-holder',
|
|
|
|
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',
|
|
|
|
url: browser_url,
|
|
|
|
)
|
|
|
|
tasks_close_all()
|
|
|
|
|
|
|
|
ticket1 = ticket_create(
|
|
|
|
data: {
|
|
|
|
customer: 'nico',
|
|
|
|
group: 'Users',
|
2018-05-29 08:03:42 +00:00
|
|
|
title: 'test_user_access_permissions_2 - ticket 2',
|
|
|
|
body: 'test_user_access_permissions_2 - ticket 2',
|
2018-03-28 05:33:41 +00:00
|
|
|
},
|
|
|
|
)
|
|
|
|
|
|
|
|
# open ticket#1
|
|
|
|
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"]')
|
|
|
|
|
|
|
|
set(
|
|
|
|
css: '.modal [name="lastname"]',
|
|
|
|
value: 'B2',
|
|
|
|
)
|
|
|
|
|
|
|
|
set(
|
|
|
|
css: '.modal [data-name="note"]',
|
|
|
|
value: 'some note abc',
|
|
|
|
)
|
|
|
|
|
|
|
|
click(css: '.content.active .modal button.js-submit')
|
|
|
|
|
|
|
|
watch_for(
|
|
|
|
css: '.content.active .sidebar[data-tab="customer"] .sidebar-block [data-name="note"]',
|
|
|
|
value: 'some note abc',
|
|
|
|
)
|
|
|
|
|
2018-05-29 08:03:42 +00:00
|
|
|
# search and open user
|
|
|
|
user_open_by_search(value: 'Nicole')
|
|
|
|
|
|
|
|
verify_task(
|
|
|
|
data: {
|
|
|
|
title: 'Nicole B2',
|
|
|
|
}
|
2018-03-28 05:33:41 +00:00
|
|
|
)
|
|
|
|
|
2018-05-29 08:03:42 +00:00
|
|
|
ticket_open_by_search(
|
|
|
|
number: ticket1[:number],
|
|
|
|
)
|
|
|
|
sleep 0.3
|
|
|
|
|
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"]')
|
|
|
|
|
|
|
|
watch_for(
|
|
|
|
css: '.content.active .modal',
|
|
|
|
value: 'note',
|
|
|
|
)
|
|
|
|
|
|
|
|
set(
|
|
|
|
css: '.modal [name="lastname"]',
|
|
|
|
value: 'Braun',
|
|
|
|
)
|
|
|
|
set(
|
|
|
|
css: '.modal [data-name="note"]',
|
|
|
|
value: 'some note abc',
|
|
|
|
)
|
|
|
|
click(css: '.content.active .modal button.js-submit')
|
|
|
|
|
|
|
|
watch_for(
|
|
|
|
css: '.content.active .sidebar[data-tab="customer"] .sidebar-block [data-name="note"]',
|
|
|
|
value: 'some note abc',
|
|
|
|
)
|
|
|
|
|
2018-05-29 08:03:42 +00:00
|
|
|
# search and open user
|
|
|
|
user_open_by_search(value: 'Nicole')
|
|
|
|
|
|
|
|
verify_task(
|
|
|
|
data: {
|
|
|
|
title: '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',
|
|
|
|
url: browser_url,
|
|
|
|
)
|
|
|
|
tasks_close_all()
|
|
|
|
|
2018-05-29 08:03:42 +00:00
|
|
|
# search and open user
|
|
|
|
user_open_by_search(value: 'Nicole')
|
|
|
|
|
2018-03-28 05:33:41 +00:00
|
|
|
ticket1 = ticket_create(
|
|
|
|
data: {
|
|
|
|
customer: 'nico',
|
|
|
|
group: 'Users',
|
2018-05-29 08:03:42 +00:00
|
|
|
title: 'test_user_access_permissions_2 - ticket 2',
|
|
|
|
body: 'test_user_access_permissions_2 - ticket 2',
|
2018-03-28 05:33:41 +00:00
|
|
|
},
|
|
|
|
)
|
|
|
|
|
|
|
|
ticket_open_by_search(
|
|
|
|
number: ticket1[:number],
|
|
|
|
)
|
|
|
|
|
2018-05-29 08:03:42 +00:00
|
|
|
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"]')
|
2018-03-28 05:33:41 +00:00
|
|
|
|
|
|
|
watch_for(
|
|
|
|
css: '.content.active .modal',
|
|
|
|
value: 'note',
|
|
|
|
)
|
|
|
|
|
|
|
|
set(
|
|
|
|
css: '.modal [name="lastname"]',
|
|
|
|
value: 'B2',
|
|
|
|
)
|
|
|
|
set(
|
|
|
|
css: '.modal [data-name="note"]',
|
|
|
|
value: 'some note abc',
|
|
|
|
)
|
|
|
|
click(css: '.content.active .modal button.js-submit')
|
|
|
|
|
|
|
|
watch_for(
|
2018-05-29 08:03:42 +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-05-29 08:03:42 +00:00
|
|
|
tasks_close_all()
|
|
|
|
|
|
|
|
# search and open user
|
|
|
|
user_open_by_search(value: 'Nicole')
|
|
|
|
|
2018-03-28 05:33:41 +00:00
|
|
|
verify_task(
|
|
|
|
data: {
|
|
|
|
title: 'Nicole B2',
|
|
|
|
}
|
|
|
|
)
|
|
|
|
|
2018-05-29 08:03:42 +00:00
|
|
|
ticket_open_by_search(
|
|
|
|
number: ticket1[:number],
|
|
|
|
)
|
|
|
|
|
2018-03-28 05:33:41 +00:00
|
|
|
# change lastname back
|
2018-05-29 08:03:42 +00:00
|
|
|
click(css: '.content.active .tabsSidebar .tabsSidebar-tab[data-tab="customer"]')
|
|
|
|
click(css: '.content.active .tabsSidebar .sidebar[data-tab="customer"] .js-actions .dropdown-toggle')
|
|
|
|
click(css: '.content.active .tabsSidebar .sidebar[data-tab="customer"] .js-actions li[data-type="customer-edit"]')
|
2018-03-28 05:33:41 +00:00
|
|
|
|
|
|
|
watch_for(
|
|
|
|
css: '.content.active .modal',
|
|
|
|
value: 'note',
|
|
|
|
)
|
|
|
|
set(
|
|
|
|
css: '.modal [name="lastname"]',
|
|
|
|
value: 'Braun',
|
|
|
|
)
|
|
|
|
set(
|
|
|
|
css: '.modal [data-name="note"]',
|
|
|
|
value: 'note',
|
|
|
|
)
|
|
|
|
click(css: '.content.active .modal button.js-submit')
|
|
|
|
|
2018-05-29 08:03:42 +00:00
|
|
|
# search and open user
|
|
|
|
user_open_by_search(value: 'Nicole')
|
|
|
|
|
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',
|
|
|
|
url: browser_url,
|
|
|
|
)
|
|
|
|
tasks_close_all()
|
|
|
|
|
|
|
|
ticket1 = ticket_create(
|
|
|
|
data: {
|
|
|
|
customer: 'master',
|
|
|
|
group: 'Users',
|
2018-05-29 08:03:42 +00:00
|
|
|
title: 'test_user_access_permissions_2 - ticket 2',
|
|
|
|
body: 'test_user_access_permissions_2 - ticket 2',
|
2018-03-28 05:33:41 +00:00
|
|
|
},
|
|
|
|
)
|
|
|
|
|
|
|
|
ticket_open_by_search(
|
|
|
|
number: ticket1[:number],
|
|
|
|
)
|
|
|
|
|
2018-05-29 08:03:42 +00:00
|
|
|
click(css: '.content.active .tabsSidebar .tabsSidebar-tab[data-tab="customer"]')
|
|
|
|
click(css: '.content.active .sidebar[data-tab="customer"] .js-actions .dropdown-toggle')
|
2018-03-28 05:33:41 +00:00
|
|
|
|
|
|
|
exists_not(
|
2018-05-29 08:03:42 +00:00
|
|
|
css: '.content.active .sidebar[data-tab="customer"] .js-actions [data-type="customer-edit"]'
|
2018-03-28 05:33:41 +00:00
|
|
|
)
|
|
|
|
end
|
|
|
|
end
|