-
-
Notifications
You must be signed in to change notification settings - Fork 979
/
Copy pathtest.js
119 lines (98 loc) · 4.11 KB
/
test.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
// For authoring Nightwatch tests, see
// http://nightwatchjs.org/guide#usage
module.exports = {
before: function (browser) {
console.log('Setting up... browser', typeof browser)
},
after: function (browser) {
console.log('Closing down... browser', typeof browser)
},
'CoreUI Vue e2e tests': function (browser) {
// automatically uses dev Server port from /config.index.js
// default: http://localhost:8080
// see nightwatch.conf.js
// const devServer = browser.globals.devServerURL
const devServer = process.env.VUE_DEV_SERVER_URL
browser.url(devServer).pause(500).expect.element('body').to.be.present
browser.waitForElementVisible('.app', 10000)
.assert.elementPresent('.app-header')
.assert.elementPresent('.app-header > .navbar-brand')
.assert.elementPresent('.app-body')
.assert.elementPresent('.app-body > .main > .breadcrumb')
.assert.elementPresent('.app-body > .main > .container-fluid > .animated')
.assert.elementPresent('.app-body > .sidebar > .sidebar-nav')
.assert.elementPresent('.app-body > .sidebar > .sidebar-minimizer')
.assert.elementPresent('.app-footer')
.assert.containsText('.app-footer > div > span', 'creativeLabs')
.assert.containsText('.app-footer > div.ml-auto > span', 'Powered by')
.assert.elementCount('button', 10)
.resizeWindow(1024, 800)
.pause(500)
.assert.cssClassNotPresent('body', 'aside-menu-show')
.assert.cssClassNotPresent('body', 'aside-menu-lg-show')
browser.click('body > div > header > button.d-none.d-lg-block.navbar-toggler', function (response) {
console.log('response', typeof response)
this.assert.ok(browser === this, 'Check if the context is right.')
this.assert.cssClassPresent('body', 'aside-menu-lg-show')
})
browser.pause(500)
browser.click('body > div > header > button.d-none.d-lg-block.navbar-toggler', function (response) {
console.log('response', typeof response)
this.assert.cssClassNotPresent('body', 'aside-menu-lg-show')
})
browser.pause(500)
browser
.useXpath()
.click('/html/body/div/header/button[2]', function (response) {
console.log('response', typeof response)
this.assert.cssClassNotPresent('/html/body', 'sidebar-lg-show')
})
browser
.pause(500)
.click('/html/body/div/header/button[2]', function (response) {
console.log('response', typeof response)
this.assert.cssClassPresent('/html/body', 'sidebar-lg-show')
})
browser
.pause(500)
.click('/html/body/div/div/div/button', function (response) {
console.log('response', typeof response)
this.assert.cssClassPresent('/html/body', 'sidebar-minimized')
this.assert.cssClassPresent('/html/body', 'brand-minimized')
this.assert.cssProperty("/html/body/div/div/main", "margin-left", "50px");
})
.pause(500)
.click('/html/body/div/div/div/button', function (response) {
console.log('response', typeof response)
this.assert.cssClassNotPresent('/html/body', 'sidebar-minimized')
this.assert.cssClassNotPresent('/html/body', 'brand-minimized')
})
browser
.resizeWindow(800, 600)
.pause(500)
browser
.pause(500)
.click('/html/body/div/header/button[1]', function (response) {
console.log('response', typeof response)
this.assert.cssClassPresent('/html/body', 'sidebar-show')
this.assert.cssProperty("/html/body/div/div/main", "margin-left", "200px");
})
browser
.pause(500)
.click('/html/body/div/div/div/nav/section/ul/li[1]/div/a', function (response) {
console.log('response', typeof response)
this.assert.cssClassNotPresent('/html/body', 'sidebar-show')
})
browser
.resizeWindow(500, 600)
.pause(500)
.click('/html/body/div/header/button[1]', function (response) {
console.log('response', typeof response)
this.assert.cssClassPresent('/html/body', 'sidebar-show')
this.assert.cssProperty("/html/body/div/div/main", "margin-left", "0px");
})
browser
.pause(5000)
.end()
}
}