123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539 |
- # encoding: utf-8
- require 'browser_test_helper'
- class AgentTicketActionLevel5Test < TestCase
- def test_I
- random = 'text_module_test_' + rand(99999999).to_s
- random2 = 'text_module_test_' + rand(99999999).to_s
- # user
- tests = [
- {
- :name => 'add #1',
- :action => [
- {
- :execute => 'close_all_tasks',
- },
- {
- :execute => 'click',
- :css => 'a[href="#manage"]',
- },
- {
- :execute => 'click',
- :css => 'a[href="#manage/text_modules"]',
- },
- {
- :execute => 'click',
- :css => 'a[data-type="new"]',
- },
- {
- :execute => 'set',
- :css => '.modal input[name=name]',
- :value => 'some name' + random,
- },
- {
- :execute => 'set',
- :css => '.modal input[name="keywords"]',
- :value => random,
- },
- {
- :execute => 'set',
- :css => '.modal textarea[name="content"]',
- :value => 'some content' + random,
- },
- {
- :execute => 'click',
- :css => '.modal button.js-submit',
- },
- {
- :execute => 'wait',
- :value => 3,
- },
- {
- :execute => 'match',
- :css => 'body',
- :value => random,
- :match_result => true,
- },
- ],
- },
- {
- :name => 'add #2',
- :action => [
- {
- :execute => 'click',
- :css => 'a[href="#manage"]',
- },
- {
- :execute => 'click',
- :css => 'a[href="#manage/text_modules"]',
- },
- {
- :execute => 'click',
- :css => 'a[data-type="new"]',
- },
- {
- :execute => 'set',
- :css => '.modal input[name=name]',
- :value => 'some name' + random2,
- },
- {
- :execute => 'set',
- :css => '.modal input[name="keywords"]',
- :value => random2,
- },
- {
- :execute => 'set',
- :css => '.modal textarea[name="content"]',
- :value => 'some content' + random2,
- },
- {
- :execute => 'click',
- :css => '.modal button.js-submit',
- },
- {
- :execute => 'wait',
- :value => 3,
- },
- {
- :execute => 'match',
- :css => 'body',
- :value => random2,
- :match_result => true,
- },
- ],
- },
- {
- :name => 'verify usage',
- :action => [
- {
- :execute => 'click',
- :css => 'a[href="#new"]',
- },
- {
- :execute => 'click',
- :css => 'a[href="#ticket/create"]',
- },
- {
- :execute => 'wait',
- :value => 2,
- },
- {
- :execute => 'set',
- :css => '.active [data-name="body"]',
- :value => 'test ::' + random,
- },
- {
- :execute => 'wait',
- :value => 2,
- },
- {
- :execute => 'match',
- :css => 'body',
- :value => random,
- :match_result => true,
- },
- {
- :execute => 'sendkey',
- :value => [:arrow_down,:enter]
- },
- {
- :execute => 'wait',
- :value => 1,
- },
- {
- :execute => 'match',
- :css => '.active [data-name="body"]',
- :value => 'some content' + random,
- :match_result => true,
- },
- ],
- },
- ]
- browser_signle_test_with_login(tests, { :username => 'master@example.com' })
- end
- def test_II
- random = 'text_II_module_test_' + rand(99999999).to_s
- user_rand = rand(99999999).to_s
- login = 'agent-text-module-' + user_rand
- firstname = 'Text' + user_rand
- lastname = 'Module' + user_rand
- email = 'agent-text-module-' + user_rand + '@example.com'
- password = 'agentpw'
- # user
- tests = [
- {
- :name => 'start',
- :instance1 => browser_instance,
- :instance2 => browser_instance,
- :instance1_username => 'master@example.com',
- :instance1_password => 'test',
- :instance2_username => 'agent1@example.com',
- :instance2_password => 'test',
- :action => [
- # create ticket
- {
- :where => :instance2,
- :execute => 'close_all_tasks',
- },
- {
- :where => :instance2,
- :execute => 'create_ticket',
- :subject => 'A',
- :customer => '',
- :do_not_submit => true,
- },
- {
- :where => :instance2,
- :execute => 'create_ticket',
- :customer => '',
- :subject => 'B',
- :do_not_submit => true,
- },
- # create new text module
- {
- :where => :instance1,
- :execute => 'click',
- :css => 'a[href="#manage"]',
- },
- {
- :where => :instance1,
- :execute => 'click',
- :css => 'a[href="#manage/text_modules"]',
- },
- {
- :where => :instance1,
- :execute => 'click',
- :css => 'a[data-type="new"]',
- },
- {
- :where => :instance1,
- :execute => 'set',
- :css => '.modal input[name=name]',
- :value => 'some name' + random,
- },
- {
- :where => :instance1,
- :execute => 'set',
- :css => '.modal input[name="keywords"]',
- :value => random,
- },
- {
- :where => :instance1,
- :execute => 'set',
- :css => '.modal textarea[name="content"]',
- :value => 'some content <%= @ticket.customer.lastname %>' + random,
- },
- {
- :where => :instance1,
- :execute => 'click',
- :css => '.modal button.js-submit',
- },
- {
- :execute => 'wait',
- :value => 3,
- },
- {
- :where => :instance1,
- :execute => 'match',
- :css => 'body',
- :value => random,
- :match_result => true,
- },
- ],
- },
- # create user
- {
- :name => 'create user',
- :action => [
- {
- :where => :instance1,
- :execute => 'create_user',
- :login => login,
- :firstname => firstname,
- :lastname => lastname,
- :email => email,
- :password => password,
- },
- ],
- },
- {
- :name => 'check if text module exists in instance2, for ready to use',
- :action => [
- {
- :execute => 'wait',
- :value => 4,
- },
- {
- :where => :instance2,
- :execute => 'set',
- :css => '.active [data-name="body"]',
- :value => '::' + random,
- },
- {
- :where => :instance2,
- :execute => 'wait',
- :value => 2,
- },
- {
- :where => :instance2,
- :execute => 'match',
- :css => 'body',
- :value => random,
- :match_result => true,
- },
- {
- :where => :instance2,
- :execute => 'sendkey',
- :value => [:arrow_down,:enter]
- },
- {
- :where => :instance2,
- :execute => 'wait',
- :value => 1,
- },
- {
- :where => :instance2,
- :execute => 'match',
- :css => '.active [data-name="body"]',
- :value => 'some content ' + random,
- :match_result => true,
- },
- {
- :execute => 'wait',
- :value => 3,
- },
- {
- :where => :instance2,
- :execute => 'set',
- :css => '.active .newTicket input[name="customer_id_completion"]',
- :value => 'nicole',
- },
- {
- :execute => 'wait',
- :value => 4,
- },
- {
- :where => :instance2,
- :execute => 'sendkey',
- :value => [:arrow_down,:enter]
- },
- {
- :where => :instance2,
- :execute => 'wait',
- :value => 1,
- },
- {
- :where => :instance2,
- :execute => 'set',
- :css => '.active [data-name="body"]',
- :value => '::' + random,
- },
- {
- :where => :instance2,
- :execute => 'wait',
- :value => 1,
- },
- {
- :where => :instance2,
- :execute => 'sendkey',
- :value => [:arrow_down,:enter]
- },
- {
- :where => :instance2,
- :execute => 'wait',
- :value => 1,
- },
- {
- :where => :instance2,
- :execute => 'match',
- :css => '.active [data-name="body"]',
- :value => 'some content Braun' + random,
- :match_result => true,
- },
- ],
- },
- {
- :name => 'verify zoom',
- :action => [
- {
- :where => :instance1,
- :execute => 'click',
- :css => 'a[href="#manage"]',
- },
- # create ticket
- {
- :where => :instance2,
- :execute => 'create_ticket',
- :group => 'Users',
- :subject => 'some subject 123äöü',
- :body => 'some body 123äöü',
- },
- # check ticket
- {
- :where => :instance2,
- :execute => 'match',
- :css => '.active div.ticket-article',
- :value => 'some body 123äöü',
- :match_result => true,
- },
- # check ticket zoom
- {
- :execute => 'wait',
- :value => 4,
- },
- {
- :where => :instance2,
- :execute => 'set',
- :css => '.active [data-name="body"]',
- :value => 'test',
- },
- {
- :execute => 'wait',
- :value => 2,
- },
- {
- :where => :instance2,
- :execute => 'set',
- :css => '.active [data-name="body"]',
- :value => '::' + random,
- },
- {
- :execute => 'wait',
- :value => 2,
- },
- {
- :where => :instance2,
- :execute => 'match',
- :css => 'body',
- :value => random,
- :match_result => true,
- },
- {
- :where => :instance2,
- :execute => 'sendkey',
- :value => [:arrow_down,:enter]
- },
- {
- :execute => 'wait',
- :value => 1,
- },
- {
- :where => :instance2,
- :execute => 'match',
- :css => '.active [data-name="body"]',
- :value => 'some content Braun' + random,
- :match_result => true,
- },
- ],
- },
- {
- :name => 'change customer',
- :action => [
- {
- :where => :instance1,
- :execute => 'click',
- :css => 'a[href="#manage"]',
- },
- # create ticket
- {
- :where => :instance2,
- :execute => 'click',
- :css => '.content.active .tabsSidebar-tabs [data-tab="customer"]',
- },
- {
- :where => :instance2,
- :execute => 'click',
- :css => '.content.active .tabsSidebar [data-name="Change Customer"]',
- },
- {
- :execute => 'wait',
- :value => 1,
- },
- {
- :where => :instance2,
- :execute => 'set',
- :css => '.modal [name="customer_id_completion"]',
- :value => firstname,
- },
- {
- :execute => 'wait',
- :value => 4,
- },
- {
- :where => :instance2,
- :execute => 'sendkey',
- :value => [:arrow_down,:enter]
- },
- {
- :where => :instance2,
- :execute => 'wait',
- :value => 1,
- },
- {
- :where => :instance2,
- :execute => 'click',
- :css => '.modal-content .js-submit',
- },
- {
- :where => :instance2,
- :execute => 'wait',
- :value => 4,
- },
- {
- :where => :instance2,
- :execute => 'set',
- :css => '.active [data-name="body"]',
- :value => '::' + random,
- },
- {
- :execute => 'wait',
- :value => 2,
- },
- # {
- # :where => :instance2,
- # :execute => 'match',
- # :css => 'body',
- # :value => random,
- # :match_result => true,
- # },
- {
- :where => :instance2,
- :execute => 'sendkey',
- :value => [:arrow_down,:enter]
- },
- {
- :execute => 'wait',
- :value => 1,
- },
- {
- :where => :instance2,
- :execute => 'match',
- :css => '.active [data-name="body"]',
- :value => 'some content ' + lastname,
- :match_result => true,
- },
- {
- :execute => 'wait',
- :value => 2,
- },
- ],
- },
- ]
- browser_double_test(tests)
- end
- end
|