2013-03-06 22:15:01 +00:00
|
|
|
# encoding: utf-8
|
|
|
|
require 'browser_test_helper'
|
|
|
|
|
|
|
|
class ManageTest < TestCase
|
|
|
|
def test_user
|
2013-03-22 08:29:44 +00:00
|
|
|
random = 'manage-test-' + rand(999999).to_s
|
|
|
|
user_email = random + '@example.com'
|
|
|
|
|
|
|
|
# user
|
2013-03-06 22:15:01 +00:00
|
|
|
tests = [
|
|
|
|
{
|
|
|
|
:name => 'user',
|
|
|
|
:action => [
|
|
|
|
{
|
|
|
|
:execute => 'click',
|
|
|
|
:css => 'a[href="#admin"]',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'click',
|
|
|
|
:css => 'a[href="#users"]',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'wait',
|
|
|
|
:value => 2,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'click',
|
|
|
|
:css => 'a[data-type="new"]',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'wait',
|
|
|
|
:value => 2,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'set',
|
|
|
|
:css => 'input[name=login]',
|
2013-03-22 08:29:44 +00:00
|
|
|
:value => 'some login' + random,
|
2013-03-06 22:15:01 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'set',
|
|
|
|
:css => 'input[name="firstname"]',
|
2013-03-22 08:29:44 +00:00
|
|
|
:value => 'Manage Firstname' + random,
|
2013-03-06 22:15:01 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'set',
|
|
|
|
:css => 'input[name="lastname"]',
|
2013-03-22 08:29:44 +00:00
|
|
|
:value => 'Manage Lastname' + random,
|
2013-03-06 22:15:01 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'set',
|
|
|
|
:css => 'input[name="email"]',
|
|
|
|
:value => user_email,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'set',
|
|
|
|
:css => 'input[name="password"]',
|
|
|
|
:value => 'some-pass',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'set',
|
|
|
|
:css => 'input[name="password_confirm"]',
|
|
|
|
:value => 'some-pass',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'click',
|
|
|
|
:css => 'input[name="role_ids"][value="3"]',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'click',
|
|
|
|
:css => 'button.submit',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'wait',
|
|
|
|
:value => 5,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'match',
|
|
|
|
:css => 'body',
|
2013-03-22 08:29:44 +00:00
|
|
|
:value => random,
|
2013-03-06 22:15:01 +00:00
|
|
|
:match_result => true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'click',
|
|
|
|
:css => 'a[data-type="edit"]:last-child',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'wait',
|
|
|
|
:value => 1,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'set',
|
|
|
|
:css => 'input[name="lastname"]',
|
2013-03-22 08:29:44 +00:00
|
|
|
:value => '2Manage Lastname' + random,
|
2013-03-06 22:15:01 +00:00
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'click',
|
|
|
|
:css => 'button.submit',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'wait',
|
|
|
|
:value => 5,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'match',
|
|
|
|
:css => 'body',
|
2013-03-22 08:29:44 +00:00
|
|
|
:value => '2Manage Lastname' + random,
|
2013-03-06 22:15:01 +00:00
|
|
|
:match_result => true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'wait',
|
|
|
|
:value => 1,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2013-03-22 08:29:44 +00:00
|
|
|
{
|
|
|
|
:name => 'sla',
|
|
|
|
:action => [
|
|
|
|
{
|
|
|
|
:execute => 'click',
|
|
|
|
:css => 'a[href="#admin"]',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'click',
|
|
|
|
:css => 'a[href="#slas"]',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'wait',
|
|
|
|
:value => 2,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'click',
|
|
|
|
:css => 'a[data-type="new"]',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'wait',
|
|
|
|
:value => 2,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'set',
|
|
|
|
:css => 'input[name=name]',
|
|
|
|
:value => 'some sla' + random,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'set',
|
|
|
|
:css => 'input[name="first_response_time"]',
|
|
|
|
:value => 61,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'click',
|
|
|
|
:css => 'button.submit',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'wait',
|
|
|
|
:value => 5,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'match',
|
|
|
|
:css => 'body',
|
|
|
|
:value => random,
|
|
|
|
:match_result => true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'click',
|
|
|
|
:css => 'a[data-type="edit"]:last-child',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'wait',
|
|
|
|
:value => 2,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'set',
|
|
|
|
:css => 'input[name=name]',
|
|
|
|
:value => 'some sla update ' + random,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'set',
|
|
|
|
:css => 'input[name="first_response_time"]',
|
|
|
|
:value => 121,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'click',
|
|
|
|
:css => 'button.submit',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'wait',
|
|
|
|
:value => 5,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'match',
|
|
|
|
:css => 'body',
|
|
|
|
:value => 'some sla update ' + random,
|
|
|
|
:match_result => true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'wait',
|
|
|
|
:value => 1,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'click',
|
|
|
|
:css => 'a[data-type="destroy"]:last-child',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'wait',
|
|
|
|
:value => 2,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'accept',
|
|
|
|
:element => :alert,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'wait',
|
|
|
|
:value => 2,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'match',
|
|
|
|
:css => 'body',
|
|
|
|
:value => 'some sla update ' + random,
|
|
|
|
:match_result => false,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'click',
|
|
|
|
:css => 'a[href="#/"]',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'click',
|
|
|
|
:css => 'a[href="#admin"]',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'click',
|
|
|
|
:css => 'a[href="#slas"]',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'wait',
|
|
|
|
:value => 2,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
:execute => 'match',
|
|
|
|
:css => 'body',
|
|
|
|
:value => 'some sla update ' + random,
|
|
|
|
:match_result => false,
|
|
|
|
},
|
|
|
|
],
|
|
|
|
|
|
|
|
},
|
2013-03-06 22:15:01 +00:00
|
|
|
]
|
|
|
|
browser_signle_test_with_login(tests, { :username => 'master@example.com' })
|
|
|
|
end
|
|
|
|
end
|