@seleniumhq/code-export-javascript-mocha 4.0.13 → 4.1.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,11 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
1
+ // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
2
2
 
3
3
  exports[`command code emitter should emit 'assert selected label' command 1`] = `
4
4
  "{
5
5
  const element = await driver.findElement(By.id(\\"test\\"))
6
6
  const locator = \`option[@value='\${await element.getAttribute(\\"value\\")}']\`
7
7
  const selectedText = await element.findElement(By.xpath(locator)).getText()
8
- assert(selectedText == \\"test\\")
8
+ assert.equal(selectedText, \\"test\\")
9
9
  }"
10
10
  `;
11
11
 
@@ -14,10 +14,14 @@ exports[`command code emitter should emit 'verify selected label' command 1`] =
14
14
  const element = await driver.findElement(By.id(\\"test\\"))
15
15
  const locator = \`option[@value='\${await element.getAttribute(\\"value\\")}']\`
16
16
  const selectedText = await element.findElement(By.xpath(locator)).getText()
17
- assert(selectedText == \\"test\\")
17
+ assert.equal(selectedText, \\"test\\")
18
18
  }"
19
19
  `;
20
20
 
21
+ exports[`command code emitter should emit \`accept alert\` command 1`] = `"await driver.switchTo().alert().accept()"`;
22
+
23
+ exports[`command code emitter should emit \`accept confirmation\` command 1`] = `"await driver.switchTo().alert().accept()"`;
24
+
21
25
  exports[`command code emitter should emit \`add selection\` command 1`] = `
22
26
  "{
23
27
  const dropdown = await driver.findElement(By.css(\\"select\\"))
@@ -25,7 +29,7 @@ exports[`command code emitter should emit \`add selection\` command 1`] = `
25
29
  }"
26
30
  `;
27
31
 
28
- exports[`command code emitter should emit \`answer on visible prompt\` command 1`] = `
32
+ exports[`command code emitter should emit \`answer prompt\` command 1`] = `
29
33
  "{
30
34
  const alert = await driver.switchTo().alert()
31
35
  await alert.sendKeys(\\"an answer\\")
@@ -72,14 +76,14 @@ exports[`command code emitter should emit \`assert not editable\` command 1`] =
72
76
  exports[`command code emitter should emit \`assert not selected value\` command 1`] = `
73
77
  "{
74
78
  const value = await driver.findElement(By.id(\\"select\\")).getAttribute(\\"value\\")
75
- assert(value !== \\"test\\")
79
+ assert.equal(value, \\"test\\")
76
80
  }"
77
81
  `;
78
82
 
79
83
  exports[`command code emitter should emit \`assert not text\` command 1`] = `
80
84
  "{
81
85
  const text = await driver.findElement(By.id(\\"test\\")).getText()
82
- assert(text !== \\"text\\")
86
+ assert.notEqual(text, \\"text\\")
83
87
  }"
84
88
  `;
85
89
 
@@ -88,18 +92,18 @@ exports[`command code emitter should emit \`assert prompt\` command 1`] = `"asse
88
92
  exports[`command code emitter should emit \`assert selected value\` command 1`] = `
89
93
  "{
90
94
  const value = await driver.findElement(By.id(\\"select\\")).getAttribute(\\"value\\")
91
- assert(value == \\"test\\")
95
+ assert.equal(value, \\"test\\")
92
96
  }"
93
97
  `;
94
98
 
95
- exports[`command code emitter should emit \`assert text\` command 1`] = `"assert(await driver.findElement(By.id(\\"test\\")).getText() == \\"some text that should be here\\")"`;
99
+ exports[`command code emitter should emit \`assert text\` command 1`] = `"assert.equal(await driver.findElement(By.id(\\"test\\")).getText(), \\"some text that should be here\\")"`;
96
100
 
97
101
  exports[`command code emitter should emit \`assert title\` command 1`] = `"assert(await driver.getTitle() == \\"example title\\")"`;
98
102
 
99
103
  exports[`command code emitter should emit \`assert value\` command 1`] = `
100
104
  "{
101
105
  const value = await driver.findElement(By.id(\\"select\\")).getAttribute(\\"value\\")
102
- assert(value == \\"test\\")
106
+ assert.equal(value, \\"test\\")
103
107
  }"
104
108
  `;
105
109
 
@@ -112,19 +116,20 @@ exports[`command code emitter should emit \`check\` command 1`] = `
112
116
  }"
113
117
  `;
114
118
 
115
- exports[`command code emitter should emit \`choose cancel on visible prompt\` command 1`] = `"await driver.switchTo().alert().dismiss()"`;
116
-
117
- exports[`command code emitter should emit \`choose ok on visible confirmation\` command 1`] = `"await driver.switchTo().alert().accept()"`;
118
-
119
119
  exports[`command code emitter should emit \`click at\` command 1`] = `"await driver.findElement(By.linkText(\\"button\\")).click()"`;
120
120
 
121
121
  exports[`command code emitter should emit \`click\` command 1`] = `"await driver.findElement(By.linkText(\\"button\\")).click()"`;
122
122
 
123
123
  exports[`command code emitter should emit \`close\` command 1`] = `"await driver.close()"`;
124
124
 
125
+ exports[`command code emitter should emit \`dismiss confirmation\` command 1`] = `"await driver.switchTo().alert().dismiss()"`;
126
+
127
+ exports[`command code emitter should emit \`dismiss prompt\` command 1`] = `"await driver.switchTo().alert().dismiss()"`;
128
+
125
129
  exports[`command code emitter should emit \`do\` command 1`] = `
126
130
  Object {
127
- "body": "do {",
131
+ "body": "let loop1 = 0
132
+ do {",
128
133
  "endingLevel": 1,
129
134
  }
130
135
  `;
@@ -153,7 +158,7 @@ exports[`command code emitter should emit \`drag and drop to object\` command 1`
153
158
 
154
159
  exports[`command code emitter should emit \`echo\` command 1`] = `"console.log(\\"blah\\")"`;
155
160
 
156
- exports[`command code emitter should emit \`echo\` command with variables 1`] = `"console.log(vars[\\"blah\\"])"`;
161
+ exports[`command code emitter should emit \`echo\` command with variables 1`] = `"console.log(String(vars[\\"blah\\"]))"`;
157
162
 
158
163
  exports[`command code emitter should emit \`edit content\` command 1`] = `
159
164
  "{
@@ -226,13 +231,6 @@ exports[`command code emitter should emit \`mouse move at\` event 1`] = `
226
231
  }"
227
232
  `;
228
233
 
229
- exports[`command code emitter should emit \`mouse move\` event 1`] = `
230
- "{
231
- const element = await driver.findElement(By.id(\\"button\\"))
232
- await driver.actions({ bridge: true }).moveToElement(element).perform()
233
- }"
234
- `;
235
-
236
234
  exports[`command code emitter should emit \`mouse out\` event 1`] = `
237
235
  "{
238
236
  const element = await driver.findElement(By.CSS_SELECTOR, \\"body\\")
@@ -272,11 +270,16 @@ exports[`command code emitter should emit \`remove selection\` command 1`] = `
272
270
  }"
273
271
  `;
274
272
 
275
- exports[`command code emitter should emit \`repeatIf\` command 1`] = `"} while(!!await driver.executeScript(\\"return (true)\\"))"`;
273
+ exports[`command code emitter should emit \`repeatIf\` command 1`] = `
274
+ " if (++loop1 > 1000) throw new Error('Max retry limit exceeded')
275
+ } while(!!await driver.executeScript(\\"return (true)\\"))"
276
+ `;
276
277
 
277
278
  exports[`command code emitter should emit \`run script\` command 1`] = `"await driver.executeScript(\\"alert('test');alert('Im annoying');\\")"`;
278
279
 
279
- exports[`command code emitter should emit \`run\` command 1`] = `"sometestcase()"`;
280
+ exports[`command code emitter should emit \`run\` command 1`] = `"await sometestcase()"`;
281
+
282
+ exports[`command code emitter should emit \`run\` command for a test with a capitalized name 1`] = `"await someTestCase()"`;
280
283
 
281
284
  exports[`command code emitter should emit \`select frame\` to select the top frame 1`] = `"await driver.switchTo().defaultContent()"`;
282
285
 
@@ -299,7 +302,7 @@ exports[`command code emitter should emit \`send keys\` command 1`] = `"await dr
299
302
 
300
303
  exports[`command code emitter should emit \`send keys\` command with a key press 1`] = `"await driver.findElement(By.id(\\"input\\")).sendKeys(\\"SuperSecretPassword!\\", Key.ENTER)"`;
301
304
 
302
- exports[`command code emitter should emit \`send keys\` command with a variable input 1`] = `"await driver.findElement(By.id(\\"input\\")).sendKeys(vars[\\"blah\\"])"`;
305
+ exports[`command code emitter should emit \`send keys\` command with a variable input 1`] = `"await driver.findElement(By.id(\\"input\\")).sendKeys(String(vars[\\"blah\\"]))"`;
303
306
 
304
307
  exports[`command code emitter should emit \`set speed\` 1`] = `"console.log(\\"\`set speed\` is a no-op in code export, use \`pause\` instead\\")"`;
305
308
 
@@ -312,6 +315,8 @@ exports[`command code emitter should emit \`store attribute\` command 1`] = `
312
315
  }"
313
316
  `;
314
317
 
318
+ exports[`command code emitter should emit \`store element count\` command 1`] = `"vars[\\"myVar\\"] = await driver.findElements(By.xpath(\\"button\\")).length"`;
319
+
315
320
  exports[`command code emitter should emit \`store json\` command 1`] = `"vars[\\"myVar\\"] = JSON.parse('[{\\"a\\":0}]')"`;
316
321
 
317
322
  exports[`command code emitter should emit \`store text\` command 1`] = `"vars[\\"myVar\\"] = await driver.findElement(By.id(\\"someElement\\")).getText()"`;
@@ -322,15 +327,19 @@ exports[`command code emitter should emit \`store value\` command 1`] = `"vars[\
322
327
 
323
328
  exports[`command code emitter should emit \`store window handle\` command 1`] = `"vars[\\"windowName\\"] = await driver.getWindowHandle()"`;
324
329
 
325
- exports[`command code emitter should emit \`store xpath count\` command 1`] = `"vars[\\"myVar\\"] = await driver.findElements(By.xpath(\\"button\\")).length"`;
326
-
327
330
  exports[`command code emitter should emit \`store\` command 1`] = `"vars[\\"myVar\\"] = \\"some value\\""`;
328
331
 
329
- exports[`command code emitter should emit \`submit\` command 1`] = `"raise Exception(\\"\`submit\` is not a supported command in Selenium Webdriver. Please re-record the step in the IDE.\\")"`;
330
-
331
332
  exports[`command code emitter should emit \`times\` command 1`] = `
332
- "const times = 5
333
- for(let i = 0; i < times; i++) {"
333
+ "const times1 = 5
334
+ for (let loop1 = 0; loop1 < times1; loop1++) {
335
+ if (loop1 >= 1000) throw new Error('Max retry limit exceeded')"
336
+ `;
337
+
338
+ exports[`command code emitter should emit \`times\` command with a variable count 1`] = `
339
+ "const times1 = Math.floor(Number(vars[\\"count\\"]))
340
+ if (isNaN(times1)) throw new Error('Invalid number provided as a target.')
341
+ for (let loop1 = 0; loop1 < times1; loop1++) {
342
+ if (loop1 >= 1000) throw new Error('Max retry limit exceeded')"
334
343
  `;
335
344
 
336
345
  exports[`command code emitter should emit \`type\` command 1`] = `"await driver.findElement(By.id(\\"input\\")).sendKeys(\\"example input\\")"`;
@@ -377,32 +386,32 @@ exports[`command code emitter should emit \`verify not editable\` command 1`] =
377
386
  exports[`command code emitter should emit \`verify not selected value\` command 1`] = `
378
387
  "{
379
388
  const value = await driver.findElement(By.id(\\"select\\")).getAttribute(\\"value\\")
380
- assert(value !== \\"test\\")
389
+ assert.equal(value, \\"test\\")
381
390
  }"
382
391
  `;
383
392
 
384
393
  exports[`command code emitter should emit \`verify not text\` command 1`] = `
385
394
  "{
386
395
  const text = await driver.findElement(By.id(\\"test\\")).getText()
387
- assert(text !== \\"text\\")
396
+ assert.notEqual(text, \\"text\\")
388
397
  }"
389
398
  `;
390
399
 
391
400
  exports[`command code emitter should emit \`verify selected value\` command 1`] = `
392
401
  "{
393
402
  const value = await driver.findElement(By.id(\\"select\\")).getAttribute(\\"value\\")
394
- assert(value == \\"test\\")
403
+ assert.equal(value, \\"test\\")
395
404
  }"
396
405
  `;
397
406
 
398
- exports[`command code emitter should emit \`verify text\` command 1`] = `"assert(await driver.findElement(By.id(\\"test\\")).getText() == \\"some text that should be here\\")"`;
407
+ exports[`command code emitter should emit \`verify text\` command 1`] = `"assert.equal(await driver.findElement(By.id(\\"test\\")).getText(), \\"some text that should be here\\")"`;
399
408
 
400
409
  exports[`command code emitter should emit \`verify title\` command 1`] = `"assert(await driver.getTitle() == \\"example title\\")"`;
401
410
 
402
411
  exports[`command code emitter should emit \`verify value\` command 1`] = `
403
412
  "{
404
413
  const value = await driver.findElement(By.id(\\"select\\")).getAttribute(\\"value\\")
405
- assert(value == \\"test\\")
414
+ assert.equal(value, \\"test\\")
406
415
  }"
407
416
  `;
408
417
 
@@ -422,7 +431,13 @@ exports[`command code emitter should emit \`waitForElementVisible\` command 1`]
422
431
 
423
432
  exports[`command code emitter should emit \`waitForText\` command 1`] = `"await driver.wait(until.elementTextIs(await driver.findElement(By.css(\\"#blah\\")), 'text'), 30000)"`;
424
433
 
425
- exports[`command code emitter should emit \`while\` command 1`] = `"while(!!await driver.executeScript(\\"return (true)\\")) {"`;
434
+ exports[`command code emitter should emit \`while\` command 1`] = `
435
+ "let loop1 = 0
436
+ while(!!await driver.executeScript(\\"return (true)\\")) {
437
+ if (++loop1 > 1000) throw new Error('Max retry limit exceeded')"
438
+ `;
439
+
440
+ exports[`command code emitter should emit a comment for \`run\` with a test name from a variable 1`] = `"// Cannot export run with a test name from a variable: vars[\\"testName\\"]"`;
426
441
 
427
442
  exports[`command code emitter should emit new window handling, if command opens a new window 1`] = `
428
443
  "vars[\\"windowHandles\\"] = await driver.getAllWindowHandles()
@@ -1,14 +1,16 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
1
+ // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
2
2
 
3
3
  exports[`Code Export JavaScript Mocha should export a suite 1`] = `
4
4
  "// Generated by Selenium IDE
5
5
  const { Builder, By, Key, until } = require('selenium-webdriver')
6
6
  const assert = require('assert')
7
7
 
8
+
8
9
  describe('login', function() {
9
10
  this.timeout(30000)
10
11
  let driver
11
12
  let vars
13
+
12
14
  beforeEach(async function() {
13
15
  driver = await new Builder().forBrowser('chrome').build()
14
16
  vars = {}
@@ -22,7 +24,7 @@ describe('login', function() {
22
24
  await driver.findElement(By.id(\\"username\\")).sendKeys(\\"tomsmith\\")
23
25
  await driver.findElement(By.id(\\"password\\")).sendKeys(\\"SuperSecretPassword!\\")
24
26
  await driver.findElement(By.css(\\"#login button\\")).click()
25
- assert(await driver.findElement(By.css(\\".flash.success\\")).getText() == \\"You logged into a secure area!\\\\\\\\\\\\\\\\n×\\")
27
+ assert.equal(await driver.findElement(By.css(\\".flash.success\\")).getText(), \\"You logged into a secure area!\\\\\\\\n×\\")
26
28
  })
27
29
  it('invalid credentials', async function() {
28
30
  await driver.get(\\"http://the-internet.herokuapp.com/login\\")
@@ -30,7 +32,7 @@ describe('login', function() {
30
32
  await driver.findElement(By.id(\\"username\\")).sendKeys(\\"blah\\")
31
33
  await driver.findElement(By.id(\\"password\\")).sendKeys(\\"blah\\")
32
34
  await driver.findElement(By.css(\\"#login button\\")).click()
33
- assert(await driver.findElement(By.id(\\"flash\\")).getText() == \\"Your username is invalid!\\\\\\\\\\\\\\\\n×\\")
35
+ assert.equal(await driver.findElement(By.id(\\"flash\\")).getText(), \\"Your username is invalid!\\\\\\\\n×\\")
34
36
  })
35
37
  })
36
38
  "
@@ -41,10 +43,12 @@ exports[`Code Export JavaScript Mocha should export a suite that uses control fl
41
43
  const { Builder, By, Key, until } = require('selenium-webdriver')
42
44
  const assert = require('assert')
43
45
 
46
+
44
47
  describe('control flow', function() {
45
48
  this.timeout(30000)
46
49
  let driver
47
50
  let vars
51
+
48
52
  beforeEach(async function() {
49
53
  driver = await new Builder().forBrowser('chrome').build()
50
54
  vars = {}
@@ -87,22 +91,27 @@ describe('control flow', function() {
87
91
  })
88
92
  it('control flow do', async function() {
89
93
  vars[\\"check\\"] = await driver.executeScript(\\"return 1\\")
94
+ let loop1 = 0
90
95
  do {
91
96
  vars[\\"check\\"] = await driver.executeScript(\\"return arguments[0] + 1\\", vars[\\"check\\"])
97
+ if (++loop1 > 1000) throw new Error('Max retry limit exceeded')
92
98
  } while(!!await driver.executeScript(\\"return (arguments[0] < 3)\\", vars[\\"check\\"]))
93
99
  assert(vars[\\"check\\"].toString() == \\"3\\")
94
100
  })
95
101
  it('control flow times', async function() {
96
102
  vars[\\"check\\"] = await driver.executeScript(\\"return 1\\")
97
- const times = 2
98
- for(let i = 0; i < times; i++) {
103
+ const times1 = 2
104
+ for (let loop1 = 0; loop1 < times1; loop1++) {
105
+ if (loop1 >= 1000) throw new Error('Max retry limit exceeded')
99
106
  vars[\\"check\\"] = await driver.executeScript(\\"return arguments[0] + 1\\", vars[\\"check\\"])
100
107
  }
101
108
  assert(vars[\\"check\\"].toString() == \\"3\\")
102
109
  })
103
110
  it('control flow while', async function() {
104
111
  vars[\\"check\\"] = await driver.executeScript(\\"return 1\\")
112
+ let loop1 = 0
105
113
  while(!!await driver.executeScript(\\"return (arguments[0] < 3)\\", vars[\\"check\\"])) {
114
+ if (++loop1 > 1000) throw new Error('Max retry limit exceeded')
106
115
  vars[\\"check\\"] = await driver.executeScript(\\"return arguments[0] + 1\\", vars[\\"check\\"])
107
116
  }
108
117
  assert(vars[\\"check\\"].toString() == \\"3\\")
@@ -116,10 +125,12 @@ exports[`Code Export JavaScript Mocha should export a suite with a reused test m
116
125
  const { Builder, By, Key, until } = require('selenium-webdriver')
117
126
  const assert = require('assert')
118
127
 
128
+
119
129
  describe('Reused methods', function() {
120
130
  this.timeout(30000)
121
131
  let driver
122
132
  let vars
133
+
123
134
  beforeEach(async function() {
124
135
  driver = await new Builder().forBrowser('chrome').build()
125
136
  vars = {}
@@ -130,8 +141,8 @@ describe('Reused methods', function() {
130
141
  async function login() {
131
142
  await driver.get(\\"https://the-internet.herokuapp.com/\\")
132
143
  await driver.findElement(By.linkText(\\"Form Authentication\\")).click()
133
- await driver.findElement(By.id(\\"username\\")).sendKeys(vars[\\"username\\"])
134
- await driver.findElement(By.id(\\"password\\")).sendKeys(vars[\\"password\\"])
144
+ await driver.findElement(By.id(\\"username\\")).sendKeys(String(vars[\\"username\\"]))
145
+ await driver.findElement(By.id(\\"password\\")).sendKeys(String(vars[\\"password\\"]))
135
146
  if (!!await driver.executeScript(\\"return (true)\\")) {
136
147
  await driver.findElement(By.css(\\".fa\\")).click()
137
148
  }
@@ -139,21 +150,22 @@ describe('Reused methods', function() {
139
150
  async function tinymethod() {
140
151
  vars[\\"value\\"] = \\"field\\"
141
152
  }
153
+
142
154
  it('invalid credentials', async function() {
143
155
  vars[\\"username\\"] = \\"blah\\"
144
156
  vars[\\"password\\"] = \\"blah\\"
145
- login()
157
+ await login()
146
158
  })
147
159
  it('valid credentials', async function() {
148
160
  vars[\\"username\\"] = \\"tomsmith\\"
149
161
  vars[\\"password\\"] = \\"SuperSecretPassword!\\"
150
- login()
162
+ await login()
151
163
  })
152
164
  it('two methods', async function() {
153
165
  vars[\\"username\\"] = \\"blah\\"
154
166
  vars[\\"password\\"] = \\"blah\\"
155
- login()
156
- tinymethod()
167
+ await login()
168
+ await tinymethod()
157
169
  })
158
170
  })
159
171
  "
@@ -164,10 +176,12 @@ exports[`Code Export JavaScript Mocha should export a suite with commands that o
164
176
  const { Builder, By, Key, until } = require('selenium-webdriver')
165
177
  const assert = require('assert')
166
178
 
179
+
167
180
  describe('Default Suite', function() {
168
181
  this.timeout(30000)
169
182
  let driver
170
183
  let vars
184
+
171
185
  beforeEach(async function() {
172
186
  driver = await new Builder().forBrowser('chrome').build()
173
187
  vars = {}
@@ -192,8 +206,9 @@ describe('Default Suite', function() {
192
206
  await driver.switchTo().window(vars[\\"win9425\\"])
193
207
  assert(await driver.getTitle() == \\"New Window\\")
194
208
  }
209
+
195
210
  it('reuse', async function() {
196
- selectwindow()
211
+ await selectwindow()
197
212
  })
198
213
  })
199
214
  "
@@ -204,10 +219,12 @@ exports[`Code Export JavaScript Mocha should export a suite with just one new wi
204
219
  const { Builder, By, Key, until } = require('selenium-webdriver')
205
220
  const assert = require('assert')
206
221
 
222
+
207
223
  describe('Default Suite', function() {
208
224
  this.timeout(30000)
209
225
  let driver
210
226
  let vars
227
+
211
228
  beforeEach(async function() {
212
229
  driver = await new Builder().forBrowser('chrome').build()
213
230
  vars = {}
@@ -232,8 +249,9 @@ describe('Default Suite', function() {
232
249
  await driver.switchTo().window(vars[\\"win9425\\"])
233
250
  assert(await driver.getTitle() == \\"New Window\\")
234
251
  }
252
+
235
253
  it('reuse', async function() {
236
- selectwindow()
254
+ await selectwindow()
237
255
  })
238
256
  it('select window', async function() {
239
257
  await driver.get(\\"http://the-internet.herokuapp.com/windows\\")
@@ -252,10 +270,12 @@ exports[`Code Export JavaScript Mocha should export a test 1`] = `
252
270
  const { Builder, By, Key, until } = require('selenium-webdriver')
253
271
  const assert = require('assert')
254
272
 
273
+
255
274
  describe('login', function() {
256
275
  this.timeout(30000)
257
276
  let driver
258
277
  let vars
278
+
259
279
  beforeEach(async function() {
260
280
  driver = await new Builder().forBrowser('chrome').build()
261
281
  vars = {}
@@ -269,7 +289,7 @@ describe('login', function() {
269
289
  await driver.findElement(By.id(\\"username\\")).sendKeys(\\"tomsmith\\")
270
290
  await driver.findElement(By.id(\\"password\\")).sendKeys(\\"SuperSecretPassword!\\")
271
291
  await driver.findElement(By.css(\\"#login button\\")).click()
272
- assert(await driver.findElement(By.css(\\".flash.success\\")).getText() == \\"You logged into a secure area!\\\\\\\\\\\\\\\\n×\\")
292
+ assert.equal(await driver.findElement(By.css(\\".flash.success\\")).getText(), \\"You logged into a secure area!\\\\\\\\n×\\")
273
293
  })
274
294
  })
275
295
  "
@@ -280,10 +300,12 @@ exports[`Code Export JavaScript Mocha should export a test with a reused test me
280
300
  const { Builder, By, Key, until } = require('selenium-webdriver')
281
301
  const assert = require('assert')
282
302
 
303
+
283
304
  describe('valid credentials', function() {
284
305
  this.timeout(30000)
285
306
  let driver
286
307
  let vars
308
+
287
309
  beforeEach(async function() {
288
310
  driver = await new Builder().forBrowser('chrome').build()
289
311
  vars = {}
@@ -294,16 +316,17 @@ describe('valid credentials', function() {
294
316
  async function login() {
295
317
  await driver.get(\\"https://the-internet.herokuapp.com/\\")
296
318
  await driver.findElement(By.linkText(\\"Form Authentication\\")).click()
297
- await driver.findElement(By.id(\\"username\\")).sendKeys(vars[\\"username\\"])
298
- await driver.findElement(By.id(\\"password\\")).sendKeys(vars[\\"password\\"])
319
+ await driver.findElement(By.id(\\"username\\")).sendKeys(String(vars[\\"username\\"]))
320
+ await driver.findElement(By.id(\\"password\\")).sendKeys(String(vars[\\"password\\"]))
299
321
  if (!!await driver.executeScript(\\"return (true)\\")) {
300
322
  await driver.findElement(By.css(\\".fa\\")).click()
301
323
  }
302
324
  }
325
+
303
326
  it('valid credentials', async function() {
304
327
  vars[\\"username\\"] = \\"tomsmith\\"
305
328
  vars[\\"password\\"] = \\"SuperSecretPassword!\\"
306
- login()
329
+ await login()
307
330
  })
308
331
  })
309
332
  "
@@ -314,10 +337,12 @@ exports[`Code Export JavaScript Mocha should export a test with commands that op
314
337
  const { Builder, By, Key, until } = require('selenium-webdriver')
315
338
  const assert = require('assert')
316
339
 
340
+
317
341
  describe('select window', function() {
318
342
  this.timeout(30000)
319
343
  let driver
320
344
  let vars
345
+
321
346
  beforeEach(async function() {
322
347
  driver = await new Builder().forBrowser('chrome').build()
323
348
  vars = {}
@@ -334,6 +359,7 @@ describe('select window', function() {
334
359
  }
335
360
  throw new Error(\\"New window did not appear before timeout\\")
336
361
  }
362
+
337
363
  it('select window', async function() {
338
364
  await driver.get(\\"http://the-internet.herokuapp.com/\\")
339
365
  await driver.manage().window().setRect({ width: 1260, height: 1027 })
@@ -356,10 +382,12 @@ exports[`Code Export JavaScript Mocha should export a test with grid execution 1
356
382
  const { Builder, By, Key, until } = require('selenium-webdriver')
357
383
  const assert = require('assert')
358
384
 
385
+
359
386
  describe('login', function() {
360
387
  this.timeout(30000)
361
388
  let driver
362
389
  let vars
390
+
363
391
  beforeEach(async function() {
364
392
  driver = await new Builder().forBrowser('firefox').usingServer('http://localhost:4444/wd/hub').build()
365
393
  vars = {}
@@ -373,7 +401,7 @@ describe('login', function() {
373
401
  await driver.findElement(By.id(\\"username\\")).sendKeys(\\"tomsmith\\")
374
402
  await driver.findElement(By.id(\\"password\\")).sendKeys(\\"SuperSecretPassword!\\")
375
403
  await driver.findElement(By.css(\\"#login button\\")).click()
376
- assert(await driver.findElement(By.css(\\".flash.success\\")).getText() == \\"You logged into a secure area!\\\\\\\\\\\\\\\\n×\\")
404
+ assert.equal(await driver.findElement(By.css(\\".flash.success\\")).getText(), \\"You logged into a secure area!\\\\\\\\n×\\")
377
405
  })
378
406
  })
379
407
  "
@@ -1,3 +1,3 @@
1
- // Jest Snapshot v1, https://goo.gl/fbAQLP
1
+ // Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
2
2
 
3
3
  exports[`location code emitter should escape quotes in locator strings 1`] = `"By.css(\\"a[title=\\"escaped\\"]\\")"`;