Added auto wizard login support for browser tests.

This commit is contained in:
Martin Edenhofer 2015-12-31 02:04:45 +01:00
parent 82fb4c4c73
commit 224f2e8391
5 changed files with 44 additions and 0 deletions

View file

@ -197,6 +197,7 @@ job_integration_twitter_ff:
- export WS_PORT=3042
- export BROWSER_URL=http://$IP:$BROWSER_PORT
- RAILS_ENV=test rake db:create
- cp contrib/auto_wizard_test.json auto_wizard.json
- script/bootstrap.sh
- rake assets:precompile
- script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT
@ -213,6 +214,7 @@ job_integration_facebook_ff:
- export WS_PORT=3052
- export BROWSER_URL=http://$IP:$BROWSER_PORT
- RAILS_ENV=test rake db:create
- cp contrib/auto_wizard_test.json auto_wizard.json
- script/bootstrap.sh
- rake assets:precompile
- script/build/test_startup.sh $RAILS_ENV $BROWSER_PORT $WS_PORT

View file

@ -0,0 +1,28 @@
{
"Users": [
{
"login": "master@example.com",
"firstname": "Test Master",
"lastname": "Agent",
"email": "master@example.com",
"password": "test"
},
{
"login": "agent1@example.com",
"firstname": "Agent 1",
"lastname": "Test",
"email": "agent1@example.com",
"password": "test"
}
],
"Settings": [
{
"name": "developer_mode",
"value": true
},
{
"name": "product_name",
"value": "Zammad Test System"
}
]
}

View file

@ -124,6 +124,7 @@ class TestCase < Test::Unit::TestCase
password: 'somepassword',
url: 'some url', # optional
remember_me: true, # optional
auto_wizard: false, # optional, in case of auto wizard, skip login
)
=end
@ -139,6 +140,17 @@ class TestCase < Test::Unit::TestCase
element = instance.find_elements({ css: '#login input[name="username"]' })[0]
if !element
if params[:auto_wizard]
sleep 10
login = instance.find_elements({ css: '.user-menu .user a' })[0].attribute('title')
if login != params[:username]
screenshot(browser: instance, comment: 'auto wizard login failed')
fail 'auto wizard login failed'
end
assert(true, 'auto wizard login ok')
return
end
screenshot(browser: instance, comment: 'login_failed')
fail 'No login box found'
end

View file

@ -27,6 +27,7 @@ class FacebookBrowserTest < TestCase
username: 'master@example.com',
password: 'test',
url: browser_url,
auto_wizard: true,
)
tasks_close_all()

View file

@ -29,6 +29,7 @@ class TwitterBrowserTest < TestCase
username: 'master@example.com',
password: 'test',
url: browser_url,
auto_wizard: true,
)
tasks_close_all()