-
Notifications
You must be signed in to change notification settings - Fork 1.1k
/
Copy pathgeneralSettings.test.ts
212 lines (197 loc) · 9.78 KB
/
generalSettings.test.ts
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
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
'use strict'
import { NightwatchBrowser } from 'nightwatch'
import init from '../helpers/init'
module.exports = {
before: function (browser: NightwatchBrowser, done: VoidFunction) {
init(browser, done, 'http://127.0.0.1:8080', false)
},
'Should display settings menu ': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('*[data-id="remixIdeIconPanel"]', 10000)
.click('*[data-id="landingPageStartSolidity"]')
.waitForElementVisible('*[data-id="verticalIconsKindsettings"]', 5000)
.click('*[data-id="verticalIconsKindsettings"]')
.waitForElementContainsText('h6[data-id="sidePanelSwapitTitle"]', 'SETTINGS')
},
'Should activate `generate contract metadata` ': function (browser) {
browser.waitForElementVisible('*[data-id="remixIdeSidePanel"]', 5000)
.waitForElementVisible('*[data-id="settingsTabGenerateContractMetadataLabel"]', 5000)
.verify.elementPresent('[data-id="settingsTabGenerateContractMetadata"]:checked')
.click('*[data-id="verticalIconsKindfilePanel"]')
.click('[data-id="treeViewLitreeViewItemcontracts"]')
.openFile('contracts/3_Ballot.sol')
.click('*[data-id="verticalIconsKindsolidity"]')
.pause(2000)
.click('*[data-id="compilerContainerCompileBtn"]')
.pause(3000)
.click('*[data-id="verticalIconsKindfilePanel"]')
.openFile('contracts/artifacts/Ballot.json')
.openFile('contracts/artifacts/Ballot_metadata.json')
.getEditorValue((content) => {
const metadata = JSON.parse(content)
browser.assert.equal(metadata.language, 'Solidity')
})
},
'Should add new github access token ': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('*[data-id="verticalIconsKindsettings"]', 5000)
.click('*[data-id="verticalIconsKindsettings"]')
.setValue('*[data-id="settingsTabGistAccessToken"]', '**********')
.click('*[data-id="settingsTabSaveGistToken"]')
.waitForElementVisible('*[data-shared="tooltipPopup"]', 5000)
.assert.containsText('*[data-shared="tooltipPopup"]', 'Credentials updated')
.pause(3000)
},
'Should copy github access token to clipboard ': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('*[data-id="verticalIconsKindsettings"]', 5000)
.click('*[data-id="copyToClipboardCopyIcon"]')
.waitForElementVisible('*[data-shared="tooltipPopup"]', 5000)
// .waitForElementVisible('*[data-shared="tooltipPopup"]:nth-last-of-type(1) , 5000)
// .assert.containsText('*[data-shared="tooltipPopup"]', 'Copied value to clipboard.')
// .assert.containsText('*[data-shared="tooltipPopup"]:nth-last-of-type(1)', 'Copied value to clipboard.')
},
'Should remove github access token ': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('*[data-id="verticalIconsKindsettings"]', 5000)
.pause(1000)
.click('*[data-id="settingsTabRemoveGistToken"]')
.waitForElementVisible('*[data-shared="tooltipPopup"]', 5000)
.assert.containsText('*[data-shared="tooltipPopup"]', 'Credentials removed')
.assert.containsText('*[data-id="settingsTabGistAccessToken"]', '')
},
'Should load dark theme ': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('*[data-id="verticalIconsKindsettings"]', 5000)
.scrollAndClick('*[data-id="settingsTabThemeLabelDark"]')
.pause(2000)
.checkElementStyle(':root', '--primary', remixIdeThemes.dark.primary)
.checkElementStyle(':root', '--secondary', remixIdeThemes.dark.secondary)
.checkElementStyle(':root', '--success', remixIdeThemes.dark.success)
.checkElementStyle(':root', '--info', remixIdeThemes.dark.info)
.checkElementStyle(':root', '--warning', remixIdeThemes.dark.warning)
.checkElementStyle(':root', '--danger', remixIdeThemes.dark.danger)
},
'Should load light theme ': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('*[data-id="verticalIconsKindsettings"]', 5000)
.scrollAndClick('*[data-id="settingsTabThemeLabelLight"]')
.pause(2000)
.checkElementStyle(':root', '--primary', remixIdeThemes.light.primary)
.checkElementStyle(':root', '--secondary', remixIdeThemes.light.secondary)
.checkElementStyle(':root', '--success', remixIdeThemes.light.success)
.checkElementStyle(':root', '--info', remixIdeThemes.light.info)
.checkElementStyle(':root', '--warning', remixIdeThemes.light.warning)
.checkElementStyle(':root', '--danger', remixIdeThemes.light.danger)
},
'Should load Cerulean theme ': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('*[data-id="verticalIconsKindsettings"]', 5000)
.scrollAndClick('*[data-id="settingsTabThemeLabelCerulean"]')
.pause(5000)
.checkElementStyle(':root', '--primary', remixIdeThemes.cerulean.primary)
.checkElementStyle(':root', '--secondary', remixIdeThemes.cerulean.secondary)
.checkElementStyle(':root', '--success', remixIdeThemes.cerulean.success)
.checkElementStyle(':root', '--info', remixIdeThemes.cerulean.info)
.checkElementStyle(':root', '--warning', remixIdeThemes.cerulean.warning)
.checkElementStyle(':root', '--danger', remixIdeThemes.cerulean.danger)
},
'Should load Flatly theme ': function (browser: NightwatchBrowser) {
browser.waitForElementVisible('*[data-id="verticalIconsKindsettings"]', 5000)
.scrollAndClick('*[data-id="settingsTabThemeLabelFlatly"]')
.pause(2000)
.checkElementStyle(':root', '--primary', remixIdeThemes.flatly.primary)
.checkElementStyle(':root', '--secondary', remixIdeThemes.flatly.secondary)
.checkElementStyle(':root', '--success', remixIdeThemes.flatly.success)
.checkElementStyle(':root', '--info', remixIdeThemes.flatly.info)
.checkElementStyle(':root', '--warning', remixIdeThemes.flatly.warning)
.checkElementStyle(':root', '--danger', remixIdeThemes.flatly.danger)
},
'Should load Spacelab theme ': function (browser) {
browser.waitForElementVisible('*[data-id="verticalIconsKindsettings"]', 5000)
.scrollAndClick('*[data-id="settingsTabThemeLabelSpacelab"]')
.pause(2000)
.checkElementStyle(':root', '--primary', remixIdeThemes.spacelab.primary)
.checkElementStyle(':root', '--secondary', remixIdeThemes.spacelab.secondary)
.checkElementStyle(':root', '--success', remixIdeThemes.spacelab.success)
.checkElementStyle(':root', '--info', remixIdeThemes.spacelab.info)
.checkElementStyle(':root', '--warning', remixIdeThemes.spacelab.warning)
.checkElementStyle(':root', '--danger', remixIdeThemes.spacelab.danger)
},
'Should load Cyborg theme ': function (browser) {
browser.waitForElementVisible('*[data-id="verticalIconsKindsettings"]', 5000)
.scrollAndClick('*[data-id="settingsTabThemeLabelCyborg"]')
.pause(2000)
.checkElementStyle(':root', '--primary', remixIdeThemes.cyborg.primary)
.checkElementStyle(':root', '--secondary', remixIdeThemes.cyborg.secondary)
.checkElementStyle(':root', '--success', remixIdeThemes.cyborg.success)
.checkElementStyle(':root', '--info', remixIdeThemes.cyborg.info)
.checkElementStyle(':root', '--warning', remixIdeThemes.cyborg.warning)
.checkElementStyle(':root', '--danger', remixIdeThemes.cyborg.danger)
},
'Should load zh locale ': function (browser) {
browser.waitForElementVisible('*[data-id="verticalIconsKindsettings"]', 5000)
.scrollAndClick('*[data-id="settingsTabLocaleLabelzh"]')
.pause(2000)
.assert.containsText('*[data-id="sidePanelSwapitTitle"]', '设置')
.assert.containsText('*[data-id="listenNetworkCheckInput"]', '监听所有交易')
.assert.containsText('*[data-id="settingsTabGenerateContractMetadataLabel"]', '生成合约元数据')
.assert.containsText('*[data-id="settingsAutoCompleteLabel"]', '在编辑器中启用代码自动补全')
.assert.containsText('*[data-id="settingsShowGasLabel"]', '在编辑器中展示 gas 预算')
.assert.containsText('*[data-id="displayErrorsLabel"]', '编辑代码时展示错误提示')
},
'Should load en locale ': function (browser) {
browser.waitForElementVisible('*[data-id="verticalIconsKindsettings"]', 5000)
.scrollAndClick('*[data-id="settingsTabLocaleLabelen"]')
.pause(2000)
.assert.containsText('*[data-id="sidePanelSwapitTitle"]', 'SETTINGS')
.assert.containsText('*[data-id="listenNetworkCheckInput"]', 'Listen on all transactions')
.assert.containsText('*[data-id="settingsTabGenerateContractMetadataLabel"]', 'Generate contract metadata')
.assert.containsText('*[data-id="settingsAutoCompleteLabel"]', 'Enable code completion in editor')
.assert.containsText('*[data-id="settingsShowGasLabel"]', 'Display gas estimates in editor')
.assert.containsText('*[data-id="displayErrorsLabel"]', 'Display errors in editor while typing')
}
}
const remixIdeThemes = {
dark: {
primary: '#007aa6',
secondary: '#595c76',
success: '#32ba89',
info: '#086CB5',
warning: '#c97539',
danger: '#b84040'
},
light: {
primary: '#007aa6',
secondary: '#b3bcc483',
success: '#32ba89',
info: '#007aa6',
warning: '#c97539',
danger: '#b84040'
},
cerulean: {
primary: '#2FA4E7',
secondary: '#e9ecef',
success: '#73A839',
info: '#033C73',
warning: '#DD5600',
danger: '#C71C22'
},
flatly: {
primary: '#2C3E50',
secondary: '#dadfe0',
success: '#18BC9C',
info: '#3498DB',
warning: '#F39C12',
danger: '#E74C3C'
},
spacelab: {
primary: '#446E9B',
secondary: '#dadfe0',
success: '#3CB521',
info: '#3399F3',
warning: '#D47500',
danger: '#CD0200'
},
cyborg: {
primary: '#2A9FD6',
secondary: '#3c3939',
success: '#77B300',
info: '#93C',
warning: '#F80',
danger: '#C00'
}
}