From 865f70ecdaeb79605be93ca0f7a27405bb6d5176 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Tue, 2 Dec 2014 08:22:26 +0100 Subject: [PATCH] Support new ui selectors. --- .../javascripts/app/views/login.jst.eco | 8 ++ script/local_browser_tests.sh | 2 +- test/browser/auth_customer_test.rb | 75 ++----------------- test/browser/auth_master_test.rb | 36 +-------- test/browser/customer_ticket_create_test.rb | 2 +- test/browser/manage_test.rb | 8 -- test/browser/taskbar_session_test.rb | 4 +- test/browser_test_helper.rb | 3 + 8 files changed, 26 insertions(+), 112 deletions(-) diff --git a/app/assets/javascripts/app/views/login.jst.eco b/app/assets/javascripts/app/views/login.jst.eco index 1906a8898..78fb9a623 100644 --- a/app/assets/javascripts/app/views/login.jst.eco +++ b/app/assets/javascripts/app/views/login.jst.eco @@ -15,6 +15,14 @@ +
+ + +
+
diff --git a/script/local_browser_tests.sh b/script/local_browser_tests.sh index 8188a0027..2d6b7ba18 100755 --- a/script/local_browser_tests.sh +++ b/script/local_browser_tests.sh @@ -29,7 +29,7 @@ rake db:seed cat config/environments/production.rb | sed -e 's/config.serve_static_assets = false/config.serve_static_assets = true/' > /tmp/production.rb && cp /tmp/production.rb config/environments/production.rb # mofidy auth backend -cat lib/auth/test.rb | sed 's/test/production/' > /tmp/test.rb && cp /tmp/test.rb lib/auth/test.rb +cat lib/auth/test.rb | sed "s/\] == 'test'/] == 'production'/" > /tmp/test.rb && cp /tmp/test.rb lib/auth/test.rb pumactl --pidfile tmp/pids/puma.pid stop script/websocket-server.rb stop diff --git a/test/browser/auth_customer_test.rb b/test/browser/auth_customer_test.rb index 4f9646885..0497dc92b 100644 --- a/test/browser/auth_customer_test.rb +++ b/test/browser/auth_customer_test.rb @@ -38,47 +38,21 @@ class AuthCustomerTest < TestCase :name => 'login', :action => [ { - :execute => 'check', - :css => '#login', - :result => true, - }, - { - :execute => 'set', - :css => 'input[name="username"]', - :value => 'nicole.braun@zammad.org', - }, - { - :execute => 'set', - :css => 'input[name="password"]', - :value => 'test' - }, - { - :execute => 'click', - :css => '#login button', + :execute => 'login', + :username => 'nicole.braun@zammad.org', + :password => 'test', }, { :execute => 'wait', :value => 5, }, - - # check action - { - :execute => 'check', - :css => '#login', - :result => false, - }, - { - :execute => 'watch_for', - :area => 'body', - :value => 'nicole.braun@zammad.org', - }, { :execute => 'reload', }, { :execute => 'watch_for', :area => 'body', - :value => 'nicole.braun@zammad.org', + :value => 'Overviews', }, { :execute => 'match', @@ -122,43 +96,10 @@ class AuthCustomerTest < TestCase :url => browser_url, :action => [ { - :execute => 'check', - :css => '#login', - :result => true, - }, - { - :execute => 'set', - :css => 'input[name="username"]', - :value => 'nicole.braun@zammad.org', - }, - { - :execute => 'set', - :css => 'input[name="password"]', - :value => 'test' - }, - { - :execute => 'click', - :css => '#login [name="remember_me"]', - }, - { - :execute => 'click', - :css => '#login button', - }, - { - :execute => 'wait', - :value => 6, - }, - - # check action - { - :execute => 'check', - :css => '#login', - :result => false, - }, - { - :execute => 'watch_for', - :area => 'body', - :value => 'nicole.braun@zammad.org', + :execute => 'login', + :username => 'nicole.braun@zammad.org', + :password => 'test', + :remember_me => true, }, { :execute => 'match', diff --git a/test/browser/auth_master_test.rb b/test/browser/auth_master_test.rb index 571a984ee..37a9bb5e4 100644 --- a/test/browser/auth_master_test.rb +++ b/test/browser/auth_master_test.rb @@ -38,39 +38,9 @@ class AuthMasterTest < TestCase :name => 'login', :action => [ { - :execute => 'check', - :css => '#login', - :result => true, - }, - { - :execute => 'set', - :css => 'input[name="username"]', - :value => 'master@example.com', - }, - { - :execute => 'set', - :css => 'input[name="password"]', - :value => 'test1234äöüß' - }, - { - :execute => 'click', - :css => '#login button', - }, - { - :execute => 'wait', - :value => 5, - }, - - # check action - { - :execute => 'check', - :css => '#login', - :result => false, - }, - { - :execute => 'watch_for', - :area => 'body', - :value => 'master@example', + :execute => 'login', + :username => 'master@example.com', + :password => 'test1234äöüß', }, ], }, diff --git a/test/browser/customer_ticket_create_test.rb b/test/browser/customer_ticket_create_test.rb index 8cfe06905..cb011f21f 100644 --- a/test/browser/customer_ticket_create_test.rb +++ b/test/browser/customer_ticket_create_test.rb @@ -45,7 +45,7 @@ class CustomerTicketCreateTest < TestCase }, { :execute => 'wait', - :value => 3, + :value => 4, }, { :execute => 'check', diff --git a/test/browser/manage_test.rb b/test/browser/manage_test.rb index c7e79ced7..95d827015 100644 --- a/test/browser/manage_test.rb +++ b/test/browser/manage_test.rb @@ -164,10 +164,6 @@ class ManageTest < TestCase :value => 'some sla update ' + random, :match_result => false, }, - { - :execute => 'click', - :css => 'a[href="#/"]', - }, { :execute => 'click', :css => 'a[href="#manage"]', @@ -193,10 +189,6 @@ class ManageTest < TestCase :execute => 'wait', :value => 2, }, - { - :execute => 'click', - :css => 'a[href="#/"]', - }, { :execute => 'click', :css => 'a[href="#manage"]', diff --git a/test/browser/taskbar_session_test.rb b/test/browser/taskbar_session_test.rb index bd3ad4aa7..acc256fe8 100644 --- a/test/browser/taskbar_session_test.rb +++ b/test/browser/taskbar_session_test.rb @@ -16,7 +16,7 @@ class TaskbarSessionTest < TestCase :action => [ { :execute => 'wait', - :value => 12, + :value => 8, }, { :where => :instance1, @@ -52,7 +52,7 @@ class TaskbarSessionTest < TestCase :action => [ { :execute => 'wait', - :value => 12, + :value => 8, }, { :where => :instance1, diff --git a/test/browser_test_helper.rb b/test/browser_test_helper.rb index 2775e3ac6..b9b774322 100644 --- a/test/browser_test_helper.rb +++ b/test/browser_test_helper.rb @@ -227,6 +227,9 @@ class TestCase < Test::Unit::TestCase element = instance.find_element( { :css => '#login input[name="password"]' } ) element.clear element.send_keys( action[:password] ) + if action[:remember_me] + instance.find_element( { :css => '#login [name="remember_me"]' } ).click + end instance.find_element( { :css => '#login button' } ).click sleep 4 login = instance.find_element( { :css => '.user-menu .user a' } ).attribute('title')