Skip to content

Commit

Permalink
Merge pull request #1733 from ministryofjustice/upgrade-cypress
Browse files Browse the repository at this point in the history
Upgrade cypress
  • Loading branch information
hawx authored Jan 21, 2025
2 parents b866c1c + d759198 commit 1eaa7a7
Show file tree
Hide file tree
Showing 20 changed files with 375 additions and 296 deletions.
6 changes: 4 additions & 2 deletions cypress/e2e/attorney/trust-corporation.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,10 @@ describe('As a trust corporation', () => {

// start
cy.contains('a', 'Start').click();
cy.contains('label', 'Random value').click();
cy.get('form').submit();
cy.origin('http://localhost:7012', () => {
cy.contains('label', 'Random value').click();
cy.get('form').submit();
});

// enter reference number
cy.get('#f-reference-number').type(shareCode);
Expand Down
35 changes: 21 additions & 14 deletions cypress/e2e/certificate-provider/confirm-your-identity.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ describe('confirm your identity', () => {

it('can see details when successful', () => {
cy.contains('button', 'Continue').click()
cy.get('[name="user"]').check('certificate-provider', { force: true })

cy.contains('button', 'Continue').click()
cy.origin('http://localhost:7012', () => {
cy.get('[name="user"]').check('certificate-provider', { force: true })
cy.contains('button', 'Continue').click()
});

cy.url().should('contain', '/identity-details');
cy.checkA11yApp();
Expand All @@ -32,9 +33,10 @@ describe('confirm your identity', () => {

it('can see details when not matched', () => {
cy.contains('button', 'Continue').click()
cy.get('[name="user"]').check('donor', { force: true })

cy.contains('button', 'Continue').click()
cy.origin('http://localhost:7012', () => {
cy.get('[name="user"]').check('donor', { force: true })
cy.contains('button', 'Continue').click()
});

cy.url().should('contain', '/identity-details');
cy.checkA11yApp();
Expand All @@ -54,9 +56,10 @@ describe('confirm your identity', () => {

it('can see next steps when failing', () => {
cy.contains('button', 'Continue').click()
cy.get('[name="return-code"]').check('T', { force: true })

cy.contains('button', 'Continue').click()
cy.origin('http://localhost:7012', () => {
cy.get('[name="return-code"]').check('T', { force: true })
cy.contains('button', 'Continue').click()
});

cy.url().should('contain', '/identity-details');
cy.checkA11yApp();
Expand All @@ -72,9 +75,10 @@ describe('confirm your identity', () => {

it('can see next steps when has insufficient evidence', () => {
cy.contains('button', 'Continue').click()
cy.get('[name="return-code"]').check('X', { force: true })

cy.contains('button', 'Continue').click()
cy.origin('http://localhost:7012', () => {
cy.get('[name="return-code"]').check('X', { force: true })
cy.contains('button', 'Continue').click()
})

cy.url().should('contain', '/identity-details');
cy.checkA11yApp();
Expand All @@ -90,9 +94,12 @@ describe('confirm your identity', () => {

it('can go to the post office ', () => {
cy.url().should('contain', '/confirm-your-identity');
cy.contains('button', 'Continue').click();

cy.go(-2);
cy.url().then(u => {
cy.contains('button', 'Continue').click();
cy.visit(u.split('/').slice(3, -1).join('/') + '/task-list');
});

cy.contains('li', "Confirm your identity")
.should('contain', 'In progress')
.find('a')
Expand Down
6 changes: 4 additions & 2 deletions cypress/e2e/certificate-provider/enter-reference-number.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@ describe('Enter reference number', () => {
cy.visit(`/fixtures/certificate-provider?redirect=/certificate-provider-start&withShareCode=${shareCode}&email=${TestEmail}`);

cy.contains('a', 'Start').click()
cy.contains('label', 'Random value').click();
cy.contains('button', 'Continue').click();
cy.origin('http://localhost:7012', () => {
cy.contains('label', 'Random value').click();
cy.contains('button', 'Continue').click();
});
cy.url().should('contain', '/certificate-provider-enter-reference-number')
});

Expand Down
4 changes: 3 additions & 1 deletion cypress/e2e/certificate-provider/start.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ describe('Start', () => {
cy.contains('a', 'Start').click();

if (Cypress.config().baseUrl.includes('localhost')) {
cy.url().should('contain', '/authorize')
cy.origin('http://localhost:7012', () => {
cy.url().should('contain', '/authorize')
});
} else {
cy.origin('https://signin.integration.account.gov.uk', () => {
cy.url().should('contain', '/')
Expand Down
18 changes: 10 additions & 8 deletions cypress/e2e/donor/add-correspondent.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,11 @@ describe('Add correspondent', () => {
cy.contains('.govuk-summary-list__row', 'Reference number').find('.govuk-summary-list__value')
.invoke('text')
.then((uid) => {
cy.visit(`http://localhost:9001/?detail-type=correspondent-updated&detail=${uid}`);

cy.contains(`{"uid":"${uid}",`);
cy.contains(`"firstNames":"John","lastName":"Smith","email":"[email protected]"}`);
cy.origin('http://localhost:9001', { args: { uid } }, ({ uid }) => {
cy.visit(`/?detail-type=correspondent-updated&detail=${uid}`);
cy.contains(`{"uid":"${uid}",`);
cy.contains(`"firstNames":"John","lastName":"Smith","email":"[email protected]"}`);
});
});
});

Expand Down Expand Up @@ -68,10 +69,11 @@ describe('Add correspondent', () => {
cy.contains('.govuk-summary-list__row', 'Reference number').find('.govuk-summary-list__value')
.invoke('text')
.then((uid) => {
cy.visit(`http://localhost:9001/?detail-type=correspondent-updated&detail=${uid}`);

cy.contains(`{"uid":"${uid}",`);
cy.contains(`"firstNames":"John","lastName":"Smith","email":"[email protected]","address":{"line1":"2 RICHMOND PLACE","line2":"","line3":"","town":"BIRMINGHAM","postcode":"B14 7ED","country":"GB"}}`);
cy.origin('http://localhost:9001', { args: { uid } }, ({ uid }) => {
cy.visit(`/?detail-type=correspondent-updated&detail=${uid}`)
cy.contains(`{"uid":"${uid}",`);
cy.contains(`"firstNames":"John","lastName":"Smith","email":"[email protected]","address":{"line1":"2 RICHMOND PLACE","line2":"","line3":"","town":"BIRMINGHAM","postcode":"B14 7ED","country":"GB"}}`);
});
});
});
});
Loading

0 comments on commit 1eaa7a7

Please sign in to comment.