forked from DavidTNguyen/testing-workshop-cypress
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathspec.js
49 lines (45 loc) · 1.1 KB
/
spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
/// <reference types="cypress" />
/// <reference path="./custom-commands.d.ts" />
beforeEach(function resetData () {
cy.request('POST', '/reset', {
todos: []
})
})
beforeEach(function visitSite () {
cy.visit('/')
})
it('enters 10 todos', function () {
cy.get('.new-todo')
.type('todo 0{enter}')
.type('todo 1{enter}')
.type('todo 2{enter}')
.type('todo 3{enter}')
.type('todo 4{enter}')
.type('todo 5{enter}')
.type('todo 6{enter}')
.type('todo 7{enter}')
.type('todo 8{enter}')
.type('todo 9{enter}')
cy.get('.todo').should('have.length', 10)
})
// it('creates a todo')
it.skip('passes when object gets new property', () => {
const o = {}
setTimeout(() => {
o.foo = 'bar'
}, 1000)
// TODO write "get" that returns the given property
// from an object.
// cy.wrap(o).pipe(get('foo'))
// add assertions
})
it.only('creates todos', () => {
cy.get('.new-todo')
.type('todo 0{enter}')
.type('todo 1{enter}')
.type('todo 2{enter}')
cy.get('.todo').should('have.length', 3)
cy.window()
.its('app.todos')
.toMatchSnapshot()
})