Fix cypress tests
This commit is contained in:
parent
4fb534aa25
commit
bc368e7a2f
|
|
@ -139,6 +139,7 @@ onMounted(() => {
|
|||
<router-link
|
||||
v-if="inCourse() && courseSessionsStore.currentCourseSession"
|
||||
:to="courseSessionsStore.currentCourseSession.media_library_url"
|
||||
data-cy="medialibrary-link"
|
||||
class="nav-item-no-mobile"
|
||||
:class="{ 'nav-item--active': inMediaLibrary() }"
|
||||
>
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ log.debug("LearningContentMediaLibraryBlock.vue created");
|
|||
<a
|
||||
:href="`${props.content.content_url}`"
|
||||
target="_blank"
|
||||
data-cy="media-library-link"
|
||||
class="btn-primary inline-flex items-center"
|
||||
>
|
||||
Handlungsfeld anzeigen
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ describe("circle page", () => {
|
|||
beforeEach(() => {
|
||||
cy.manageCommand("cypress_reset");
|
||||
|
||||
login("admin", "test");
|
||||
login("test-student1@example.com", "test");
|
||||
cy.visit("/course/test-lehrgang/learn/fahrzeug");
|
||||
});
|
||||
|
||||
|
|
@ -16,17 +16,17 @@ describe("circle page", () => {
|
|||
cy.get('[data-cy="circle-title"]').should("contain", "Fahrzeug");
|
||||
|
||||
cy.get(
|
||||
'[data-cy="test-lehrgang-lp-circle-fahrzeug-lc-mediathek-fahrzeug-checkbox"] > .cy-checkbox'
|
||||
'[data-cy="test-lehrgang-lp-circle-fahrzeug-lc-handlungsfeld-fahrzeug-checkbox"] > .cy-checkbox'
|
||||
).click();
|
||||
|
||||
cy.get(
|
||||
'[data-cy="test-lehrgang-lp-circle-fahrzeug-lc-mediathek-fahrzeug-checkbox"] > .cy-checkbox-checked'
|
||||
'[data-cy="test-lehrgang-lp-circle-fahrzeug-lc-handlungsfeld-fahrzeug-checkbox"] > .cy-checkbox-checked'
|
||||
).should("have.class", "cy-checkbox-checked");
|
||||
|
||||
// completion data should still be there after reload
|
||||
cy.reload();
|
||||
cy.get(
|
||||
'[data-cy="test-lehrgang-lp-circle-fahrzeug-lc-mediathek-fahrzeug-checkbox"] > .cy-checkbox-checked'
|
||||
'[data-cy="test-lehrgang-lp-circle-fahrzeug-lc-handlungsfeld-fahrzeug-checkbox"] > .cy-checkbox-checked'
|
||||
).should("have.class", "cy-checkbox-checked");
|
||||
});
|
||||
|
||||
|
|
@ -41,7 +41,10 @@ describe("circle page", () => {
|
|||
cy.get('[data-cy="complete-and-continue"]').click({ force: true });
|
||||
|
||||
cy.get('[data-cy="ls-continue-button"]').click();
|
||||
cy.get('[data-cy="lc-title"]').should("contain", "Mediathek Fahrzeug");
|
||||
cy.get('[data-cy="lc-title"]').should(
|
||||
"contain",
|
||||
"Handlungsfeld «Fahrzeug»"
|
||||
);
|
||||
cy.get('[data-cy="complete-and-continue"]').click({ force: true });
|
||||
|
||||
cy.get('[data-cy="ls-continue-button"]').click();
|
||||
|
|
@ -52,7 +55,7 @@ describe("circle page", () => {
|
|||
'[data-cy="test-lehrgang-lp-circle-fahrzeug-lc-verschaffe-dir-einen-überblick-checkbox"] > .cy-checkbox-checked'
|
||||
).should("have.class", "cy-checkbox-checked");
|
||||
cy.get(
|
||||
'[data-cy="test-lehrgang-lp-circle-fahrzeug-lc-mediathek-fahrzeug-checkbox"] > .cy-checkbox-checked'
|
||||
'[data-cy="test-lehrgang-lp-circle-fahrzeug-lc-handlungsfeld-fahrzeug-checkbox"] > .cy-checkbox-checked'
|
||||
).should("have.class", "cy-checkbox-checked");
|
||||
|
||||
cy.get(
|
||||
|
|
@ -72,12 +75,18 @@ describe("circle page", () => {
|
|||
|
||||
cy.get('[data-cy="ls-continue-button"]').should("contain", "Weiter geht's");
|
||||
cy.get('[data-cy="ls-continue-button"]').click();
|
||||
cy.get('[data-cy="lc-title"]').should("contain", "Mediathek Fahrzeug");
|
||||
cy.get('[data-cy="lc-title"]').should(
|
||||
"contain",
|
||||
"Handlungsfeld «Fahrzeug»"
|
||||
);
|
||||
});
|
||||
|
||||
it("can open learning content by url", () => {
|
||||
cy.visit("/course/test-lehrgang/learn/fahrzeug/mediathek-fahrzeug");
|
||||
cy.get('[data-cy="lc-title"]').should("contain", "Mediathek Fahrzeug");
|
||||
cy.visit("/course/test-lehrgang/learn/fahrzeug/handlungsfeld-fahrzeug");
|
||||
cy.get('[data-cy="lc-title"]').should(
|
||||
"contain",
|
||||
"Handlungsfeld «Fahrzeug»"
|
||||
);
|
||||
|
||||
cy.get('[data-cy="close-learning-content"]').click();
|
||||
cy.get('[data-cy="circle-title"]').should("contain", "Fahrzeug");
|
||||
|
|
|
|||
|
|
@ -3,35 +3,25 @@ import { login } from "./helpers";
|
|||
describe("learningPath page", () => {
|
||||
beforeEach(() => {
|
||||
cy.manageCommand("cypress_reset");
|
||||
login("test-student1@example.com", "test");
|
||||
cy.visit("/course/test-lehrgang/learn");
|
||||
});
|
||||
|
||||
it("can open learningPath page", () => {
|
||||
login("admin", "test");
|
||||
cy.visit("/course/versicherungsvermittler-in/learn");
|
||||
|
||||
cy.get('[data-cy="learning-path-title"]').should(
|
||||
"contain",
|
||||
"Versicherungsvermittler/-in"
|
||||
"Test Lehrgang"
|
||||
);
|
||||
});
|
||||
|
||||
it("can click on circle to open it", () => {
|
||||
login("admin", "test");
|
||||
cy.visit("/course/versicherungsvermittler-in/learn");
|
||||
|
||||
cy.get('[data-cy="circle-Fahrzeug"]').click({ force: true });
|
||||
|
||||
cy.url().should(
|
||||
"include",
|
||||
"/course/versicherungsvermittler-in/learn/fahrzeug"
|
||||
);
|
||||
cy.url().should("include", "/course/test-lehrgang/learn/fahrzeug");
|
||||
cy.get('[data-cy="circle-title"]').should("contain", "Fahrzeug");
|
||||
});
|
||||
|
||||
it("switch between list and path view", () => {
|
||||
login("admin", "test");
|
||||
cy.visit("/course/versicherungsvermittler-in/learn");
|
||||
|
||||
cy.get('[data-cy="lp-path-view"]').should("be.visible");
|
||||
cy.get('[data-cy="view-switch"]').click();
|
||||
cy.get('[data-cy="lp-list-view"]').should("be.visible");
|
||||
|
|
@ -40,21 +30,18 @@ describe("learningPath page", () => {
|
|||
});
|
||||
|
||||
it("weiter gehts button will open next circle", () => {
|
||||
login("admin", "test");
|
||||
cy.visit("/course/versicherungsvermittler-in/learn");
|
||||
|
||||
// first click will open first circle
|
||||
cy.get('[data-cy="lp-continue-button"]')
|
||||
.filter(":visible")
|
||||
.should("contain", "Los geht's")
|
||||
.click();
|
||||
cy.get('[data-cy="circle-title"]').should("contain", "Basis");
|
||||
cy.get('[data-cy="circle-title"]').should("contain", "Fahrzeug");
|
||||
cy.get('[data-cy="back-to-learning-path-button"]').click();
|
||||
|
||||
// mark a learning content in second circle
|
||||
cy.get('[data-cy="circle-Fahrzeug"]').click({ force: true });
|
||||
cy.get('[data-cy="circle-Reisen"]').click({ force: true });
|
||||
cy.get(
|
||||
'[data-cy="versicherungsvermittler-in-lp-circle-fahrzeug-lc-rafael-fasel-wechselt-sein-auto-einstieg-checkbox"] > .cy-checkbox'
|
||||
'[data-cy="test-lehrgang-lp-circle-reisen-lc-fachcheck-reisen-checkbox"] > .cy-checkbox'
|
||||
).click();
|
||||
cy.get('[data-cy="back-to-learning-path-button"]').click();
|
||||
|
||||
|
|
@ -63,6 +50,6 @@ describe("learningPath page", () => {
|
|||
.filter(":visible")
|
||||
.should("contain", "Weiter geht's")
|
||||
.click();
|
||||
cy.get('[data-cy="circle-title"]').should("contain", "Fahrzeug");
|
||||
cy.get('[data-cy="circle-title"]').should("contain", "Reisen");
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -13,40 +13,34 @@ describe("login", () => {
|
|||
it("can login to app with username/password", () => {
|
||||
cy.visit("/");
|
||||
|
||||
cy.get("#username").type("admin");
|
||||
cy.get("#username").type("test-student1@example.com");
|
||||
cy.get("#password").type("test");
|
||||
|
||||
cy.get('[data-cy="login-button"]').click();
|
||||
cy.request("/api/core/me").its("status").should("eq", 200);
|
||||
|
||||
cy.get('[data-cy="welcome-message"]').should(
|
||||
"contain",
|
||||
"Willkommen, Peter"
|
||||
);
|
||||
cy.get('[data-cy="welcome-message"]').should("contain", "Willkommen, Test");
|
||||
});
|
||||
|
||||
it("can login with helper function", () => {
|
||||
login("admin", "test");
|
||||
login("test-student1@example.com", "test");
|
||||
cy.visit("/");
|
||||
cy.request("/api/core/me").its("status").should("eq", 200);
|
||||
cy.get('[data-cy="welcome-message"]').should(
|
||||
"contain",
|
||||
"Willkommen, Peter"
|
||||
);
|
||||
cy.get('[data-cy="welcome-message"]').should("contain", "Willkommen, Test");
|
||||
});
|
||||
|
||||
it("login will redirect to requestet page", () => {
|
||||
cy.visit("/course/versicherungsvermittler-in/learn");
|
||||
cy.visit("/course/test-lehrgang/learn");
|
||||
cy.get("h1").should("contain", "Login");
|
||||
|
||||
cy.get("#username").type("admin");
|
||||
cy.get("#username").type("test-student1@example.com");
|
||||
cy.get("#password").type("test");
|
||||
|
||||
cy.get('[data-cy="login-button"]').click();
|
||||
|
||||
cy.get('[data-cy="learning-path-title"]').should(
|
||||
"contain",
|
||||
"Versicherungsvermittler"
|
||||
"Test Lehrgang"
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -4,13 +4,11 @@ describe("MediaLibrary", () => {
|
|||
beforeEach(() => {
|
||||
cy.manageCommand("cypress_reset");
|
||||
|
||||
login("admin", "test");
|
||||
login("test-student1@example.com", "test");
|
||||
});
|
||||
|
||||
it.skip("should be accessible via link in header", () => {
|
||||
// der Link zur Mediathek fehlt aktuell im Header (auch im Design)
|
||||
// das ganze Konzept der Mediathek wird noch überdacht -> skip
|
||||
cy.visit("/course/test-lehrgang");
|
||||
it("should be accessible via link in header", () => {
|
||||
cy.visit("/course/test-lehrgang/learn");
|
||||
cy.get('[data-cy="medialibrary-link"]').click();
|
||||
cy.get('[data-cy="Handlungsfelder-link"]').click();
|
||||
cy.get('[data-cy="Fahrzeug-link"]').click();
|
||||
|
|
@ -18,9 +16,21 @@ describe("MediaLibrary", () => {
|
|||
});
|
||||
|
||||
it("should be accessible via direct url", () => {
|
||||
cy.visit("/media/test-lehrgang-media");
|
||||
cy.visit("/course/test-lehrgang/media");
|
||||
cy.get('[data-cy="Handlungsfelder-link"]').click();
|
||||
cy.get('[data-cy="Fahrzeug-link"]').click();
|
||||
cy.get('[data-cy="hf-title"]').should("contain", "Fahrzeug");
|
||||
});
|
||||
|
||||
it("handlungsfeld should be accessible via direct url", () => {
|
||||
cy.visit("/course/test-lehrgang/media/category/fahrzeug");
|
||||
cy.get('[data-cy="hf-title"]').should("contain", "Fahrzeug");
|
||||
});
|
||||
|
||||
it("should be accessible via learning path circle", () => {
|
||||
cy.visit("/course/test-lehrgang/learn/fahrzeug/handlungsfeld-fahrzeug");
|
||||
cy.get('[data-cy="media-library-link"]')
|
||||
.invoke("attr", "href")
|
||||
.should("contain", "/media/category/fahrzeug");
|
||||
});
|
||||
});
|
||||
|
|
|
|||
|
|
@ -223,7 +223,7 @@ damit du erfolgreich mit deinem Lernpfad (durch-)starten kannst.
|
|||
f"<p>In der Mediathek unter dem Handlungsfeld «{title}» findest du alle relevanten Ressourcen für deine Fachkompetenzen.</p>"
|
||||
f"<p>Wir empfehlen dir vor der Absolvierung der weiteren Lerneinheiten dich in die Thematik einzulesen.</p>"
|
||||
),
|
||||
content_url=f"/course/überbetriebliche-kurse/media/category/{slugify(title)}",
|
||||
content_url=f"/course/{lp.get_course().slug}/media/category/{slugify(title)}",
|
||||
)
|
||||
LearningContentPlaceholderFactory(
|
||||
title="Vorbereitungsauftrag",
|
||||
|
|
|
|||
Loading…
Reference in New Issue