diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2013-05-08 12:18:24 +0200 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2013-05-08 12:18:24 +0200 |
commit | 7a372ed40aee114397a40aa1134f512596bde8fd (patch) | |
tree | a1a6dd367cd72438e1f317af62c3622a8105b79c /tests | |
parent | bc02ce6a319017d42fec42915d4708c7c2c1e018 (diff) |
added test for sliding up the form
Diffstat (limited to 'tests')
-rw-r--r-- | tests/acceptance/features/create_new.feature | 12 | ||||
-rw-r--r-- | tests/acceptance/features/step_definitions/create_new_steps.rb | 40 |
2 files changed, 44 insertions, 8 deletions
diff --git a/tests/acceptance/features/create_new.feature b/tests/acceptance/features/create_new.feature index d6ccfee49..1a5e096b1 100644 --- a/tests/acceptance/features/create_new.feature +++ b/tests/acceptance/features/create_new.feature @@ -15,4 +15,14 @@ Feature: create_new Scenario: hide caption when not hover Given I hover over the add new button When I hover out off the add new button - Then I should not see an "Add Website" caption on the add new button
\ No newline at end of file + Then I should not see an "Add Website" caption on the add new button + + Scenario: show add website dialogue + When I click on the add new button + Then I should see a form to add feeds and folders + + Scenario: hide add website dialogue when clicking somewhere else + Given I should not see a form to add feeds and folders + And I click on the add new button + When I click somewhere else + Then I should not see a form to add feeds and folders
\ No newline at end of file diff --git a/tests/acceptance/features/step_definitions/create_new_steps.rb b/tests/acceptance/features/step_definitions/create_new_steps.rb index 78ec55c7f..80ef45290 100644 --- a/tests/acceptance/features/step_definitions/create_new_steps.rb +++ b/tests/acceptance/features/step_definitions/create_new_steps.rb @@ -1,3 +1,9 @@ +# use this to turn off animations to check for visibility +def turn_off_animations + page.execute_script("$.fx.off=true") +end + + When (/^I hover over the add new button$/) do # FIXME: get this working with hover action page.execute_script("$('.list-title span').show()") @@ -8,12 +14,32 @@ When (/^I hover out off the add new button$/) do page.execute_script("$('.list-title span').hide()") end -Then (/^I should see an "([^"]+)" caption on the add new button$/) do |caption| - button = page.find(:xpath, "//li[contains(@class,\"add-new\")]/a/span[1]") - button.should have_content(caption) +Then (/^I should (not )?see an "([^"]+)" caption on the add new button$/) do |shouldNot, caption| + selector = "//li[contains(@class,\"add-new\")]/a/span[1]" + if shouldNot + page.should have_no_selector(:xpath, selector) + else + page.find(:xpath, selector).should have_content(caption) + end +end + + +When (/^I click on the add new button$/) do + turn_off_animations() + click_link 'Add Website' end -Then (/^I should not see an "([^"]+)" caption on the add new button$/) do |caption| - # if its not visible the selector wont find it - page.should have_no_selector(:xpath, "//li[contains(@class,\"add-new\")]/a/span[1]") -end
\ No newline at end of file +When (/^I click somewhere else$/) do + page.execute_script("$('#app-content').trigger('click')") +end + + +Then (/^I should (not )?see a form to add feeds and folders$/) do |shouldNot| + selector = "//*[contains(@class,\"add-new-popup\")]" + + if shouldNot + page.should have_no_selector(:xpath, selector) + else + page.should have_selector(:xpath, selector) + end +end |