From b61f6d7cb639e65d39343c8b1e52d5229d422027 Mon Sep 17 00:00:00 2001 From: Betsy Carina Traran Date: Wed, 25 Sep 2024 16:22:40 +0200 Subject: [PATCH] Playwright-tester --- .../src/main/js/playwright/globalSetup.tsx | 3 ++ .../main/js/playwright/mocks/BasicMocks.tsx | 50 +++++++++++++++++++ .../fagsystem/afpOffentlig/initialValues.tsx | 6 ++- 3 files changed, 57 insertions(+), 2 deletions(-) diff --git a/apps/dolly-frontend/src/main/js/playwright/globalSetup.tsx b/apps/dolly-frontend/src/main/js/playwright/globalSetup.tsx index ec20a4276de..5baa2f7d3d1 100644 --- a/apps/dolly-frontend/src/main/js/playwright/globalSetup.tsx +++ b/apps/dolly-frontend/src/main/js/playwright/globalSetup.tsx @@ -1,6 +1,7 @@ import { test as base } from '@playwright/test' import { aaregMock, + afpOffentligMock, ameldingMock, arenaMock, backendBestillingerMock, @@ -86,6 +87,7 @@ const pensjonTp = new RegExp(/testnav-pensjon-testdata-facade-proxy\/api\/v1\/tp const pensjonPensjonsavtale = new RegExp( /testnav-pensjon-testdata-facade-proxy\/api\/v2\/pensjonsavtale\/hent/, ) +const afpOffentlig = new RegExp(/testnav-pensjon-testdata-facade-proxy\/q1\/api\/mock-oppsett/) const krrstub = new RegExp(/testnav-krrstub-proxy\/api\/v2/) const udistub = new RegExp(/testnav-udistub-proxy\/api\/v1/) const brregstub = new RegExp(/testnav-brregstub/) @@ -147,6 +149,7 @@ const mockRoutes: RouteInfo[] = [ { url: pensjon, response: pensjonMock }, { url: pensjonTp, response: pensjonTpMock }, { url: pensjonPensjonsavtale, response: pensjonPensjonsavtaleMock }, + { url: afpOffentlig, response: afpOffentligMock }, { url: sigrunstub, response: sigrunstubMock }, { url: udistub, response: udistubMock }, { url: kodeverk, response: kodeverkMock }, diff --git a/apps/dolly-frontend/src/main/js/playwright/mocks/BasicMocks.tsx b/apps/dolly-frontend/src/main/js/playwright/mocks/BasicMocks.tsx index f861792b266..853200d21bd 100644 --- a/apps/dolly-frontend/src/main/js/playwright/mocks/BasicMocks.tsx +++ b/apps/dolly-frontend/src/main/js/playwright/mocks/BasicMocks.tsx @@ -883,6 +883,24 @@ export const pensjonTpMock = [{ ordning: '4095' }, { ordning: '3010' }] export const pensjonPensjonsavtaleMock = [{}, {}] +export const afpOffentligMock = { + direktekall: [], + mocksvar: [ + { + tpId: '4099', + statusAfp: 'INNVILGET', + virkningsDato: '2024-09-01T00:00:00', + sistBenyttetG: 2024, + belopsListe: [ + { + fomDato: '2024-09-02T00:00:00', + belop: '10000', + }, + ], + }, + ], +} + export const tagsMock = [{ tag: 'DUMMY', beskrivelse: 'Dummy' }] export const kontoregisterMock = { @@ -1486,6 +1504,21 @@ export const backendBestillingerMock = [ }, ], }, + { + id: 'PEN_AFP_OFFENTLIG', + navn: 'AFP offentlig (PEN)', + statuser: [ + { + melding: 'OK', + detaljert: [ + { + miljo: 'q1', + identer: ['12345678912'], + }, + ], + }, + ], + }, { id: 'INNTKMELD', navn: 'Inntektsmelding (ALTINN/JOARK)', @@ -1683,6 +1716,23 @@ export const backendBestillingerMock = [ ], }, ], + afpOffentlig: { + direktekall: [], + mocksvar: [ + { + tpId: '4099', + statusAfp: 'INNVILGET', + virkningsDato: '2024-09-01T00:00:00', + sistBenyttetG: 2024, + belopsListe: [ + { + fomDato: '2024-09-02T00:00:00', + belop: '10000', + }, + ], + }, + ], + }, }, inntektsmelding: { inntekter: [ diff --git a/apps/dolly-frontend/src/main/js/src/components/fagsystem/afpOffentlig/initialValues.tsx b/apps/dolly-frontend/src/main/js/src/components/fagsystem/afpOffentlig/initialValues.tsx index 5552a77d453..f522abb09e0 100644 --- a/apps/dolly-frontend/src/main/js/src/components/fagsystem/afpOffentlig/initialValues.tsx +++ b/apps/dolly-frontend/src/main/js/src/components/fagsystem/afpOffentlig/initialValues.tsx @@ -1,5 +1,7 @@ +import { runningE2ETest } from '@/service/services/Request' + export const initialBeloep = { - fomDato: null, + fomDato: runningE2ETest() ? new Date() : null, belop: 0, } @@ -7,7 +9,7 @@ export const initialMocksvar = { tpId: null, statusAfp: null, virkningsDato: null, - sistBenyttetG: 2024, + sistBenyttetG: new Date().getFullYear(), belopsListe: [initialBeloep], }