Skip to content

Commit

Permalink
Fix failing assertions tests
Browse files Browse the repository at this point in the history
  • Loading branch information
p2635 committed Jan 25, 2024
1 parent 56f11b4 commit 848416c
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions cypress/e2e/assertions.cy.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,32 @@
// Introduction to Cypress, Chapter 7 - Assertions
describe("Assertions", () => {
// Check bread card is visible after creating the card
it("create bread card and check is visible", () => {
before("Reset the data and create the board", () => {
cy.request("POST", "/api/reset");
cy.request("POST", "/api/boards", { name: "new board" });
cy.request("POST", "/api/lists", { boardId: 1, name: "groceries" });
});

beforeEach("Clear cards then visit board", () => {
cy.request("DELETE", "/api/cards");
cy.visit("/board/1");
});

it("create bread card and check is visible", () => {
cy.get('[data-cy="new-card"]').click();
cy.get('[data-cy="new-card-input"]').type("bread{enter}");

cy.contains("bread").should("be.visible");
});

// Create two cards and check there are in fact two cards created
it("create two cards and check there are in fact two cards created", () => {
cy.visit("/board/1");

cy.get('[data-cy="new-card"]').click();
cy.get('[data-cy="new-card-input"]').type("bread{enter}");
cy.get('[data-cy="new-card-input"]').type("milk{enter}");

cy.get('[data-cy="card"]').should("have.length", 2);
});

// Create a list called 'groceries', create a card and complete it. Check the due date is green.
it.only("complete a task and check due date shows as completed", () => {
cy.visit("/board/1");
cy.get('[data-cy="add-list-input"]').type("groceries{enter}");
it("complete a task and check due date shows as completed", () => {
cy.get('[data-cy="new-card"]').click();
cy.get('[data-cy="new-card-input"]').type("bread{enter}");
cy.get('[data-cy="due-date"]').should("not.have.class", "completed");
Expand Down

0 comments on commit 848416c

Please sign in to comment.