-
Notifications
You must be signed in to change notification settings - Fork 2
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 #1659 from ministryofjustice/MLPAB-2673-correspond…
…ent-event MLPAB-2673 Send correspondent-updated event
- Loading branch information
Showing
15 changed files
with
433 additions
and
100 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,59 +1,75 @@ | ||
import { AddressFormAssertions } from "../../support/e2e"; | ||
|
||
describe('Add correspondent', () => { | ||
beforeEach(() => { | ||
cy.visit('/fixtures?progress=provideYourDetails&redirect='); | ||
}); | ||
|
||
it('allows none', () => { | ||
cy.contains('M-FAKE-').click(); | ||
cy.contains('Go to task list').click(); | ||
cy.contains('li', 'Add a correspondent').should('contain', 'Not started').click(); | ||
|
||
cy.checkA11yApp(); | ||
cy.contains('label', 'No').click(); | ||
cy.contains('button', 'Save and continue').click(); | ||
cy.contains('li', 'Add a correspondent').should('contain', 'Completed'); | ||
}); | ||
|
||
it('allows without address', () => { | ||
cy.contains('M-FAKE-').click(); | ||
cy.contains('Go to task list').click(); | ||
cy.contains('li', 'Add a correspondent').should('contain', 'Not started').click(); | ||
|
||
cy.checkA11yApp(); | ||
cy.contains('label', 'Yes').click(); | ||
cy.contains('button', 'Save and continue').click(); | ||
|
||
cy.checkA11yApp(); | ||
cy.get('#f-first-names').type('John'); | ||
cy.get('#f-last-name').type('Smith'); | ||
cy.get('#f-email').type('[email protected]'); | ||
cy.contains('label', 'No').click(); | ||
cy.contains('button', 'Save and continue').click(); | ||
cy.contains('li', 'Add a correspondent').should('contain', 'Completed'); | ||
}); | ||
|
||
it('allows with address', () => { | ||
cy.contains('M-FAKE-').click(); | ||
cy.contains('Go to task list').click(); | ||
cy.contains('li', 'Add a correspondent').should('contain', 'Not started').click(); | ||
|
||
cy.checkA11yApp(); | ||
cy.contains('label', 'Yes').click(); | ||
cy.contains('button', 'Save and continue').click(); | ||
|
||
cy.checkA11yApp(); | ||
cy.get('#f-first-names').type('John'); | ||
cy.get('#f-last-name').type('Smith'); | ||
cy.get('#f-email').type('[email protected]'); | ||
cy.contains('label', 'Yes').click(); | ||
cy.contains('button', 'Save and continue').click(); | ||
|
||
cy.contains('label', 'Enter a new address').click(); | ||
cy.contains('button', 'Continue').click(); | ||
AddressFormAssertions.assertCanAddAddressFromSelect() | ||
|
||
cy.contains('li', 'Add a correspondent').should('contain', 'Completed'); | ||
}); | ||
beforeEach(() => { | ||
cy.visit('/fixtures?progress=provideYourDetails&redirect='); | ||
}); | ||
|
||
it('allows none', () => { | ||
cy.contains('M-FAKE-').click(); | ||
cy.contains('Go to task list').click(); | ||
cy.contains('li', 'Add a correspondent').should('contain', 'Not started').click(); | ||
|
||
cy.checkA11yApp(); | ||
cy.contains('label', 'No').click(); | ||
cy.contains('button', 'Save and continue').click(); | ||
cy.contains('li', 'Add a correspondent').should('contain', 'Completed'); | ||
}); | ||
|
||
it('allows without address', () => { | ||
cy.contains('M-FAKE-').click(); | ||
cy.contains('Go to task list').click(); | ||
cy.contains('li', 'Add a correspondent').should('contain', 'Not started').click(); | ||
|
||
cy.checkA11yApp(); | ||
cy.contains('label', 'Yes').click(); | ||
cy.contains('button', 'Save and continue').click(); | ||
|
||
cy.checkA11yApp(); | ||
cy.get('#f-first-names').type('John'); | ||
cy.get('#f-last-name').type('Smith'); | ||
cy.get('#f-email').type('[email protected]'); | ||
cy.contains('label', 'No').click(); | ||
cy.contains('button', 'Save and continue').click(); | ||
cy.contains('li', 'Add a correspondent').should('contain', 'Completed'); | ||
|
||
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}","firstNames":"John","lastName":"Smith","email":"[email protected]"}`); | ||
}); | ||
}); | ||
|
||
it('allows with address', () => { | ||
cy.contains('M-FAKE-').click(); | ||
cy.contains('Go to task list').click(); | ||
cy.contains('li', 'Add a correspondent').should('contain', 'Not started').click(); | ||
|
||
cy.checkA11yApp(); | ||
cy.contains('label', 'Yes').click(); | ||
cy.contains('button', 'Save and continue').click(); | ||
|
||
cy.checkA11yApp(); | ||
cy.get('#f-first-names').type('John'); | ||
cy.get('#f-last-name').type('Smith'); | ||
cy.get('#f-email').type('[email protected]'); | ||
cy.contains('label', 'Yes').click(); | ||
cy.contains('button', 'Save and continue').click(); | ||
|
||
cy.contains('label', 'Enter a new address').click(); | ||
cy.contains('button', 'Continue').click(); | ||
AddressFormAssertions.assertCanAddAddressFromSelect() | ||
|
||
cy.contains('li', 'Add a correspondent').should('contain', 'Completed'); | ||
|
||
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}","firstNames":"John","lastName":"Smith","email":"[email protected]","address":{"line1":"2 RICHMOND PLACE","line2":"","line3":"","town":"BIRMINGHAM","postcode":"B14 7ED","country":"GB"}}`); | ||
}); | ||
}); | ||
}); |
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.