add cucumber feature for photo lightbox
change step to reflect element visibility
This commit is contained in:
parent
f5f78a977c
commit
d0fe59af69
4 changed files with 69 additions and 7 deletions
32
features/photo_lightbox.feature
Normal file
32
features/photo_lightbox.feature
Normal file
|
|
@ -0,0 +1,32 @@
|
||||||
|
@javascript
|
||||||
|
Feature: viewing the photo lightbox
|
||||||
|
Background:
|
||||||
|
Given I am on the home page
|
||||||
|
And a user with username "bob"
|
||||||
|
|
||||||
|
When I sign in as "bob@bob.bob"
|
||||||
|
And I am on the home page
|
||||||
|
|
||||||
|
Given I expand the publisher
|
||||||
|
And I attach the file "spec/fixtures/button.png" to hidden element "file" within "#file-upload"
|
||||||
|
And I fill in "status_message_fake_text" with "Look at this dog"
|
||||||
|
And I press "Share"
|
||||||
|
And I wait for the ajax to finish
|
||||||
|
And I follow "Your Aspects"
|
||||||
|
|
||||||
|
Scenario: viewing a photo
|
||||||
|
Then I should see an image attached to the post
|
||||||
|
And I press the attached image
|
||||||
|
Then I should see the photo lightbox
|
||||||
|
|
||||||
|
Scenario: closing the lightbox by clicking the close link
|
||||||
|
Then I should see an image attached to the post
|
||||||
|
And I press the attached image
|
||||||
|
And I press the close lightbox link
|
||||||
|
Then I should not see the photo lightbox
|
||||||
|
|
||||||
|
Scenario: closing the lightbox by clicking the backdrop
|
||||||
|
Then I should see an image attached to the post
|
||||||
|
And I press the attached image
|
||||||
|
And I press the lightbox backdrop
|
||||||
|
Then I should not see the photo lightbox
|
||||||
|
|
@ -111,8 +111,12 @@ end
|
||||||
|
|
||||||
Then /^(?:|I )should not see a "([^\"]*)"(?: within "([^\"]*)")?$/ do |selector, scope_selector|
|
Then /^(?:|I )should not see a "([^\"]*)"(?: within "([^\"]*)")?$/ do |selector, scope_selector|
|
||||||
with_scope(scope_selector) do
|
with_scope(scope_selector) do
|
||||||
|
if page.has_css?(selector)
|
||||||
|
find(:css, selector).visible?.should be_false
|
||||||
|
else
|
||||||
page.has_css?(selector).should be_false
|
page.has_css?(selector).should be_false
|
||||||
end
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
When /^I wait for the ajax to finish$/ do
|
When /^I wait for the ajax to finish$/ do
|
||||||
|
|
@ -202,3 +206,10 @@ Then /^I follow Edit Profile in the same window$/ do
|
||||||
And %(I follow "Edit Profile")
|
And %(I follow "Edit Profile")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Then 'I should see an image attached to the post' do
|
||||||
|
Then %{I should see a "img" within ".stream_element div.photo_attachments"}
|
||||||
|
end
|
||||||
|
|
||||||
|
Then 'I press the attached image' do
|
||||||
|
Then %{I press the 1st "img" within ".stream_element div.photo_attachments"}
|
||||||
|
end
|
||||||
19
features/step_definitions/lightbox_steps.rb
Normal file
19
features/step_definitions/lightbox_steps.rb
Normal file
|
|
@ -0,0 +1,19 @@
|
||||||
|
Then 'I should see the photo lightbox' do
|
||||||
|
Then %{I should see a "img" within "#lightbox-imageset"}
|
||||||
|
And %{I should see a "#lightbox-backdrop" within "body"}
|
||||||
|
And %{I should see a "#lightbox-image" within "body"}
|
||||||
|
end
|
||||||
|
|
||||||
|
Then 'I should not see the photo lightbox' do
|
||||||
|
Then %{I should not see a "img" within "#lightbox-imageset"}
|
||||||
|
And %{I should not see a "#lightbox-backdrop" within "body"}
|
||||||
|
And %{I should not see a "#lightbox-image" within "body"}
|
||||||
|
end
|
||||||
|
|
||||||
|
Then 'I press the close lightbox link' do
|
||||||
|
find(:css, "#lightbox-close-link").click
|
||||||
|
end
|
||||||
|
|
||||||
|
Then 'I press the lightbox backdrop' do
|
||||||
|
find(:css, "#lightbox-backdrop").click
|
||||||
|
end
|
||||||
Loading…
Reference in a new issue