From 3a39055cb23169406a46369742c4fba69e44e38f Mon Sep 17 00:00:00 2001 From: Ole Martin Handeland Date: Mon, 27 Jun 2022 14:39:34 +0200 Subject: [PATCH] Stabilizing tests (#254) Co-authored-by: Ole Martin Handeland --- .../fetch/fetchTextResourcesSagas.test.ts | 2 +- .../integration/app-frontend/confirmation.js | 17 ++++++++--------- .../e2e/integration/app-frontend/receipt.js | 17 ++++++++--------- 3 files changed, 17 insertions(+), 19 deletions(-) diff --git a/src/altinn-app-frontend/src/shared/resources/textResources/fetch/fetchTextResourcesSagas.test.ts b/src/altinn-app-frontend/src/shared/resources/textResources/fetch/fetchTextResourcesSagas.test.ts index f953af08c2..e2f9ac71ac 100644 --- a/src/altinn-app-frontend/src/shared/resources/textResources/fetch/fetchTextResourcesSagas.test.ts +++ b/src/altinn-app-frontend/src/shared/resources/textResources/fetch/fetchTextResourcesSagas.test.ts @@ -53,7 +53,7 @@ describe('fetchTextResourcesSagas', () => { }; expectSaga(fetchTextResources) .provide([ - [select(appLanguageStateSelector), ''], + [select(appLanguageStateSelector), 'nb'], [select(allowAnonymousSelector), true], [call(get, textResourcesUrl('nb')), mockTextResource], ]) diff --git a/test/cypress/e2e/integration/app-frontend/confirmation.js b/test/cypress/e2e/integration/app-frontend/confirmation.js index dab11aea94..8a282077dc 100644 --- a/test/cypress/e2e/integration/app-frontend/confirmation.js +++ b/test/cypress/e2e/integration/app-frontend/confirmation.js @@ -19,16 +19,15 @@ describe('Confirm', () => { .first() .should('contain.text', `${Cypress.env('multiData2Stage')}.pdf`); - const getAttachments = () => (cy.get(appFrontend.confirm.uploadedAttachments) + cy.get(appFrontend.confirm.uploadedAttachments) .last() - .find('a')); - - getAttachments().should('have.length', 5); - getAttachments().eq(0).should('contain.text', `test.pdf`); - getAttachments().eq(1).should('contain.text', `attachment-in-single.pdf`); - getAttachments().eq(2).should('contain.text', `attachment-in-multi1.pdf`); - getAttachments().eq(3).should('contain.text', `attachment-in-multi2.pdf`); - getAttachments().eq(4).should('contain.text', `attachment-in-nested.pdf`); + .find('a') + .should('have.length', 5) + .should('contain.text', `test.pdf`) + .should('contain.text', `attachment-in-single.pdf`) + .should('contain.text', `attachment-in-multi1.pdf`) + .should('contain.text', `attachment-in-multi2.pdf`) + .should('contain.text', `attachment-in-nested.pdf`); cy.get(appFrontend.confirm.sendIn).should('be.visible'); cy.url().then((url) => { diff --git a/test/cypress/e2e/integration/app-frontend/receipt.js b/test/cypress/e2e/integration/app-frontend/receipt.js index 235b806b34..0b24c3cde8 100644 --- a/test/cypress/e2e/integration/app-frontend/receipt.js +++ b/test/cypress/e2e/integration/app-frontend/receipt.js @@ -26,16 +26,15 @@ describe('Receipt', () => { .first() .should('contain.text', `${Cypress.env('multiData2Stage')}.pdf`); - const getAttachmentList = () => (cy.get(appFrontend.receipt.uploadedAttachments) + cy.get(appFrontend.receipt.uploadedAttachments) .last() - .find('a')); - - getAttachmentList().should('have.length', 5); - getAttachmentList().eq(0).should('contain.text', `test.pdf`); - getAttachmentList().eq(1).should('contain.text', `attachment-in-single.pdf`); - getAttachmentList().eq(2).should('contain.text', `attachment-in-multi1.pdf`); - getAttachmentList().eq(3).should('contain.text', `attachment-in-multi2.pdf`); - getAttachmentList().eq(4).should('contain.text', `attachment-in-nested.pdf`); + .find('a') + .should('have.length', 5) + .should('contain.text', `test.pdf`) + .should('contain.text', `attachment-in-single.pdf`) + .should('contain.text', `attachment-in-multi1.pdf`) + .should('contain.text', `attachment-in-multi2.pdf`) + .should('contain.text', `attachment-in-nested.pdf`); cy.get('body').should('have.css', 'background-color', 'rgb(212, 249, 228)'); cy.get(appFrontend.header).should('contain.text', texts.ttd);