trabajo-afectivo/test/browser/agent_ticket_actions_level0_test.rb

290 lines
5.9 KiB
Ruby
Raw Normal View History

# encoding: utf-8
require 'browser_test_helper'
class AgentTicketActionLevel0Test < TestCase
2015-02-23 22:37:00 +00:00
def test_text_modules
random = 'text_module_test_' + rand(99_999_999).to_s
random2 = 'text_module_test_' + rand(99_999_999).to_s
2015-02-23 22:37:00 +00:00
@browser = browser_instance
login(
username: 'master@example.com',
password: 'test',
url: browser_url,
2015-02-23 22:37:00 +00:00
)
tasks_close_all()
# create new text modules
text_module_create(
data: {
name: 'some name' + random,
keywords: random,
content: 'some content' + random,
},
2015-02-23 22:37:00 +00:00
)
text_module_create(
data: {
name: 'some name' + random2,
keywords: random2,
content: 'some content' + random2,
},
2015-02-23 22:37:00 +00:00
)
# try to use them
click( css: 'a[href="#new"]' )
click( css: 'a[href="#ticket/create"]' )
2015-02-23 22:37:00 +00:00
sleep 2
set(
css: '.active div[data-name=body]',
value: 'test ::' + random
2015-02-23 22:37:00 +00:00
)
watch_for(
css: '.active .shortcut',
value: random,
2015-02-23 22:37:00 +00:00
)
sendkey(
value: :arrow_down,
2015-02-23 22:37:00 +00:00
)
click( css: '.active .shortcut > ul> li > a' )
2015-02-23 22:37:00 +00:00
watch_for(
css: '.active div[data-name=body]',
value: 'some content' + random,
2015-02-23 22:37:00 +00:00
)
tasks_close_all( discard_changes: true )
2015-02-23 22:37:00 +00:00
# test with two browser windows
random = 'text_II_module_test_' + rand(99_999_999).to_s
user_rand = rand(99_999_999).to_s
2014-08-15 08:59:40 +00:00
login = 'agent-text-module-' + user_rand
firstname = 'Text' + user_rand
lastname = 'Module' + user_rand
email = 'agent-text-module-' + user_rand + '@example.com'
password = 'agentpw'
2015-02-23 22:37:00 +00:00
# use current session
browser1 = @browser
2014-08-15 08:59:40 +00:00
2015-02-23 22:37:00 +00:00
browser2 = browser_instance
login(
browser: browser2,
username: 'agent1@example.com',
password: 'test',
url: browser_url,
2015-02-23 22:37:00 +00:00
)
tasks_close_all(
browser: browser2,
2015-02-23 22:37:00 +00:00
)
# create new ticket
ticket_create(
browser: browser2,
data: {
title: 'A',
2014-08-15 08:59:40 +00:00
},
do_not_submit: true,
2015-02-23 22:37:00 +00:00
)
ticket_create(
browser: browser2,
data: {
title: 'B',
},
do_not_submit: true,
2015-02-23 22:37:00 +00:00
)
# create new text module
text_module_create(
browser: browser1,
data: {
name: 'some name' + random,
keywords: random,
content: 'some content <%= @ticket.customer.lastname %>' + random,
},
2015-02-23 22:37:00 +00:00
)
# create user to test placeholder
user_create(
browser: browser1,
data: {
login: login,
firstname: firstname,
lastname: lastname,
email: email,
password: password,
2014-08-14 09:04:02 +00:00
},
2015-02-23 22:37:00 +00:00
)
# check if text module exists in instance2, for ready to use
set(
browser: browser2,
css: '.active div[data-name=body]',
value: 'test ::' + random
2015-02-23 22:37:00 +00:00
)
watch_for(
browser: browser2,
css: '.active .shortcut',
value: random,
2015-02-23 22:37:00 +00:00
)
sendkey(
browser: browser2,
value: :arrow_down,
2015-02-23 22:37:00 +00:00
)
click(
browser: browser2,
css: '.active .shortcut > ul> li > a',
2015-02-23 22:37:00 +00:00
)
watch_for(
browser: browser2,
css: '.active div[data-name=body]',
value: 'some content ' + random,
2015-02-23 22:37:00 +00:00
)
sleep 2
set(
browser: browser2,
css: '.active .newTicket input[name="customer_id_completion"]',
value: 'nicole',
2015-02-23 22:37:00 +00:00
)
sleep 4
sendkey(
browser: browser2,
value: :arrow_down,
2015-02-23 22:37:00 +00:00
)
click(
browser: browser2,
css: '.active .newTicket .recipientList-entry.js-user.is-active',
2015-02-23 22:37:00 +00:00
)
set(
browser: browser2,
css: '.active div[data-name=body]',
value: '::' + random,
2015-02-23 22:37:00 +00:00
)
sendkey(
browser: browser2,
value: :arrow_down,
2015-02-23 22:37:00 +00:00
)
click(
browser: browser2,
css: '.active .shortcut > ul> li > a',
2015-02-23 22:37:00 +00:00
)
watch_for(
browser: browser2,
css: '.active div[data-name=body]',
value: 'some content Braun' + random,
2015-02-23 22:37:00 +00:00
)
# verify zoom
click(
browser: browser1,
css: 'a[href="#manage"]',
2015-02-23 22:37:00 +00:00
)
# create ticket
ticket_create(
browser: browser2,
data: {
customer: 'nico',
group: 'Users',
title: 'some subject 123äöü',
body: 'some body 123äöü',
2015-02-23 22:37:00 +00:00
},
)
set(
browser: browser2,
css: '.active div[data-name=body]',
value: 'test',
2015-02-23 22:37:00 +00:00
)
set(
browser: browser2,
css: '.active div[data-name=body]',
value: '::' + random,
2015-02-23 22:37:00 +00:00
)
2015-02-23 22:58:05 +00:00
2015-02-23 22:37:00 +00:00
sendkey(
browser: browser2,
value: :arrow_down,
2015-02-23 22:37:00 +00:00
)
2015-02-23 22:58:05 +00:00
2015-02-23 22:37:00 +00:00
click(
browser: browser2,
css: '.active .shortcut > ul> li > a',
2015-02-23 22:37:00 +00:00
)
watch_for(
browser: browser2,
css: '.active div[data-name=body]',
value: 'some content Braun' + random,
2015-02-23 22:37:00 +00:00
)
# change customer
click(
browser: browser1,
css: 'a[href="#manage"]',
2015-02-23 22:37:00 +00:00
)
click(
browser: browser2,
2015-05-31 22:47:53 +00:00
css: '.active div[data-tab="ticket"] .js-actions .icon-arrow-down',
2015-02-23 22:37:00 +00:00
)
click(
browser: browser2,
2015-09-30 06:36:15 +00:00
css: '.active div[data-tab="ticket"] .js-actions [data-type="customer-change"]',
2015-02-23 22:37:00 +00:00
)
sleep 1
set(
browser: browser2,
css: '.modal [name="customer_id_completion"]',
value: firstname,
2015-02-23 22:37:00 +00:00
)
sleep 4
sendkey(
browser: browser2,
value: :arrow_down,
2015-02-23 22:37:00 +00:00
)
click(
browser: browser2,
css: '.modal .recipientList-entry.js-user.is-active',
2015-02-23 22:37:00 +00:00
)
click(
browser: browser2,
css: '.modal-content .js-submit',
2015-02-23 22:37:00 +00:00
)
watch_for_disappear(
browser: browser2,
css: '.modal',
2015-02-23 22:37:00 +00:00
)
2015-02-24 00:11:10 +00:00
set(
browser: browser2,
css: '.active div[data-name=body]',
value: '::' + random,
2015-02-23 22:37:00 +00:00
)
sendkey(
browser: browser2,
value: :arrow_down,
2015-02-23 22:37:00 +00:00
)
2014-08-14 09:04:02 +00:00
sleep 1
2015-02-23 22:37:00 +00:00
click(
browser: browser2,
css: '.active .shortcut > ul> li > a',
2015-02-23 22:37:00 +00:00
)
2014-08-14 09:04:02 +00:00
2015-02-23 22:37:00 +00:00
watch_for(
browser: browser2,
css: '.active div[data-name=body]',
value: 'some content ' + lastname,
2015-02-23 22:37:00 +00:00
)
end
end