From b899c03f93862b1e974784d45643a041de1c1747 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Fri, 22 Feb 2013 14:37:21 +0100 Subject: [PATCH] Added signup browser test. --- test/browser/signup.rb | 87 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 87 insertions(+) create mode 100644 test/browser/signup.rb diff --git a/test/browser/signup.rb b/test/browser/signup.rb new file mode 100644 index 000000000..31c5b2647 --- /dev/null +++ b/test/browser/signup.rb @@ -0,0 +1,87 @@ +# encoding: utf-8 +require 'browser_test_helper' + +class Signup < ActiveSupport::TestCase + test 'signup' do + signup_user_email = 'signup-test-' + rand(999999).to_s + '@example.com' + tests = [ + { + :name => 'start', + :instance => Watir::Browser.new, + :url => 'http://localhost:3000', + :action => [ + { + :execute => 'click', + :css => 'a[href="#signup"]', + }, + { + :execute => 'wait', + :value => 1, + }, + { + :execute => 'check', + :css => '#form-signup', + :result => true, + }, + ], + }, + { + :name => 'signup', + :action => [ + { + :execute => 'set', + :css => 'input[name="firstname"]', + :value => 'Signup Firstname', + }, + { + :execute => 'set', + :css => 'input[name="lastname"]', + :value => 'Signup Lastname', + }, + { + :execute => 'set', + :css => 'input[name="email"]', + :value => signup_user_email, + }, + { + :execute => 'set', + :css => 'input[name="password"]', + :value => 'some-pass', + }, + { + :execute => 'set', + :css => 'input[name="password_confirm"]', + :value => 'some-pass', + }, + { + :execute => 'click', + :css => 'button.submit', + }, + { + :execute => 'wait', + :value => 3, + }, + + # check action + { + :execute => 'check', + :css => '#login', + :result => false, + }, + { + :execute => 'check', + :css => '#form-signup', + :result => false, + }, + { + :execute => 'match', + :css => 'body', + :value => signup_user_email, + :match_result => true, + }, + ], + }, + ] + browser_single_test(tests) + end +end \ No newline at end of file