-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable JavaScript testing with Poltergeist #230
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Feature: Smokey Javascript Error detection | ||
|
||
@normal | ||
Scenario: Smokey detects JS errors | ||
When I inject a JavaScript error on the page, Smokey raises an exception | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,7 @@ | ||
Feature: Private Frontend | ||
|
||
Background: | ||
Given I am testing "private-frontend" | ||
And I am not an authenticated user | ||
|
||
@normal | ||
Scenario: check private frontend requires auth | ||
When I try to visit "/" | ||
Given I am testing "private-frontend" | ||
When I visit "/" without authentication | ||
Then I should get a 401 status code |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,5 @@ | ||
require 'json' | ||
|
||
Then /^I should see a consistent JSON format for the path "([^"]*)"$/ do |path| | ||
json = get_request "#{@host}#{path}", cache_bust: @bypass_varnish | ||
json = JSON.parse(json) | ||
assert json["england-and-wales"] | ||
assert json["england-and-wales"]["events"] | ||
assert json["england-and-wales"]["events"].length | ||
result = json["england-and-wales"]["events"].first | ||
assert result["title"] | ||
assert result["date"] | ||
Then /^JSON is returned$/ do | ||
JSON.parse(@response.body).class.should == Hash | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,23 @@ | ||
Given /^I am testing in an EFG context$/ do | ||
# Not sure if there is a better way to do this? | ||
page.driver.browser.agent.add_auth(efg_base_url, ENV['AUTH_USERNAME'], ENV['AUTH_PASSWORD']) | ||
# TODO: remove me | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. was this forgotten? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure - @tijmenb ? |
||
end | ||
|
||
When /^I try to access the list of lenders$/ do | ||
visit "#{efg_base_url}/lenders" | ||
visit_path "#{efg_base_url}/lenders" | ||
end | ||
|
||
When /^I try to login as a valid EFG user$/ do | ||
assert ENV["EFG_USERNAME"] && ENV["EFG_PASSWORD"], "Please ensure that the EFG user credentials are available in the environment" | ||
|
||
# Need to do it this way to comply with CSRF protection | ||
visit "#{efg_base_url}/users/sign_in" | ||
visit_path "#{efg_base_url}/users/sign_in" | ||
fill_in "Username", :with => ENV["EFG_USERNAME"] | ||
fill_in "Password", :with =>ENV["EFG_PASSWORD"] | ||
click_button "Sign In" | ||
end | ||
|
||
When /^I visit the EFG home page$/ do | ||
visit "#{efg_base_url}" | ||
visit_path "#{efg_base_url}" | ||
end | ||
|
||
Then /^I should be on the EFG home page$/ do | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
Then /^I should see an input field to search$/ do | ||
@response.body.should have_field('keywords') | ||
page.body.should have_field('keywords') | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
When /^I click on the section "(.*?)"$/ do |section_name| | ||
link_href = Nokogiri::HTML.parse(@response.body).at_xpath("//h3[text()='#{section_name}']/../@href") | ||
link_href = Nokogiri::HTML.parse(page.body).at_xpath("//h3[text()='#{section_name}']/../@href") | ||
link_href.should_not == nil | ||
step "I visit \"#{link_href.value}\"" | ||
end | ||
|
||
Then /^I should see an input field for postcode$/ do | ||
@response.body.should have_field('postcode') | ||
page.body.should have_field('postcode') | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
When /^I login to Licensify$/ do | ||
visit "https://licensify-admin.#{ENV['GOVUK_APP_DOMAIN']}/login" | ||
visit_path "https://licensify-admin.#{ENV['GOVUK_APP_DOMAIN']}/login" | ||
click_button 'Login' | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
When /^I search for "(.*)"$/ do |term| | ||
visit_path "/search?q=#{term}" | ||
end | ||
|
||
Then /^I should see some search results$/ do | ||
result_links = page.all(".results-list li a") | ||
result_links.count.should >= 1 | ||
end | ||
|
||
Then /^I should see organisations in the organisation filter$/ do | ||
organisation_options = page.all("#organisations-filter input") | ||
organisation_options.count.should >= 10 | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is clever!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nicely done!