Skip to content

Commit

Permalink
OK-672: Lisätty playwright-testeihin tilojen tallentamisen testaus
Browse files Browse the repository at this point in the history
  • Loading branch information
pretseli committed Nov 27, 2024
1 parent d68185e commit 912b2d1
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 5 deletions.
4 changes: 2 additions & 2 deletions tests/e2e/fixtures/hakemuksen-valintalaskenta-tulokset.json
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@
"jonosijat": [
{
"jonosija": 1,
"hakemusOid": "1.2.246.562.11.00000000000002190092",
"hakemusOid": "1.2.246.562.11.00000000000001796027",
"hakijaOid": "1.2.246.562.24.54857401125",
"jarjestyskriteerit": [
{
Expand Down Expand Up @@ -370,7 +370,7 @@
"jonosijat": [
{
"jonosija": 1,
"hakemusOid": "1.2.246.562.11.00000000000002190092",
"hakemusOid": "1.2.246.562.11.00000000000001796027",
"hakijaOid": "1.2.246.562.24.54857401125",
"jarjestyskriteerit": [
{
Expand Down
52 changes: 49 additions & 3 deletions tests/e2e/henkilo.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ test.beforeEach(async ({ page }) => {
json: hakemusValinnanTulosFixture({
hakukohdeOid: '1.2.246.562.20.00000000000000045105',
hakemusOid: '1.2.246.562.11.00000000000001796027',
valintatapajonoOid: '1709304299853373641707401606360',
valintatapajonoOid: '17093042998533736417074016063604',
henkiloOid: '1.2.246.562.24.69259807406',
valinnantila: SijoittelunTila.HYVAKSYTTY,
vastaanottotila: VastaanottoTila.VASTAANOTTANUT_SITOVASTI,
Expand Down Expand Up @@ -346,7 +346,20 @@ test('Displays selected henkilö hakutoiveet with laskenta results only', async
]);
});

test('Shows valintalaskenta edit modal', async ({ page }) => {
test('Shows valintalaskenta edit modal and saves data', async ({ page }) => {
await page.route(
configuration.jarjestyskriteeriMuokkausUrl({
hakemusOid: '1.2.246.562.11.00000000000001796027',
valintatapajonoOid: '17093042998533736417074016063604',
jarjestyskriteeriPrioriteetti: 0,
}),
(route) => {
return route.fulfill({
json: [],
});
},
);

await page.goto(
'/valintojen-toteuttaminen/haku/1.2.246.562.29.00000000000000045102/henkilo/1.2.246.562.11.00000000000001796027',
);
Expand Down Expand Up @@ -395,9 +408,30 @@ test('Shows valintalaskenta edit modal', async ({ page }) => {
await expect(
valintalaskentaMuokkausModal.getByLabel('Muokkauksen syy'),
).toHaveValue('');

const tallennaButton = valintalaskentaMuokkausModal.getByRole('button', {
name: 'Tallenna',
});

await tallennaButton.click();

await expect(
page.getByText('Valintalaskennan tietojen tallentaminen onnistui'),
).toBeVisible();
});

test('Shows valinta edit modal', async ({ page }) => {
test('Shows valinta edit modal and saves data', async ({ page }) => {
await page.route(
configuration.valinnanTulosMuokkausUrl({
valintatapajonoOid: '17093042998533736417074016063604',
}),
(route) => {
return route.fulfill({
json: [],
});
},
);

await page.goto(
'/valintojen-toteuttaminen/haku/1.2.246.562.29.00000000000000045102/henkilo/1.2.246.562.11.00000000000001796027',
);
Expand Down Expand Up @@ -436,4 +470,16 @@ test('Shows valinta edit modal', async ({ page }) => {
await expect(
valintaMuokkausModal.getByLabel('Ilmoittautumisen tila'),
).toContainText('Ei ilmoittautunut');

const tallennaButton = valintaMuokkausModal.getByRole('button', {
name: 'Tallenna',
});

await tallennaButton.click();

await expect(valintaMuokkausModal).toBeHidden();

await expect(
page.getByText('Valinnan tietojen tallentaminen onnistui'),
).toBeVisible();
});

0 comments on commit 912b2d1

Please sign in to comment.