generated from digitalservicebund/remix-application-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
31 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,7 +59,7 @@ async function registerMailInterceptionHandlerAndExpect( | |
|
||
test.describe("test positive result for digital and interoperability", () => { | ||
test.beforeEach( | ||
"answer all pre-check questions with yes and go to result page", | ||
"answer all pre-check questions with yes, go to result page and fill title", | ||
async ({ page }) => { | ||
await page.goto(questions[0].url); | ||
for (const question of questions) { | ||
|
@@ -68,6 +68,7 @@ test.describe("test positive result for digital and interoperability", () => { | |
await page.getByRole("button", { name: "Übernehmen" }).click(); | ||
} | ||
await page.waitForURL(ROUTE_RESULT.url); | ||
await page.getByLabel("Arbeitstitel des Vorhabens").fill("Policy ABC"); | ||
}, | ||
); | ||
|
||
|
@@ -84,7 +85,7 @@ test.describe("test positive result for digital and interoperability", () => { | |
}); | ||
|
||
test("error is shown if title is empty", async ({ page }) => { | ||
// not filling title | ||
await page.getByLabel("Arbeitstitel des Vorhabens").clear(); | ||
await registerMailInterceptionHandlerAndExpect(page); | ||
await page.getByRole("button", { name: "E-Mail erstellen" }).click(); | ||
await expect(page.getByTestId(TITLE_INPUT_ERROR)).toBeVisible(); | ||
|
@@ -94,6 +95,7 @@ test.describe("test positive result for digital and interoperability", () => { | |
}); | ||
|
||
test("error is shown if title is too long", async ({ page }) => { | ||
await page.getByLabel("Arbeitstitel des Vorhabens").clear(); | ||
await page.getByLabel("Arbeitstitel des Vorhabens").fill("A".repeat(101)); | ||
await registerMailInterceptionHandlerAndExpect(page); | ||
await page.getByRole("button", { name: "E-Mail erstellen" }).click(); | ||
|
@@ -102,7 +104,6 @@ test.describe("test positive result for digital and interoperability", () => { | |
}); | ||
|
||
test("no error is shown if optional email is empty", async ({ page }) => { | ||
await page.getByLabel("Arbeitstitel des Vorhabens").fill("Policy ABC"); | ||
// not filling email | ||
await registerMailInterceptionHandlerAndExpect(page); | ||
await page.getByRole("button", { name: "E-Mail erstellen" }).click(); | ||
|
@@ -111,24 +112,20 @@ test.describe("test positive result for digital and interoperability", () => { | |
|
||
test("no error shown when email and title are filled", async ({ page }) => { | ||
await page.getByLabel("Ihre E-Mail Adresse").fill("[email protected]"); | ||
await page.getByLabel("Arbeitstitel des Vorhabens").fill("Policy ABC"); | ||
await registerMailInterceptionHandlerAndExpect(page); | ||
await page.getByRole("button", { name: "E-Mail erstellen" }).click(); | ||
await expect(page.getByTestId(EMAIL_INPUT_ERROR)).not.toBeVisible(); | ||
await expect(page.getByTestId(TITLE_INPUT_ERROR)).not.toBeVisible(); | ||
}); | ||
|
||
test("email subject includes title", async ({ page }) => { | ||
await page.getByLabel("Arbeitstitel des Vorhabens").fill("Policy ABC"); | ||
|
||
await registerMailInterceptionHandlerAndExpect(page, { | ||
subject: "Digitalcheck Vorprüfung: „Policy ABC“", | ||
}); | ||
await page.getByRole("button", { name: "E-Mail erstellen" }).click(); | ||
}); | ||
|
||
test("email recipients include nkr", async ({ page }) => { | ||
await page.getByLabel("Arbeitstitel des Vorhabens").fill("Policy ABC"); | ||
await registerMailInterceptionHandlerAndExpect(page, { | ||
recipients: ["[email protected]"], | ||
}); | ||
|
@@ -138,15 +135,13 @@ test.describe("test positive result for digital and interoperability", () => { | |
test("email recipients include digitalcheck team if interoperability is positive", async ({ | ||
page, | ||
}) => { | ||
await page.getByLabel("Arbeitstitel des Vorhabens").fill("Policy ABC"); | ||
await registerMailInterceptionHandlerAndExpect(page, { | ||
recipients: ["[email protected]"], | ||
}); | ||
await page.getByRole("button", { name: "E-Mail erstellen" }).click(); | ||
}); | ||
|
||
test("email cc includes email from email input", async ({ page }) => { | ||
await page.getByLabel("Arbeitstitel des Vorhabens").fill("Policy ABC"); | ||
await page.getByLabel("Ihre E-Mail Adresse").fill("[email protected]"); | ||
await registerMailInterceptionHandlerAndExpect(page, { | ||
cc: ["[email protected]"], | ||
|
@@ -155,7 +150,6 @@ test.describe("test positive result for digital and interoperability", () => { | |
}); | ||
|
||
test("email body contains result title", async ({ page }) => { | ||
await page.getByLabel("Arbeitstitel des Vorhabens").fill("Policy ABC"); | ||
await registerMailInterceptionHandlerAndExpect(page, { | ||
body: [ | ||
"Das Regelungsvorhaben hat einen Digitalbezug und enthält Anforderungen der Interoperabilität.", | ||
|
@@ -165,7 +159,6 @@ test.describe("test positive result for digital and interoperability", () => { | |
}); | ||
|
||
test("email body contains all answers in positive form", async ({ page }) => { | ||
await page.getByLabel("Arbeitstitel des Vorhabens").fill("Policy ABC"); | ||
const bodyContains = [ | ||
"In Bezug auf digitale Aspekte führt ihr Regelungsvorhaben zu...", | ||
"In Bezug auf Interoperabilität führt ihr Regelungsvorhaben zu...", | ||
|
@@ -181,7 +174,6 @@ test.describe("test positive result for digital and interoperability", () => { | |
}); | ||
|
||
test("email body does not contain negative reasoning", async ({ page }) => { | ||
await page.getByLabel("Arbeitstitel des Vorhabens").fill("Policy ABC"); | ||
await registerMailInterceptionHandlerAndExpect(page, undefined, { | ||
body: ["Begründung:"], | ||
}); | ||
|
@@ -191,7 +183,7 @@ test.describe("test positive result for digital and interoperability", () => { | |
|
||
test.describe("test positive result for digital and negative for interoperability", () => { | ||
test.beforeEach( | ||
"answer all digital questions with yes and all interoperability questions with no and go to result page", | ||
"answer all digital questions with yes and all interoperability questions with no, go to result page and fill title", | ||
async ({ page }) => { | ||
await page.goto(questions[0].url); | ||
for (const question of questions) { | ||
|
@@ -201,6 +193,7 @@ test.describe("test positive result for digital and negative for interoperabilit | |
.click(); | ||
await page.getByRole("button", { name: "Übernehmen" }).click(); | ||
} | ||
await page.getByLabel("Arbeitstitel des Vorhabens").fill("Policy ABC"); | ||
}, | ||
); | ||
|
||
|
@@ -211,7 +204,6 @@ test.describe("test positive result for digital and negative for interoperabilit | |
test("email recipients do not include digitalcheck team if interoperability is negative", async ({ | ||
page, | ||
}) => { | ||
await page.getByLabel("Arbeitstitel des Vorhabens").fill("Policy ABC"); | ||
// set expected to undefined to set notExpected | ||
await registerMailInterceptionHandlerAndExpect(page, undefined, { | ||
recipients: ["[email protected]"], | ||
|
@@ -220,7 +212,6 @@ test.describe("test positive result for digital and negative for interoperabilit | |
}); | ||
|
||
test("email body contains result title", async ({ page }) => { | ||
await page.getByLabel("Arbeitstitel des Vorhabens").fill("Policy ABC"); | ||
await registerMailInterceptionHandlerAndExpect(page, { | ||
body: [ | ||
"Das Regelungsvorhaben hat einen Digitalbezug und keine Anforderungen der Interoperabilität.", | ||
|
@@ -232,7 +223,7 @@ test.describe("test positive result for digital and negative for interoperabilit | |
|
||
test.describe("test positive result for digital and unsure for interoperability", () => { | ||
test.beforeEach( | ||
"answer all digital questions with yes and all interoperability questions with unsure and go to result page", | ||
"answer all digital questions with yes and all interoperability questions with unsure, go to result page and fill title", | ||
async ({ page }) => { | ||
await page.goto(questions[0].url); | ||
for (const question of questions) { | ||
|
@@ -242,6 +233,7 @@ test.describe("test positive result for digital and unsure for interoperability" | |
.click(); | ||
await page.getByRole("button", { name: "Übernehmen" }).click(); | ||
} | ||
await page.getByLabel("Arbeitstitel des Vorhabens").fill("Policy ABC"); | ||
}, | ||
); | ||
|
||
|
@@ -252,15 +244,13 @@ test.describe("test positive result for digital and unsure for interoperability" | |
test("email recipients include digitalcheck team if interoperability is unsure", async ({ | ||
page, | ||
}) => { | ||
await page.getByLabel("Arbeitstitel des Vorhabens").fill("Policy ABC"); | ||
await registerMailInterceptionHandlerAndExpect(page, { | ||
recipients: ["[email protected]"], | ||
}); | ||
await page.getByRole("button", { name: "E-Mail erstellen" }).click(); | ||
}); | ||
|
||
test("email body contains result title", async ({ page }) => { | ||
await page.getByLabel("Arbeitstitel des Vorhabens").fill("Policy ABC"); | ||
await registerMailInterceptionHandlerAndExpect(page, { | ||
body: [ | ||
"Das Regelungsvorhaben hat einen Digitalbezug und keine eindeutigen Anforderungen der Interoperabilität.", | ||
|
@@ -272,7 +262,6 @@ test.describe("test positive result for digital and unsure for interoperability" | |
test("email body contains all answers for interoperability in unsure form", async ({ | ||
page, | ||
}) => { | ||
await page.getByLabel("Arbeitstitel des Vorhabens").fill("Policy ABC"); | ||
const bodyContains = [ | ||
"In Bezug auf Interoperabilität ist nicht sicher, ob Ihr Regelungsvorhaben zu Folgendem führt...", | ||
]; | ||
|
@@ -291,14 +280,15 @@ test.describe("test positive result for digital and unsure for interoperability" | |
|
||
test.describe("test negative result for digital and interoperability", () => { | ||
test.beforeEach( | ||
"answer all pre-check questions with no and go to result page", | ||
"answer all pre-check questions with no, go to result page and fill title", | ||
async ({ page }) => { | ||
await page.goto(questions[0].url); | ||
for (const question of questions) { | ||
await page.waitForURL(question.url); | ||
await page.getByLabel("Nein").click(); | ||
await page.getByRole("button", { name: "Übernehmen" }).click(); | ||
} | ||
await page.getByLabel("Arbeitstitel des Vorhabens").fill("Policy ABC"); | ||
}, | ||
); | ||
|
||
|
@@ -315,7 +305,6 @@ test.describe("test negative result for digital and interoperability", () => { | |
}); | ||
|
||
test("error is shown if negative reasoning is empty", async ({ page }) => { | ||
await page.getByLabel("Arbeitstitel des Vorhabens").fill("Policy ABC"); | ||
await registerMailInterceptionHandlerAndExpect(page); | ||
await page.getByRole("button", { name: "E-Mail erstellen" }).click(); | ||
await expect(page.getByTestId(NEGATIVE_REASONING_ERROR)).toBeVisible(); | ||
|
@@ -326,15 +315,13 @@ test.describe("test negative result for digital and interoperability", () => { | |
|
||
test("error is shown if negative reasoning is too long", async ({ page }) => { | ||
await page.getByLabel("Begründung").fill("A".repeat(501)); | ||
await page.getByLabel("Arbeitstitel des Vorhabens").fill("Policy ABC"); | ||
await registerMailInterceptionHandlerAndExpect(page); | ||
await page.getByRole("button", { name: "E-Mail erstellen" }).click(); | ||
await expect(page.getByTestId(NEGATIVE_REASONING_ERROR)).toBeVisible(); | ||
await expect(page.locator("main")).toContainText("kürzere Begründung"); | ||
}); | ||
|
||
test("email body contains all answers in negative form", async ({ page }) => { | ||
await page.getByLabel("Arbeitstitel des Vorhabens").fill("Policy ABC"); | ||
const bodyContains = [ | ||
"In Bezug auf digitale Aspekte führt ihr Regelungsvorhaben zu...", | ||
"In Bezug auf Interoperabilität führt ihr Regelungsvorhaben zu...", | ||
|
@@ -350,7 +337,6 @@ test.describe("test negative result for digital and interoperability", () => { | |
}); | ||
|
||
test("email body contains result title", async ({ page }) => { | ||
await page.getByLabel("Arbeitstitel des Vorhabens").fill("Policy ABC"); | ||
await registerMailInterceptionHandlerAndExpect(page, { | ||
body: [ | ||
"Das Regelungsvorhaben hat keinen Digitalbezug und keine Anforderungen der Interoperabilität.", | ||
|
@@ -360,7 +346,6 @@ test.describe("test negative result for digital and interoperability", () => { | |
}); | ||
|
||
test("email body contains negative reasoning", async ({ page }) => { | ||
await page.getByLabel("Arbeitstitel des Vorhabens").fill("Policy ABC"); | ||
await page | ||
.getByLabel("Begründung") | ||
.fill( | ||
|
@@ -378,7 +363,7 @@ test.describe("test negative result for digital and interoperability", () => { | |
|
||
test.describe("test negative result for digital and positive for interoperability", () => { | ||
test.beforeEach( | ||
"answer all digital questions with no and all interoperability questions with yes and go to result page", | ||
"answer all digital questions with no and all interoperability questions with yes, go to result page and fill title", | ||
async ({ page }) => { | ||
await page.goto(questions[0].url); | ||
for (const question of questions) { | ||
|
@@ -388,6 +373,7 @@ test.describe("test negative result for digital and positive for interoperabilit | |
.click(); | ||
await page.getByRole("button", { name: "Übernehmen" }).click(); | ||
} | ||
await page.getByLabel("Arbeitstitel des Vorhabens").fill("Policy ABC"); | ||
}, | ||
); | ||
|
||
|
@@ -396,7 +382,6 @@ test.describe("test negative result for digital and positive for interoperabilit | |
}); | ||
|
||
test("email body contains result title", async ({ page }) => { | ||
await page.getByLabel("Arbeitstitel des Vorhabens").fill("Policy ABC"); | ||
await registerMailInterceptionHandlerAndExpect(page, { | ||
body: [ | ||
"Das Regelungsvorhaben hat keinen Digitalbezug und keine Anforderungen der Interoperabilität.", | ||
|
@@ -408,7 +393,6 @@ test.describe("test negative result for digital and positive for interoperabilit | |
test("email body contains hint that interoperability is not possible if digital is negative", async ({ | ||
page, | ||
}) => { | ||
await page.getByLabel("Arbeitstitel des Vorhabens").fill("Policy ABC"); | ||
await registerMailInterceptionHandlerAndExpect(page, { | ||
body: [ | ||
"Bitte beachten Sie: Wenn Ihr Vorhaben keinen Digitalbezug aufweist, können die Anforderungen der Interoperabilität nicht erfüllt werden", | ||
|
@@ -420,7 +404,7 @@ test.describe("test negative result for digital and positive for interoperabilit | |
|
||
test.describe("test negative result for digital and unsure for interoperability", () => { | ||
test.beforeEach( | ||
"answer all digital questions with no and all interoperability questions with unsure and go to result page", | ||
"answer all digital questions with no and all interoperability questions with unsure, go to result page and fill title", | ||
async ({ page }) => { | ||
await page.goto(questions[0].url); | ||
for (const question of questions) { | ||
|
@@ -430,6 +414,7 @@ test.describe("test negative result for digital and unsure for interoperability" | |
.click(); | ||
await page.getByRole("button", { name: "Übernehmen" }).click(); | ||
} | ||
await page.getByLabel("Arbeitstitel des Vorhabens").fill("Policy ABC"); | ||
}, | ||
); | ||
|
||
|
@@ -438,7 +423,6 @@ test.describe("test negative result for digital and unsure for interoperability" | |
}); | ||
|
||
test("email body contains result title", async ({ page }) => { | ||
await page.getByLabel("Arbeitstitel des Vorhabens").fill("Policy ABC"); | ||
await registerMailInterceptionHandlerAndExpect(page, { | ||
body: [ | ||
"Das Regelungsvorhaben hat keinen Digitalbezug und keine eindeutigen Anforderungen der Interoperabilität.", | ||
|
@@ -449,25 +433,28 @@ test.describe("test negative result for digital and unsure for interoperability" | |
}); | ||
|
||
test.describe("test positive result with mixed answers", () => { | ||
test.beforeEach("Go to assessment page", async ({ page }) => { | ||
await page.goto(questions[0].url); | ||
await page.getByLabel("Nein").click(); | ||
await page.getByRole("button", { name: "Übernehmen" }).click(); | ||
await page.waitForURL(questions[1].url); | ||
await page.getByLabel("Ich bin unsicher").click(); | ||
await page.getByRole("button", { name: "Übernehmen" }).click(); | ||
for (const question of questions.slice(2)) { | ||
await page.waitForURL(question.url); | ||
await page.getByLabel("Ja").click(); | ||
test.beforeEach( | ||
"answer questions with mixed answers, go to result page and fill title", | ||
async ({ page }) => { | ||
await page.goto(questions[0].url); | ||
await page.getByLabel("Nein").click(); | ||
await page.getByRole("button", { name: "Übernehmen" }).click(); | ||
} | ||
await page.waitForURL(ROUTE_RESULT.url); | ||
}); | ||
await page.waitForURL(questions[1].url); | ||
await page.getByLabel("Ich bin unsicher").click(); | ||
await page.getByRole("button", { name: "Übernehmen" }).click(); | ||
for (const question of questions.slice(2)) { | ||
await page.waitForURL(question.url); | ||
await page.getByLabel("Ja").click(); | ||
await page.getByRole("button", { name: "Übernehmen" }).click(); | ||
} | ||
await page.waitForURL(ROUTE_RESULT.url); | ||
await page.getByLabel("Arbeitstitel des Vorhabens").fill("Policy ABC"); | ||
}, | ||
); | ||
|
||
test("answers in email body are prefixed by a special character indicating the type of answer", async ({ | ||
page, | ||
}) => { | ||
await page.getByLabel("Arbeitstitel des Vorhabens").fill("Policy ABC"); | ||
const bodyContains = [ | ||
`- ${questions[0].negativeResult}`, | ||
`? ${questions[1].positiveResult}`, | ||
|