-
Notifications
You must be signed in to change notification settings - Fork 3.1k
/
index.js
54 lines (41 loc) · 1.17 KB
/
index.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
require('@packages/ui-components/cypress/support/customPercyCommand')
require('cypress-react-unit-test/dist/hooks')
const BluebirdPromise = require('bluebird')
beforeEach(function () {
this.util = {
deferred (Promise = BluebirdPromise) {
const deferred = {}
deferred.promise = new Promise((resolve, reject) => {
deferred.resolve = resolve
deferred.reject = reject
})
return deferred
},
deepClone (obj) {
return JSON.parse(JSON.stringify(obj))
},
}
})
Cypress.Commands.add('visitIndex', (options = {}) => {
return cy.visit('/', options)
})
Cypress.Commands.add('shouldBeOnIntro', () => {
return cy.get('.main-nav .logo')
})
Cypress.Commands.add('shouldBeOnProjectSpecs', () => {
cy.contains('.folder', 'integration')
return cy.contains('.folder', 'unit')
})
Cypress.Commands.add('logOut', () => {
cy.contains('Jane Lane').click()
return cy.contains('Log Out').click()
})
Cypress.Commands.add('shouldBeLoggedOut', () => {
return cy.contains('.main-nav a', 'Log In')
})
Cypress.Commands.add('setAppStore', (options = {}) => {
return cy.window()
.then((win) => {
return win.AppStore.set(options)
})
})