import { login } from "./helpers";

describe("Competence", () => {
  beforeEach(() => {
    cy.manageCommand("cypress_reset");

    login("admin", "test");
    cy.visit("/course/versicherungsvermittler-in/learn/analyse");
  });

  it("self evaluation should be neutral", () => {
    cy.get(
      '[data-cy="versicherungsvermittler-in-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="versicherungsvermittler-in-lp-circle-analyse-lu-fahrzeug"]'
    ).click();
    cy.makeSelfEvaluation([true, true, true]);
    cy.get(
      '[data-cy="versicherungsvermittler-in-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="versicherungsvermittler-in-lp-circle-analyse-lu-fahrzeug"]'
    ).click();
    cy.makeSelfEvaluation([false, false, false]);
    cy.get(
      '[data-cy="versicherungsvermittler-in-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="versicherungsvermittler-in-lp-circle-analyse-lu-fahrzeug"]'
    ).click();
    cy.makeSelfEvaluation([false, true, true]);
    cy.get(
      '[data-cy="versicherungsvermittler-in-lp-circle-analyse-lu-fahrzeug"]'
    )
      .find('[data-cy="fail"]')
      .should("exist");
  });
});
