@@ -99,6 +99,11 @@ def replace_hostname(url)
9999 @browser . current_url . should eq url
100100end
101101
102+ Then /^I wait until I am on "([^"]*)"$/ do |url |
103+ url = replace_hostname ( url )
104+ wait_with_timeout . until { @browser . current_url == url }
105+ end
106+
102107Then /^I wait until current URL contains "([^"]*)"$/ do |url |
103108 url = replace_hostname ( url )
104109 wait_with_timeout . until { @browser . current_url . include? url }
@@ -588,7 +593,7 @@ def generate_user(name)
588593 And I type "#{ password } " into "#user_password_confirmation"
589594 And I type "16" into "#user_age"
590595 And I click selector "input[type=submit][value='Sign up']"
591- And I am on "http://code.org/"
596+ And I wait until I am on "http://studio. code.org/"
592597 }
593598end
594599
@@ -603,41 +608,17 @@ def generate_user(name)
603608 And I type "#{ password } " into "#user_password"
604609 And I type "#{ password } " into "#user_password_confirmation"
605610 And I click selector "input[type=submit][value='Sign up']"
606- And I am on "http://code.org/"
611+ And I wait until I am on "http://code.org/teacher-dashboard# /"
607612 }
608613end
609614
610- # can be used for tests that touch components that are being A/B tested
611- And ( /^I create a student with an (even|odd) ID named "([^"]*)"$/ ) do |id_type , name |
612- new_user = nil
613- begin
614- new_user = User . find_or_create_by! ( email : "user#{ Time . now . to_i } _#{ rand ( 1000 ) } @testing.xx" ) do |user |
615- user . name = name
616- user . password = name + "password" # hack
617- user . user_type = 'student'
618- user . age = 16
619- user . confirmed_at = Time . now
620- end
621- end until ( id_type == 'even' && new_user . id . even? ) || ( id_type == 'odd' && new_user . id . odd? )
622- @users ||= { }
623- @users [ name ] = new_user
624- end
625-
626615And ( /I fill in username and password for "([^"]*)"$/ ) do |name |
627616 steps %Q{
628617 And I type "#{ @users [ name ] [ :email ] } " into "#user_login"
629618 And I type "#{ @users [ name ] [ :password ] } " into "#user_password"
630619 }
631620end
632621
633- Given ( /^I sign in as a (student|teacher)$/ ) do |user_type |
634- steps %Q{
635- Given I am on "http://learn.code.org/"
636- And I am a #{ user_type }
637- And I am on "http://learn.code.org/users/sign_in"
638- }
639- end
640-
641622When ( /^I sign out$/ ) do
642623 steps 'When I am on "http://studio.code.org/users/sign_out"'
643624end
0 commit comments