-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #230 from alphagov/capybara-webkit
Enable JavaScript testing with Poltergeist
- Loading branch information
Showing
30 changed files
with
157 additions
and
188 deletions.
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
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.