2012-12-14 10:14:48 +00:00
|
|
|
require 'browser_test_helper'
|
2013-02-12 00:56:23 +00:00
|
|
|
|
2013-02-23 22:54:48 +00:00
|
|
|
class CustomerTicketCreateTest < TestCase
|
2018-07-06 12:30:12 +00:00
|
|
|
def test_customer_ticket_create_and_verify_state_after_update
|
2015-02-22 22:20:05 +00:00
|
|
|
@browser = browser_instance
|
|
|
|
login(
|
2015-04-27 13:42:53 +00:00
|
|
|
username: 'nicole.braun@zammad.org',
|
|
|
|
password: 'test',
|
2018-12-19 17:31:51 +00:00
|
|
|
url: browser_url,
|
2015-02-22 22:20:05 +00:00
|
|
|
)
|
2013-02-21 21:09:36 +00:00
|
|
|
|
2015-02-22 22:20:05 +00:00
|
|
|
# customer ticket create
|
2018-03-06 05:30:12 +00:00
|
|
|
click(css: 'a[href="#new"]', only_if_exists: true)
|
2016-03-22 12:58:48 +00:00
|
|
|
click(css: 'a[href="#customer_ticket_new"]')
|
2015-02-22 22:20:05 +00:00
|
|
|
sleep 2
|
2013-02-21 21:09:36 +00:00
|
|
|
|
2015-02-22 22:20:05 +00:00
|
|
|
select(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.newTicket select[name="group_id"]',
|
2015-04-27 13:42:53 +00:00
|
|
|
value: 'Users',
|
2015-02-22 22:20:05 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
set(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.newTicket input[name="title"]',
|
2015-04-27 13:42:53 +00:00
|
|
|
value: 'some subject 123äöü',
|
2015-02-22 22:20:05 +00:00
|
|
|
)
|
|
|
|
set(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.newTicket [data-name="body"]',
|
2015-04-27 13:42:53 +00:00
|
|
|
value: 'some body 123äöü',
|
2015-02-22 22:20:05 +00:00
|
|
|
)
|
2017-01-03 09:57:05 +00:00
|
|
|
exists_not(
|
|
|
|
css: '.newTicket input[name="customer_id"]',
|
|
|
|
)
|
|
|
|
exists_not(
|
|
|
|
css: '.newTicket input[name="priority_id"]',
|
|
|
|
)
|
|
|
|
|
2016-03-22 12:58:48 +00:00
|
|
|
click(css: '.newTicket button.js-submit')
|
2015-02-22 22:20:05 +00:00
|
|
|
sleep 5
|
|
|
|
|
|
|
|
# check if ticket is shown
|
2016-03-22 12:58:48 +00:00
|
|
|
location_check(url: '#ticket/zoom/')
|
2015-02-22 22:20:05 +00:00
|
|
|
|
|
|
|
match(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.active div.ticket-article',
|
|
|
|
value: 'some body 123äöü',
|
2015-04-27 13:42:53 +00:00
|
|
|
no_quote: true,
|
2015-02-22 22:20:05 +00:00
|
|
|
)
|
|
|
|
|
2018-07-06 12:30:12 +00:00
|
|
|
# verify if the state has changed to open
|
|
|
|
match(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .sidebar [name="state_id"]',
|
2018-07-06 12:30:12 +00:00
|
|
|
value: 'new',
|
|
|
|
)
|
|
|
|
|
2015-02-22 22:20:05 +00:00
|
|
|
# update ticket
|
|
|
|
set(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active [data-name="body"]',
|
|
|
|
value: 'some body 1234 äöüß',
|
2015-12-05 19:44:43 +00:00
|
|
|
no_click: true,
|
2015-02-22 22:20:05 +00:00
|
|
|
)
|
2015-11-06 01:43:26 +00:00
|
|
|
|
|
|
|
task_type(
|
|
|
|
type: 'stayOnTab',
|
|
|
|
)
|
|
|
|
|
2017-01-03 09:57:05 +00:00
|
|
|
click(css: '.content.active .js-submit')
|
2015-02-22 22:20:05 +00:00
|
|
|
|
|
|
|
watch_for(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active div.ticket-article',
|
2015-04-27 13:42:53 +00:00
|
|
|
value: 'some body 1234 äöüß',
|
2015-02-22 22:20:05 +00:00
|
|
|
)
|
2018-02-07 10:46:17 +00:00
|
|
|
|
2018-07-06 12:30:12 +00:00
|
|
|
# check if the ticket state is new after update by customer
|
|
|
|
match(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .sidebar [name="state_id"]',
|
2018-07-06 12:30:12 +00:00
|
|
|
value: 'new',
|
|
|
|
)
|
|
|
|
|
2018-02-07 10:46:17 +00:00
|
|
|
# now we want to verify the default followup state
|
|
|
|
# for this case we close the ticket first and then
|
|
|
|
# write a new article. If the content is written
|
|
|
|
# then the state should change initially to open
|
|
|
|
|
|
|
|
# close the ticket
|
|
|
|
select(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active [name="state_id"]',
|
2018-02-07 10:46:17 +00:00
|
|
|
value: 'closed',
|
|
|
|
)
|
|
|
|
|
|
|
|
set(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active [data-name="body"]',
|
|
|
|
value: 'close #1',
|
2018-02-07 10:46:17 +00:00
|
|
|
no_click: true,
|
|
|
|
)
|
|
|
|
|
|
|
|
click(css: '.content.active .js-submit')
|
|
|
|
watch_for(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active div.ticket-article',
|
2018-02-07 10:46:17 +00:00
|
|
|
value: 'close #1',
|
|
|
|
)
|
|
|
|
|
|
|
|
# check if the ticket is closed
|
|
|
|
match(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .sidebar [name="state_id"]',
|
2018-02-07 10:46:17 +00:00
|
|
|
value: 'closed',
|
|
|
|
)
|
|
|
|
|
2019-08-16 15:39:31 +00:00
|
|
|
# type in new content into rte to trigger the default follow-up state
|
2018-02-07 10:46:17 +00:00
|
|
|
set(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active [data-name="body"]',
|
|
|
|
value: 'some body blublub default followup for reopen check',
|
2018-02-07 10:46:17 +00:00
|
|
|
no_click: true,
|
|
|
|
)
|
|
|
|
|
|
|
|
# verify if the state has changed to open
|
|
|
|
watch_for(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .sidebar [name="state_id"]',
|
2018-02-07 10:46:17 +00:00
|
|
|
value: 'open',
|
|
|
|
)
|
|
|
|
|
|
|
|
# no we verify the reverse way:
|
|
|
|
# if the body get changed to empty again then
|
2019-08-16 15:39:31 +00:00
|
|
|
# the default follow-up state should get unset and
|
2018-02-07 10:46:17 +00:00
|
|
|
# will change to the the default ticket state.
|
|
|
|
|
|
|
|
# remove content from rte
|
|
|
|
set(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active [data-name="body"]',
|
|
|
|
value: '',
|
2018-02-07 10:46:17 +00:00
|
|
|
no_click: true,
|
|
|
|
)
|
|
|
|
|
|
|
|
# check if state changed to closed again
|
|
|
|
watch_for(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .sidebar [name="state_id"]',
|
2018-02-07 10:46:17 +00:00
|
|
|
value: 'closed',
|
|
|
|
)
|
|
|
|
|
2019-08-16 15:39:31 +00:00
|
|
|
# type in new content into rte to trigger the default follow-up state
|
2018-02-07 10:46:17 +00:00
|
|
|
set(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active [data-name="body"]',
|
|
|
|
value: 'some body blublub default followup for reopen check',
|
2018-02-07 10:46:17 +00:00
|
|
|
no_click: true,
|
|
|
|
)
|
|
|
|
|
|
|
|
# verify if the state has changed to open
|
|
|
|
watch_for(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .sidebar [name="state_id"]',
|
2018-02-07 10:46:17 +00:00
|
|
|
value: 'open',
|
|
|
|
)
|
|
|
|
|
|
|
|
# submit and reload to check if the new state is set
|
|
|
|
click(css: '.content.active .js-submit')
|
|
|
|
|
|
|
|
watch_for(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active div.ticket-article',
|
2018-02-07 10:46:17 +00:00
|
|
|
value: 'some body blublub default followup for reopen check',
|
|
|
|
)
|
|
|
|
|
|
|
|
# verify if the state has changed to open
|
|
|
|
match(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.content.active .sidebar [name="state_id"]',
|
2018-02-07 10:46:17 +00:00
|
|
|
value: 'open',
|
|
|
|
)
|
2012-12-14 10:14:48 +00:00
|
|
|
end
|
2018-03-07 21:58:03 +00:00
|
|
|
|
2018-07-06 12:30:12 +00:00
|
|
|
def test_customer_ticket_create_relogin_with_agent_ticket_create
|
2018-03-07 21:58:03 +00:00
|
|
|
@browser = browser_instance
|
|
|
|
login(
|
|
|
|
username: 'nicole.braun@zammad.org',
|
|
|
|
password: 'test',
|
2018-12-19 17:31:51 +00:00
|
|
|
url: browser_url,
|
2018-03-07 21:58:03 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
# customer ticket create
|
|
|
|
click(css: 'a[href="#new"]', only_if_exists: true)
|
|
|
|
click(css: 'a[href="#customer_ticket_new"]')
|
|
|
|
sleep 2
|
|
|
|
|
|
|
|
select(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.newTicket select[name="group_id"]',
|
2018-03-07 21:58:03 +00:00
|
|
|
value: 'Users',
|
|
|
|
)
|
|
|
|
|
|
|
|
set(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.newTicket input[name="title"]',
|
2018-03-07 21:58:03 +00:00
|
|
|
value: 'relogin - customer - agent - test 1',
|
|
|
|
)
|
|
|
|
set(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.newTicket [data-name="body"]',
|
2018-03-07 21:58:03 +00:00
|
|
|
value: 'relogin - customer - agent - test 1',
|
|
|
|
)
|
|
|
|
|
|
|
|
click(css: '.newTicket button.js-submit')
|
|
|
|
sleep 5
|
|
|
|
|
|
|
|
# check if ticket is shown
|
|
|
|
location_check(url: '#ticket/zoom/')
|
|
|
|
|
|
|
|
match(
|
2018-12-19 17:31:51 +00:00
|
|
|
css: '.active div.ticket-article',
|
|
|
|
value: 'relogin - customer - agent - test 1',
|
2018-03-07 21:58:03 +00:00
|
|
|
no_quote: true,
|
|
|
|
)
|
|
|
|
|
|
|
|
logout()
|
|
|
|
|
|
|
|
# verify if we still can create new tickets as agent
|
|
|
|
login(
|
|
|
|
username: 'master@example.com',
|
|
|
|
password: 'test',
|
2018-12-19 17:31:51 +00:00
|
|
|
url: browser_url,
|
2018-03-07 21:58:03 +00:00
|
|
|
)
|
|
|
|
tasks_close_all()
|
|
|
|
|
2019-06-28 11:38:49 +00:00
|
|
|
ticket_create(
|
2018-03-07 21:58:03 +00:00
|
|
|
data: {
|
|
|
|
customer: 'nico',
|
2018-12-19 17:31:51 +00:00
|
|
|
group: 'Users',
|
|
|
|
title: 'relogin - customer - agent - test 2',
|
|
|
|
body: 'relogin - customer - agent - test 2',
|
|
|
|
state: 'closed',
|
2018-03-07 21:58:03 +00:00
|
|
|
},
|
|
|
|
)
|
|
|
|
end
|
|
|
|
|
2018-05-17 15:20:17 +00:00
|
|
|
def test_customer_disable_ticket_creation
|
|
|
|
@browser = browser_instance
|
|
|
|
|
|
|
|
# disable ticket creation
|
|
|
|
login(
|
|
|
|
username: 'master@example.com',
|
|
|
|
password: 'test',
|
2018-12-19 17:31:51 +00:00
|
|
|
url: browser_url,
|
2018-05-17 15:20:17 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
click(css: 'a[href="#manage"]')
|
|
|
|
click(css: 'a[href="#channels/web"]')
|
|
|
|
|
|
|
|
@browser.find_element(css: 'select[name=customer_ticket_create]').find_element(css: 'option[value=false]').click
|
|
|
|
click(css: '#customer_ticket_create .btn')
|
|
|
|
|
|
|
|
sleep(1)
|
|
|
|
|
|
|
|
logout()
|
|
|
|
|
|
|
|
# check if new ticket button is not visible
|
|
|
|
|
|
|
|
login(
|
|
|
|
username: 'nicole.braun@zammad.org',
|
|
|
|
password: 'test',
|
2018-12-19 17:31:51 +00:00
|
|
|
url: browser_url,
|
2018-05-17 15:20:17 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
assert(exists_not(css: 'a[href="#customer_ticket_new"]'))
|
|
|
|
|
|
|
|
logout()
|
|
|
|
|
|
|
|
# enable ticket creation
|
|
|
|
|
|
|
|
login(
|
|
|
|
username: 'master@example.com',
|
|
|
|
password: 'test',
|
2018-12-19 17:31:51 +00:00
|
|
|
url: browser_url,
|
2018-05-17 15:20:17 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
click(css: 'a[href="#manage"]')
|
|
|
|
click(css: 'a[href="#channels/web"]')
|
|
|
|
|
|
|
|
@browser.find_element(css: 'select[name=customer_ticket_create]').find_element(css: 'option[value=true]').click
|
|
|
|
click(css: '#customer_ticket_create .btn')
|
|
|
|
|
|
|
|
sleep(1)
|
|
|
|
|
|
|
|
logout()
|
|
|
|
|
|
|
|
# check if new ticket button is visible
|
|
|
|
|
|
|
|
login(
|
|
|
|
username: 'nicole.braun@zammad.org',
|
|
|
|
password: 'test',
|
2018-12-19 17:31:51 +00:00
|
|
|
url: browser_url,
|
2018-05-17 15:20:17 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
assert(exists(css: 'a[href="#customer_ticket_new"]'))
|
|
|
|
end
|
2015-04-27 14:15:29 +00:00
|
|
|
end
|