trabajo-afectivo/test/browser/agent_ticket_actions_simple_test.rb

315 lines
8.6 KiB
Ruby
Raw Normal View History

2013-04-23 18:36:09 +00:00
# encoding: utf-8
require 'browser_test_helper'
class AgentTicketActionSimpleTest < TestCase
2013-04-24 07:16:51 +00:00
def test_agent_ticket
2013-04-23 18:36:09 +00:00
tests = [
{
:name => 'agent ticket create 1',
:action => [
{
:execute => 'click',
:css => 'a[href="#new"]',
},
{
:execute => 'click',
:css => 'a[href="#ticket_create/call_inbound"]',
},
{
:execute => 'wait',
:value => 5,
},
{
:execute => 'check',
2013-06-10 09:46:07 +00:00
:css => '.active .ticket_create',
2013-04-23 18:36:09 +00:00
:result => true,
},
{
:execute => 'wait',
:value => 1,
},
{
:execute => 'set',
2013-06-10 09:46:07 +00:00
:css => '.active .ticket_create input[name="customer_id_autocompletion"]',
2013-04-23 18:36:09 +00:00
:value => 'ma',
},
{
:execute => 'wait',
:value => 4,
},
{
:execute => 'sendkey',
2013-06-10 09:46:07 +00:00
:css => '.active .ticket_create input[name="customer_id_autocompletion"]',
2013-04-23 18:36:09 +00:00
:value => :arrow_down,
},
{
:execute => 'sendkey',
2013-06-10 09:46:07 +00:00
:css => '.active .ticket_create input[name="customer_id_autocompletion"]',
2013-04-23 18:36:09 +00:00
:value => :tab,
},
{
:execute => 'select',
2013-06-10 09:46:07 +00:00
:css => '.active .ticket_create select[name="group_id"]',
2013-04-23 18:36:09 +00:00
:value => 'Users',
},
{
:execute => 'set',
2013-06-10 09:46:07 +00:00
:css => '.active .ticket_create input[name="subject"]',
2013-04-23 18:36:09 +00:00
:value => 'some subject 123äöü',
},
{
:execute => 'set',
2013-06-10 09:46:07 +00:00
:css => '.active .ticket_create textarea[name="body"]',
2013-04-23 18:36:09 +00:00
:value => 'some body 123äöü',
},
{
:execute => 'click',
2013-06-10 09:46:07 +00:00
:css => '.active .form-actions button[type="submit"]',
2013-04-23 18:36:09 +00:00
},
{
:execute => 'wait',
:value => 5,
},
{
:execute => 'check',
:css => '#login',
:result => false,
},
{
:execute => 'check',
:element => :url,
:result => '#ticket/zoom/',
},
# check ticket
{
:execute => 'match',
2013-06-10 09:46:07 +00:00
:css => '.active div.article',
2013-04-23 18:36:09 +00:00
:value => 'some body 123äöü',
:match_result => true,
},
# remember old ticket where we want to merge to
{
:execute => 'match',
2013-06-10 09:46:07 +00:00
:css => '.active .ticket-zoom small',
2013-04-23 18:36:09 +00:00
:value => '^(.*)$',
:no_quote => true,
:match_result => true,
},
# update ticket
2013-05-31 11:34:11 +00:00
{
:execute => 'select',
2013-06-10 09:46:07 +00:00
:css => '.active select[name="ticket_article_type_id"]',
2013-05-31 11:34:11 +00:00
:value => 'note',
},
2013-04-23 18:36:09 +00:00
{
:execute => 'check',
2013-06-10 09:46:07 +00:00
:css => '.active textarea[name="body"]',
2013-04-23 18:36:09 +00:00
:result => true,
},
{
:execute => 'set',
2013-06-10 09:46:07 +00:00
:css => '.active textarea[name="body"]',
2013-04-23 18:36:09 +00:00
:value => 'some body 1234 äöüß',
},
{
:execute => 'click',
2013-06-10 09:46:07 +00:00
:css => '.active button',
2013-04-23 18:36:09 +00:00
},
{
:execute => 'wait',
:value => 4,
},
{
:execute => 'match',
:css => 'body',
:value => 'some body 1234 äöüß',
:match_result => true,
},
{
:execute => 'click',
:css => '#task [data-type="close"]',
},
],
},
{
:name => 'agent ticket create 2',
:action => [
{
:execute => 'click',
:css => 'a[href="#new"]',
},
{
:execute => 'click',
:css => 'a[href="#ticket_create/call_inbound"]',
},
{
:execute => 'wait',
:value => 5,
},
{
:execute => 'check',
2013-06-10 09:46:07 +00:00
:css => '.active .ticket_create',
2013-04-23 18:36:09 +00:00
:result => true,
},
{
:execute => 'wait',
:value => 1,
},
{
:execute => 'set',
2013-06-10 09:46:07 +00:00
:css => '.active .ticket_create input[name="customer_id_autocompletion"]',
2013-04-23 18:36:09 +00:00
:value => 'ma',
},
{
:execute => 'wait',
:value => 4,
},
{
:execute => 'sendkey',
2013-06-10 09:46:07 +00:00
:css => '.active .ticket_create input[name="customer_id_autocompletion"]',
2013-04-23 18:36:09 +00:00
:value => :arrow_down,
},
{
:execute => 'sendkey',
2013-06-10 09:46:07 +00:00
:css => '.active .ticket_create input[name="customer_id_autocompletion"]',
2013-04-23 18:36:09 +00:00
:value => :tab,
},
{
:execute => 'select',
2013-06-10 09:46:07 +00:00
:css => '.active .ticket_create select[name="group_id"]',
2013-04-23 18:36:09 +00:00
:value => 'Users',
},
{
:execute => 'set',
2013-06-10 09:46:07 +00:00
:css => '.active .ticket_create input[name="subject"]',
2013-04-23 18:36:09 +00:00
:value => 'test to merge',
},
{
:execute => 'set',
2013-06-10 09:46:07 +00:00
:css => '.active .ticket_create textarea[name="body"]',
2013-04-23 18:36:09 +00:00
:value => 'some body 123äöü 222',
},
{
:execute => 'click',
2013-06-10 09:46:07 +00:00
:css => '.active .form-actions button[type="submit"]',
2013-04-23 18:36:09 +00:00
},
{
:execute => 'wait',
:value => 5,
},
{
:execute => 'check',
:css => '#login',
:result => false,
},
{
:execute => 'check',
:element => :url,
:result => '#ticket/zoom/',
},
# check ticket
{
:execute => 'match',
2013-06-10 09:46:07 +00:00
:css => '.active',
2013-04-23 18:36:09 +00:00
:value => 'some body 123äöü 222',
:match_result => true,
},
# update ticket
2013-05-31 11:34:11 +00:00
{
:execute => 'select',
2013-06-10 09:46:07 +00:00
:css => '.active select[name="ticket_article_type_id"]',
2013-05-31 11:34:11 +00:00
:value => 'note',
},
2013-04-23 18:36:09 +00:00
{
:execute => 'check',
2013-06-10 09:46:07 +00:00
:css => '.active textarea[name="body"]',
2013-04-23 18:36:09 +00:00
:result => true,
},
{
:execute => 'set',
2013-06-10 09:46:07 +00:00
:css => '.active textarea[name="body"]',
2013-04-23 18:36:09 +00:00
:value => 'some body 1234 äöüß 222',
},
{
:execute => 'click',
2013-06-10 09:46:07 +00:00
:css => '.active button',
2013-04-23 18:36:09 +00:00
},
{
:execute => 'wait',
:value => 4,
},
{
:execute => 'match',
2013-06-10 09:46:07 +00:00
:css => '.active .ticket-answer',
2013-04-23 18:36:09 +00:00
:value => 'some body 1234 äöüß 222',
:match_result => true,
},
# check if task is shown
{
:execute => 'match',
:css => 'body',
:value => 'test to merge',
:match_result => true,
},
],
},
{
:name => 'agent ticket merge',
:action => [
{
:execute => 'click',
2013-06-10 09:46:07 +00:00
:css => '.active a[data-type="merge"]',
2013-04-23 18:36:09 +00:00
},
{
:execute => 'wait',
:value => 4,
},
{
:execute => 'set',
:css => '.modal input[name="master_ticket_number"]',
:value => '###stack###',
},
{
:execute => 'click',
:css => '.modal button[type="submit"]',
},
{
:execute => 'wait',
2013-04-24 07:16:51 +00:00
:value => 6,
2013-04-23 18:36:09 +00:00
},
# check if megred to ticket is shown now
{
:execute => 'match',
2013-06-10 09:46:07 +00:00
:css => '.active .ticket-zoom small',
2013-04-23 18:36:09 +00:00
:value => '###stack###',
:match_result => true,
},
# check if task is now gone
{
:execute => 'match',
:css => 'body',
:value => 'test to merge',
2013-04-24 07:16:51 +00:00
:match_result => true,
2013-04-23 18:36:09 +00:00
},
2013-05-31 23:52:15 +00:00
# close task/cleanup
{
:execute => 'click',
:css => '#task [data-type="close"]',
},
2013-04-23 18:36:09 +00:00
],
},
]
browser_signle_test_with_login(tests, { :username => 'agent1@example.com' })
end
end