-
Notifications
You must be signed in to change notification settings - Fork 17
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
Test component guide #452
Conversation
test/components/all_components.rb
Outdated
end | ||
components.each do |component| | ||
visit component[:href] + '/preview' | ||
end |
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.
Could this be:
all(:css, '.component-list a').each do |el|
visit "#{el[:href]}/preview"
end
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.
I think it suffered from the issue we ran into where the instances can't be visited since they 'no longer exist'
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.
component_previews = all(:css, '.component-list a').map do |el|
"#{el[:href]}/preview"
end
component_previews.each do |component|
visit component
end
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.
That's better, I think I was tired when I wrote this because there's also unneeded data in there too. Will update
test/components/all_components.rb
Outdated
@@ -0,0 +1,15 @@ | |||
require 'component_test_helper' |
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.
I think this can be test_helper
This will catch any JavaScript errors on the page, which will be useful when we throw accessibility related errors
Pick up aXe testing
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.
2c426ec
to
a806be8
Compare
Rebased with master and updated gem to pick up aXe tests. Needed to add a806be8 for tests to fail as expected when running locally. |
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