Skip to content

Commit

Permalink
fix: cypress test and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexZorkin committed Jan 26, 2022
1 parent cdcbe2a commit bd07c71
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 8 deletions.
8 changes: 1 addition & 7 deletions app/components/Operator/OperatorTableRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,7 @@ interface Props {
}

const OperatorTableRow: React.FC<Props> = ({ operator }) => {
const {
id,
legalName,
tradeName,
bcRegistryId,
operatorCode
} = useFragment(
const { id, legalName, tradeName, bcRegistryId, operatorCode } = useFragment(
graphql`
fragment OperatorTableRow_operator on Operator {
id
Expand Down
36 changes: 36 additions & 0 deletions app/cypress/integration/cif/operators.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import logAxeResults from "../../plugins/logAxeResults";

describe("the operators page", () => {
beforeEach(() => {
cy.sqlFixture("e2e/dbReset");
cy.sqlFixture("dev/001_cif_user");
cy.sqlFixture("dev/002_cif_operator");
cy.sqlFixture("dev/003_cif_project");
cy.mockLogin("cif_internal");
});

it("displays the list of operators", () => {
cy.visit("/cif/operators");
cy.get("h2").contains("Operators");
cy.injectAxe();
cy.checkA11y("main", null, logAxeResults);
cy.get("body").happoScreenshot({
component: "Operators Page",
});
});

it("allows the list of operators to be paginated, filtered and ordered", () => {
cy.visit("/cif/operators");
cy.get("h2").contains("Operators");
cy.get("tbody tr").should("have.length", 3);
cy.get("[placeholder='Filter']").first().type("first operator legal name");
cy.get("button").contains("Apply").click();
cy.get("tbody tr").should("have.length", 1);
cy.get("button").contains("Clear").click();
cy.get("tbody tr").should("have.length", 3);
// click twice for descending order
cy.get("thead th").contains("Operator Legal Name").click();
cy.get("thead th").contains("Operator Legal Name").click();
cy.contains("third operator legal name");
});
});
2 changes: 1 addition & 1 deletion app/tests/unit/pages/operators.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const defaultMockResolver = {
{ node: { id: "1", legalName: "Operator 1" } },
{ node: { id: "2", legalName: "Operator 2" } },
],
}
},
};
},
};
Expand Down

0 comments on commit bd07c71

Please sign in to comment.