Skip to content

Commit

Permalink
Tester detaljvisning for NAV-visning av Arbeidsmarkedstiltak
Browse files Browse the repository at this point in the history
  • Loading branch information
sndrem committed Feb 6, 2024
1 parent 539a4c1 commit 39438a0
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,11 @@ export function ModiaArbeidsmarkedstiltakDetaljer() {
</Button>
)}
{enableDeltakerRegistrering && skalVisePameldingslenke ? (
<Link className={classNames(styles.link, styles.linkAsButton)} to="./deltaker">
<Link
className={classNames(styles.link, styles.linkAsButton)}
to="./deltaker"
data-testid="start-pamelding-lenke"
>
Start påmelding
</Link>
) : null}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ export function NavEnhetFilter({
</div>
<div className={styles.caret_container}>
<ChevronDownIcon
aria-label="Ikon ned"
fontSize="1.25rem"
className={classnames(styles.accordion_down, {
[styles.accordion_down_open]: regionOpen.includes(region.enhetsnummer),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import { expect, test } from "@playwright/test";
import { sjekkUU } from "./playwrightUtils";

test.beforeEach(async ({ page }) => {
await page.goto("/nav");
});

test.describe("Tiltaksoversikt", () => {
test.beforeEach(async ({ page }) => {
await page.goto("/nav/oversikt");
});

test("Sjekk at det er tiltaksgjennomføringer i oversikten", async ({ page }) => {
const rows = page.getByTestId("oversikt_tiltaksgjennomforinger").getByRole("link");
await expect(page.getByTestId("oversikt_tiltaksgjennomforinger")).toContainText(
"Avklaring - Fredrikstad",
);
await expect(await rows.count()).toBeGreaterThan(5);
});

test("Sjekk UU", async ({ page }) => {
await sjekkUU(page);
});

test.describe("Tiltaksgjennomføringsdetaljer for alle NAV-ansatte", () => {
test.beforeEach(async ({ page }) => {
await page.goto("/nav/oversikt");
await page.getByTestId("tiltaksgjennomforing_sindres-mentorordning-med-yoda").click();
});

test("Sjekk UU", async ({ page }) => {
await sjekkUU(page);
});

test("Sjekk riktig tiltaksgjennomføring", async ({ page }) => {
await expect(
page.getByTestId("tiltaksgjennomforing-header_sindres-mentorordning-med-yoda"),
).toContainText("Sindres mentorordning med Yoda");
});

test("Sjekk at 'Del me bruker', 'Start påmelding' eller 'Opprett avtale' ikke eksisterer", async ({
page,
}) => {
await expect(page.getByTestId("deleknapp")).toHaveCount(0);
await expect(page.getByTestId("start-pamelding-lenke")).toHaveCount(0);
await expect(page.getByTestId("opprettavtaleknapp")).toHaveCount(0);
});
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import AxeBuilder from "@axe-core/playwright";
import { Page, expect } from "@playwright/test";

export const sjekkUU = async (page: Page) => {
const accessibilityScanResults = await new AxeBuilder({ page })
.withTags(["wcag2a", "wcag2aa", "wcag21a", "wcag21aa"])
.analyze();
expect(accessibilityScanResults.violations).toEqual([]);
};
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
import { expect, Page, test } from "@playwright/test";
import AxeBuilder from "@axe-core/playwright";
import { sjekkUU } from "./playwrightUtils";

test.beforeEach(async ({ page }) => {
await page.goto("/");
});

const sjekkUU = async (page: Page) => {
const accessibilityScanResults = await new AxeBuilder({ page })
.withTags(["wcag2a", "wcag2aa", "wcag21a", "wcag21aa"])
.analyze();
expect(accessibilityScanResults.violations).toEqual([]);
};

const velgFilter = async (page: Page, filternavn: string) => {
await page.getByTestId(`filter_radio_${filternavn}`).click();
await expect(page.getByTestId(`filter_radio_${filternavn}`)).toBeChecked();
Expand Down
2 changes: 1 addition & 1 deletion frontend/mulighetsrommet-veileder-flate/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@
"@/*": ["./src/*"],
},
},
"include": ["src"],
"include": ["src", "tests"],
"references": [{ "path": "./tsconfig.node.json" }],
}

0 comments on commit 39438a0

Please sign in to comment.