Browse Source

Fixed tests for PhantomJS 2.5

development
Godwin 8 years ago
parent
commit
7d7166c3be
  1. 4
      app/assets/stylesheets/bumbleberry-settings.json
  2. 1098
      config/locales/fr.yml
  3. 5
      features/sign_in.feature
  4. 6
      features/step_definitions/interface_steps.rb
  5. 2
      features/step_definitions/navigation.rb
  6. 7
      features/support/env.rb
  7. 7
      features/support/helper.rb
  8. 3
      features/support/paths.rb
  9. 1
      features/support/state.rb
  10. 48
      features/workshops.feature

4
app/assets/stylesheets/bumbleberry-settings.json

@ -7,8 +7,8 @@
}, },
"development": { "development": {
"safari": ["5", "5.1"], "safari": ["5", "5.1"],
"and_chr": ["57"], "and_chr": ["59"],
"chrome": ["57"], "chrome": ["59"],
"edge": ["13"], "edge": ["13"],
"firefox": ["50"], "firefox": ["50"],
"ie": ["11"], "ie": ["11"],

1098
config/locales/fr.yml

File diff suppressed because it is too large

5
features/sign_in.feature

@ -78,7 +78,4 @@ Feature: Sign In
Then I should see 'Before proceeding, you must provide us an email address' Then I should see 'Before proceeding, you must provide us an email address'
When I enter my email address When I enter my email address
And press save And click the 'Save' button
Then I should see 'Mark Zuckerberg'
And I should see 'Sign out'

6
features/step_definitions/interface_steps.rb

@ -11,15 +11,19 @@ Then /^(?:I )?(?:should )?(not )?see (?:the |an? )?'(.+)' link$/i do |no, item|
end end
Then /^(?:I )?(?:should )?(?:still )?(not )?see '(.+)'$/i do |negate, item| Then /^(?:I )?(?:should )?(?:still )?(not )?see '(.+)'$/i do |negate, item|
attempt_to true do
attempt_to do attempt_to do
expect(page).send(negate ? :not_to : :to, have_text(item)) expect(page).send(negate ? :not_to : :to, have_text(item))
end end
end
end end
Then /^(?:I )?(?:should )?(?:still )?(not )?see (?:my |the )([^']+)$/i do |negate, item| Then /^(?:I )?(?:should )?(?:still )?(not )?see (?:my |the )([^']+)$/i do |negate, item|
attempt_to true do
attempt_to do attempt_to do
expect(page).send(negate ? :not_to : :to, have_text(TestState::Values[get_field(item)])) expect(page).send(negate ? :not_to : :to, have_text(TestState::Values[get_field(item)]))
end end
end
end end
Then /^(?:I )?click (?:on )?(?:the )?(a )?'(.+?)'( button| link)?(?: beside '(.+?)')?(?: again)?$/i do |first, item, type, beside| Then /^(?:I )?click (?:on )?(?:the )?(a )?'(.+?)'( button| link)?(?: beside '(.+?)')?(?: again)?$/i do |first, item, type, beside|
@ -114,7 +118,7 @@ Then /^(?:I )?enter (?:my |an? |some |the )?(.+?)(?: as '(.+)')?$/i do |field, v
end end
end end
(TestState::Values[field] = value) TestState::Values[field] = value
element.set value element.set value

2
features/step_definitions/navigation.rb

@ -23,6 +23,7 @@ Then /^(?:I )?should be on (?:the |an? | my)?(.+) page$/i do |page_name|
sleep(1) sleep(1)
attempt_to do attempt_to do
path = path_to(page_name) path = path_to(page_name)
TestState.last_page = path
path = /(https?\/\/:[^\/]+)?#{Regexp.escape(path)}\/?(\?|#|$)/ unless path.is_a?(Regexp) path = /(https?\/\/:[^\/]+)?#{Regexp.escape(path)}\/?(\?|#|$)/ unless path.is_a?(Regexp)
begin begin
current_url.should match path current_url.should match path
@ -33,7 +34,6 @@ Then /^(?:I )?should be on (?:the |an? | my)?(.+) page$/i do |page_name|
visit page.driver.network_traffic.last.url visit page.driver.network_traffic.last.url
end end
else else
puts "#{page.driver.network_traffic.last.method} #{page.driver.network_traffic.last.url} (#{page.driver.network_traffic.last.response_parts.first.status}) != #{path}"
raise e raise e
end end
end end

7
features/support/env.rb

@ -24,7 +24,7 @@ Capybara.register_driver :bb_poltergeist do |app|
end end
opts = { opts = {
timeout: 60, timeout: 10,
window_size: [1200, 800] window_size: [1200, 800]
} }
Capybara::Poltergeist::Driver.new(app, opts) Capybara::Poltergeist::Driver.new(app, opts)
@ -50,9 +50,12 @@ Before do
end end
After do |scenario| After do |scenario|
sleep 1
log_result scenario log_result scenario
if LinguaFranca.recording?
sleep 1
LinguaFranca.screenshot_mail LinguaFranca.screenshot_mail
end
if scenario.failed? if scenario.failed?
if @exception if @exception

7
features/support/helper.rb

@ -53,7 +53,7 @@ def capture_html(distance_from_root = 3)
html.gsub(/(=\"|\(['"]?)(?:#{host})?\/(assets|uploads)/, "\\1#{public_dir}\\2") html.gsub(/(=\"|\(['"]?)(?:#{host})?\/(assets|uploads)/, "\\1#{public_dir}\\2")
end end
def attempt_to(&block) def attempt_to(refresh_on_fail = false, &block)
begin begin
retries ||= 0 retries ||= 0
timeout ||= 0 timeout ||= 0
@ -61,8 +61,7 @@ def attempt_to(&block)
yield yield
rescue Exception => e rescue Exception => e
raise e unless (retries += 1) <= 4 raise e unless (retries += 1) <= 4
# puts "Failed: #{e}" visit TestState.last_page if TestState.last_page && refresh_on_fail
# puts "Retry ##{retries}"
sleep(timeout * timeout) sleep(timeout * timeout)
retry retry
end end
@ -84,7 +83,7 @@ end
def emails_to(email_address, subject = nil) def emails_to(email_address, subject = nil)
ActionMailer::Base.deliveries.select do |mail| ActionMailer::Base.deliveries.select do |mail|
mail.to.include?(email_address) && mail.to.include?(email_address) &&
(subject.nil? || mail.subject.downcase =~ /#{Regexp.escape(subject.downcase)}/) (subject.nil? || mail.subject.downcase.include?(subject.downcase))
end end
end end

3
features/support/paths.rb

@ -10,6 +10,9 @@ module NavigationHelpers
path = :view_workshop path = :view_workshop
args << TestState.last_conference.slug args << TestState.last_conference.slug
args << TestState.last_workshop.id args << TestState.last_workshop.id
when /^delete_workshop$/i
args << TestState.last_conference.slug
args << TestState.last_workshop.id
when /^registration$/i when /^registration$/i
path = :register path = :register
args << TestState.last_conference.slug args << TestState.last_conference.slug

1
features/support/state.rb

@ -6,6 +6,7 @@ module TestState
attr_accessor :last_organization attr_accessor :last_organization
attr_accessor :last_email attr_accessor :last_email
attr_accessor :it attr_accessor :it
attr_accessor :last_page
def my_account=(user) def my_account=(user)
@my_account = user @my_account = user

48
features/workshops.feature

@ -21,7 +21,8 @@ Feature: Workshops
And check 'Meeting Room' And check 'Meeting Room'
And click the 'Save' button And click the 'Save' button
Then I should see 'Funding' Then I should be on my workshop page
And I should see 'Funding'
And should see 'Projector' And should see 'Projector'
And see my title And see my title
And see my info And see my info
@ -55,12 +56,18 @@ Feature: Workshops
Then I should see 'Deleting a workshop cannot be undone' Then I should see 'Deleting a workshop cannot be undone'
When I click on the 'Cancel' button When I click on the 'Cancel' button
Then I should see 'Tools' Then I should be on my workshop page
And I should see 'Tools'
And should see 'Education' And should see 'Education'
When I click the 'Delete Workshop' link When I click the 'Delete Workshop' link
And click the 'Confirm' button And click the 'Confirm' button
Then I should see 'Propose a Workshop'
Then I should be on the delete_workshop page
When 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 But I should not see any workshops
Scenario: Users can comment on an translate their own workshops Scenario: Users can comment on an translate their own workshops
@ -78,19 +85,25 @@ Feature: Workshops
When I enter my title as 'Puentes a las bicicletas' When I enter my title as 'Puentes a las bicicletas'
And enter some info And enter some info
And click the 'Save' button And click the 'Save' button
Then my workshop title should be 'Bridges to Bicycles' Then I should be on my workshop page
And my workshop title should be 'Bridges to Bicycles'
And my Spanish workshop title should be 'Puentes a las bicicletas' And my Spanish workshop title should be 'Puentes a las bicicletas'
And I should see 'Bridges to Bicycles' And I should see 'Bridges to Bicycles'
When I enter a comment When I enter a comment
And I click the 'Add Comment' button And I click the 'Add Comment' button
Then I should see 'less than a minute ago'
Then I should be on my workshop page
And I should see 'less than a minute ago'
And I should see my comment And I should see my comment
When I click the 'Reply' button When I click the 'Reply' button
And enter a reply And enter a reply
And click the 'Reply' button And click the 'Reply' button
Then I should see my comment
Then I should be on my workshop page
And I should see 'less than a minute ago'
And I should see my comment
And see my reply And see my reply
Scenario: Users can add facilitators to their workshops Scenario: Users can add facilitators to their workshops
@ -122,9 +135,10 @@ Feature: Workshops
Then I should see 'Please Confirm' Then I should see 'Please Confirm'
And I should see 'Yes' And I should see 'Yes'
And click the 'Yes' button And click the 'Yes' button
Then I should not see 'Please Confirm' Then I should not see 'Please Confirm'
And I should not see 'new-facilitator@bikebike.org Unregistered' # And I should not see 'new-facilitator@bikebike.org Unregistered'
But I should see 'Applying for 501c3 status' # But I should see 'Applying for 501c3 status'
Scenario: Users can approve and deny facilitation requests on their workshops Scenario: Users can approve and deny facilitation requests on their workshops
Given that there is an upcoming conference Given that there is an upcoming conference
@ -175,7 +189,8 @@ Feature: Workshops
And see 'Are you sure you would like to remove Hadrian as a facilitator of this workshop?' And see 'Are you sure you would like to remove Hadrian as a facilitator of this workshop?'
When I click on the 'Yes' button When I click on the 'Yes' button
Then I should not see 'Hadrian' Then I should be on my workshop page
And I should not see 'Hadrian'
When I click the 'Transfer Ownership' button beside 'Saladin' When I click the 'Transfer Ownership' button beside 'Saladin'
Then I should see 'Please Confirm' Then I should see 'Please Confirm'
@ -189,7 +204,8 @@ Feature: Workshops
And see 'Are you sure you want to transfer ownership to Saladin?' And see 'Are you sure you want to transfer ownership to Saladin?'
When I click the 'Yes' button When I click the 'Yes' button
Then I should not see 'Saladin Collaborator' Then I should be on my workshop page
And I should not see 'Saladin Collaborator'
But I should see 'Saladin Owner' But I should see 'Saladin Owner'
When I click the 'Leave' button When I click the 'Leave' button
@ -204,7 +220,8 @@ Feature: Workshops
And see 'Are you sure you would like to remove yourself as a facilitator of this workshop?' And see 'Are you sure you would like to remove yourself as a facilitator of this workshop?'
When I click the 'Yes' button When I click the 'Yes' button
Then I should not see 'Leave' Then I should be on my workshop page
And I should not see 'Leave'
But I should see 'Make a facilitation request' But I should see 'Make a facilitation request'
When I click the 'Make a facilitation request' button When I click the 'Make a facilitation request' button
@ -227,7 +244,8 @@ Feature: Workshops
Then I should still see 'Cancel Request' Then I should still see 'Cancel Request'
When I click the 'Cancel Request' button again When I click the 'Cancel Request' button again
And click the 'Yes' button And click the 'Yes' button
Then I should not see 'Cancel Request' Then I should be on my workshop page
And I should not see 'Cancel Request'
But I should see 'Make a facilitation request' But I should see 'Make a facilitation request'
Scenario: Users can add interest to workshops Scenario: Users can add interest to workshops
@ -306,7 +324,8 @@ Feature: Workshops
And enter a comment as 'Will you be covering Canadian contracts?' And enter a comment as 'Will you be covering Canadian contracts?'
And click the 'Add Comment' button And click the 'Add Comment' button
Then I should see 'Will you be covering Canadian contracts?' Then I should be on my workshop page
And I should see 'Will you be covering Canadian contracts?'
And 'Brunhilda' should get a 'commented' email And 'Brunhilda' should get a 'commented' email
When in a new session When in a new session
@ -316,5 +335,6 @@ Feature: Workshops
And enter a reply as 'If we can find a Canadian facilitator' And enter a reply as 'If we can find a Canadian facilitator'
And click the 'Reply' button And click the 'Reply' button
Then I should see 'If we can find a Canadian facilitator' 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 And 'Geronimo' should get a 'replied' email

Loading…
Cancel
Save