-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement EW migration alert banner messages
WIP
- Loading branch information
Showing
5 changed files
with
102 additions
and
58 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
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
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,9 +1,42 @@ | ||
import { exportWinsFaker } from '../../fakers/export-wins' | ||
import urls from '../../../../../src/lib/urls' | ||
import { company, formFields } from './constants' | ||
import { HISTORIC_ALERT_MESSAGE } from '../../../../../src/client/modules/ExportWins/Status/constants' | ||
|
||
const exportWin = exportWinsFaker() | ||
|
||
const assertHistoricExportWinsMessage = () => { | ||
cy.get('[data-test="status-message"]') | ||
.should('contain', HISTORIC_ALERT_MESSAGE.ELEMENT) | ||
.should('contain.text', HISTORIC_ALERT_MESSAGE.URI_ELEMENT) | ||
.find('a') | ||
.should('have.attr', 'href', HISTORIC_ALERT_MESSAGE.URI_LINK) | ||
} | ||
|
||
const assertCustomerDetailsMessage = () => { | ||
cy.get('[data-test="status-message"]').should( | ||
'contain.text', | ||
'Contact [email protected] if you need to update the section: export experience.' | ||
) | ||
} | ||
|
||
const assertWinDetailsMessage = () => { | ||
cy.get('[data-test="status-message"]').should( | ||
'contain.text', | ||
'Contact [email protected] if you need to update the sections: ' + | ||
'summary of the support given, destination country, date won, type of win and value.' | ||
) | ||
} | ||
|
||
const assertSummaryMessage = () => { | ||
cy.get('[data-test="status-message"]').should( | ||
'contain.text', | ||
'To edit an export win' + | ||
'Edit each section that needs changing then return to the summary page. ' + | ||
'When you are happy with all the changes save the page.' | ||
) | ||
} | ||
|
||
describe('Editing a pending export win', () => { | ||
beforeEach(() => { | ||
cy.intercept('GET', '/api-proxy/v4/export-win/*', exportWin).as( | ||
|
@@ -41,10 +74,7 @@ describe('Editing a pending export win', () => { | |
urls.companies.exportWins.editOfficerDetails(company.id, exportWin.id) | ||
) | ||
cy.wait(['@apiGetExportWin', '@apiTeamType', '@apiHqTeam']) | ||
cy.get('[data-test="status-message"]').should( | ||
'have.text', | ||
'Contact [email protected] if you need to update the section: Lead officer name' | ||
) | ||
assertHistoricExportWinsMessage() | ||
}) | ||
}) | ||
|
||
|
@@ -54,7 +84,7 @@ describe('Editing a pending export win', () => { | |
urls.companies.exportWins.editCreditForThisWin(company.id, exportWin.id) | ||
) | ||
cy.wait(['@apiGetExportWin', '@apiTeamType', '@apiHqTeam']) | ||
cy.get('[data-test="status-message"]').should('not.exist') | ||
assertHistoricExportWinsMessage() | ||
}) | ||
}) | ||
|
||
|
@@ -67,12 +97,8 @@ describe('Editing a pending export win', () => { | |
}) | ||
|
||
it('should render an edit status message', () => { | ||
cy.get('[data-test="status-message"]') | ||
.should('exist') | ||
.should( | ||
'have.text', | ||
'Contact [email protected] if you need to update the section: Export experience' | ||
) | ||
assertHistoricExportWinsMessage() | ||
assertCustomerDetailsMessage() | ||
}) | ||
|
||
it('should not render Export experience', () => { | ||
|
@@ -91,13 +117,8 @@ describe('Editing a pending export win', () => { | |
}) | ||
|
||
it('should render an edit status message', () => { | ||
cy.get('[data-test="status-message"]') | ||
.should('exist') | ||
.should( | ||
'have.text', | ||
'Contact [email protected] if you need to update the sections: ' + | ||
'Summary of the support given, Destination country, Date won, Type of win and Value' | ||
) | ||
assertHistoricExportWinsMessage() | ||
assertWinDetailsMessage() | ||
}) | ||
|
||
it('should not render a hint', () => { | ||
|
@@ -137,20 +158,17 @@ describe('Editing a pending export win', () => { | |
urls.companies.exportWins.editSupportProvided(company.id, exportWin.id) | ||
) | ||
cy.wait(['@apiGetExportWin']) | ||
cy.get('[data-test="status-message"]').should('not.exist') | ||
cy.get('[data-test="status-message"]') | ||
assertHistoricExportWinsMessage() | ||
}) | ||
}) | ||
|
||
context('Summary', () => { | ||
it('should render an edit status message', () => { | ||
cy.visit(urls.companies.exportWins.editSummary(company.id, exportWin.id)) | ||
cy.wait(['@apiGetExportWin']) | ||
cy.get('[data-test="status-message"]').should( | ||
'contain', | ||
'To edit an export win' + | ||
'Edit each section that needs changing then return to the summary page. ' + | ||
'When you are happy with all the changes save the page.' | ||
) | ||
assertHistoricExportWinsMessage() | ||
assertSummaryMessage() | ||
}) | ||
|
||
it('should render a lead officer name contact link', () => { | ||
|
@@ -249,7 +267,7 @@ describe('Editing a pending export win', () => { | |
cy.get('[data-test="resend-export-win"]').click() | ||
cy.wait('@apiResendExportWin') | ||
cy.get('[data-test="flash"]').should( | ||
'have.text', | ||
'contain.text', | ||
`The export win ${exportWin.name_of_export} to ${exportWin.country.name} has been sent to ${exportWin.company_contacts[0].email} for review and confirmation.` | ||
) | ||
}) | ||
|