Skip to content

Commit

Permalink
chore(candidate): add test on reset on site and remote filters
Browse files Browse the repository at this point in the history
  • Loading branch information
cedricss committed Dec 18, 2024
1 parent 1bf2ddc commit 4f20795
Show file tree
Hide file tree
Showing 2 changed files with 57 additions and 0 deletions.
53 changes: 53 additions & 0 deletions packages/reva-candidate/cypress/e2e/organism.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,11 @@ context("Candidacy with department certification selected", () => {

cy.get('[data-test="button-select-onsite"]').click();

cy.get('[data-test="button-select-onsite"]').should(
"have.attr",
"aria-pressed",
"true",
);
cy.get('[data-test="input-wrapper-zip"] input').should("not.be.disabled");
cy.get('[data-test="checkbox-wrapper-pmr"] input').should(
"not.be.disabled",
Expand All @@ -98,6 +103,54 @@ context("Candidacy with department certification selected", () => {
cy.get('[data-test="button-select-onsite"]').click();
cy.get('[data-test="input-wrapper-zip"] input').should("have.value", "");
});

it("on site filters can be reset", function () {
cy.get('[data-test="button-select-onsite"]').click();
cy.get('[data-test="button-select-onsite"]').should(
"have.attr",
"aria-pressed",
"true",
);
cy.get('[data-test="input-wrapper-zip"] input').type("44000");
cy.get('[data-test="checkbox-wrapper-pmr"] input').check({
force: true,
});

cy.get('[data-test="button-reset-filters"]').click();
cy.get('[data-test="button-select-onsite"]').should(
"have.attr",
"aria-pressed",
"false",
);
cy.get('[data-test="input-wrapper-zip"] input').should("have.value", "");
cy.get('[data-test="checkbox-wrapper-pmr"] input').should("not.be.checked");
});

it("remote filters can be reset", function () {
cy.get('[data-test="button-select-remote"]').click();
cy.get('[data-test="button-select-remote"]').should(
"have.attr",
"aria-pressed",
"true",
);

cy.get('[data-test="button-reset-filters"]').click();
cy.get('[data-test="button-select-remote"]').should(
"have.attr",
"aria-pressed",
"false",
);
});

it("mcf filter can be reset", function () {
cy.get('[data-test="checkbox-wrapper-mcf"] input').check({
force: true,
});

cy.get('[data-test="button-reset-filters"]').click();
cy.get('[data-test="checkbox-wrapper-mcf"] input').should("not.be.checked");
});

it("submit first organism", function () {
cy.intercept("POST", "/api/graphql", (req) => {
stubMutation(req, "candidacy_selectOrganism", "selected-organism.json");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ export const OrganismFilters = ({
<div className="-mb-6">
<Button
data-test="button-select-onsite"
aria-pressed={organismSearchOnsite}
priority="tertiary no outline"
title="Choisir sur site"
onClick={() => {
Expand All @@ -74,6 +75,7 @@ export const OrganismFilters = ({
</Button>
<Button
data-test="button-select-remote"
aria-pressed={organismSearchRemote}
priority="tertiary no outline"
title="Choisir à distance"
onClick={() => {
Expand Down Expand Up @@ -162,6 +164,7 @@ export const OrganismFilters = ({
</p>
</modalMcfInfo.Component>
<Checkbox
data-test="checkbox-wrapper-mcf"
small
options={[
{
Expand All @@ -187,6 +190,7 @@ export const OrganismFilters = ({
{/* <hr /> */}
<div className="flex justify-center">
<Button
data-test="button-reset-filters"
priority="tertiary no outline"
onClick={() => {
onSearch({
Expand Down

0 comments on commit 4f20795

Please sign in to comment.