@seleniumhq/code-export-python-pytest 3.17.2 → 4.0.0-alpha.0
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/LICENSE +202 -0
- package/__test__/src/command.spec.js +1 -1
- package/__test__/src/index.spec.js +2 -2
- package/dist/command.d.ts +25 -0
- package/dist/command.d.ts.map +1 -0
- package/dist/command.js +659 -778
- package/dist/command.js.map +1 -0
- package/dist/hook.d.ts +68 -0
- package/dist/hook.d.ts.map +1 -0
- package/dist/hook.js +103 -150
- package/dist/hook.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +117 -135
- package/dist/index.js.map +1 -0
- package/dist/location.d.ts +6 -0
- package/dist/location.d.ts.map +1 -0
- package/dist/location.js +22 -35
- package/dist/location.js.map +1 -0
- package/dist/selection.d.ts +6 -0
- package/dist/selection.d.ts.map +1 -0
- package/dist/selection.js +20 -32
- package/dist/selection.js.map +1 -0
- package/package.json +11 -12
- package/src/{command.js → command.ts} +98 -84
- package/src/{hook.js → hook.ts} +3 -13
- package/src/index.ts +147 -0
- package/src/{location.js → location.ts} +8 -8
- package/src/{selection.js → selection.ts} +6 -6
- package/tsconfig.json +18 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/.babelrc +0 -13
- package/src/index.js +0 -140
package/dist/index.js
CHANGED
|
@@ -1,138 +1,120 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
2
|
+
// Licensed to the Software Freedom Conservancy (SFC) under one
|
|
3
|
+
// or more contributor license agreements. See the NOTICE file
|
|
4
|
+
// distributed with this work for additional information
|
|
5
|
+
// regarding copyright ownership. The SFC licenses this file
|
|
6
|
+
// to you under the Apache License, Version 2.0 (the
|
|
7
|
+
// "License"); you may not use this file except in compliance
|
|
8
|
+
// with the License. You may obtain a copy of the License at
|
|
9
|
+
//
|
|
10
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
11
|
+
//
|
|
12
|
+
// Unless required by applicable law or agreed to in writing,
|
|
13
|
+
// software distributed under the License is distributed on an
|
|
14
|
+
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
15
|
+
// KIND, either express or implied. See the License for the
|
|
16
|
+
// specific language governing permissions and limitations
|
|
17
|
+
// under the License.
|
|
18
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
19
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
20
|
+
};
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.opts = exports.displayName = void 0;
|
|
23
|
+
const side_code_export_1 = require("@seleniumhq/side-code-export");
|
|
24
|
+
const command_1 = __importDefault(require("./command"));
|
|
25
|
+
const location_1 = __importDefault(require("./location"));
|
|
26
|
+
const hook_1 = __importDefault(require("./hook"));
|
|
24
27
|
// Define language options
|
|
25
|
-
|
|
26
|
-
exports.
|
|
27
|
-
|
|
28
|
-
exports.
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
function
|
|
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
|
-
body: _sideUtils.codeExport.emit.orderedSuite(_suite)
|
|
116
|
-
};
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
var _default = {
|
|
120
|
-
emit: {
|
|
121
|
-
test: emitTest,
|
|
122
|
-
suite: emitSuite,
|
|
123
|
-
locator: _location.default.emit,
|
|
124
|
-
command: _command.default.emit
|
|
125
|
-
},
|
|
126
|
-
register: {
|
|
127
|
-
command: _command.default.register,
|
|
128
|
-
variable: opts.hooks.declareVariables.register,
|
|
129
|
-
dependency: opts.hooks.declareDependencies.register,
|
|
130
|
-
beforeAll: opts.hooks.beforeAll.register,
|
|
131
|
-
beforeEach: opts.hooks.beforeEach.register,
|
|
132
|
-
afterEach: opts.hooks.afterEach.register,
|
|
133
|
-
afterAll: opts.hooks.afterAll.register,
|
|
134
|
-
inEachBegin: opts.hooks.inEachBegin.register,
|
|
135
|
-
inEachEnd: opts.hooks.inEachEnd.register
|
|
136
|
-
}
|
|
28
|
+
exports.displayName = 'Python pytest';
|
|
29
|
+
exports.opts = {
|
|
30
|
+
emitter: command_1.default,
|
|
31
|
+
displayName: exports.displayName,
|
|
32
|
+
name: 'python-pytest',
|
|
33
|
+
hooks: (0, side_code_export_1.generateHooks)(hook_1.default),
|
|
34
|
+
fileExtension: '.py',
|
|
35
|
+
commandPrefixPadding: ' ',
|
|
36
|
+
terminatingKeyword: '',
|
|
37
|
+
commentPrefix: '#',
|
|
38
|
+
// Create generators for dynamic string creation of primary entities (e.g., filename, methods, test, and suite)
|
|
39
|
+
generateTestDeclaration: function generateTestDeclaration(name) {
|
|
40
|
+
return `def test_${side_code_export_1.codeExport.parsers.uncapitalize(side_code_export_1.codeExport.parsers.sanitizeName(name))}(self):`;
|
|
41
|
+
},
|
|
42
|
+
generateMethodDeclaration: function generateMethodDeclaration(name) {
|
|
43
|
+
return `def ${side_code_export_1.codeExport.parsers.uncapitalize(side_code_export_1.codeExport.parsers.sanitizeName(name))}(self):`;
|
|
44
|
+
},
|
|
45
|
+
generateSuiteDeclaration: function generateSuiteDeclaration(name) {
|
|
46
|
+
return `class Test${side_code_export_1.codeExport.parsers.capitalize(side_code_export_1.codeExport.parsers.sanitizeName(name))}():`;
|
|
47
|
+
},
|
|
48
|
+
generateFilename: function generateFilename(name) {
|
|
49
|
+
return `test_${side_code_export_1.codeExport.parsers.uncapitalize(side_code_export_1.codeExport.parsers.sanitizeName(name))}${exports.opts.fileExtension}`;
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
const language = {
|
|
53
|
+
emit: {
|
|
54
|
+
locator: location_1.default.emit,
|
|
55
|
+
command: command_1.default.emit,
|
|
56
|
+
suite: async function emitSuite({ baseUrl, suite, tests, project, enableOriginTracing, beforeEachOptions, enableDescriptionAsComment, }) {
|
|
57
|
+
// @ts-expect-error globals yuck
|
|
58
|
+
global.baseUrl = baseUrl;
|
|
59
|
+
const result = await side_code_export_1.codeExport.emit.testsFromSuite(tests, suite, exports.opts, {
|
|
60
|
+
enableOriginTracing,
|
|
61
|
+
generateTestDeclaration: exports.opts.generateTestDeclaration,
|
|
62
|
+
enableDescriptionAsComment,
|
|
63
|
+
project,
|
|
64
|
+
});
|
|
65
|
+
const suiteDeclaration = exports.opts.generateSuiteDeclaration(suite.name);
|
|
66
|
+
const _suite = await side_code_export_1.codeExport.emit.suite(result, tests, {
|
|
67
|
+
...exports.opts,
|
|
68
|
+
suiteDeclaration,
|
|
69
|
+
suite,
|
|
70
|
+
suiteName: suite.name,
|
|
71
|
+
project,
|
|
72
|
+
beforeEachOptions,
|
|
73
|
+
});
|
|
74
|
+
return {
|
|
75
|
+
filename: exports.opts.generateFilename(suite.name),
|
|
76
|
+
body: side_code_export_1.codeExport.emit.orderedSuite(_suite),
|
|
77
|
+
};
|
|
78
|
+
},
|
|
79
|
+
// Emit an individual test, wrapped in a suite (using the test name as the suite name)
|
|
80
|
+
test: async function emitTest({ baseUrl, test, tests, project, enableOriginTracing, beforeEachOptions, enableDescriptionAsComment, }) {
|
|
81
|
+
// @ts-expect-error globals yuck
|
|
82
|
+
global.baseUrl = baseUrl;
|
|
83
|
+
const testDeclaration = exports.opts.generateTestDeclaration(test.name);
|
|
84
|
+
const result = await side_code_export_1.codeExport.emit.test(test, tests, {
|
|
85
|
+
...exports.opts,
|
|
86
|
+
testDeclaration,
|
|
87
|
+
enableOriginTracing,
|
|
88
|
+
enableDescriptionAsComment,
|
|
89
|
+
project,
|
|
90
|
+
});
|
|
91
|
+
const suiteName = test.name;
|
|
92
|
+
const suiteDeclaration = exports.opts.generateSuiteDeclaration(suiteName);
|
|
93
|
+
const _suite = await side_code_export_1.codeExport.emit.suite(result, tests, {
|
|
94
|
+
...exports.opts,
|
|
95
|
+
suiteDeclaration,
|
|
96
|
+
suiteName,
|
|
97
|
+
project,
|
|
98
|
+
beforeEachOptions,
|
|
99
|
+
});
|
|
100
|
+
return {
|
|
101
|
+
filename: exports.opts.generateFilename(test.name),
|
|
102
|
+
body: side_code_export_1.codeExport.emit.orderedSuite(_suite),
|
|
103
|
+
};
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
opts: exports.opts,
|
|
107
|
+
register: {
|
|
108
|
+
command: command_1.default.register,
|
|
109
|
+
variable: exports.opts.hooks.declareVariables.register,
|
|
110
|
+
dependency: exports.opts.hooks.declareDependencies.register,
|
|
111
|
+
beforeAll: exports.opts.hooks.beforeAll.register,
|
|
112
|
+
beforeEach: exports.opts.hooks.beforeEach.register,
|
|
113
|
+
afterEach: exports.opts.hooks.afterEach.register,
|
|
114
|
+
afterAll: exports.opts.hooks.afterAll.register,
|
|
115
|
+
inEachBegin: exports.opts.hooks.inEachBegin.register,
|
|
116
|
+
inEachEnd: exports.opts.hooks.inEachEnd.register,
|
|
117
|
+
},
|
|
137
118
|
};
|
|
138
|
-
exports.default =
|
|
119
|
+
exports.default = language;
|
|
120
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +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,mEAKqC;AACrC,wDAA+B;AAC/B,0DAAiC;AACjC,kDAA0B;AAE1B,0BAA0B;AACb,QAAA,WAAW,GAAG,eAAe,CAAA;AAE7B,QAAA,IAAI,GAAwB;IACvC,OAAO,EAAE,iBAAO;IAChB,WAAW,EAAX,mBAAW;IACX,IAAI,EAAE,eAAe;IACrB,KAAK,EAAE,IAAA,gCAAa,EAAC,cAAK,CAAC;IAC3B,aAAa,EAAE,KAAK;IACpB,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|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.emit = emit;
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
|
|
9
|
-
var _sideUtils = require("@seleniumhq/side-utils");
|
|
10
|
-
|
|
11
2
|
// Licensed to the Software Freedom Conservancy (SFC) under one
|
|
12
3
|
// or more contributor license agreements. See the NOTICE file
|
|
13
4
|
// distributed with this work for additional information
|
|
@@ -24,45 +15,41 @@ var _sideUtils = require("@seleniumhq/side-utils");
|
|
|
24
15
|
// KIND, either express or implied. See the License for the
|
|
25
16
|
// specific language governing permissions and limitations
|
|
26
17
|
// under the License.
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.emit = void 0;
|
|
20
|
+
const side_code_export_1 = require("@seleniumhq/side-code-export");
|
|
27
21
|
const emitters = {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
22
|
+
id: emitId,
|
|
23
|
+
name: emitName,
|
|
24
|
+
link: emitLink,
|
|
25
|
+
linkText: emitLink,
|
|
26
|
+
partialLinkText: emitPartialLinkText,
|
|
27
|
+
css: emitCss,
|
|
28
|
+
xpath: emitXpath,
|
|
35
29
|
};
|
|
36
|
-
|
|
37
30
|
function emit(location) {
|
|
38
|
-
|
|
31
|
+
return side_code_export_1.codeExport.emit.location(location, emitters);
|
|
39
32
|
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
33
|
+
exports.emit = emit;
|
|
34
|
+
exports.default = {
|
|
35
|
+
emit,
|
|
43
36
|
};
|
|
44
|
-
exports.default = _default;
|
|
45
|
-
|
|
46
37
|
function emitId(selector) {
|
|
47
|
-
|
|
38
|
+
return Promise.resolve(`By.ID, "${selector}"`);
|
|
48
39
|
}
|
|
49
|
-
|
|
50
40
|
function emitName(selector) {
|
|
51
|
-
|
|
41
|
+
return Promise.resolve(`By.NAME, "${selector}"`);
|
|
52
42
|
}
|
|
53
|
-
|
|
54
43
|
function emitLink(selector) {
|
|
55
|
-
|
|
44
|
+
return Promise.resolve(`By.LINK_TEXT, "${selector}"`);
|
|
56
45
|
}
|
|
57
|
-
|
|
58
46
|
function emitPartialLinkText(selector) {
|
|
59
|
-
|
|
47
|
+
return Promise.resolve(`By.PARTIAL_LINK_TEXT, "${selector}"`);
|
|
60
48
|
}
|
|
61
|
-
|
|
62
49
|
function emitCss(selector) {
|
|
63
|
-
|
|
50
|
+
return Promise.resolve(`By.CSS_SELECTOR, "${selector}"`);
|
|
64
51
|
}
|
|
65
|
-
|
|
66
52
|
function emitXpath(selector) {
|
|
67
|
-
|
|
68
|
-
}
|
|
53
|
+
return Promise.resolve(`By.XPATH, "${selector}"`);
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=location.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"location.js","sourceRoot":"","sources":["../src/location.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,mEAAqE;AAErE,MAAM,QAAQ,GAAG;IACf,EAAE,EAAE,MAAM;IACV,IAAI,EAAE,QAAQ;IACd,IAAI,EAAE,QAAQ;IACd,QAAQ,EAAE,QAAQ;IAClB,eAAe,EAAE,mBAAmB;IACpC,GAAG,EAAE,OAAO;IACZ,KAAK,EAAE,SAAS;CACjB,CAAA;AAED,SAAgB,IAAI,CAAC,QAAgB;IACnC,OAAO,6BAAQ,CAAC,IAAI,CAAC,QAAQ,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;AACnD,CAAC;AAFD,oBAEC;AAED,kBAAe;IACb,IAAI;CACL,CAAA;AAED,SAAS,MAAM,CAAC,QAAgB;IAC9B,OAAO,OAAO,CAAC,OAAO,CAAC,WAAW,QAAQ,GAAG,CAAC,CAAA;AAChD,CAAC;AAED,SAAS,QAAQ,CAAC,QAAgB;IAChC,OAAO,OAAO,CAAC,OAAO,CAAC,aAAa,QAAQ,GAAG,CAAC,CAAA;AAClD,CAAC;AAED,SAAS,QAAQ,CAAC,QAAgB;IAChC,OAAO,OAAO,CAAC,OAAO,CAAC,kBAAkB,QAAQ,GAAG,CAAC,CAAA;AACvD,CAAC;AAED,SAAS,mBAAmB,CAAC,QAAgB;IAC3C,OAAO,OAAO,CAAC,OAAO,CAAC,0BAA0B,QAAQ,GAAG,CAAC,CAAA;AAC/D,CAAC;AAED,SAAS,OAAO,CAAC,QAAgB;IAC/B,OAAO,OAAO,CAAC,OAAO,CAAC,qBAAqB,QAAQ,GAAG,CAAC,CAAA;AAC1D,CAAC;AAED,SAAS,SAAS,CAAC,QAAgB;IACjC,OAAO,OAAO,CAAC,OAAO,CAAC,cAAc,QAAQ,GAAG,CAAC,CAAA;AACnD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selection.d.ts","sourceRoot":"","sources":["../src/selection.ts"],"names":[],"mappings":"AA0BA,wBAAgB,IAAI,CAAC,QAAQ,EAAE,MAAM,mBAEpC;;;;AAED,wBAEC"}
|
package/dist/selection.js
CHANGED
|
@@ -1,13 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.emit = emit;
|
|
7
|
-
exports.default = void 0;
|
|
8
|
-
|
|
9
|
-
var _sideUtils = require("@seleniumhq/side-utils");
|
|
10
|
-
|
|
11
2
|
// Licensed to the Software Freedom Conservancy (SFC) under one
|
|
12
3
|
// or more contributor license agreements. See the NOTICE file
|
|
13
4
|
// distributed with this work for additional information
|
|
@@ -24,38 +15,35 @@ var _sideUtils = require("@seleniumhq/side-utils");
|
|
|
24
15
|
// KIND, either express or implied. See the License for the
|
|
25
16
|
// specific language governing permissions and limitations
|
|
26
17
|
// under the License.
|
|
18
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
exports.emit = void 0;
|
|
20
|
+
const side_code_export_1 = require("@seleniumhq/side-code-export");
|
|
27
21
|
const emitters = {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
22
|
+
id: emitId,
|
|
23
|
+
value: emitValue,
|
|
24
|
+
label: emitLabel,
|
|
25
|
+
index: emitIndex,
|
|
32
26
|
};
|
|
33
|
-
|
|
34
27
|
function emit(location) {
|
|
35
|
-
|
|
28
|
+
return side_code_export_1.codeExport.emit.selection(location, emitters);
|
|
36
29
|
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
30
|
+
exports.emit = emit;
|
|
31
|
+
exports.default = {
|
|
32
|
+
emit,
|
|
40
33
|
};
|
|
41
|
-
exports.default = _default;
|
|
42
|
-
|
|
43
34
|
function emitId(id) {
|
|
44
|
-
|
|
35
|
+
return Promise.resolve(`By.CSS_SELECTOR, "*[id='${id}']"`);
|
|
45
36
|
}
|
|
46
|
-
|
|
47
37
|
function emitValue(value) {
|
|
48
|
-
|
|
38
|
+
return Promise.resolve(`By.CSS_SELECTOR, "*[value='${value}']"`);
|
|
49
39
|
}
|
|
50
|
-
|
|
51
40
|
function emitLabel(label) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
return Promise.resolve(`By.XPATH, "//option[. = '${label}']"`);
|
|
41
|
+
if (label.startsWith('self.vars[')) {
|
|
42
|
+
return Promise.resolve(`By.XPATH, "//option[. = '{}']".format(${label})`);
|
|
43
|
+
}
|
|
44
|
+
return Promise.resolve(`By.XPATH, "//option[. = '${label}']"`);
|
|
57
45
|
}
|
|
58
|
-
|
|
59
46
|
function emitIndex(index) {
|
|
60
|
-
|
|
61
|
-
}
|
|
47
|
+
return Promise.resolve(`By.CSS_SELECTOR, "*:nth-child(${index})"`);
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL=selection.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"selection.js","sourceRoot":"","sources":["../src/selection.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,mEAAqE;AAErE,MAAM,QAAQ,GAAG;IACf,EAAE,EAAE,MAAM;IACV,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,SAAS;IAChB,KAAK,EAAE,SAAS;CACjB,CAAA;AAED,SAAgB,IAAI,CAAC,QAAgB;IACnC,OAAO,6BAAQ,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;AACpD,CAAC;AAFD,oBAEC;AAED,kBAAe;IACb,IAAI;CACL,CAAA;AAED,SAAS,MAAM,CAAC,EAAU;IACxB,OAAO,OAAO,CAAC,OAAO,CAAC,2BAA2B,EAAE,KAAK,CAAC,CAAA;AAC5D,CAAC;AAED,SAAS,SAAS,CAAC,KAAa;IAC9B,OAAO,OAAO,CAAC,OAAO,CAAC,8BAA8B,KAAK,KAAK,CAAC,CAAA;AAClE,CAAC;AAED,SAAS,SAAS,CAAC,KAAa;IAC9B,IAAI,KAAK,CAAC,UAAU,CAAC,YAAY,CAAC,EAAE;QAClC,OAAO,OAAO,CAAC,OAAO,CAAC,yCAAyC,KAAK,GAAG,CAAC,CAAA;KAC1E;IACD,OAAO,OAAO,CAAC,OAAO,CAAC,4BAA4B,KAAK,KAAK,CAAC,CAAA;AAChE,CAAC;AAED,SAAS,SAAS,CAAC,KAAa;IAC9B,OAAO,OAAO,CAAC,OAAO,CAAC,iCAAiC,KAAK,IAAI,CAAC,CAAA;AACpE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seleniumhq/code-export-python-pytest",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0-alpha.0",
|
|
4
4
|
"description": "Export Selenium IDE project contents to Python pytest",
|
|
5
5
|
"repository": "https://github.com/SeleniumHQ/selenium-ide",
|
|
6
6
|
"keywords": [
|
|
@@ -9,18 +9,17 @@
|
|
|
9
9
|
"export"
|
|
10
10
|
],
|
|
11
11
|
"license": "Apache-2.0",
|
|
12
|
-
"private": false,
|
|
13
|
-
"scripts": {
|
|
14
|
-
"build": "babel -d dist src --ignore=__test__",
|
|
15
|
-
"watch": "yarn build -w"
|
|
16
|
-
},
|
|
17
12
|
"main": "dist/index.js",
|
|
13
|
+
"dependencies": {
|
|
14
|
+
"@seleniumhq/side-code-export": "^4.0.0-alpha.2"
|
|
15
|
+
},
|
|
18
16
|
"devDependencies": {
|
|
19
|
-
"@
|
|
20
|
-
"@babel/plugin-proposal-object-rest-spread": "^7.4.4",
|
|
21
|
-
"@babel/preset-env": "^7.4.5"
|
|
17
|
+
"@seleniumhq/side-model": "^4.0.0-alpha.2"
|
|
22
18
|
},
|
|
23
|
-
"
|
|
24
|
-
|
|
19
|
+
"gitHead": "f58e327e7616e23a3e926e4b80cf9952164e5744",
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "tsc",
|
|
22
|
+
"clean": "rm -rf dist tsconfig.tsbuildinfo node_modules",
|
|
23
|
+
"watch": "tsc --watch"
|
|
25
24
|
}
|
|
26
|
-
}
|
|
25
|
+
}
|