-
Notifications
You must be signed in to change notification settings - Fork 1
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 new automation #1471
Open
ayfw
wants to merge
10
commits into
main
Choose a base branch
from
test_new_automation
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Test new automation #1471
Changes from 6 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
c20909b
added_axe_accessibility_tests_for_ott
ayfw ae1a304
added_axe_tests_for_dutycal_and_roo
ayfw 93619f4
added_e2e_tests_for_dutycalc_and_roo
ayfw 291926d
added_e2e_tests_duty_and_roo
ayfw 3958f45
added_e2e_axe_tests_for_roo_and_dutycalc
ayfw b382cdf
Merge branch 'main' into test_new_automation
bhavanibandla 4ac977b
fixed_package.json
ayfw 0ed4af1
removed_duplicate_cypress_devdependency
ayfw a921c23
Merge branch 'main' into test_new_automation
bhavanibandla 31f9acd
removed_.only_from_accessibility_test
ayfw 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
143 changes: 143 additions & 0 deletions
143
cypress/e2e/AccessibilityTests/accessibilityTests.cy.js
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,143 @@ | ||
describe('Accessibility Test Suite', () => { | ||
context('when on the UK service', function() { | ||
it('Find commodity page - Accessibility Test', () => { | ||
cy.visit('/find_commodity'); | ||
cy.injectAndCheckA11y(); | ||
}); | ||
it('Browse page - Accessibility Test', () => { | ||
cy.visit('/browse'); | ||
cy.injectAndCheckA11y(); | ||
}); | ||
it('A-z index page - Accessibility Test', () => { | ||
cy.visit('/a-z-index/a'); | ||
cy.injectAndCheckA11y(); | ||
}); | ||
it('Tools page - Accessibility Test', () => { | ||
cy.visit('/tools'); | ||
cy.injectAndCheckA11y(); | ||
}); | ||
it('News page - Accessibility Test', () => { | ||
cy.visit('/news'); | ||
cy.injectAndCheckA11y(); | ||
}); | ||
it('Help page - Accessibility Test', () => { | ||
cy.visit('/help'); | ||
cy.injectAndCheckA11y(); | ||
}); | ||
it('Quota search page - Accessibility Test', () => { | ||
cy.visit('/quota_search'); | ||
cy.injectAndCheckA11y(); | ||
}); | ||
it('Additional code search page - Accessibility Test', () => { | ||
cy.visit('/additional_code_search'); | ||
cy.injectAndCheckA11y(); | ||
}); | ||
it('Certificate search page - Accessibility Test', () => { | ||
cy.visit('/certificate_search'); | ||
cy.injectAndCheckA11y(); | ||
}); | ||
it('Footnote search page - Accessibility Test', () => { | ||
cy.visit('/footnote_search'); | ||
cy.injectAndCheckA11y(); | ||
}); | ||
it('Chemical search page - Accessibility Test', () => { | ||
cy.visit('/chemical_search'); | ||
cy.injectAndCheckA11y(); | ||
}); | ||
it('Import page - Accessibility Test', () => { | ||
cy.visit('/commodities/6004100091?country=JP#import'); | ||
cy.injectAndCheckA11y(); | ||
}); | ||
it('Export page - Accessibility Test', () => { | ||
cy.visit('/commodities/6004100091?country=JP#export'); | ||
cy.injectAndCheckA11y(); | ||
}); | ||
it('Origin page - Accessibility Test', () => { | ||
cy.visit('/commodities/6004100091?country=JP#rules-of-origin'); | ||
cy.injectAndCheckA11y(); | ||
}); | ||
it('Notes page - Accessibility Test', () => { | ||
cy.visit('/commodities/6004100091?country=JP#footnotes'); | ||
cy.injectAndCheckA11y(); | ||
}); | ||
it('Duty calculator page - Northern Ireland to GB United Kingdom - Accessibility Test', () => { | ||
cy.visit('/commodities/6004100091'); | ||
cy.dutyCalLink('6004100091'); | ||
cy.axeValidDate(); | ||
cy.axeSelectDestination('gb'); | ||
cy.axeOriginList({value: 'Northern Ireland'}); | ||
cy.axeNoDuty(); | ||
}); | ||
it.only('ROO - importing goods into the UK from Japan - Not Wholely Obtained + One Scheme + Insufficient processing - Japan - Accessibility Test', () => { | ||
cy.visit('/commodities/6004100091?country=JP#rules-of-origin'); | ||
cy.axeCheckRoO(); | ||
cy.axeImpOrExp('Japan', 'import'); | ||
cy.axeHowOrginating('Japan', 'UK-Japan Comprehensive Economic Partnership Agreement'); | ||
cy.axeHowWhollyObtained('UK-Japan Comprehensive Economic Partnership Agreement'); | ||
cy.axeWhatComponents('UK-Japan Comprehensive Economic Partnership Agreement'); | ||
cy.axeWhollyObtained('Japan', 'no'); | ||
cy.axeNotWhollyObtained('Japan'); | ||
cy.axeCumulation('japan', '6004100091', 'JP', 'UK-Japan Comprehensive Economic Partnership Agreement'); | ||
cy.axeMinimalOps('UK-Japan Comprehensive Economic Partnership Agreement', 'no'); | ||
cy.axeRooNotMet('Importing', 'Japan', '6004100091', 'UK-Japan Comprehensive Economic Partnership Agreement'); | ||
}); | ||
}); | ||
context('when on the XI service', function() { | ||
it('Find commodity page - Accessibility Test', () => { | ||
cy.visit('/xi/find_commodity'); | ||
cy.injectAndCheckA11y(); | ||
}); | ||
it('Browse page - Accessibility Test', () => { | ||
cy.visit('/xi/browse'); | ||
cy.injectAndCheckA11y(); | ||
}); | ||
it('A-z index page - Accessibility Test', () => { | ||
cy.visit('/xi/a-z-index/a'); | ||
cy.injectAndCheckA11y(); | ||
}); | ||
it('Tools page - Accessibility Test', () => { | ||
cy.visit('/xi/tools'); | ||
cy.injectAndCheckA11y(); | ||
}); | ||
it('News page - Accessibility Test', () => { | ||
cy.visit('/xi/news'); | ||
cy.injectAndCheckA11y(); | ||
}); | ||
it('Help page - Accessibility Test', () => { | ||
cy.visit('/xi/help'); | ||
cy.injectAndCheckA11y(); | ||
}); | ||
it('Additional code search page - Accessibility Test', () => { | ||
cy.visit('/xi/additional_code_search'); | ||
cy.injectAndCheckA11y(); | ||
}); | ||
it('Certificate search page - Accessibility Test', () => { | ||
cy.visit('/xi/certificate_search'); | ||
cy.injectAndCheckA11y(); | ||
}); | ||
it('Footnote search page - Accessibility Test', () => { | ||
cy.visit('/xi/footnote_search'); | ||
cy.injectAndCheckA11y(); | ||
}); | ||
it('Chemical search page - Accessibility Test', () => { | ||
cy.visit('/xi/chemical_search'); | ||
cy.injectAndCheckA11y(); | ||
}); | ||
it('Import page - Accessibility Test', () => { | ||
cy.visit('/xi/commodities/6004100091?country=JP'); | ||
cy.injectAndCheckA11y(); | ||
}); | ||
it('Export page - Accessibility Test', () => { | ||
cy.visit('/xi/commodities/6004100091?country=JP#export'); | ||
cy.injectAndCheckA11y(); | ||
}); | ||
it('Origin page - Accessibility Test', () => { | ||
cy.visit('/xi/commodities/6004100091?country=JP#rules-of-origin'); | ||
cy.injectAndCheckA11y(); | ||
}); | ||
it('Notes page - Accessibility Test', () => { | ||
cy.visit('/xi/commodities/6004100091?country=JP#footnotes'); | ||
cy.injectAndCheckA11y(); | ||
}); | ||
}) | ||
}) |
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,154 @@ | ||
|
||
import dayjs from 'dayjs'; | ||
|
||
const currentDate = dayjs().format('DD'); | ||
const currentMonth = dayjs().format('MM'); | ||
const currentYear = dayjs().format('YYYY'); | ||
|
||
beforeEach(() => { | ||
cy.clearCookies(); | ||
}); | ||
|
||
Cypress.Commands.add('axeIgnoreVio', (destination) => { | ||
cy.injectAxe(); | ||
cy.checkA11y(null, null, (violations) => { | ||
cy.log('Accessibility Violations:', violations); | ||
violations.forEach(v => { | ||
cy.log(`Violation: ${v.id} - ${v.description}`); | ||
}); | ||
}, true); | ||
}); | ||
|
||
Cypress.Commands.add('axeValidDate', () => { | ||
cy.contains('When will the goods be imported?'); | ||
cy.title().should('eq', 'When will the good be imported - Online Tariff Duty calculator'); | ||
cy.get('#steps_import_date_import_date_3i').click(); | ||
cy.get('#steps_import_date_import_date_3i').clear(); | ||
cy.get('#steps_import_date_import_date_3i').type(currentDate); | ||
cy.get('#steps_import_date_import_date_2i').click(); | ||
cy.get('#steps_import_date_import_date_2i').clear(); | ||
cy.get('#steps_import_date_import_date_2i').type(currentMonth); | ||
cy.get('#steps_import_date_import_date_1i').click(); | ||
cy.get('#steps_import_date_import_date_1i').clear(); | ||
cy.get('#steps_import_date_import_date_1i').type(currentYear); | ||
cy.axeIgnoreVio(); | ||
cy.contains('Continue').click(); | ||
cy.axeIgnoreVio(); | ||
}); | ||
|
||
Cypress.Commands.add('axeSelectDestination', (destination) => { | ||
cy.contains('Which part of the UK are you importing into?'); | ||
cy.title().should('eq', 'Which part of the UK are you importing into - Online Tariff Duty calculator'); | ||
if (destination === 'xi') { | ||
cy.get('#steps-import-destination-import-destination-xi-field').check(); | ||
} else { | ||
cy.get('#steps-import-destination-import-destination-uk-field').check(); | ||
} | ||
cy.contains('Continue').click(); | ||
cy.axeIgnoreVio(); | ||
}); | ||
|
||
Cypress.Commands.add('axeOriginList', (origin) => { | ||
cy.contains('Where are the goods coming from?'); | ||
cy.title().should('eq', 'Which country are the goods dispatched from - Online Tariff Duty calculator'); | ||
cy.get('#steps-country-of-origin-country-of-origin-field').click(); | ||
cy.get('#steps-country-of-origin-country-of-origin-field').clear(); | ||
cy.get('#steps-country-of-origin-country-of-origin-field').type(origin.value); | ||
cy.contains('Continue').click(); | ||
cy.axeIgnoreVio(); | ||
}); | ||
|
||
Cypress.Commands.add('axeNoDuty', (_options) => { | ||
cy.contains('There is no import duty to pay'); | ||
cy.title().should('eq', 'There is no import duty to pay - Online Tariff Duty calculator'); | ||
cy.axeIgnoreVio(); | ||
}); | ||
|
||
Cypress.Commands.add('axeCheckRoO', ()=>{ | ||
cy.contains('UK Integrated Online Tariff '); | ||
cy.get('div#rules-of-origin button[name=\'button\']').click(); | ||
cy.axeIgnoreVio(); | ||
}); | ||
|
||
Cypress.Commands.add('axeImpOrExp', (country, selection)=>{ | ||
cy.contains('Details of your trade'); | ||
cy.contains(`Are you importing goods into the UK or into ${country}?`); | ||
cy.get(`#rules-of-origin-steps-import-export-import-or-export-${selection}-field`).check(); | ||
cy.get('.govuk-button').contains('Continue').click(); | ||
cy.axeIgnoreVio(); | ||
}); | ||
|
||
Cypress.Commands.add('axeHowOrginating', (country, agreement)=>{ | ||
cy.contains('Are your goods originating?'); | ||
cy.contains(`How to work out if your goods are classed as 'originating' in ${country}`); | ||
cy.get('.govuk-body-l').contains(`${agreement}`); | ||
cy.contains(`Click on the ‘Continue’ button to view the definition of ‘wholly obtained’ in the ${agreement}.`); | ||
cy.get('.govuk-button').contains('Continue').click(); | ||
cy.axeIgnoreVio(); | ||
}); | ||
|
||
Cypress.Commands.add('axeHowWhollyObtained', (agreement)=>{ | ||
cy.contains('Are your goods originating?'); | ||
cy.contains(`How 'wholly obtained' is defined in the ${agreement}`); | ||
cy.contains(`Click on the ‘Continue’ button to see which parts and processes should be included or disregarded in determining originating status for the ${agreement}.`); | ||
cy.get('.govuk-button').contains('Continue').click(); | ||
cy.axeIgnoreVio(); | ||
}); | ||
|
||
Cypress.Commands.add('axeWhatComponents', (agreement)=>{ | ||
cy.contains('Are your goods originating?'); | ||
cy.contains(`Neutral elements in the ${agreement}`); | ||
cy.contains(`Packing materials in the ${agreement}`); | ||
cy.contains(`Accessories, spare parts and tools in the ${agreement}`); | ||
cy.contains(`Click on the 'Continue' button to indicate if your goods are wholly obtained, based on the rules of the ${agreement}.`); | ||
cy.get('.govuk-button').contains('Continue').click(); | ||
cy.axeIgnoreVio(); | ||
}); | ||
|
||
Cypress.Commands.add('axeWhollyObtained', (country, select)=>{ | ||
cy.get(`#rules-of-origin-steps-wholly-obtained-wholly-obtained-${select}-field`).check(); | ||
cy.get('.govuk-button').contains('Continue').click(); | ||
cy.axeIgnoreVio(); | ||
}); | ||
|
||
Cypress.Commands.add('axeNotWhollyObtained', (country)=>{ | ||
cy.contains('Are your goods originating?'); | ||
cy.get('.govuk-button').contains('Continue').click(); | ||
cy.axeIgnoreVio(); | ||
}); | ||
|
||
Cypress.Commands.add('axeCumulation', (country, code, countryShortName, scheme)=>{ | ||
cy.contains('Are your goods originating?'); | ||
cy.get('form#edit_rules_of_origin_steps_cumulation_cumulation a[target=\'_blank\']').should('have.attr', 'href', `/cumulation_maps/${country}.png`); | ||
cy.contains('Bilateral cumulation - an example').click(); | ||
cy.contains('insufficient processing clause').should('have.attr', 'href', `/rules_of_origin/${code}/${countryShortName}/sufficient_processing`); | ||
if (`${countryShortName}` === 'JP') { | ||
cy.contains('Extended cumulation - an example').click(); | ||
cy.contains('insufficient processing clause').should('have.attr', 'href', `/rules_of_origin/${code}/${countryShortName}/sufficient_processing`); | ||
} else if (`${countryShortName}` === 'KR') { | ||
cy.contains('Diagonal cumulation - an example').click(); | ||
cy.should('not.contain.text', 'insufficient processing clause'); | ||
} | ||
cy.get('.govuk-button').contains('Continue').click(); | ||
cy.axeIgnoreVio(); | ||
}); | ||
|
||
Cypress.Commands.add('axeMinimalOps', (scheme, selection)=>{ | ||
cy.contains('Are your goods originating?'); | ||
cy.get(`#rules-of-origin-steps-sufficient-processing-sufficient-processing-${selection}-field`).check(); | ||
cy.get('.govuk-button').contains('Continue').click(); | ||
cy.axeIgnoreVio(); | ||
}); | ||
|
||
Cypress.Commands.add('axeRooNotMet', (tradetype, country, code, scheme)=>{ | ||
cy.contains(`${tradetype} commodity ${code} from ${country}`); | ||
cy.contains('Product-specific rules not met'); | ||
cy.should('not.have.text', 'Find out about duty drawback'); | ||
cy.get('.govuk-warning-text__text').contains('obtaining and verifying proofs of origin').click(); | ||
cy.contains('Valid proofs of origin'); | ||
cy.go('back'); | ||
cy.get('.govuk-warning-text__text').contains('start again').click(); | ||
cy.contains(`Are you importing goods into the UK or into ${country}?`); | ||
cy.axeIgnoreVio(); | ||
bhavanibandla marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}); | ||
|
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
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.
@ayfw Can you remove
.only
from this test case?