Skip to content

Commit 3c74650

Browse files
committed
chore(test): add e2e test for single todo
1 parent 4ee7bda commit 3c74650

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

cypress/integration/try-cy-spec.js

+19-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
// using function declaration instead of arrow functions
44
// so Safari browser understands
55

6+
function random() {
7+
return Math.random().toString(16).substr(2)
8+
}
9+
610
describe('a cy unit test', function () {
711
it('is ok', function () {
812
expect(true).to.be.true
@@ -63,8 +67,8 @@ describe('todomvc app', function () {
6367
})
6468

6569
it('can clear all completed todos', function () {
66-
const random = Math.random().toString(16).substr(2)
67-
const label = `an example ${random}`
70+
const id = random()
71+
const label = `an example ${id}`
6872
addTodo(label)
6973
cy
7074
.get('ul.todo-list')
@@ -79,4 +83,17 @@ describe('todomvc app', function () {
7983
.contains('li', label)
8084
.should('not.exist')
8185
})
86+
87+
it('can show individual TODO item', function () {
88+
const id = random()
89+
const label = `one todo ${id}`
90+
addTodo(label)
91+
cy.get('ul.todo-list')
92+
.contains('li', label)
93+
.should('be.visible')
94+
.click()
95+
cy.url().should('contain', `/todo/`)
96+
cy.get('ul.todo-list li')
97+
.should('have.length', 1)
98+
})
8299
})

0 commit comments

Comments
 (0)