Skip to content

Commit

Permalink
Remove non-acknowldged prior notification e2e test case
Browse files Browse the repository at this point in the history
  • Loading branch information
ivangabriele committed Aug 15, 2024
1 parent ebc9e99 commit 6fbac7a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 27 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { editSideWindowPriorNotification } from '../manual_prior_notification_fo

context('Side Window > Logbook Prior Notification Form > Error Handling', () => {
const failedQueryCount = RTK_MAX_RETRIES + 1
const url = '/bff/v1/prior_notifications/FAKE_OPERATION_109?isManuallyCreated=false&operationDate=*'
const url = '/bff/v1/prior_notifications/FAKE_OPERATION_109_COR?isManuallyCreated=false&operationDate=*'

it('Should handle fetching error as expected', () => {
cy.intercept(
Expand All @@ -18,7 +18,7 @@ context('Side Window > Logbook Prior Notification Form > Error Handling', () =>
}
).as('getPriorNotificationsWithError')

editSideWindowPriorNotification(`L'ANCRE`, 'FAKE_OPERATION_109')
editSideWindowPriorNotification(`L'ANCRE`, 'FAKE_OPERATION_109_COR')

for (let i = 1; i <= failedQueryCount; i += 1) {
cy.wait('@getPriorNotificationsWithError')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,27 +59,8 @@ context('Side Window > Prior Notification Card > Card', () => {
cy.contains(`25 kg`).should('be.visible')
})

it('Should display a failed acknowledged message as expected', () => {
openSideWindowPriorNotification(`CALAMARO`)

// Title
cy.contains(`Préavis navire ≥ 12 M`).should('be.visible')
cy.contains(`CALAMARO (CFR105)`).should('be.visible')

// Message Header
cy.contains(`PNO`).should('be.visible')
cy.contains(`Préavis (notification de retour au port)`).should('be.visible')

// Message Body
cy.getDataCy('LogbookMessage-failed-acknowledgement-icon').should('be.visible')
cy.contains(`Saint-Malo (FRSML)`).should('be.visible')
cy.contains(`Débarquement (LAN)`).should('be.visible')
cy.contains(`BAUDROIE (ANF)`).should('be.visible')
cy.contains(`150 kg`).should('be.visible')
})

it('Should refresh the list when the opened prior notification data differs from its entry in the current list', () => {
const url = '/bff/v1/prior_notifications/FAKE_OPERATION_109?isManuallyCreated=false&operationDate=*'
const url = '/bff/v1/prior_notifications/FAKE_OPERATION_109_COR?isManuallyCreated=false&operationDate=*'

cy.intercept({
method: 'GET',
Expand Down Expand Up @@ -112,7 +93,7 @@ context('Side Window > Prior Notification Card > Card', () => {
})

it('Should display a warning banner and refresh the list when the opened prior notification has been deleted', () => {
const url = '/bff/v1/prior_notifications/FAKE_OPERATION_109?isManuallyCreated=false&operationDate=*'
const url = '/bff/v1/prior_notifications/FAKE_OPERATION_109_COR?isManuallyCreated=false&operationDate=*'

cy.intercept({
method: 'GET',
Expand Down Expand Up @@ -250,11 +231,11 @@ context('Side Window > Prior Notification Card > Card', () => {
cy.get('[data-cy="side-window-sub-menu-ALL"]').click()
cy.fill('Rechercher un navire', 'ANCRE')

cy.getTableRowById('FAKE_OPERATION_109' as any)
cy.getTableRowById('FAKE_OPERATION_109_COR' as any)
.find('[title="Préavis invalidé"]')
.should('not.exist')

cy.getTableRowById('FAKE_OPERATION_109' as any).clickButton('Éditer le préavis')
cy.getTableRowById('FAKE_OPERATION_109_COR' as any).clickButton('Éditer le préavis')
if (document.querySelector('[data-cy="first-loader"]')) {
cy.getDataCy('first-loader').should('not.be.visible')
}
Expand All @@ -269,7 +250,7 @@ context('Side Window > Prior Notification Card > Card', () => {

cy.clickButton('Fermer')

cy.getTableRowById('FAKE_OPERATION_109' as any)
cy.getTableRowById('FAKE_OPERATION_109_COR' as any)
.find('[title="Préavis invalidé"]')
.should('exist')
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { openSideWindowPriorNotification } from './utils'

context('Side Window > Logbook Prior Notification Card > Error Handling', () => {
const failedQueryCount = RTK_MAX_RETRIES + 1
const url = '/bff/v1/prior_notifications/FAKE_OPERATION_109?isManuallyCreated=false&operationDate=*'
const url = '/bff/v1/prior_notifications/FAKE_OPERATION_109_COR?isManuallyCreated=false&operationDate=*'

beforeEach(() => {
cy.intercept('/bff/v1/authorization/current', { statusCode: 401 }).as('getIsSuperUser')
Expand Down

0 comments on commit 6fbac7a

Please sign in to comment.