From d68d77fc195fbe2b23ddceeffbc889ee3e906e02 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Wed, 24 Apr 2013 10:59:26 +0200 Subject: [PATCH] New browser tests for user creation. --- test/browser/agent_user_manage_test.rb | 144 +++++++++++++++++++++++++ 1 file changed, 144 insertions(+) create mode 100644 test/browser/agent_user_manage_test.rb diff --git a/test/browser/agent_user_manage_test.rb b/test/browser/agent_user_manage_test.rb new file mode 100644 index 000000000..c679c6e9c --- /dev/null +++ b/test/browser/agent_user_manage_test.rb @@ -0,0 +1,144 @@ +# encoding: utf-8 +require 'browser_test_helper' + +class AgentUserManageTest < TestCase + def test_agent_user + customer_user_email = 'customer-test-' + rand(999999).to_s + '@example.com' + tests = [ + { + :name => 'create customer', + :action => [ + { + :execute => 'click', + :css => 'a[href="#new"]', + }, + { + :execute => 'click', + :css => 'a[href="#ticket_create/call_inbound"]', + }, + { + :execute => 'wait', + :value => 5, + }, + { + :execute => 'click', + :css => '.customer_new', + }, + { + :execute => 'wait', + :value => 2, + }, + { + :execute => 'set', + :css => '.modal input[name="firstname"]', + :value => 'Customer Firstname', + }, + { + :execute => 'set', + :css => '.modal input[name="lastname"]', + :value => 'Customer Lastname', + }, + { + :execute => 'set', + :css => '.modal input[name="email"]', + :value => customer_user_email, + }, + { + :execute => 'click', + :css => '.modal button', + }, + { + :execute => 'wait', + :value => 4, + }, + + # check is used is selected + { + :execute => 'match', + :css => 'input[name="customer_id"]', + :value => '^[0-9].?$', + :no_quote => true, + :match_result => true, + }, + { + :execute => 'match', + :css => 'input[name="customer_id_autocompletion"]', + :value => 'Customer', + :no_quote => true, + :match_result => true, + }, + + # call new ticket screen again + { + :execute => 'click', + :css => '.taskbar a[data-type="close"]', + }, + { + :execute => 'wait', + :value => 1, + }, + { + :execute => 'click', + :css => 'a[href="#new"]', + }, + { + :execute => 'click', + :css => 'a[href="#ticket_create/call_inbound"]', + }, + { + :execute => 'wait', + :value => 2, + }, + { + :execute => 'match', + :css => 'input[name="customer_id"]', + :value => '^[0-9].?$', + :no_quote => true, + :match_result => false, + }, + { + :execute => 'match', + :css => 'input[name="customer_id_autocompletion"]', + :value => 'Customer', + :no_quote => true, + :match_result => false, + }, + { + :execute => 'set', + :css => '.ticket_create input[name="customer_id_autocompletion"]', + :value => customer_user_email, + }, + { + :execute => 'wait', + :value => 4, + }, + { + :execute => 'sendkey', + :css => '.ticket_create input[name="customer_id_autocompletion"]', + :value => :arrow_down, + }, + { + :execute => 'sendkey', + :css => '.ticket_create input[name="customer_id_autocompletion"]', + :value => :tab, + }, + { + :execute => 'match', + :css => 'input[name="customer_id"]', + :value => '^[0-9].?$', + :no_quote => true, + :match_result => true, + }, + { + :execute => 'match', + :css => 'input[name="customer_id_autocompletion"]', + :value => 'Customer', + :no_quote => true, + :match_result => true, + }, + ], + }, + ] + browser_signle_test_with_login(tests, { :username => 'agent1@example.com' }) + end +end