@seleniumhq/code-export-csharp-xunit 4.0.13 → 4.1.0-beta.2

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,4 +1,4 @@
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
  "{
@@ -61,7 +61,7 @@ exports[`command code emitter should emit \`assert not editable\` command 1`] =
61
61
  exports[`command code emitter should emit \`assert not selected value\` command 1`] = `
62
62
  "{
63
63
  String value = driver.FindElement(By.Id(\\"select\\")).GetAttribute(\\"value\\");
64
- Assert.NotEqual(value, test);
64
+ Assert.NotEqual(value, \\"test\\");
65
65
  }"
66
66
  `;
67
67
 
@@ -87,7 +87,7 @@ exports[`command code emitter should emit \`assert value\` command 1`] = `
87
87
  }"
88
88
  `;
89
89
 
90
- exports[`command code emitter should emit \`assert\` command 1`] = `"Assert.Equal(vars[\\"varrrName\\"].ToString(), \\"blah\\");"`;
90
+ exports[`command code emitter should emit \`assert\` command 1`] = `"Assert.Equal(Convert.ToString(vars[\\"varrrName\\"]), \\"blah\\");"`;
91
91
 
92
92
  exports[`command code emitter should emit \`verify checked\` command 1`] = `"Assert.True(driver.FindElement(By.Id(\\"check\\")).Selected);"`;
93
93
 
@@ -126,7 +126,7 @@ exports[`command code emitter should emit \`verify not editable\` command 1`] =
126
126
  exports[`command code emitter should emit \`verify not selected value\` command 1`] = `
127
127
  "{
128
128
  String value = driver.FindElement(By.Id(\\"select\\")).GetAttribute(\\"value\\");
129
- Assert.NotEqual(value, test);
129
+ Assert.NotEqual(value, \\"test\\");
130
130
  }"
131
131
  `;
132
132
 
@@ -145,9 +145,9 @@ exports[`command code emitter should emit \`verify title\` command 1`] = `"Asser
145
145
 
146
146
  exports[`command code emitter should emit \`verify value\` command 1`] = `
147
147
  "{
148
- string value = driver.FindElement(By.Id(\\"select\\")).GetAttribute(\\"value\\");
149
- Assert.That(value, Is.EqualTo(\\"test\\"));
148
+ String value = driver.FindElement(By.Id(\\"select\\")).GetAttribute(\\"value\\");
149
+ Assert.Equal(value, \\"test\\");
150
150
  }"
151
151
  `;
152
152
 
153
- exports[`command code emitter should emit \`verify\` command 1`] = `"Assert.Equal(vars[\\"varrrName\\"].ToString(), \\"blah\\");"`;
153
+ exports[`command code emitter should emit \`verify\` command 1`] = `"Assert.Equal(Convert.ToString(vars[\\"varrrName\\"]), \\"blah\\");"`;
@@ -1,4 +1,4 @@
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 C# xUnit should export a suite 1`] = `
4
4
  "// Generated by Selenium IDE
@@ -13,13 +13,13 @@ using OpenQA.Selenium.Remote;
13
13
  using OpenQA.Selenium.Support.UI;
14
14
  using OpenQA.Selenium.Interactions;
15
15
  using Xunit;
16
- namespace Login
17
- {
18
- public class SuiteTests : IDisposable {
16
+
17
+ public class LoginTests : IDisposable {
19
18
  public IWebDriver driver {get; private set;}
20
19
  public IDictionary<String, Object> vars {get; private set;}
21
20
  public IJavaScriptExecutor js {get; private set;}
22
- public SuiteTests()
21
+
22
+ public LoginTests()
23
23
  {
24
24
  driver = new ChromeDriver();
25
25
  js = (IJavaScriptExecutor)driver;
@@ -36,7 +36,7 @@ public class SuiteTests : IDisposable {
36
36
  driver.FindElement(By.Id(\\"username\\")).SendKeys(\\"tomsmith\\");
37
37
  driver.FindElement(By.Id(\\"password\\")).SendKeys(\\"SuperSecretPassword!\\");
38
38
  driver.FindElement(By.CssSelector(\\"#login button\\")).Click();
39
- Assert.Equal(driver.FindElement(By.CssSelector(\\".flash.success\\")).Text, \\"You logged into a secure area!\\\\\\\\\\\\\\\\n×\\");
39
+ Assert.Equal(driver.FindElement(By.CssSelector(\\".flash.success\\")).Text, \\"You logged into a secure area!\\\\\\\\n×\\");
40
40
  }
41
41
  [Fact]
42
42
  public void Invalidcredentials() {
@@ -45,10 +45,10 @@ public class SuiteTests : IDisposable {
45
45
  driver.FindElement(By.Id(\\"username\\")).SendKeys(\\"blah\\");
46
46
  driver.FindElement(By.Id(\\"password\\")).SendKeys(\\"blah\\");
47
47
  driver.FindElement(By.CssSelector(\\"#login button\\")).Click();
48
- Assert.Equal(driver.FindElement(By.Id(\\"flash\\")).Text, \\"Your username is invalid!\\\\\\\\\\\\\\\\n×\\");
48
+ Assert.Equal(driver.FindElement(By.Id(\\"flash\\")).Text, \\"Your username is invalid!\\\\\\\\n×\\");
49
49
  }
50
50
  }
51
- }"
51
+ "
52
52
  `;
53
53
 
54
54
  exports[`Code Export C# xUnit should export a suite that uses control flow commands 1`] = `
@@ -64,13 +64,13 @@ using OpenQA.Selenium.Remote;
64
64
  using OpenQA.Selenium.Support.UI;
65
65
  using OpenQA.Selenium.Interactions;
66
66
  using Xunit;
67
- namespace Controlflow
68
- {
69
- public class SuiteTests : IDisposable {
67
+
68
+ public class ControlflowTests : IDisposable {
70
69
  public IWebDriver driver {get; private set;}
71
70
  public IDictionary<String, Object> vars {get; private set;}
72
71
  public IJavaScriptExecutor js {get; private set;}
73
- public SuiteTests()
72
+
73
+ public ControlflowTests()
74
74
  {
75
75
  driver = new ChromeDriver();
76
76
  js = (IJavaScriptExecutor)driver;
@@ -90,7 +90,7 @@ public class SuiteTests : IDisposable {
90
90
  } else {
91
91
  vars[\\"output\\"] = js.ExecuteScript(\\"return 'c'\\");
92
92
  }
93
- Assert.Equal(vars[\\"output\\"].ToString(), \\"a\\");
93
+ Assert.Equal(Convert.ToString(vars[\\"output\\"]), \\"a\\");
94
94
  }
95
95
  [Fact]
96
96
  public void Controlflowelseif() {
@@ -102,7 +102,7 @@ public class SuiteTests : IDisposable {
102
102
  } else {
103
103
  vars[\\"output\\"] = js.ExecuteScript(\\"return 'c'\\");
104
104
  }
105
- Assert.Equal(vars[\\"output\\"].ToString(), \\"b\\");
105
+ Assert.Equal(Convert.ToString(vars[\\"output\\"]), \\"b\\");
106
106
  }
107
107
  [Fact]
108
108
  public void Controlflowelse() {
@@ -114,35 +114,40 @@ public class SuiteTests : IDisposable {
114
114
  } else {
115
115
  vars[\\"output\\"] = js.ExecuteScript(\\"return 'c'\\");
116
116
  }
117
- Assert.Equal(vars[\\"output\\"].ToString(), \\"c\\");
117
+ Assert.Equal(Convert.ToString(vars[\\"output\\"]), \\"c\\");
118
118
  }
119
119
  [Fact]
120
120
  public void Controlflowdo() {
121
121
  vars[\\"check\\"] = js.ExecuteScript(\\"return 1\\");
122
+ var loop1 = 0;
122
123
  do {
123
124
  vars[\\"check\\"] = js.ExecuteScript(\\"return arguments[0] + 1\\", vars[\\"check\\"]);
125
+ if (++loop1 > 1000) throw new Exception(\\"Max retry limit exceeded\\");
124
126
  } while ((Boolean) js.ExecuteScript(\\"return (arguments[0] < 3)\\", vars[\\"check\\"]));
125
- Assert.Equal(vars[\\"check\\"].ToString(), \\"3\\");
127
+ Assert.Equal(Convert.ToString(vars[\\"check\\"]), \\"3\\");
126
128
  }
127
129
  [Fact]
128
130
  public void Controlflowtimes() {
129
131
  vars[\\"check\\"] = js.ExecuteScript(\\"return 1\\");
130
- var times = 2;
131
- for(int i = 0; i < times; i++) {
132
+ var times1 = 2;
133
+ for (var loop1 = 0; loop1 < times1; loop1++) {
134
+ if (loop1 >= 1000) throw new Exception(\\"Max retry limit exceeded\\");
132
135
  vars[\\"check\\"] = js.ExecuteScript(\\"return arguments[0] + 1\\", vars[\\"check\\"]);
133
136
  }
134
- Assert.Equal(vars[\\"check\\"].ToString(), \\"3\\");
137
+ Assert.Equal(Convert.ToString(vars[\\"check\\"]), \\"3\\");
135
138
  }
136
139
  [Fact]
137
140
  public void Controlflowwhile() {
138
141
  vars[\\"check\\"] = js.ExecuteScript(\\"return 1\\");
142
+ var loop1 = 0;
139
143
  while ((Boolean) js.ExecuteScript(\\"return (arguments[0] < 3)\\", vars[\\"check\\"])) {
144
+ if (++loop1 > 1000) throw new Exception(\\"Max retry limit exceeded\\");
140
145
  vars[\\"check\\"] = js.ExecuteScript(\\"return arguments[0] + 1\\", vars[\\"check\\"]);
141
146
  }
142
- Assert.Equal(vars[\\"check\\"].ToString(), \\"3\\");
147
+ Assert.Equal(Convert.ToString(vars[\\"check\\"]), \\"3\\");
143
148
  }
144
149
  }
145
- }"
150
+ "
146
151
  `;
147
152
 
148
153
  exports[`Code Export C# xUnit should export a suite with a reused test method 1`] = `
@@ -158,13 +163,13 @@ using OpenQA.Selenium.Remote;
158
163
  using OpenQA.Selenium.Support.UI;
159
164
  using OpenQA.Selenium.Interactions;
160
165
  using Xunit;
161
- namespace Reusedmethods
162
- {
163
- public class SuiteTests : IDisposable {
166
+
167
+ public class ReusedmethodsTests : IDisposable {
164
168
  public IWebDriver driver {get; private set;}
165
169
  public IDictionary<String, Object> vars {get; private set;}
166
170
  public IJavaScriptExecutor js {get; private set;}
167
- public SuiteTests()
171
+
172
+ public ReusedmethodsTests()
168
173
  {
169
174
  driver = new ChromeDriver();
170
175
  js = (IJavaScriptExecutor)driver;
@@ -174,41 +179,42 @@ public class SuiteTests : IDisposable {
174
179
  {
175
180
  driver.Quit();
176
181
  }
177
- public void login()
182
+ public void run_login()
178
183
  {
179
184
  driver.Navigate().GoToUrl(\\"https://the-internet.herokuapp.com/\\");
180
185
  driver.FindElement(By.LinkText(\\"Form Authentication\\")).Click();
181
- driver.FindElement(By.Id(\\"username\\")).SendKeys(vars[\\"username\\"].ToString());
182
- driver.FindElement(By.Id(\\"password\\")).SendKeys(vars[\\"password\\"].ToString());
186
+ driver.FindElement(By.Id(\\"username\\")).SendKeys(Convert.ToString(vars[\\"username\\"]));
187
+ driver.FindElement(By.Id(\\"password\\")).SendKeys(Convert.ToString(vars[\\"password\\"]));
183
188
  if ((Boolean) js.ExecuteScript(\\"return (true)\\")) {
184
189
  driver.FindElement(By.CssSelector(\\".fa\\")).Click();
185
190
  }
186
191
  }
187
- public void tinymethod()
192
+ public void run_tinymethod()
188
193
  {
189
194
  vars[\\"value\\"] = \\"field\\";
190
195
  }
196
+
191
197
  [Fact]
192
198
  public void Invalidcredentials() {
193
199
  vars[\\"username\\"] = \\"blah\\";
194
200
  vars[\\"password\\"] = \\"blah\\";
195
- login();
201
+ run_login();
196
202
  }
197
203
  [Fact]
198
204
  public void Validcredentials() {
199
205
  vars[\\"username\\"] = \\"tomsmith\\";
200
206
  vars[\\"password\\"] = \\"SuperSecretPassword!\\";
201
- login();
207
+ run_login();
202
208
  }
203
209
  [Fact]
204
210
  public void Twomethods() {
205
211
  vars[\\"username\\"] = \\"blah\\";
206
212
  vars[\\"password\\"] = \\"blah\\";
207
- login();
208
- tinymethod();
213
+ run_login();
214
+ run_tinymethod();
209
215
  }
210
216
  }
211
- }"
217
+ "
212
218
  `;
213
219
 
214
220
  exports[`Code Export C# xUnit should export a suite with commands that open a new window inside of a reused test method 1`] = `
@@ -224,13 +230,13 @@ using OpenQA.Selenium.Remote;
224
230
  using OpenQA.Selenium.Support.UI;
225
231
  using OpenQA.Selenium.Interactions;
226
232
  using Xunit;
227
- namespace DefaultSuite
228
- {
229
- public class SuiteTests : IDisposable {
233
+
234
+ public class DefaultSuiteTests : IDisposable {
230
235
  public IWebDriver driver {get; private set;}
231
236
  public IDictionary<String, Object> vars {get; private set;}
232
237
  public IJavaScriptExecutor js {get; private set;}
233
- public SuiteTests()
238
+
239
+ public DefaultSuiteTests()
234
240
  {
235
241
  driver = new ChromeDriver();
236
242
  js = (IJavaScriptExecutor)driver;
@@ -254,21 +260,22 @@ public class SuiteTests : IDisposable {
254
260
  return whNow.First().ToString();
255
261
  }
256
262
  }
257
- public void selectwindow()
263
+ public void run_selectwindow()
258
264
  {
259
265
  driver.Navigate().GoToUrl(\\"http://the-internet.herokuapp.com/windows\\");
260
266
  vars[\\"WindowHandles\\"] = driver.WindowHandles;
261
267
  driver.FindElement(By.LinkText(\\"Click Here\\")).Click();
262
268
  vars[\\"win9425\\"] = waitForWindow(2000);
263
- driver.SwitchTo().Window(vars[\\"win9425\\"].ToString());
269
+ driver.SwitchTo().Window(Convert.ToString(vars[\\"win9425\\"]));
264
270
  Assert.Equal(driver.Title, \\"New Window\\");
265
271
  }
272
+
266
273
  [Fact]
267
274
  public void Reuse() {
268
- selectwindow();
275
+ run_selectwindow();
269
276
  }
270
277
  }
271
- }"
278
+ "
272
279
  `;
273
280
 
274
281
  exports[`Code Export C# xUnit should export a suite with just one new window util method when there are multiple commands that open a new window 1`] = `
@@ -284,13 +291,13 @@ using OpenQA.Selenium.Remote;
284
291
  using OpenQA.Selenium.Support.UI;
285
292
  using OpenQA.Selenium.Interactions;
286
293
  using Xunit;
287
- namespace DefaultSuite
288
- {
289
- public class SuiteTests : IDisposable {
294
+
295
+ public class DefaultSuiteTests : IDisposable {
290
296
  public IWebDriver driver {get; private set;}
291
297
  public IDictionary<String, Object> vars {get; private set;}
292
298
  public IJavaScriptExecutor js {get; private set;}
293
- public SuiteTests()
299
+
300
+ public DefaultSuiteTests()
294
301
  {
295
302
  driver = new ChromeDriver();
296
303
  js = (IJavaScriptExecutor)driver;
@@ -314,18 +321,19 @@ public class SuiteTests : IDisposable {
314
321
  return whNow.First().ToString();
315
322
  }
316
323
  }
317
- public void selectwindow()
324
+ public void run_selectwindow()
318
325
  {
319
326
  driver.Navigate().GoToUrl(\\"http://the-internet.herokuapp.com/windows\\");
320
327
  vars[\\"WindowHandles\\"] = driver.WindowHandles;
321
328
  driver.FindElement(By.LinkText(\\"Click Here\\")).Click();
322
329
  vars[\\"win9425\\"] = waitForWindow(2000);
323
- driver.SwitchTo().Window(vars[\\"win9425\\"].ToString());
330
+ driver.SwitchTo().Window(Convert.ToString(vars[\\"win9425\\"]));
324
331
  Assert.Equal(driver.Title, \\"New Window\\");
325
332
  }
333
+
326
334
  [Fact]
327
335
  public void Reuse() {
328
- selectwindow();
336
+ run_selectwindow();
329
337
  }
330
338
  [Fact]
331
339
  public void Selectwindow() {
@@ -333,11 +341,11 @@ public class SuiteTests : IDisposable {
333
341
  vars[\\"WindowHandles\\"] = driver.WindowHandles;
334
342
  driver.FindElement(By.LinkText(\\"Click Here\\")).Click();
335
343
  vars[\\"win9425\\"] = waitForWindow(2000);
336
- driver.SwitchTo().Window(vars[\\"win9425\\"].ToString());
344
+ driver.SwitchTo().Window(Convert.ToString(vars[\\"win9425\\"]));
337
345
  Assert.Equal(driver.Title, \\"New Window\\");
338
346
  }
339
347
  }
340
- }"
348
+ "
341
349
  `;
342
350
 
343
351
  exports[`Code Export C# xUnit should export a test 1`] = `
@@ -353,11 +361,13 @@ using OpenQA.Selenium.Remote;
353
361
  using OpenQA.Selenium.Support.UI;
354
362
  using OpenQA.Selenium.Interactions;
355
363
  using Xunit;
356
- public class SuiteTests : IDisposable {
364
+
365
+ public class LoginTests : IDisposable {
357
366
  public IWebDriver driver {get; private set;}
358
367
  public IDictionary<String, Object> vars {get; private set;}
359
368
  public IJavaScriptExecutor js {get; private set;}
360
- public SuiteTests()
369
+
370
+ public LoginTests()
361
371
  {
362
372
  driver = new ChromeDriver();
363
373
  js = (IJavaScriptExecutor)driver;
@@ -374,7 +384,7 @@ public class SuiteTests : IDisposable {
374
384
  driver.FindElement(By.Id(\\"username\\")).SendKeys(\\"tomsmith\\");
375
385
  driver.FindElement(By.Id(\\"password\\")).SendKeys(\\"SuperSecretPassword!\\");
376
386
  driver.FindElement(By.CssSelector(\\"#login button\\")).Click();
377
- Assert.Equal(driver.FindElement(By.CssSelector(\\".flash.success\\")).Text, \\"You logged into a secure area!\\\\\\\\\\\\\\\\n×\\");
387
+ Assert.Equal(driver.FindElement(By.CssSelector(\\".flash.success\\")).Text, \\"You logged into a secure area!\\\\\\\\n×\\");
378
388
  }
379
389
  }
380
390
  "
@@ -393,11 +403,13 @@ using OpenQA.Selenium.Remote;
393
403
  using OpenQA.Selenium.Support.UI;
394
404
  using OpenQA.Selenium.Interactions;
395
405
  using Xunit;
396
- public class SuiteTests : IDisposable {
406
+
407
+ public class ValidcredentialsTests : IDisposable {
397
408
  public IWebDriver driver {get; private set;}
398
409
  public IDictionary<String, Object> vars {get; private set;}
399
410
  public IJavaScriptExecutor js {get; private set;}
400
- public SuiteTests()
411
+
412
+ public ValidcredentialsTests()
401
413
  {
402
414
  driver = new ChromeDriver();
403
415
  js = (IJavaScriptExecutor)driver;
@@ -407,21 +419,22 @@ public class SuiteTests : IDisposable {
407
419
  {
408
420
  driver.Quit();
409
421
  }
410
- public void login()
422
+ public void run_login()
411
423
  {
412
424
  driver.Navigate().GoToUrl(\\"https://the-internet.herokuapp.com/\\");
413
425
  driver.FindElement(By.LinkText(\\"Form Authentication\\")).Click();
414
- driver.FindElement(By.Id(\\"username\\")).SendKeys(vars[\\"username\\"].ToString());
415
- driver.FindElement(By.Id(\\"password\\")).SendKeys(vars[\\"password\\"].ToString());
426
+ driver.FindElement(By.Id(\\"username\\")).SendKeys(Convert.ToString(vars[\\"username\\"]));
427
+ driver.FindElement(By.Id(\\"password\\")).SendKeys(Convert.ToString(vars[\\"password\\"]));
416
428
  if ((Boolean) js.ExecuteScript(\\"return (true)\\")) {
417
429
  driver.FindElement(By.CssSelector(\\".fa\\")).Click();
418
430
  }
419
431
  }
432
+
420
433
  [Fact]
421
434
  public void Validcredentials() {
422
435
  vars[\\"username\\"] = \\"tomsmith\\";
423
436
  vars[\\"password\\"] = \\"SuperSecretPassword!\\";
424
- login();
437
+ run_login();
425
438
  }
426
439
  }
427
440
  "
@@ -440,11 +453,13 @@ using OpenQA.Selenium.Remote;
440
453
  using OpenQA.Selenium.Support.UI;
441
454
  using OpenQA.Selenium.Interactions;
442
455
  using Xunit;
443
- public class SuiteTests : IDisposable {
456
+
457
+ public class SelectwindowTests : IDisposable {
444
458
  public IWebDriver driver {get; private set;}
445
459
  public IDictionary<String, Object> vars {get; private set;}
446
460
  public IJavaScriptExecutor js {get; private set;}
447
- public SuiteTests()
461
+
462
+ public SelectwindowTests()
448
463
  {
449
464
  driver = new ChromeDriver();
450
465
  js = (IJavaScriptExecutor)driver;
@@ -468,6 +483,7 @@ public class SuiteTests : IDisposable {
468
483
  return whNow.First().ToString();
469
484
  }
470
485
  }
486
+
471
487
  [Fact]
472
488
  public void Selectwindow() {
473
489
  driver.Navigate().GoToUrl(\\"http://the-internet.herokuapp.com/\\");
@@ -477,9 +493,9 @@ public class SuiteTests : IDisposable {
477
493
  driver.FindElement(By.LinkText(\\"Click Here\\")).Click();
478
494
  vars[\\"win9625\\"] = waitForWindow(2000);
479
495
  vars[\\"root\\"] = driver.CurrentWindowHandle;
480
- driver.SwitchTo().Window(vars[\\"win9625\\"].ToString());
496
+ driver.SwitchTo().Window(Convert.ToString(vars[\\"win9625\\"]));
481
497
  Assert.Equal(driver.Title, \\"New Window\\");
482
- driver.SwitchTo().Window(vars[\\"root\\"].ToString());
498
+ driver.SwitchTo().Window(Convert.ToString(vars[\\"root\\"]));
483
499
  Assert.Equal(driver.Title, \\"The Internet\\");
484
500
  }
485
501
  }
@@ -499,11 +515,13 @@ using OpenQA.Selenium.Remote;
499
515
  using OpenQA.Selenium.Support.UI;
500
516
  using OpenQA.Selenium.Interactions;
501
517
  using Xunit;
502
- public class SuiteTests : IDisposable {
518
+
519
+ public class LoginTests : IDisposable {
503
520
  public IWebDriver driver {get; private set;}
504
521
  public IDictionary<String, Object> vars {get; private set;}
505
522
  public IJavaScriptExecutor js {get; private set;}
506
- public SuiteTests()
523
+
524
+ public LoginTests()
507
525
  {
508
526
  driver = new RemoteWebDriver(new Uri(\\"http://localhost:4444/wd/hub\\"), new FirefoxOptions().ToCapabilities());
509
527
  js = (IJavaScriptExecutor)driver;
@@ -520,7 +538,7 @@ public class SuiteTests : IDisposable {
520
538
  driver.FindElement(By.Id(\\"username\\")).SendKeys(\\"tomsmith\\");
521
539
  driver.FindElement(By.Id(\\"password\\")).SendKeys(\\"SuperSecretPassword!\\");
522
540
  driver.FindElement(By.CssSelector(\\"#login button\\")).Click();
523
- Assert.Equal(driver.FindElement(By.CssSelector(\\".flash.success\\")).Text, \\"You logged into a secure area!\\\\\\\\\\\\\\\\n×\\");
541
+ Assert.Equal(driver.FindElement(By.CssSelector(\\".flash.success\\")).Text, \\"You logged into a secure area!\\\\\\\\n×\\");
524
542
  }
525
543
  }
526
544
  "
@@ -16,9 +16,9 @@
16
16
  // under the License.
17
17
 
18
18
  import Command from '../../src/command'
19
- import { Commands } from '../../../selenium-ide/src/neo/models/Command'
19
+ import { Commands } from '@seleniumhq/side-model'
20
20
  import { opts } from '../../src/index'
21
- import { codeExport as exporter } from '@seleniumhq/side-code-export'
21
+ import { codeExport as exporter } from 'side-code-export'
22
22
 
23
23
  const commandPrefixPadding = opts.commandPrefixPadding
24
24
 
@@ -31,22 +31,11 @@ async function prettify(command, { fullPayload } = {}) {
31
31
  }
32
32
 
33
33
  describe('command code emitter', () => {
34
- it.skip('should emit all known commands', () => {
35
- let result = []
36
- Commands.array.forEach(command => {
37
- if (!Command.canEmit(command)) {
38
- result.push(command)
39
- }
40
- })
41
- expect(() => {
42
- if (result.length) {
43
- if (result.length === 1) {
44
- throw new Error(`${result[0]} has no emitter, write one!`)
45
- } else {
46
- throw new Error(`No emitters for ${result.join(', ')}. Write them!`)
47
- }
48
- }
49
- }).not.toThrow()
34
+ it('should have an emitter for every command', () => {
35
+ const missing = Object.keys(Commands).filter(
36
+ (command) => !Command.emitters[command]
37
+ )
38
+ expect(missing).toEqual([])
50
39
  })
51
40
  it('should emit `assert` command', () => {
52
41
  const command = {
@@ -17,14 +17,8 @@
17
17
 
18
18
  import fs from 'fs'
19
19
  import path from 'path'
20
- import codeExport, {
21
- emitTest,
22
- emitSuite,
23
- _emitMethod,
24
- _findTestByName,
25
- } from '../../src'
20
+ import languageExport from '../../src'
26
21
  import Command from '../../src/command'
27
- import { project as projectProcessor } from '@seleniumhq/side-code-export'
28
22
 
29
23
  function readFile(filename) {
30
24
  return JSON.parse(
@@ -43,110 +37,92 @@ function readFile(filename) {
43
37
  )
44
38
  }
45
39
 
40
+ const options = (project) => ({
41
+ project,
42
+ tests: project.tests,
43
+ enableOriginTracing: false,
44
+ enableDescriptionAsComment: false,
45
+ beforeEachOptions: {},
46
+ })
47
+
46
48
  describe('Code Export C# xUnit', () => {
47
49
  it('should export a test', async () => {
48
50
  const project = readFile('single-test.side')
49
- const results = await emitTest({
50
- baseUrl: project.url,
51
+ const results = await languageExport.emit.test({
52
+ ...options(project),
51
53
  test: project.tests[0],
52
- tests: project.tests,
53
54
  })
54
- expect(results.body).toBeDefined()
55
55
  expect(results.body).toMatchSnapshot()
56
56
  })
57
57
  it('should export a test with grid execution', async () => {
58
58
  const project = readFile('single-test.side')
59
- const results = await emitTest({
60
- baseUrl: project.url,
59
+ const results = await languageExport.emit.test({
60
+ ...options(project),
61
61
  test: project.tests[0],
62
- tests: project.tests,
63
62
  beforeEachOptions: {
64
63
  browserName: 'Firefox',
65
64
  gridUrl: 'http://localhost:4444/wd/hub',
66
65
  },
67
66
  })
68
- expect(results.body).toBeDefined()
69
67
  expect(results.body).toMatchSnapshot()
70
68
  })
71
69
  it('should export a suite', async () => {
72
- const project = normalizeProject(readFile('single-suite.side'))
73
- const results = await emitSuite({
74
- baseUrl: project.url,
70
+ const project = readFile('single-suite.side')
71
+ const results = await languageExport.emit.suite({
72
+ ...options(project),
75
73
  suite: project.suites[0],
76
- tests: project.tests,
77
74
  })
78
- expect(results.body).toBeDefined()
79
75
  expect(results.body).toMatchSnapshot()
80
76
  })
81
77
  it('should export a test with a reused test method', async () => {
82
- const project = normalizeProject(readFile('test-case-reuse.side'))
83
- const results = await emitTest({
84
- baseUrl: project.url,
78
+ const project = readFile('test-case-reuse.side')
79
+ const results = await languageExport.emit.test({
80
+ ...options(project),
85
81
  test: project.tests[1],
86
- tests: project.tests,
87
- })
88
- expect(results.body).toBeDefined()
89
- expect(results.body).toMatchSnapshot()
90
- })
91
- it('should export a test with commands that open a new window', async () => {
92
- const project = normalizeProject(readFile('select-window.side'))
93
- const results = await emitTest({
94
- baseUrl: project.url,
95
- test: project.tests[0],
96
- tests: project.tests,
97
82
  })
98
- expect(results.body).toBeDefined()
99
83
  expect(results.body).toMatchSnapshot()
100
84
  })
101
85
  it('should export a suite with a reused test method', async () => {
102
- const project = normalizeProject(readFile('test-case-reuse.side'))
103
- const results = await emitSuite({
104
- baseUrl: project.url,
86
+ const project = readFile('test-case-reuse.side')
87
+ const results = await languageExport.emit.suite({
88
+ ...options(project),
105
89
  suite: project.suites[0],
106
- tests: project.tests,
107
90
  })
108
- expect(results.body).toBeDefined()
109
91
  expect(results.body).toMatchSnapshot()
110
92
  })
111
93
  it('should export a suite that uses control flow commands', async () => {
112
- const project = normalizeProject(readFile('control-flow-suite.side'))
113
- const results = await emitSuite({
114
- baseUrl: project.url,
94
+ const project = readFile('control-flow-suite.side')
95
+ const results = await languageExport.emit.suite({
96
+ ...options(project),
115
97
  suite: project.suites[0],
116
- tests: project.tests,
117
98
  })
118
- expect(results.body).toBeDefined()
99
+ expect(results.body).toMatchSnapshot()
100
+ })
101
+ it('should export a test with commands that open a new window', async () => {
102
+ const project = readFile('select-window.side')
103
+ const results = await languageExport.emit.test({
104
+ ...options(project),
105
+ test: project.tests[0],
106
+ })
119
107
  expect(results.body).toMatchSnapshot()
120
108
  })
121
109
  it('should export a suite with commands that open a new window inside of a reused test method', async () => {
122
- const project = normalizeProject(readFile('nested-select-window.side'))
123
- const results = await emitSuite({
124
- baseUrl: project.url,
110
+ const project = readFile('nested-select-window.side')
111
+ const results = await languageExport.emit.suite({
112
+ ...options(project),
125
113
  suite: project.suites[0],
126
- tests: project.tests,
127
114
  })
128
- expect(results.body).toBeDefined()
129
115
  expect(results.body).toMatchSnapshot()
130
116
  })
131
117
  it('should export a suite with just one new window util method when there are multiple commands that open a new window', async () => {
132
- const project = normalizeProject(readFile('nested-select-window-v2.side'))
133
- const results = await emitSuite({
134
- baseUrl: project.url,
118
+ const project = readFile('nested-select-window-v2.side')
119
+ const results = await languageExport.emit.suite({
120
+ ...options(project),
135
121
  suite: project.suites[0],
136
- tests: project.tests,
137
122
  })
138
- expect(results.body).toBeDefined()
139
123
  expect(results.body).toMatchSnapshot()
140
124
  })
141
125
  it('should export the command emitter', () => {
142
- expect(Command.emit).toStrictEqual(codeExport.emit.command)
126
+ expect(languageExport.emit.command).toBe(Command.emit)
143
127
  })
144
128
  })
145
-
146
- function normalizeProject(project) {
147
- let _project = { ...project }
148
- _project.suites.forEach(suite => {
149
- projectProcessor.normalizeTestsInSuite({ suite, tests: _project.tests })
150
- })
151
- return _project
152
- }