Add navigation cypress tests

This commit is contained in:
Daniel Egger 2023-05-09 14:22:53 +02:00
parent f9a5f7c9a5
commit 35e629f64c
2 changed files with 19 additions and 4 deletions

View File

@ -65,6 +65,7 @@ function calcStepIndex(step: number) {
v-if="props.startBadgeText"
class="inline-flex h-7 items-center justify-center whitespace-nowrap rounded-3xl px-3 text-sm"
:class="startBadgeClasses"
data-cy="nav-progress-step-start"
>
<router-link v-if="props.baseUrl" :to="`${props.baseUrl}?${props.queryParam}=0`">
{{ props.startBadgeText }}
@ -79,6 +80,7 @@ function calcStepIndex(step: number) {
<div
class="inline-flex h-7 w-7 items-center justify-center rounded-full px-3 py-1 text-sm"
:class="getPillClasses(step)"
:data-cy="`nav-progress-step-${calcStepIndex(step)}`"
>
<router-link
v-if="props.baseUrl"
@ -94,6 +96,7 @@ function calcStepIndex(step: number) {
v-if="endBadgeText"
class="inline-flex h-7 items-center justify-center whitespace-nowrap rounded-3xl px-3 text-sm"
:class="endBadgeClasses"
data-cy="nav-progress-end"
>
<router-link
v-if="props.baseUrl"

View File

@ -23,10 +23,10 @@ describe("student test", () => {
"Teilaufgabe 1: Beispiel einer Versicherungspolice finden"
);
// 2 Steps forward, 1 step backwards
for (let i = 0; i !== 2; i++) {
cy.learningContentMultiLayoutNextStep();
}
cy.learningContentMultiLayoutNextStep();
cy.learningContentMultiLayoutNextStep();
cy.testLearningContentTitle("Teilaufgabe 3: Aktuelle Versicherung");
cy.learningContentMultiLayoutPreviousStep();
cy.testLearningContentTitle(
@ -66,4 +66,16 @@ describe("student test", () => {
"Hallovelo"
);
});
it("can visit sub step directly via url", () => {
cy.visit(
"/course/test-lehrgang/learn/fahrzeug/überprüfen-einer-motorfahrzeug-versicherungspolice?page=3"
);
cy.testLearningContentTitle("Teilaufgabe 3: Aktuelle Versicherung");
});
it("can visit sub step by clicking navigation bar", () => {
cy.get('[data-cy="nav-progress-step-4"]').click();
cy.testLearningContentTitle("Teilaufgabe 4: Deine Empfehlungen");
});
});