This repository has been archived by the owner on Feb 28, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 189
/
Copy pathspec.js
66 lines (58 loc) · 1.62 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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
/// <reference types="cypress" />
/**
* Adds a todo item
* @param {string} text
*/
const addItem = (text) => {
cy.get('.new-todo').type(`${text}{enter}`)
}
describe('reset data using XHR call', () => {
beforeEach(() => {
// application should be running at port 3000
// and the "localhost:3000" is set as "baseUrl" in "cypress.json"
// TODO call /reset endpoint with POST method and object {todos: []}
cy.visit('/')
})
it('adds two items', () => {
addItem('first item')
addItem('second item')
cy.get('li.todo').should('have.length', 2)
})
})
describe('reset data using cy.writeFile', () => {
beforeEach(() => {
// TODO write file "todomvc/data.json" with stringified todos object
// file path is relative to the project's root folder
// where cypress.json is located
cy.visit('/')
})
it('adds two items', () => {
addItem('first item')
addItem('second item')
cy.get('li.todo').should('have.length', 2)
})
})
describe('reset data using a task', () => {
beforeEach(() => {
// TODO call a task to reset data
cy.visit('/')
})
it('adds two items', () => {
addItem('first item')
addItem('second item')
cy.get('li.todo').should('have.length', 2)
})
})
describe('set initial data', () => {
it('sets data to complex object right away', () => {
// TODO call task and pass an object with todos
cy.visit('/')
// check what is rendered
})
it('sets data using fixture', () => {
// TODO load todos from "cypress/fixtures/two-items.json"
// and then call the task to set todos
cy.visit('/')
// check what is rendered
})
})