Skip to content

Commit

Permalink
fixes cypress test
Browse files Browse the repository at this point in the history
  • Loading branch information
cammiida committed Nov 27, 2024
1 parent 7c95726 commit 9b392e3
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions test/e2e/integration/frontend-test/summary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,8 @@ describe('Summary', () => {
cy.wrap(items).find('button').should('not.exist');
});

cy.get(appFrontend.changeOfName.summaryNameChanges)
.parent()
.siblings()
.contains(mui.gridContainer, texts.dateOfEffect)
.then((summaryDate) => {
cy.wrap(summaryDate).children().find('button').click();
});
cy.findByRole('group', { name: 'Endringer til navn' });
cy.findByRole('button', { name: 'Endre: Når vil du at navnendringen skal skje?' }).click();

cy.get(appFrontend.changeOfName.dateOfEffect).clear();
cy.get(appFrontend.changeOfName.upload).selectFile('test/e2e/fixtures/test.pdf', { force: true });
Expand All @@ -79,7 +74,8 @@ describe('Summary', () => {
cy.get(appFrontend.errorReport).should('contain.text', texts.requiredFieldDateFrom);
cy.gotoNavPage('summary');

cy.get(appFrontend.changeOfName.summaryNameChanges)
cy.findByRole('group', { name: 'Endringer til navn' })
.parent()
.parent()
.siblings()
.then((summary) => {
Expand All @@ -95,7 +91,8 @@ describe('Summary', () => {

// Summary displays error when required field is not filled
// Navigate to form and fill the required field
cy.get(appFrontend.changeOfName.summaryNameChanges)
cy.findByRole('group', { name: 'Endringer til navn' })
.parent()
.parent()
.siblings()
.contains(mui.gridContainer, texts.dateOfEffect)
Expand All @@ -109,7 +106,8 @@ describe('Summary', () => {
});

// Error in summary field is removed when the required field is filled
cy.get(appFrontend.changeOfName.summaryNameChanges)
cy.findByRole('group', { name: 'Endringer til navn' })
.parent()
.parent()
.siblings()
.contains(mui.gridContainer, texts.dateOfEffect)
Expand Down

0 comments on commit 9b392e3

Please sign in to comment.