diff --git a/test/e2e/integration/frontend-test/options.ts b/test/e2e/integration/frontend-test/options.ts index e31cd8a13c..eff0273e07 100644 --- a/test/e2e/integration/frontend-test/options.ts +++ b/test/e2e/integration/frontend-test/options.ts @@ -110,14 +110,10 @@ describe('Options', () => { cy.goto('changename'); - // All options are fetched once at first (with 'undefined' in mapping, as no value for source has been set) - cy.get('@interceptOptions(references).all').should('have.length', 1); - cy.get('@interceptOptions(test).all').should('have.length', 1); - // This field uses preselectedOptionIndex to select 'Altinn' cy.get(appFrontend.changeOfName.sources).should('have.value', 'Altinn'); - // At that point our options have new mappings, so requests should have fired again + // At this point our options have new mappings, so requests should have fired again cy.get('@interceptOptions(references).all').should('have.length', 2); cy.get('@interceptOptions(test).all').should('have.length', 2); diff --git a/test/e2e/integration/frontend-test/tabbing.ts b/test/e2e/integration/frontend-test/tabbing.ts index 23af0445f1..7fe57ff579 100644 --- a/test/e2e/integration/frontend-test/tabbing.ts +++ b/test/e2e/integration/frontend-test/tabbing.ts @@ -5,7 +5,15 @@ const appFrontend = new AppFrontend(); describe('Tabbing', () => { it('Tab through the fields in change name form', () => { + cy.intercept('GET', '**/api/options/references?language=nb&source=altinn').as('fetchReferences'); cy.goto('changename'); + + // Making extra sure we've finished waiting for the page to load. Sometimes, if we start too early (unrealistically + // early, compared to real users) the focus might have been reset before we get to simulate tabbing. This was + // somewhat flaky for a while. + cy.wait('@fetchReferences'); + cy.waitUntilSaved(); + cy.get(appFrontend.changeOfName.newFirstName).focus().tab(); cy.focused().should('have.text', 'Nytt mellomnavn'); cy.tab();