trabajo-afectivo/test/browser/manage_test.rb

259 lines
6.6 KiB
Ruby
Raw Normal View History

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',
2013-08-19 21:03:16 +00:00
:css => 'a[href="#manage"]',
2013-03-06 22:15:01 +00:00
},
{
:execute => 'click',
2013-08-19 21:03:16 +00:00
:css => 'a[href="#manage/users"]',
2013-03-06 22:15:01 +00:00
},
{
:execute => 'wait',
:value => 2,
},
{
:execute => 'click',
:css => 'a[data-type="new"]',
},
{
:execute => 'wait',
:value => 2,
},
{
:execute => 'set',
2014-05-20 20:00:11 +00:00
:css => '.modal 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',
2014-05-20 20:00:11 +00:00
:css => '.modal 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',
2014-05-20 20:00:11 +00:00
:css => '.modal 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',
2014-05-20 20:00:11 +00:00
:css => '.modal input[name="email"]',
2013-03-06 22:15:01 +00:00
:value => user_email,
},
{
:execute => 'set',
2014-05-20 20:00:11 +00:00
:css => '.modal input[name="password"]',
2013-03-06 22:15:01 +00:00
:value => 'some-pass',
},
{
:execute => 'set',
2014-05-20 20:00:11 +00:00
:css => '.modal input[name="password_confirm"]',
2013-03-06 22:15:01 +00:00
:value => 'some-pass',
},
{
:execute => 'click',
2014-05-20 20:00:11 +00:00
:css => '.modal input[name="role_ids"][value="3"]',
2013-03-06 22:15:01 +00:00
},
{
:execute => 'click',
2013-06-19 21:41:24 +00:00
:css => '.modal button.submit',
2013-03-06 22:15:01 +00:00
},
{
2013-08-27 21:05:33 +00:00
:execute => 'watch_for',
:area => 'body',
:value => random,
2013-03-06 22:15:01 +00:00
},
{
:execute => 'click',
:css => 'a[data-type="edit"]:last-child',
},
{
:execute => 'wait',
:value => 1,
},
{
:execute => 'set',
2014-05-20 20:00:11 +00:00
:css => '.modal 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',
2013-06-19 21:41:24 +00:00
:css => '.modal button.submit',
2013-03-06 22:15:01 +00:00
},
{
2013-08-27 21:05:33 +00:00
:execute => 'watch_for',
:area => 'body',
:value => '2Manage Lastname' + random,
2013-03-06 22:15:01 +00:00
},
{
:execute => 'wait',
:value => 1,
},
],
},
2013-03-22 08:29:44 +00:00
{
:name => 'sla',
:action => [
{
:execute => 'click',
2013-08-19 21:03:16 +00:00
:css => 'a[href="#manage"]',
2013-03-22 08:29:44 +00:00
},
{
:execute => 'click',
2013-08-19 21:03:16 +00:00
:css => 'a[href="#manage/slas"]',
2013-03-22 08:29:44 +00:00
},
{
:execute => 'wait',
:value => 2,
},
{
:execute => 'click',
:css => 'a[data-type="new"]',
},
{
:execute => 'wait',
:value => 2,
},
{
:execute => 'set',
2014-05-20 20:00:11 +00:00
:css => '.modal input[name=name]',
2013-03-22 08:29:44 +00:00
:value => 'some sla' + random,
},
{
:execute => 'set',
2014-05-20 20:00:11 +00:00
:css => '.modal input[name="first_response_time"]',
2013-03-22 08:29:44 +00:00
:value => 61,
},
{
:execute => 'click',
2013-06-19 21:41:24 +00:00
:css => '.modal button.submit',
2013-03-22 08:29:44 +00:00
},
{
2013-08-27 21:05:33 +00:00
:execute => 'watch_for',
:area => 'body',
:value => random,
2013-03-22 08:29:44 +00:00
},
{
:execute => 'click',
:css => 'a[data-type="edit"]:last-child',
},
{
:execute => 'wait',
:value => 2,
},
{
:execute => 'set',
2014-05-20 20:00:11 +00:00
:css => '.modal input[name=name]',
2013-03-22 08:29:44 +00:00
:value => 'some sla update ' + random,
},
{
:execute => 'set',
2014-05-20 20:00:11 +00:00
:css => '.modal input[name="first_response_time"]',
2013-03-22 08:29:44 +00:00
:value => 121,
},
{
:execute => 'click',
2013-06-19 21:41:24 +00:00
:css => '.modal button.submit',
2013-03-22 08:29:44 +00:00
},
{
2013-08-27 21:05:33 +00:00
:execute => 'watch_for',
:area => 'body',
:value => 'some sla update ' + random,
2013-03-22 08:29:44 +00:00
},
{
:execute => 'wait',
:value => 1,
},
{
:execute => 'click',
:css => 'a[data-type="destroy"]:last-child',
},
{
:execute => 'wait',
:value => 2,
},
{
2013-09-02 19:00:08 +00:00
:execute => 'click',
:css => '.modal .submit',
2013-03-22 08:29:44 +00:00
},
{
:execute => 'wait',
:value => 2,
},
{
:execute => 'match',
:css => 'body',
:value => 'some sla update ' + random,
:match_result => false,
},
{
:execute => 'click',
:css => 'a[href="#/"]',
},
{
:execute => 'click',
2013-08-19 21:03:16 +00:00
:css => 'a[href="#manage"]',
2013-03-22 08:29:44 +00:00
},
{
:execute => 'click',
2013-08-19 21:03:16 +00:00
:css => 'a[href="#manage/slas"]',
2013-03-22 08:29:44 +00:00
},
{
:execute => 'wait',
:value => 2,
},
{
:execute => 'match',
:css => 'body',
:value => 'some sla update ' + random,
:match_result => false,
},
2013-06-19 21:41:24 +00:00
{
:execute => 'reload',
},
{
:execute => 'wait',
:value => 2,
},
{
:execute => 'click',
:css => 'a[href="#/"]',
},
{
:execute => 'click',
2013-08-19 21:03:16 +00:00
:css => 'a[href="#manage"]',
2013-06-19 21:41:24 +00:00
},
{
:execute => 'click',
2013-08-19 21:03:16 +00:00
:css => 'a[href="#manage/slas"]',
2013-06-19 21:41:24 +00:00
},
{
:execute => 'wait',
:value => 2,
},
{
:execute => 'match',
:css => 'body',
:value => 'some sla update ' + random,
:match_result => false,
},
2013-03-22 08:29:44 +00:00
],
},
2013-03-06 22:15:01 +00:00
]
browser_signle_test_with_login(tests, { :username => 'master@example.com' })
end
end