Add competence tests
This commit is contained in:
parent
c9bf1d2753
commit
29c60d7bfb
|
|
@ -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');
|
||||
});
|
||||
});
|
||||
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Reference in New Issue