@seleniumhq/code-export-python-pytest 3.16.0 → 3.17.4

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,61 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.clearHooks = clearHooks;
7
-
8
- var _declareDependencies = require('./declareDependencies');
9
-
10
- var _declareDependencies2 = _interopRequireDefault(_declareDependencies);
11
-
12
- var _declareVariables = require('./declareVariables');
13
-
14
- var _declareVariables2 = _interopRequireDefault(_declareVariables);
15
-
16
- var _beforeAll = require('./beforeAll');
17
-
18
- var _beforeAll2 = _interopRequireDefault(_beforeAll);
19
-
20
- var _afterAll = require('./afterAll');
21
-
22
- var _afterAll2 = _interopRequireDefault(_afterAll);
23
-
24
- var _inEachBegin = require('./inEachBegin');
25
-
26
- var _inEachBegin2 = _interopRequireDefault(_inEachBegin);
27
-
28
- var _inEachEnd = require('./inEachEnd');
29
-
30
- var _inEachEnd2 = _interopRequireDefault(_inEachEnd);
31
-
32
- var _declareMethods = require('./declareMethods');
33
-
34
- var _declareMethods2 = _interopRequireDefault(_declareMethods);
35
-
36
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
37
-
38
- //import beforeEach from './beforeEach'
39
- //import afterEach from './afterEach'
40
- const hooks = [_declareDependencies2.default, _declareVariables2.default, _beforeAll2.default,
41
- //beforeEach,
42
- //afterEach,
43
- _afterAll2.default, _inEachBegin2.default, _inEachEnd2.default, _declareMethods2.default];
44
-
45
- function clearHooks() {
46
- hooks.forEach(hook => {
47
- hook.clear();
48
- });
49
- }
50
-
51
- exports.default = {
52
- dependencies: _declareDependencies2.default,
53
- variables: _declareVariables2.default,
54
- beforeAll: _beforeAll2.default,
55
- //beforeEach,
56
- //afterEach,
57
- afterAll: _afterAll2.default,
58
- inEachBegin: _inEachBegin2.default,
59
- inEachEnd: _inEachEnd2.default,
60
- methods: _declareMethods2.default
61
- };
package/dist/index.js DELETED
@@ -1,133 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.emitTest = emitTest;
7
- exports.emitSuite = emitSuite;
8
- exports.default = exports.opts = exports.displayName = void 0;
9
-
10
- var _sideUtils = require("@seleniumhq/side-utils");
11
-
12
- var _command = _interopRequireDefault(require("./command"));
13
-
14
- var _location = _interopRequireDefault(require("./location"));
15
-
16
- var _hook = require("./hook");
17
-
18
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
-
20
- function _objectSpread2(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; var ownKeys = Object.keys(source); if (typeof Object.getOwnPropertySymbols === 'function') { ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function (sym) { return Object.getOwnPropertyDescriptor(source, sym).enumerable; })); } ownKeys.forEach(function (key) { _defineProperty(target, key, source[key]); }); } return target; }
21
-
22
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
23
-
24
- // Define language options
25
- const displayName = 'Python pytest';
26
- exports.displayName = displayName;
27
- let opts = {};
28
- exports.opts = opts;
29
- opts.emitter = _command.default;
30
- opts.hooks = (0, _hook.generateHooks)();
31
- opts.fileExtension = '.py';
32
- opts.commandPrefixPadding = ' ';
33
- opts.terminatingKeyword = '';
34
- opts.commentPrefix = '#';
35
- opts.generateMethodDeclaration = generateMethodDeclaration; // Create generators for dynamic string creation of primary entities (e.g., filename, methods, test, and suite)
36
-
37
- function generateTestDeclaration(name) {
38
- return `def test_${_sideUtils.codeExport.parsers.uncapitalize(_sideUtils.codeExport.parsers.sanitizeName(name))}(self):`;
39
- }
40
-
41
- function generateMethodDeclaration(name) {
42
- return `def ${_sideUtils.codeExport.parsers.uncapitalize(_sideUtils.codeExport.parsers.sanitizeName(name))}(self):`;
43
- }
44
-
45
- function generateSuiteDeclaration(name) {
46
- return `class Test${_sideUtils.codeExport.parsers.capitalize(_sideUtils.codeExport.parsers.sanitizeName(name))}():`;
47
- }
48
-
49
- function generateFilename(name) {
50
- return `test_${_sideUtils.codeExport.parsers.uncapitalize(_sideUtils.codeExport.parsers.sanitizeName(name))}${opts.fileExtension}`;
51
- } // Emit an individual test, wrapped in a suite (using the test name as the suite name)
52
-
53
-
54
- async function emitTest({
55
- baseUrl,
56
- test,
57
- tests,
58
- project,
59
- enableOriginTracing,
60
- beforeEachOptions
61
- }) {
62
- global.baseUrl = baseUrl;
63
- const testDeclaration = generateTestDeclaration(test.name);
64
- const result = await _sideUtils.codeExport.emit.test(test, tests, _objectSpread2({}, opts, {
65
- testDeclaration,
66
- enableOriginTracing,
67
- project
68
- }));
69
- const suiteName = test.name;
70
- const suiteDeclaration = generateSuiteDeclaration(suiteName);
71
-
72
- const _suite = await _sideUtils.codeExport.emit.suite(result, tests, _objectSpread2({}, opts, {
73
- suiteDeclaration,
74
- suiteName,
75
- project,
76
- beforeEachOptions
77
- }));
78
-
79
- return {
80
- filename: generateFilename(test.name),
81
- body: _sideUtils.codeExport.emit.orderedSuite(_suite)
82
- };
83
- } // Emit a suite with all of its tests
84
-
85
-
86
- async function emitSuite({
87
- baseUrl,
88
- suite,
89
- tests,
90
- project,
91
- enableOriginTracing,
92
- beforeEachOptions
93
- }) {
94
- global.baseUrl = baseUrl;
95
- const result = await _sideUtils.codeExport.emit.testsFromSuite(tests, suite, opts, {
96
- enableOriginTracing,
97
- generateTestDeclaration,
98
- project
99
- });
100
- const suiteDeclaration = generateSuiteDeclaration(suite.name);
101
-
102
- const _suite = await _sideUtils.codeExport.emit.suite(result, tests, _objectSpread2({}, opts, {
103
- suiteDeclaration,
104
- suite,
105
- project,
106
- beforeEachOptions
107
- }));
108
-
109
- return {
110
- filename: generateFilename(suite.name),
111
- body: _sideUtils.codeExport.emit.orderedSuite(_suite)
112
- };
113
- }
114
-
115
- var _default = {
116
- emit: {
117
- test: emitTest,
118
- suite: emitSuite,
119
- locator: _location.default.emit
120
- },
121
- register: {
122
- command: _command.default.register,
123
- variable: opts.hooks.declareVariables.register,
124
- dependency: opts.hooks.declareDependencies.register,
125
- beforeAll: opts.hooks.beforeAll.register,
126
- beforeEach: opts.hooks.beforeEach.register,
127
- afterEach: opts.hooks.afterEach.register,
128
- afterAll: opts.hooks.afterAll.register,
129
- inEachBegin: opts.hooks.inEachBegin.register,
130
- inEachEnd: opts.hooks.inEachEnd.register
131
- }
132
- };
133
- exports.default = _default;
package/dist/location.js DELETED
@@ -1,68 +0,0 @@
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
- // Licensed to the Software Freedom Conservancy (SFC) under one
12
- // or more contributor license agreements. See the NOTICE file
13
- // distributed with this work for additional information
14
- // regarding copyright ownership. The SFC licenses this file
15
- // to you under the Apache License, Version 2.0 (the
16
- // "License"); you may not use this file except in compliance
17
- // with the License. You may obtain a copy of the License at
18
- //
19
- // http://www.apache.org/licenses/LICENSE-2.0
20
- //
21
- // Unless required by applicable law or agreed to in writing,
22
- // software distributed under the License is distributed on an
23
- // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
24
- // KIND, either express or implied. See the License for the
25
- // specific language governing permissions and limitations
26
- // under the License.
27
- const emitters = {
28
- id: emitId,
29
- name: emitName,
30
- link: emitLink,
31
- linkText: emitLink,
32
- partialLinkText: emitPartialLinkText,
33
- css: emitCss,
34
- xpath: emitXpath
35
- };
36
-
37
- function emit(location) {
38
- return _sideUtils.codeExport.emit.location(location, emitters);
39
- }
40
-
41
- var _default = {
42
- emit
43
- };
44
- exports.default = _default;
45
-
46
- function emitId(selector) {
47
- return Promise.resolve(`By.ID, "${selector}"`);
48
- }
49
-
50
- function emitName(selector) {
51
- return Promise.resolve(`By.NAME, "${selector}"`);
52
- }
53
-
54
- function emitLink(selector) {
55
- return Promise.resolve(`By.LINK_TEXT, "${selector}"`);
56
- }
57
-
58
- function emitPartialLinkText(selector) {
59
- return Promise.resolve(`By.PARTIAL_LINK_TEXT, "${selector}"`);
60
- }
61
-
62
- function emitCss(selector) {
63
- return Promise.resolve(`By.CSS_SELECTOR, "${selector}"`);
64
- }
65
-
66
- function emitXpath(selector) {
67
- return Promise.resolve(`By.XPATH, "${selector}"`);
68
- }
package/dist/parsers.js DELETED
@@ -1,31 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.sanitizeName = sanitizeName;
7
- exports.capitalize = capitalize;
8
- // Licensed to the Software Freedom Conservancy (SFC) under one
9
- // or more contributor license agreements. See the NOTICE file
10
- // distributed with this work for additional information
11
- // regarding copyright ownership. The SFC licenses this file
12
- // to you under the Apache License, Version 2.0 (the
13
- // "License"); you may not use this file except in compliance
14
- // with the License. You may obtain a copy of the License at
15
- //
16
- // http://www.apache.org/licenses/LICENSE-2.0
17
- //
18
- // Unless required by applicable law or agreed to in writing,
19
- // software distributed under the License is distributed on an
20
- // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21
- // KIND, either express or implied. See the License for the
22
- // specific language governing permissions and limitations
23
- // under the License.
24
-
25
- function sanitizeName(input) {
26
- return input.replace(/([^a-z0-9]+)/gi, '');
27
- }
28
-
29
- function capitalize(input) {
30
- return input.charAt(0).toUpperCase() + input.substr(1);
31
- }
package/dist/selection.js DELETED
@@ -1,57 +0,0 @@
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
- // Licensed to the Software Freedom Conservancy (SFC) under one
12
- // or more contributor license agreements. See the NOTICE file
13
- // distributed with this work for additional information
14
- // regarding copyright ownership. The SFC licenses this file
15
- // to you under the Apache License, Version 2.0 (the
16
- // "License"); you may not use this file except in compliance
17
- // with the License. You may obtain a copy of the License at
18
- //
19
- // http://www.apache.org/licenses/LICENSE-2.0
20
- //
21
- // Unless required by applicable law or agreed to in writing,
22
- // software distributed under the License is distributed on an
23
- // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
24
- // KIND, either express or implied. See the License for the
25
- // specific language governing permissions and limitations
26
- // under the License.
27
- const emitters = {
28
- id: emitId,
29
- value: emitValue,
30
- label: emitLabel,
31
- index: emitIndex
32
- };
33
-
34
- function emit(location) {
35
- return _sideUtils.codeExport.emit.selection(location, emitters);
36
- }
37
-
38
- var _default = {
39
- emit
40
- };
41
- exports.default = _default;
42
-
43
- function emitId(id) {
44
- return Promise.resolve(`By.CSS_SELECTOR, "*[id='${id}']"`);
45
- }
46
-
47
- function emitValue(value) {
48
- return Promise.resolve(`By.CSS_SELECTOR, "*[value='${value}']"`);
49
- }
50
-
51
- function emitLabel(label) {
52
- return Promise.resolve(`By.XPATH, "//option[. = '${label}']"`);
53
- }
54
-
55
- function emitIndex(index) {
56
- return Promise.resolve(`By.CSS_SELECTOR, "*:nth-child(${index})"`);
57
- }