Skip to content
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

Test component guide #452

Merged
merged 5 commits into from
Aug 25, 2017
Merged

Test component guide #452

merged 5 commits into from
Aug 25, 2017

Conversation

NickColley
Copy link
Contributor

This PR prepares government-frontend to be able to pick up throw accessibility errors from the component guide.

Related PR: alphagov/govuk_publishing_components#33

@boffbowsh boffbowsh temporarily deployed to government-frontend-pr-452 August 17, 2017 15:54 Inactive
end
components.each do |component|
visit component[:href] + '/preview'
end
Copy link
Contributor

@fofr fofr Aug 17, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this be:

all(:css, '.component-list a').each do |el|
  visit "#{el[:href]}/preview"
end

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it suffered from the issue we ran into where the instances can't be visited since they 'no longer exist'

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

component_previews = all(:css, '.component-list a').map do |el|
  "#{el[:href]}/preview"
end

component_previews.each do |component|
  visit component
end

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's better, I think I was tired when I wrote this because there's also unneeded data in there too. Will update

@NickColley NickColley temporarily deployed to government-frontend-pr-452 August 18, 2017 14:48 Inactive
@@ -0,0 +1,15 @@
require 'component_test_helper'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this can be test_helper

NickColley and others added 5 commits August 25, 2017 12:56
This will catch any JavaScript errors on the page, which will be
useful when we throw accessibility related errors
The aXe JS provided by the govuk_publishing_components gem was not
available during integration tests, meaning accessibility would not be
found locally.

Don't depend on precompiled JS assets. We are not currently
precompiling javascript before tests run when testing locally. Meaning
failing JS will not be detected in integration tests until they reach
CI.
@fofr
Copy link
Contributor

fofr commented Aug 25, 2017

Rebased with master and updated gem to pick up aXe tests.

Needed to add a806be8 for tests to fail as expected when running locally.

@fofr fofr merged commit e315baf into master Aug 25, 2017
@fofr fofr deleted the test-component-guide branch August 25, 2017 15:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants