@seleniumhq/code-export-csharp-nunit 4.0.12 → 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.
- package/__test__/src/__snapshots__/command.spec.js.snap +53 -29
- package/__test__/src/__snapshots__/index.spec.js.snap +62 -34
- package/__test__/src/command.spec.js +66 -59
- package/__test__/src/index.spec.js +40 -64
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/jest.config.js +14 -0
- package/package.json +7 -3
- package/src/index.ts +5 -2
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -16,12 +16,10 @@
|
|
|
16
16
|
// under the License.
|
|
17
17
|
|
|
18
18
|
import Command from '../../src/command'
|
|
19
|
-
import {
|
|
20
|
-
|
|
21
|
-
ControlFlowCommandNames,
|
|
22
|
-
} from '../../../selenium-ide/src/neo/models/Command'
|
|
19
|
+
import { Commands } from '@seleniumhq/side-model'
|
|
20
|
+
import { ControlFlowCommandNames } from '@seleniumhq/side-runtime/dist/playback-tree/commands'
|
|
23
21
|
import { opts } from '../../src/index'
|
|
24
|
-
import { codeExport as exporter } from '
|
|
22
|
+
import { codeExport as exporter } from 'side-code-export'
|
|
25
23
|
|
|
26
24
|
const commandPrefixPadding = opts.commandPrefixPadding
|
|
27
25
|
|
|
@@ -34,22 +32,17 @@ async function prettify(command, { fullPayload } = {}) {
|
|
|
34
32
|
}
|
|
35
33
|
|
|
36
34
|
describe('command code emitter', () => {
|
|
37
|
-
it
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
} else {
|
|
49
|
-
throw new Error(`No emitters for ${result.join(', ')}. Write them!`)
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}).not.toThrow()
|
|
35
|
+
it('should have an emitter for every command', () => {
|
|
36
|
+
const missing = Object.keys(Commands).filter(
|
|
37
|
+
(command) => !Command.emitters[command]
|
|
38
|
+
)
|
|
39
|
+
expect(missing).toEqual([])
|
|
40
|
+
})
|
|
41
|
+
it('should not escape backticks in values', async () => {
|
|
42
|
+
const command = { command: 'type', target: 'id=a', value: "it's `ok`" }
|
|
43
|
+
expect(await Command.emit(command, opts)).toBe(
|
|
44
|
+
'driver.FindElement(By.Id("a")).SendKeys("it\\\'s `ok`");'
|
|
45
|
+
)
|
|
53
46
|
})
|
|
54
47
|
it('should emit `add selection` command', () => {
|
|
55
48
|
const command = {
|
|
@@ -375,14 +368,6 @@ describe('command code emitter', () => {
|
|
|
375
368
|
}
|
|
376
369
|
return expect(prettify(command)).resolves.toMatchSnapshot()
|
|
377
370
|
})
|
|
378
|
-
it.skip('should emit `mouse move` event', () => {
|
|
379
|
-
const command = {
|
|
380
|
-
command: 'mouseMove',
|
|
381
|
-
target: 'id=button',
|
|
382
|
-
value: '',
|
|
383
|
-
}
|
|
384
|
-
return expect(prettify(command)).resolves.toMatchSnapshot()
|
|
385
|
-
})
|
|
386
371
|
it('should emit `mouse move at` event', () => {
|
|
387
372
|
const command = {
|
|
388
373
|
command: 'mouseMoveAt',
|
|
@@ -463,6 +448,14 @@ describe('command code emitter', () => {
|
|
|
463
448
|
}
|
|
464
449
|
return expect(prettify(command)).resolves.toMatchSnapshot()
|
|
465
450
|
})
|
|
451
|
+
it('should emit `run` command for a test with a capitalized name', () => {
|
|
452
|
+
const command = { command: 'run', target: 'Some Test Case', value: '' }
|
|
453
|
+
return expect(prettify(command)).resolves.toMatchSnapshot()
|
|
454
|
+
})
|
|
455
|
+
it('should emit a comment for `run` with a test name from a variable', async () => {
|
|
456
|
+
const command = { command: 'run', target: '${testName}', value: '' }
|
|
457
|
+
expect(await Command.emit(command, opts)).toMatchSnapshot()
|
|
458
|
+
})
|
|
466
459
|
it('should emit `run script` command', () => {
|
|
467
460
|
const command = {
|
|
468
461
|
command: 'runScript',
|
|
@@ -565,22 +558,6 @@ describe('command code emitter', () => {
|
|
|
565
558
|
}
|
|
566
559
|
return expect(prettify(command)).resolves.toMatchSnapshot()
|
|
567
560
|
})
|
|
568
|
-
it('should skip playback supported commands, that are not supported in webdriver', () => {
|
|
569
|
-
return Promise.all([
|
|
570
|
-
expect(
|
|
571
|
-
prettify({ command: 'answerOnNextPrompt', target: 'blah' })
|
|
572
|
-
).resolves.toMatchSnapshot(),
|
|
573
|
-
expect(
|
|
574
|
-
prettify({ command: 'chooseCancelOnNextConfirmation' })
|
|
575
|
-
).resolves.toMatchSnapshot(),
|
|
576
|
-
expect(
|
|
577
|
-
prettify({ command: 'chooseCancelOnNextPrompt' })
|
|
578
|
-
).resolves.toMatchSnapshot(),
|
|
579
|
-
expect(
|
|
580
|
-
prettify({ command: 'chooseOkOnNextConfirmation' })
|
|
581
|
-
).resolves.toMatchSnapshot(),
|
|
582
|
-
])
|
|
583
|
-
})
|
|
584
561
|
it('should emit `store` command', () => {
|
|
585
562
|
const command = {
|
|
586
563
|
command: 'store',
|
|
@@ -613,6 +590,18 @@ describe('command code emitter', () => {
|
|
|
613
590
|
}
|
|
614
591
|
return expect(prettify(command)).resolves.toMatchSnapshot()
|
|
615
592
|
})
|
|
593
|
+
it('should escape the variable name of `store json`', () => {
|
|
594
|
+
const command = {
|
|
595
|
+
command: 'storeJson',
|
|
596
|
+
target: '{"a":0}',
|
|
597
|
+
value: 'x"); System.exit(1); //',
|
|
598
|
+
}
|
|
599
|
+
return expect(prettify(command)).resolves.toMatchSnapshot()
|
|
600
|
+
})
|
|
601
|
+
it('should store a json array as a list', () => {
|
|
602
|
+
const command = { command: 'storeJson', target: '[1, 2]', value: 'list' }
|
|
603
|
+
return expect(prettify(command)).resolves.toMatchSnapshot()
|
|
604
|
+
})
|
|
616
605
|
it('should emit `store title` command', () => {
|
|
617
606
|
const command = {
|
|
618
607
|
command: 'storeTitle',
|
|
@@ -637,26 +626,28 @@ describe('command code emitter', () => {
|
|
|
637
626
|
}
|
|
638
627
|
return expect(prettify(command)).resolves.toMatchSnapshot()
|
|
639
628
|
})
|
|
640
|
-
it('should emit `store
|
|
629
|
+
it('should emit `store element count` command', () => {
|
|
641
630
|
const command = {
|
|
642
|
-
command: '
|
|
631
|
+
command: 'storeElementCount',
|
|
643
632
|
target: 'xpath=button',
|
|
644
633
|
value: 'myVar',
|
|
645
634
|
}
|
|
646
635
|
return expect(prettify(command)).resolves.toMatchSnapshot()
|
|
647
636
|
})
|
|
648
|
-
it('should emit `
|
|
637
|
+
it('should emit `times` command', () => {
|
|
649
638
|
const command = {
|
|
650
|
-
command:
|
|
651
|
-
target: '
|
|
639
|
+
command: ControlFlowCommandNames.times,
|
|
640
|
+
target: '5',
|
|
652
641
|
value: '',
|
|
653
642
|
}
|
|
654
|
-
return expect(
|
|
643
|
+
return expect(
|
|
644
|
+
prettify(command, { fullPayload: true })
|
|
645
|
+
).resolves.toMatchSnapshot()
|
|
655
646
|
})
|
|
656
|
-
it('should emit `times` command', () => {
|
|
647
|
+
it('should emit `times` command with a variable count', () => {
|
|
657
648
|
const command = {
|
|
658
649
|
command: ControlFlowCommandNames.times,
|
|
659
|
-
target: '
|
|
650
|
+
target: '${count}',
|
|
660
651
|
value: '',
|
|
661
652
|
}
|
|
662
653
|
return expect(
|
|
@@ -847,25 +838,41 @@ describe('command code emitter', () => {
|
|
|
847
838
|
}
|
|
848
839
|
return expect(prettify(command)).resolves.toMatchSnapshot()
|
|
849
840
|
})
|
|
850
|
-
it('should emit `answer
|
|
841
|
+
it('should emit `answer prompt` command', () => {
|
|
851
842
|
const command = {
|
|
852
|
-
command: '
|
|
843
|
+
command: 'answerPrompt',
|
|
853
844
|
target: 'an answer',
|
|
854
845
|
value: '',
|
|
855
846
|
}
|
|
856
847
|
return expect(prettify(command)).resolves.toMatchSnapshot()
|
|
857
848
|
})
|
|
858
|
-
it('should emit `
|
|
849
|
+
it('should emit `dismiss prompt` command', () => {
|
|
850
|
+
const command = {
|
|
851
|
+
command: 'dismissPrompt',
|
|
852
|
+
target: '',
|
|
853
|
+
value: '',
|
|
854
|
+
}
|
|
855
|
+
return expect(prettify(command)).resolves.toMatchSnapshot()
|
|
856
|
+
})
|
|
857
|
+
it('should emit `accept confirmation` command', () => {
|
|
858
|
+
const command = {
|
|
859
|
+
command: 'acceptConfirmation',
|
|
860
|
+
target: '',
|
|
861
|
+
value: '',
|
|
862
|
+
}
|
|
863
|
+
return expect(prettify(command)).resolves.toMatchSnapshot()
|
|
864
|
+
})
|
|
865
|
+
it('should emit `accept alert` command', () => {
|
|
859
866
|
const command = {
|
|
860
|
-
command: '
|
|
867
|
+
command: 'acceptAlert',
|
|
861
868
|
target: '',
|
|
862
869
|
value: '',
|
|
863
870
|
}
|
|
864
871
|
return expect(prettify(command)).resolves.toMatchSnapshot()
|
|
865
872
|
})
|
|
866
|
-
it('should emit `
|
|
873
|
+
it('should emit `dismiss confirmation` command', () => {
|
|
867
874
|
const command = {
|
|
868
|
-
command: '
|
|
875
|
+
command: 'dismissConfirmation',
|
|
869
876
|
target: '',
|
|
870
877
|
value: '',
|
|
871
878
|
}
|
|
@@ -17,14 +17,8 @@
|
|
|
17
17
|
|
|
18
18
|
import fs from 'fs'
|
|
19
19
|
import path from 'path'
|
|
20
|
-
import
|
|
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# NUnit', () => {
|
|
47
49
|
it('should export a test', async () => {
|
|
48
50
|
const project = readFile('single-test.side')
|
|
49
|
-
const results = await
|
|
50
|
-
|
|
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
|
|
60
|
-
|
|
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 =
|
|
73
|
-
const results = await
|
|
74
|
-
|
|
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 =
|
|
83
|
-
const results = await
|
|
84
|
-
|
|
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 =
|
|
103
|
-
const results = await
|
|
104
|
-
|
|
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 =
|
|
113
|
-
const results = await
|
|
114
|
-
|
|
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).
|
|
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 =
|
|
123
|
-
const results = await
|
|
124
|
-
|
|
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 =
|
|
133
|
-
const results = await
|
|
134
|
-
|
|
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(
|
|
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
|
-
}
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAiBA,OAAO,EAGL,mBAAmB,EAEpB,MAAM,kBAAkB,CAAA;AAMzB,eAAO,MAAM,WAAW,aAAa,CAAA;AAErC,eAAO,MAAM,IAAI,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAiBA,OAAO,EAGL,mBAAmB,EAEpB,MAAM,kBAAkB,CAAA;AAMzB,eAAO,MAAM,WAAW,aAAa,CAAA;AAErC,eAAO,MAAM,IAAI,EAAE,mBA8BlB,CAAA;;AAGD,wBAAoD"}
|
package/dist/index.js
CHANGED
|
@@ -35,11 +35,14 @@ exports.opts = {
|
|
|
35
35
|
commandPrefixPadding: ' ',
|
|
36
36
|
terminatingKeyword: '}',
|
|
37
37
|
commentPrefix: '//',
|
|
38
|
+
// A backslash before a backtick isn't a valid escape
|
|
39
|
+
escapedQuotes: `"'`,
|
|
38
40
|
generateFilename: (name) => {
|
|
39
41
|
return `${side_code_export_1.codeExport.parsers.capitalize(side_code_export_1.codeExport.parsers.sanitizeName(name))}Test${exports.opts.fileExtension}`;
|
|
40
42
|
},
|
|
41
43
|
generateMethodDeclaration: (name) => {
|
|
42
|
-
|
|
44
|
+
// run_ prefix: generated test names can't contain it, so they can't clash
|
|
45
|
+
return `public void run_${side_code_export_1.codeExport.parsers.sanitizeName(name)}() {`;
|
|
43
46
|
},
|
|
44
47
|
generateTestDeclaration: (name) => {
|
|
45
48
|
return `[Test]\npublic void ${side_code_export_1.codeExport.parsers.uncapitalize(side_code_export_1.codeExport.parsers.sanitizeName(name))}() {`;
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,+DAA+D;AAC/D,+DAA+D;AAC/D,wDAAwD;AACxD,6DAA6D;AAC7D,oDAAoD;AACpD,6DAA6D;AAC7D,6DAA6D;AAC7D,EAAE;AACF,+CAA+C;AAC/C,EAAE;AACF,6DAA6D;AAC7D,8DAA8D;AAC9D,yDAAyD;AACzD,4DAA4D;AAC5D,0DAA0D;AAC1D,qBAAqB;;;;;;AAErB,uDAKyB;AACzB,wDAA+B;AAC/B,uFAAiE;AACjE,kDAA0B;AAE1B,0BAA0B;AACb,QAAA,WAAW,GAAG,UAAU,CAAA;AAExB,QAAA,IAAI,GAAwB;IACvC,WAAW,EAAX,mBAAW;IACX,IAAI,EAAE,cAAc;IACpB,OAAO,EAAP,iBAAO;IACP,KAAK,EAAE,IAAA,gCAAa,EAAC,cAAK,CAAC;IAC3B,aAAa,EAAE,KAAK;IACpB,oBAAoB,EAAE,IAAI;IAC1B,kBAAkB,EAAE,GAAG;IACvB,aAAa,EAAE,IAAI;IACnB,gBAAgB,EAAE,CAAC,IAAI,EAAE,EAAE;QACzB,OAAO,GAAG,6BAAQ,CAAC,OAAO,CAAC,UAAU,CACnC,6BAAQ,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,CACpC,OAAO,YAAI,CAAC,aAAa,EAAE,CAAA;IAC9B,CAAC;IACD,yBAAyB,EAAE,CAAC,IAAI,EAAE,EAAE;QAClC,OAAO,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA,+DAA+D;AAC/D,+DAA+D;AAC/D,wDAAwD;AACxD,6DAA6D;AAC7D,oDAAoD;AACpD,6DAA6D;AAC7D,6DAA6D;AAC7D,EAAE;AACF,+CAA+C;AAC/C,EAAE;AACF,6DAA6D;AAC7D,8DAA8D;AAC9D,yDAAyD;AACzD,4DAA4D;AAC5D,0DAA0D;AAC1D,qBAAqB;;;;;;AAErB,uDAKyB;AACzB,wDAA+B;AAC/B,uFAAiE;AACjE,kDAA0B;AAE1B,0BAA0B;AACb,QAAA,WAAW,GAAG,UAAU,CAAA;AAExB,QAAA,IAAI,GAAwB;IACvC,WAAW,EAAX,mBAAW;IACX,IAAI,EAAE,cAAc;IACpB,OAAO,EAAP,iBAAO;IACP,KAAK,EAAE,IAAA,gCAAa,EAAC,cAAK,CAAC;IAC3B,aAAa,EAAE,KAAK;IACpB,oBAAoB,EAAE,IAAI;IAC1B,kBAAkB,EAAE,GAAG;IACvB,aAAa,EAAE,IAAI;IACnB,qDAAqD;IACrD,aAAa,EAAE,IAAI;IACnB,gBAAgB,EAAE,CAAC,IAAI,EAAE,EAAE;QACzB,OAAO,GAAG,6BAAQ,CAAC,OAAO,CAAC,UAAU,CACnC,6BAAQ,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,CACpC,OAAO,YAAI,CAAC,aAAa,EAAE,CAAA;IAC9B,CAAC;IACD,yBAAyB,EAAE,CAAC,IAAI,EAAE,EAAE;QAClC,0EAA0E;QAC1E,OAAO,mBAAmB,6BAAQ,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,MAAM,CAAA;IACrE,CAAC;IACD,uBAAuB,EAAE,CAAC,IAAI,EAAE,EAAE;QAChC,OAAO,uBAAuB,6BAAQ,CAAC,OAAO,CAAC,YAAY,CACzD,6BAAQ,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,CACpC,MAAM,CAAA;IACT,CAAC;IACD,wBAAwB,EAAE,CAAC,IAAI,EAAE,EAAE;QACjC,OAAO,+BAA+B,6BAAQ,CAAC,OAAO,CAAC,UAAU,CAC/D,6BAAQ,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,CAAC,CACpC,QAAQ,CAAA;IACX,CAAC;CACF,CAAA;AAED,sFAAsF;AACtF,kBAAe,IAAA,mCAAgB,EAAC,YAAI,EAAE,qCAAQ,CAAC,IAAI,CAAC,CAAA"}
|
package/jest.config.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
// The snapshots were written with the format from before Jest 29
|
|
3
|
+
snapshotFormat: { escapeString: true, printBasicPrototype: true },
|
|
4
|
+
testEnvironmentOptions: {
|
|
5
|
+
url: 'http://localhost/index.html',
|
|
6
|
+
},
|
|
7
|
+
testMatch: ['**/packages/**/__test?(s)__/**/*.spec.[jt]s?(x)'],
|
|
8
|
+
testPathIgnorePatterns: ['/node_modules/', '/dist/'],
|
|
9
|
+
transform: {
|
|
10
|
+
// Find the repo's babel.config.js from the package folder
|
|
11
|
+
'^.+\\.jsx?$': ['babel-jest', { rootMode: 'upward' }],
|
|
12
|
+
'^.+\\.ts?$': 'ts-jest',
|
|
13
|
+
},
|
|
14
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seleniumhq/code-export-csharp-nunit",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.1.0-beta.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Export Selenium IDE project contents to C# NUnit",
|
|
6
6
|
"repository": "https://github.com/SeleniumHQ/selenium-ide",
|
|
@@ -12,9 +12,13 @@
|
|
|
12
12
|
"license": "Apache-2.0",
|
|
13
13
|
"main": "dist/index.js",
|
|
14
14
|
"types": "dist/index.d.ts",
|
|
15
|
+
"devDependencies": {
|
|
16
|
+
"@seleniumhq/side-runtime": "4.1.0-beta.1",
|
|
17
|
+
"@seleniumhq/side-model": "4.1.0-beta.1"
|
|
18
|
+
},
|
|
15
19
|
"dependencies": {
|
|
16
|
-
"@seleniumhq/code-export-csharp-commons": "4.0.
|
|
17
|
-
"side-code-export": "
|
|
20
|
+
"@seleniumhq/code-export-csharp-commons": "4.1.0-beta.1",
|
|
21
|
+
"side-code-export": "4.1.0-beta.1"
|
|
18
22
|
},
|
|
19
23
|
"gitHead": "f58e327e7616e23a3e926e4b80cf9952164e5744",
|
|
20
24
|
"scripts": {
|
package/src/index.ts
CHANGED
|
@@ -37,13 +37,16 @@ export const opts: LanguageEmitterOpts = {
|
|
|
37
37
|
commandPrefixPadding: ' ',
|
|
38
38
|
terminatingKeyword: '}',
|
|
39
39
|
commentPrefix: '//',
|
|
40
|
+
// A backslash before a backtick isn't a valid escape
|
|
41
|
+
escapedQuotes: `"'`,
|
|
40
42
|
generateFilename: (name) => {
|
|
41
43
|
return `${exporter.parsers.capitalize(
|
|
42
44
|
exporter.parsers.sanitizeName(name)
|
|
43
45
|
)}Test${opts.fileExtension}`
|
|
44
46
|
},
|
|
45
47
|
generateMethodDeclaration: (name) => {
|
|
46
|
-
|
|
48
|
+
// run_ prefix: generated test names can't contain it, so they can't clash
|
|
49
|
+
return `public void run_${exporter.parsers.sanitizeName(name)}() {`
|
|
47
50
|
},
|
|
48
51
|
generateTestDeclaration: (name) => {
|
|
49
52
|
return `[Test]\npublic void ${exporter.parsers.uncapitalize(
|
|
@@ -58,4 +61,4 @@ export const opts: LanguageEmitterOpts = {
|
|
|
58
61
|
}
|
|
59
62
|
|
|
60
63
|
// Emit an individual test, wrapped in a suite (using the test name as the suite name)
|
|
61
|
-
export default languageFromOpts(opts, location.emit)
|
|
64
|
+
export default languageFromOpts(opts, location.emit)
|