diff --git a/cypress/e2e/digitalLospost.cy.js b/cypress/e2e/digitalLospost.cy.js index 054e5b1..bbb0e6c 100644 --- a/cypress/e2e/digitalLospost.cy.js +++ b/cypress/e2e/digitalLospost.cy.js @@ -20,7 +20,7 @@ describe('Digital løspost', () => { it('validates and submits løspost application', () => { cy.visit('/lospost-default'); cy.findByRole('button', { name: 'Send til NAV' }).should('exist').click(); - cy.findByRole('region', { name: 'Du må fikse disse feilene før du kan sende inn søknad.' }) + cy.get('[data-cy=valideringsfeil]') .should('exist') .within(() => { cy.findByRole('link', { name: `Last opp ${vedlegg.label}` }) diff --git a/cypress/e2e/validering.cy.js b/cypress/e2e/validering.cy.js index 1243125..ea298c9 100644 --- a/cypress/e2e/validering.cy.js +++ b/cypress/e2e/validering.cy.js @@ -12,11 +12,10 @@ describe('Tester validering', () => { cy.injectAxe(); cy.get('[data-cy="nesteStegKnapp"]').click(); - cy.focused() - .should('have.attr', 'data-cy', 'valideringsfeil') - .within(() => { - cy.get('li').should('have.length', 1); - }); + cy.get('[data-cy=valideringsfeil]').within(() => { + cy.get('h2').should('have.focus'); + cy.get('li').should('have.length', 1); + }); cy.checkA11y('#__next'); @@ -41,11 +40,10 @@ describe('Tester validering', () => { cy.get('[data-cy="sendTilNAVKnapp"]').click(); - cy.focused() - .should('have.attr', 'data-cy', 'valideringsfeil') - .within(() => { - cy.get('li').should('have.length', 4); - }); + cy.get('[data-cy=valideringsfeil]').within(() => { + cy.get('h2').should('have.focus'); + cy.get('li').should('have.length', 4); + }); cy.checkA11y('#__next'); diff --git a/cypress/e2e/vedleggsvalg.cy.js b/cypress/e2e/vedleggsvalg.cy.js index 2bbd53e..1889ccd 100644 --- a/cypress/e2e/vedleggsvalg.cy.js +++ b/cypress/e2e/vedleggsvalg.cy.js @@ -23,11 +23,10 @@ describe('Tester validering', () => { cy.get('[data-cy="sendTilNAVKnapp"]').click(); - cy.focused() - .should('have.attr', 'data-cy', 'valideringsfeil') - .within(() => { - cy.get('li').should('have.length', 5); - }); + cy.get('[data-cy=valideringsfeil]').within(() => { + cy.get('h2').should('have.focus'); + cy.get('li').should('have.length', 5); + }); cy.checkA11y('#__next');