-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
completed chapter 6; includes examples for 'Enter' button, mouseover,…
… force-click
- Loading branch information
Showing
3 changed files
with
39 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,20 @@ | ||
it('my first test', () => { | ||
cy.visit('https://cypress.io') | ||
}); | ||
function addTodo(todoText) { | ||
let todo1 = cy.get("[data-testid='text-input']"); | ||
todo1.click(); | ||
todo1.type(todoText); | ||
todo1.type("{enter}"); | ||
} | ||
|
||
function removeTodo(todoText) { | ||
let todoItem = cy.get("[data-testid='todo-item-label']").contains(todoText); | ||
todoItem.trigger('mouseover'); | ||
let todoItemRemoveButton = cy.get("[data-testid='todo-item-button']"); | ||
todoItemRemoveButton.click({force: true}); | ||
} | ||
|
||
it('add and remove a single todo item', () => { | ||
cy.visit('https://todomvc.com/examples/react/dist/'); | ||
addTodo('todo1'); | ||
removeTodo('todo1'); | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
Terminal commands | ||
================= | ||
|
||
node -v | ||
* check what version of Node is installed | ||
|
||
npm init | ||
* initialize a Node project in the current folder | ||
|
||
npm init -y | ||
* initialize a Node project and say accept all configuration defaults | ||
|
||
npm install cypress | ||
* install Cypress and its dependencies into the current Node project | ||
|
||
npx cypress open | ||
* open Cypress in UI mode |