diff --git a/features/contact_us.feature b/features/contact_us.feature index 74885b1..3474e2a 100644 --- a/features/contact_us.feature +++ b/features/contact_us.feature @@ -13,11 +13,12 @@ Feature: Contact Us And select 'Something about the website' And enter a subject as 'My Contact Subject' And enter a message as 'My contact message' - And click the 'Send' button + And press 'send' - # Then I should see 'Thank you for contacting us' + Then I should be on the contact_sent page + And I should see 'Thank you for contacting us' - And the site administrator should get two 'My Contact Subject' emails + And the site administrator should get two 'My contact subject' emails And the site administrator should get a 'Details for' email Scenario: Contact the site administrator from the contact page @@ -30,9 +31,10 @@ Feature: Contact Us And select 'Something about the website' And enter a subject as 'My Contact Subject' And enter a message as 'My contact message' - And click the 'Send' button + And press 'send' - # Then I should see 'Thank you for contacting us' + Then I should be on the contact_sent page + And I should see 'Thank you for contacting us' - And the site administrator should get two 'My Contact Subject' emails + And the site administrator should get two 'My contact subject' emails And the site administrator should get a 'Details for' email diff --git a/features/landing_page.feature b/features/landing_page.feature index b407103..f94662b 100644 --- a/features/landing_page.feature +++ b/features/landing_page.feature @@ -46,4 +46,3 @@ Feature: Landing Page Then I should see 'Brooklyn' But I should not see 'Portland' And I should not see 'Prince Rupert' - diff --git a/features/sign_in.feature b/features/sign_in.feature index 37f6721..b4c2886 100644 --- a/features/sign_in.feature +++ b/features/sign_in.feature @@ -15,7 +15,7 @@ Feature: Sign In And I should get a 'confirmation' email When I click on the 'Confirm' link in the email - Then I should see 'Your Account' + Then I should be on the settings page Then I should not see a 'My registration' link Scenario: Sign in from the settings page @@ -30,7 +30,7 @@ Feature: Sign In And I should get a 'confirmation' email When I click on the 'Confirm' link in the email - Then I should see 'Your Account' + Then I should be on the settings page Scenario: Users can sign in in different sessions Given there is an upcoming conference in 'Brooklyn NY' @@ -40,7 +40,8 @@ Feature: Sign In And I enter my email And press confirm_email - Then I should get a 'confirmation' email + Then I should be on the do_confirm page + And I should get a 'confirmation' email Then in a new session When I click on the 'Confirm' link in the email @@ -49,7 +50,6 @@ Feature: Sign In And click the 'Sign In' button Then I should be on the settings page - And I should see 'Your Account' Scenario: A registration link should be accessible for registered users Given there is an upcoming conference in 'Brooklyn NY' @@ -75,7 +75,11 @@ Feature: Sign In But my facebook account has no email address When I log in with facebook - Then I should see 'Before proceeding, you must provide us an email address' + Then I should be on the oauth_update page + And I should see 'Before proceeding, you must provide us an email address' When I enter my email address - And click the 'Save' button + And press save + Then I should be on the home page + And I should see 'Mark Zuckerberg' + And I should see 'Sign out' \ No newline at end of file diff --git a/features/step_definitions/interface_steps.rb b/features/step_definitions/interface_steps.rb index 304b85c..18f1991 100644 --- a/features/step_definitions/interface_steps.rb +++ b/features/step_definitions/interface_steps.rb @@ -11,18 +11,14 @@ Then /^(?:I )?(?:should )?(not )?see (?:the |an? )?'(.+)' link$/i do |no, item| end Then /^(?:I )?(?:should )?(?:still )?(not )?see '(.+)'$/i do |negate, item| - attempt_to true do - attempt_to do - expect(page).send(negate ? :not_to : :to, have_text(item)) - end + attempt_to do + expect(page).send(negate ? :not_to : :to, have_text(item)) end end Then /^(?:I )?(?:should )?(?:still )?(not )?see (?:my |the )([^']+)$/i do |negate, item| - attempt_to true do - attempt_to do - expect(page).send(negate ? :not_to : :to, have_text(TestState::Values[get_field(item)])) - end + attempt_to do + expect(page).send(negate ? :not_to : :to, have_text(TestState::Values[get_field(item)])) end end @@ -37,10 +33,7 @@ Then /^(?:I )?click (?:on )?(?:the )?(a )?'(.+?)'( button| link)?(?: beside '(.+ else element = element_with_text(item, root_item) end - begin - element.click - rescue Capybara::Poltergeist::TimeoutError - end + element.click rescue Exception => e puts text raise e @@ -118,7 +111,7 @@ Then /^(?:I )?enter (?:my |an? |some |the )?(.+?)(?: as '(.+)')?$/i do |field, v end end - TestState::Values[field] = value + (TestState::Values[field] = value) element.set value diff --git a/features/step_definitions/navigation.rb b/features/step_definitions/navigation.rb index a7acba2..457e469 100644 --- a/features/step_definitions/navigation.rb +++ b/features/step_definitions/navigation.rb @@ -20,23 +20,10 @@ Given /^(?:(?:I )?am )?on an? (.+) error page$/i do |page_name| end Then /^(?:I )?should be on (?:the |an? | my)?(.+) page$/i do |page_name| - sleep(1) attempt_to do path = path_to(page_name) - TestState.last_page = path path = /(https?\/\/:[^\/]+)?#{Regexp.escape(path)}\/?(\?|#|$)/ unless path.is_a?(Regexp) - begin - current_url.should match path - rescue Exception => e - # due to a bug in phantomjs 2.5-development, sometimes postbacks don't work properly, this is a workaround - if page.driver.network_traffic.last.url =~ path && page.driver.network_traffic.last.method =~ /^get$/i && page.driver.network_traffic.last.response_parts.present? && page.driver.network_traffic.last.response_parts.first.status == 200 - attempt_to do - visit page.driver.network_traffic.last.url - end - else - raise e - end - end + current_url.should match path end end diff --git a/features/step_definitions/users.rb b/features/step_definitions/users.rb index a3ed197..585cbd6 100644 --- a/features/step_definitions/users.rb +++ b/features/step_definitions/users.rb @@ -14,13 +14,12 @@ Given /^(?:I )?(?:am logged|log) in(?: as '(.+)')?$/i do |email| end first(selector_for('email')).set(TestState.my_account.email) - begin - first('.flex-form button').click - rescue Capybara::Poltergeist::TimeoutError - end + first('#token + button[type="submit"]').click - attempt_to true do + begin expect(page).to have_link TestState.my_account.name + rescue + fail "Error logging in" end end end diff --git a/features/workshops.feature b/features/workshops.feature index 0d6bbba..9615a04 100644 --- a/features/workshops.feature +++ b/features/workshops.feature @@ -56,19 +56,13 @@ Feature: Workshops Then I should see 'Deleting a workshop cannot be undone' When I click on the 'Cancel' button - Then I should be on my workshop page - And I should see 'Tools' + Then I should see 'Tools' And should see 'Education' When I click the 'Delete Workshop' link And click the 'Confirm' button - - Then I should be on the delete_workshop page - And I click the 'Confirm' button - - # Then I should be on my workshop page - # And I should see 'Propose a Workshop' - # But I should not see any workshops + Then I should see 'Propose a Workshop' + But I should not see any workshops Scenario: Users can comment on an translate their own workshops Given that there is an upcoming conference @@ -85,25 +79,19 @@ Feature: Workshops When I enter my title as 'Puentes a las bicicletas' And enter some info And click the 'Save' button - Then I should be on my workshop page - And my workshop title should be 'Bridges to Bicycles' + Then my workshop title should be 'Bridges to Bicycles' And my Spanish workshop title should be 'Puentes a las bicicletas' And I should see 'Bridges to Bicycles' When I enter a comment And I click the 'Add Comment' button - - Then I should be on my workshop page - And I should see 'less than a minute ago' + Then I should see 'less than a minute ago' And I should see my comment When I click the 'Reply' button And enter a reply And click the 'Reply' button - - Then I should be on my workshop page - And I should see 'less than a minute ago' - And I should see my comment + Then I should see my comment And see my reply Scenario: Users can add facilitators to their workshops @@ -135,10 +123,9 @@ Feature: Workshops Then I should see 'Please Confirm' And I should see 'Yes' And click the 'Yes' button - Then I should not see 'Please Confirm' - # And I should not see 'new-facilitator@bikebike.org Unregistered' - # But I should see 'Applying for 501c3 status' + And I should not see 'new-facilitator@bikebike.org Unregistered' + But I should see 'Applying for 501c3 status' Scenario: Users can approve and deny facilitation requests on their workshops Given that there is an upcoming conference @@ -163,13 +150,15 @@ Feature: Workshops And I should see 'Hadrian Requested' When I click the 'Deny' button beside 'Spartacus' - Then I should see 'Saladin' + Then I should be on my workshop page + And I should see 'Saladin' And I should see 'Hadrian' But I should not see 'Spartacus' And 'Spartacus' should get a 'Your request to facilitate ‘Sturmey Archer Hub Repair’ has been denied' email When I click the 'Approve' button beside 'Saladin' - Then I should see 'Saladin Collaborator' + Then I should be on my workshop page + And I should see 'Saladin Collaborator' And 'Saladin' should get a 'You have been added as a facilitator of ‘Sturmey Archer Hub Repair’' email When I click the 'Approve' button beside 'Hadrian' @@ -189,9 +178,7 @@ Feature: Workshops And see 'Are you sure you would like to remove Hadrian as a facilitator of this workshop?' When I click on the 'Yes' button - And reload the page - Then I should be on my workshop page - And I should not see 'Hadrian' + Then I should not see 'Hadrian' When I click the 'Transfer Ownership' button beside 'Saladin' Then I should see 'Please Confirm' @@ -205,8 +192,7 @@ Feature: Workshops And see 'Are you sure you want to transfer ownership to Saladin?' When I click the 'Yes' button - Then I should be on my workshop page - And I should not see 'Saladin Collaborator' + Then I should not see 'Saladin Collaborator' But I should see 'Saladin Owner' When I click the 'Leave' button @@ -221,8 +207,7 @@ Feature: Workshops And see 'Are you sure you would like to remove yourself as a facilitator of this workshop?' When I click the 'Yes' button - Then I should be on my workshop page - And I should not see 'Leave' + Then I should not see 'Leave' But I should see 'Make a facilitation request' When I click the 'Make a facilitation request' button @@ -245,8 +230,7 @@ Feature: Workshops Then I should still see 'Cancel Request' When I click the 'Cancel Request' button again And click the 'Yes' button - Then I should be on my workshop page - And I should not see 'Cancel Request' + Then I should not see 'Cancel Request' But I should see 'Make a facilitation request' Scenario: Users can add interest to workshops @@ -306,8 +290,7 @@ Feature: Workshops And enter some info And click the 'Save' button - Then I should be on my workshop page - And the Spanish workshop title should be 'Horas de las mujeres y de los transexuales' + Then the Spanish workshop title should be 'Horas de las mujeres y de los transexuales' And I should see 'Women and Transgender shop hours' And 'Macbeth' should get a 'The translation for ‘Women and Transgender shop hours’ has been modified' email @@ -326,8 +309,7 @@ Feature: Workshops And enter a comment as 'Will you be covering Canadian contracts?' And click the 'Add Comment' button - Then I should be on my workshop page - And I should see 'Will you be covering Canadian contracts?' + Then I should see 'Will you be covering Canadian contracts?' And 'Brunhilda' should get a 'commented' email When in a new session @@ -337,6 +319,5 @@ Feature: Workshops And enter a reply as 'If we can find a Canadian facilitator' And click the 'Reply' button - Then I should be on my workshop page - And I should see 'If we can find a Canadian facilitator' - And 'Geronimo' should get a 'replied' email + Then I should see 'If we can find a Canadian facilitator' + And 'Geronimo' should get a 'replied' email \ No newline at end of file