Skip to content

Commit

Permalink
First commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ntr0008 authored and ntr0008 committed Jul 31, 2023
1 parent b2c324d commit a5fa962
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 8 deletions.
44 changes: 44 additions & 0 deletions cypress/e2e/test.cy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
describe("Testing the to do items", () => {
let TODO_ITEM_ONE = "Make every second count";
let TODO_ITEM_TWO = "Invest in yourself";
let TODO_ITEM_THREE = "Learn Cypress";

beforeEach(() => {
cy.visit("http://localhost:8888/#/");
});

it("displays items", () => {
cy.get(".new-todo").type(TODO_ITEM_ONE).type("{enter}");
cy.get(".new-todo").type(TODO_ITEM_TWO).type("{enter}");
cy.get(".new-todo").type(TODO_ITEM_THREE).type("{enter}");
});
});

context("Mark all as completed", function () {
// New commands used here:
// - cy.check https://on.cypress.io/api/check
// - cy.uncheck https://on.cypress.io/api/uncheck

beforeEach(function () {
// This is an example of aliasing
// within a hook (beforeEach).
// Aliases will automatically persist
// between hooks and are available
// in your tests below
cy.createDefaultTodos().as("todos");
});

it("should allow me to mark all items as completed", function () {
// complete all todos
// we use 'check' instead of 'click'
// because that indicates our intention much clearer
cy.get(".toggle-all").check();

// get each todo li and ensure its class is 'completed'
cy.get("@todos").eq(0).should("have.class", "completed");

cy.get("@todos").eq(1).should("have.class", "completed");

cy.get("@todos").eq(2).should("have.class", "completed");
});
});
7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"http-server": "0.13.0",
"react": "0.13.3",
"todomvc-app-css": "2.3.0",
"todomvc-common": "cypress-io/todomvc-common#88b7c6359ad4a5097312d8b2a21dd539ce9f4446"
"todomvc-common": "github:cypress-io/todomvc-common#88b7c6359ad4a5097312d8b2a21dd539ce9f4446"
},
"devDependencies": {
"axe-core": "4.6.2",
Expand All @@ -40,5 +40,8 @@
"eslint-plugin-mocha": "5.3.0",
"npm-run-all": "4.1.5",
"typescript": "3.9.10"
}
},
"main": "index.js",
"author": "",
"license": "ISC"
}
8 changes: 2 additions & 6 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,7 @@
"lib": ["es2015", "dom"],
"allowJs": true,
"noEmit": true,
"types": [
"cypress"
]
"types": ["cypress"]
},
"include": [
"cypress/**/*.js"
]
"include": ["cypress/**/*.js"]
}

0 comments on commit a5fa962

Please sign in to comment.