trabajo-afectivo/test/browser/agent_user_profile_test.rb

155 lines
3.1 KiB
Ruby
Raw Normal View History

# Copyright (C) 2012-2021 Zammad Foundation, http://zammad-foundation.org/
require 'browser_test_helper'
class AgentUserProfileTest < TestCase
2015-02-23 15:35:48 +00:00
def test_user_profile
message = "1 #{rand(99_999_999)}"
2015-02-23 13:02:46 +00:00
@browser = browser_instance
login(
2021-08-17 12:10:02 +00:00
username: 'admin@example.com',
password: 'test',
url: browser_url,
2015-02-23 13:02:46 +00:00
)
tasks_close_all
2015-02-23 13:02:46 +00:00
# search and open user
2016-03-15 11:47:26 +00:00
user_open_by_search(value: 'Braun')
2015-02-23 13:02:46 +00:00
verify_task(
data: {
title: 'Nicole Braun',
}
)
2015-02-23 13:02:46 +00:00
watch_for(
css: '.active .profile-window',
value: 'note',
2015-02-23 13:02:46 +00:00
)
watch_for(
css: '.active .profile-window',
value: 'email',
2015-02-23 13:02:46 +00:00
)
# update note
set(
css: '.active [data-name="note"]',
value: 'some note 123',
)
empty_search
2015-02-23 13:02:46 +00:00
sleep 2
# check and change note again in edit screen
click(css: '.active .js-action .icon-arrow-down', fast: true)
2016-03-15 11:47:26 +00:00
click(css: '.active .js-action [data-type="edit"]')
2015-02-23 13:02:46 +00:00
modal_ready
2015-02-23 13:02:46 +00:00
watch_for(
css: '.active .modal',
value: 'some note 123',
2015-02-23 13:02:46 +00:00
)
set(
css: '.modal [name="lastname"]',
value: 'B2',
)
2015-02-23 13:02:46 +00:00
set(
css: '.modal [data-name="note"]',
value: 'some note abc',
2015-02-23 13:02:46 +00:00
)
2016-03-15 11:47:26 +00:00
click(css: '.active .modal button.js-submit')
modal_disappear
2015-02-23 13:02:46 +00:00
watch_for(
css: '.active .profile-window',
value: 'some note abc',
2015-02-23 13:02:46 +00:00
)
verify_task(
data: {
title: 'Nicole B2',
}
)
# change lastname back
click(css: '.active .js-action .icon-arrow-down', fast: true)
click(css: '.active .js-action [data-type="edit"]')
modal_ready
set(
css: '.modal [name="lastname"]',
value: 'Braun',
)
click(css: '.active .modal button.js-submit')
modal_disappear
verify_task(
data: {
title: 'Nicole Braun',
}
)
2015-02-23 13:02:46 +00:00
# create new ticket
ticket_create(
data: {
customer: 'nico',
group: 'Users',
title: "user profile check #{message}",
body: "user profile check #{message}",
},
2015-02-23 13:02:46 +00:00
)
# switch to org tab, verify if ticket is shown
2016-03-15 11:47:26 +00:00
user_open_by_search(value: 'Braun')
2015-02-23 13:02:46 +00:00
watch_for(
css: '.active .profile-window',
value: "user profile check #{message}",
2015-02-23 13:02:46 +00:00
)
tasks_close_all
2015-02-23 15:35:48 +00:00
# work with two browser windows
message = "comment 1 #{rand(99_999_999_999_999_999)}"
2015-02-23 15:35:48 +00:00
# use current session
browser1 = @browser
browser2 = browser_instance
login(
browser: browser2,
username: 'agent1@example.com',
password: 'test',
url: browser_url,
2015-02-23 15:35:48 +00:00
)
tasks_close_all(
browser: browser2,
2015-02-23 15:35:48 +00:00
)
user_open_by_search(
browser: browser1,
value: 'Braun',
2015-02-23 15:35:48 +00:00
)
user_open_by_search(
browser: browser2,
value: 'Braun',
2015-02-23 15:35:48 +00:00
)
# update note
set(
browser: browser1,
css: '.active [data-name="note"]',
value: message,
2015-02-23 15:35:48 +00:00
)
2016-03-15 11:47:26 +00:00
empty_search(
browser: browser1,
2015-02-23 15:35:48 +00:00
)
watch_for(
browser: browser2,
css: '.active .profile-window',
value: message,
2015-02-23 15:35:48 +00:00
)
end
end