Skip to content

Commit

Permalink
chore(test): add e2e test for single todo
Browse files Browse the repository at this point in the history
  • Loading branch information
bahmutov committed Oct 26, 2016
1 parent 4ee7bda commit 3c74650
Showing 1 changed file with 19 additions and 2 deletions.
21 changes: 19 additions & 2 deletions cypress/integration/try-cy-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
// using function declaration instead of arrow functions
// so Safari browser understands

function random() {
return Math.random().toString(16).substr(2)
}

describe('a cy unit test', function () {
it('is ok', function () {
expect(true).to.be.true
Expand Down Expand Up @@ -63,8 +67,8 @@ describe('todomvc app', function () {
})

it('can clear all completed todos', function () {
const random = Math.random().toString(16).substr(2)
const label = `an example ${random}`
const id = random()
const label = `an example ${id}`
addTodo(label)
cy
.get('ul.todo-list')
Expand All @@ -79,4 +83,17 @@ describe('todomvc app', function () {
.contains('li', label)
.should('not.exist')
})

it('can show individual TODO item', function () {
const id = random()
const label = `one todo ${id}`
addTodo(label)
cy.get('ul.todo-list')
.contains('li', label)
.should('be.visible')
.click()
cy.url().should('contain', `/todo/`)
cy.get('ul.todo-list li')
.should('have.length', 1)
})
})

0 comments on commit 3c74650

Please sign in to comment.