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
|
|
@ -62,14 +62,14 @@
|
|||
.footer_container
|
||||
.hashtags
|
||||
|
||||
#lightbox
|
||||
#lightbox-content
|
||||
= link_to "[x] close", '#', :id => 'lightbox-close-link'
|
||||
%img#lightbox-image
|
||||
#lightbox-imageset
|
||||
#lightbox
|
||||
#lightbox-content
|
||||
= link_to "[x] close", '#', :id => 'lightbox-close-link'
|
||||
%img#lightbox-image
|
||||
#lightbox-imageset
|
||||
|
||||
|
||||
#lightbox-backdrop
|
||||
#lightbox-backdrop
|
||||
|
||||
%ul#user_menu.dropdown
|
||||
%li
|
||||
|
|
|
|||
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,7 +111,11 @@ end
|
|||
|
||||
Then /^(?:|I )should not see a "([^\"]*)"(?: within "([^\"]*)")?$/ do |selector, scope_selector|
|
||||
with_scope(scope_selector) do
|
||||
page.has_css?(selector).should be_false
|
||||
if page.has_css?(selector)
|
||||
find(:css, selector).visible?.should be_false
|
||||
else
|
||||
page.has_css?(selector).should be_false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
|
@ -202,3 +206,10 @@ Then /^I follow Edit Profile in the same window$/ do
|
|||
And %(I follow "Edit Profile")
|
||||
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