Add competence tests

This commit is contained in:
Christian Cueni 2022-10-13 10:54:36 +02:00
parent c9bf1d2753
commit 29c60d7bfb
2 changed files with 44 additions and 0 deletions

View File

@ -0,0 +1,32 @@
import { login } from "./helpers";
describe("Competence", () => {
beforeEach(() => {
cy.manageCommand("cypress_reset");
login("admin", "test");
cy.visit("/learn/test-lehrgang-lp/analyse");
});
it("self evaluation should be neutral", () => {
cy.get('[data-cy="test-lehrgang-lp-circle-analyse-lu-fahrzeug"]').find('[data-cy="unknown"]').should('exist');
});
it("should be able to make a happy self evaluation", () => {
cy.get('[data-cy="test-lehrgang-lp-circle-analyse-lu-fahrzeug"]').click();
cy.makeSelfEvaluation([true, true])
cy.get('[data-cy="test-lehrgang-lp-circle-analyse-lu-fahrzeug"]').find('[data-cy="success"]').should('exist');
});
it("should be able to make a fail self evaluation", () => {
cy.get('[data-cy="test-lehrgang-lp-circle-analyse-lu-fahrzeug"]').click();
cy.makeSelfEvaluation([false, false])
cy.get('[data-cy="test-lehrgang-lp-circle-analyse-lu-fahrzeug"]').find('[data-cy="fail"]').should('exist');
});
it("should be able to make a mixed self evaluation", () => {
cy.get('[data-cy="test-lehrgang-lp-circle-analyse-lu-fahrzeug"]').click();
cy.makeSelfEvaluation([false, true])
cy.get('[data-cy="test-lehrgang-lp-circle-analyse-lu-fahrzeug"]').find('[data-cy="fail"]').should('exist');
});
});

View File

@ -96,6 +96,18 @@ function loadObjectJson(key, value, djangoModelPath, serializerModelPath) {
}
Cypress.Commands.add('makeSelfEvaluation', (answers) => {
for (let answer of answers) {
if (answer) {
cy.get('[data-cy="success"]').click();
} else {
cy.get('[data-cy="fail"]').click();
}
cy.get('[data-cy="complete-and-continue"]').click();
}
});
// Cypress.Commands.add('loadApiClientRequestResponseLog', (key, value) => {
// return loadObjectJson(
// key,