@seleniumhq/code-export-javascript-mocha 3.15.0 → 3.17.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.
- package/README.md +3 -0
- package/__test__/src/__snapshots__/command.spec.js.snap +3 -1
- package/__test__/src/__snapshots__/index.spec.js.snap +21 -8
- package/__test__/src/command.spec.js +8 -0
- package/__test__/src/index.spec.js +10 -1
- package/dist/command.js +7 -1
- package/dist/index.js +7 -2
- package/package.json +2 -2
- package/src/command.js +13 -1
- package/src/index.js +5 -0
- package/dist/hooks/afterAll.js +0 -48
- package/dist/hooks/afterEach.js +0 -49
- package/dist/hooks/beforeAll.js +0 -48
- package/dist/hooks/beforeEach.js +0 -50
- package/dist/hooks/declareDependencies.js +0 -66
- package/dist/hooks/declareMethods.js +0 -53
- package/dist/hooks/declareVariables.js +0 -48
- package/dist/hooks/inEach.js +0 -42
- package/dist/hooks/inEachBegin.js +0 -42
- package/dist/hooks/inEachEnd.js +0 -42
- package/dist/hooks/index.js +0 -61
- package/dist/parsers.js +0 -31
- package/yarn-error.log +0 -2196
package/README.md
ADDED
|
@@ -303,7 +303,7 @@ exports[`command code emitter should emit \`send keys\` command with a variable
|
|
|
303
303
|
|
|
304
304
|
exports[`command code emitter should emit \`set speed\` 1`] = `"console.log(\\"\`set speed\` is a no-op in code export, use \`pause\` instead\\")"`;
|
|
305
305
|
|
|
306
|
-
exports[`command code emitter should emit \`setWindowSize\` 1`] = `"await driver.setRect(1440, 1177)"`;
|
|
306
|
+
exports[`command code emitter should emit \`setWindowSize\` 1`] = `"await driver.manage().window().setRect({ width: 1440, height: 1177 })"`;
|
|
307
307
|
|
|
308
308
|
exports[`command code emitter should emit \`store attribute\` command 1`] = `
|
|
309
309
|
"{
|
|
@@ -420,6 +420,8 @@ exports[`command code emitter should emit \`waitForElementPresent\` command 1`]
|
|
|
420
420
|
|
|
421
421
|
exports[`command code emitter should emit \`waitForElementVisible\` command 1`] = `"await driver.wait(until.elementIsVisible(await driver.findElement(By.css(\\"#blah\\"))), 5000)"`;
|
|
422
422
|
|
|
423
|
+
exports[`command code emitter should emit \`waitForText\` command 1`] = `"await driver.wait(until.elementTextIs(await driver.findElement(By.css(\\"#blah\\")), 'text'), 30000)"`;
|
|
424
|
+
|
|
423
425
|
exports[`command code emitter should emit \`while\` command 1`] = `"while(!!await driver.executeScript(\\"return (true)\\")) {"`;
|
|
424
426
|
|
|
425
427
|
exports[`command code emitter should emit new window handling, if command opens a new window 1`] = `
|
|
@@ -18,7 +18,7 @@ describe('login', function() {
|
|
|
18
18
|
})
|
|
19
19
|
it('valid credentials', async function() {
|
|
20
20
|
await driver.get(\\"http://the-internet.herokuapp.com/login\\")
|
|
21
|
-
await driver.setRect(1440, 1177)
|
|
21
|
+
await driver.manage().window().setRect({ width: 1440, height: 1177 })
|
|
22
22
|
await driver.findElement(By.id(\\"username\\")).sendKeys(\\"tomsmith\\")
|
|
23
23
|
await driver.findElement(By.id(\\"password\\")).sendKeys(\\"SuperSecretPassword!\\")
|
|
24
24
|
await driver.findElement(By.css(\\"#login button\\")).click()
|
|
@@ -26,7 +26,7 @@ describe('login', function() {
|
|
|
26
26
|
})
|
|
27
27
|
it('invalid credentials', async function() {
|
|
28
28
|
await driver.get(\\"http://the-internet.herokuapp.com/login\\")
|
|
29
|
-
await driver.setRect(1440, 1177)
|
|
29
|
+
await driver.manage().window().setRect({ width: 1440, height: 1177 })
|
|
30
30
|
await driver.findElement(By.id(\\"username\\")).sendKeys(\\"blah\\")
|
|
31
31
|
await driver.findElement(By.id(\\"password\\")).sendKeys(\\"blah\\")
|
|
32
32
|
await driver.findElement(By.css(\\"#login button\\")).click()
|
|
@@ -116,7 +116,7 @@ exports[`Code Export JavaScript Mocha should export a suite with a reused test m
|
|
|
116
116
|
const { Builder, By, Key, until } = require('selenium-webdriver')
|
|
117
117
|
const assert = require('assert')
|
|
118
118
|
|
|
119
|
-
describe('
|
|
119
|
+
describe('Reused methods', function() {
|
|
120
120
|
this.timeout(30000)
|
|
121
121
|
let driver
|
|
122
122
|
let vars
|
|
@@ -132,7 +132,12 @@ describe('login', function() {
|
|
|
132
132
|
await driver.findElement(By.linkText(\\"Form Authentication\\")).click()
|
|
133
133
|
await driver.findElement(By.id(\\"username\\")).sendKeys(vars[\\"username\\"])
|
|
134
134
|
await driver.findElement(By.id(\\"password\\")).sendKeys(vars[\\"password\\"])
|
|
135
|
-
await driver.
|
|
135
|
+
if (!!await driver.executeScript(\\"return (true)\\")) {
|
|
136
|
+
await driver.findElement(By.css(\\".fa\\")).click()
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
async function tinymethod() {
|
|
140
|
+
vars[\\"value\\"] = \\"field\\"
|
|
136
141
|
}
|
|
137
142
|
it('invalid credentials', async function() {
|
|
138
143
|
vars[\\"username\\"] = \\"blah\\"
|
|
@@ -144,6 +149,12 @@ describe('login', function() {
|
|
|
144
149
|
vars[\\"password\\"] = \\"SuperSecretPassword!\\"
|
|
145
150
|
login()
|
|
146
151
|
})
|
|
152
|
+
it('two methods', async function() {
|
|
153
|
+
vars[\\"username\\"] = \\"blah\\"
|
|
154
|
+
vars[\\"password\\"] = \\"blah\\"
|
|
155
|
+
login()
|
|
156
|
+
tinymethod()
|
|
157
|
+
})
|
|
147
158
|
})
|
|
148
159
|
"
|
|
149
160
|
`;
|
|
@@ -254,7 +265,7 @@ describe('login', function() {
|
|
|
254
265
|
})
|
|
255
266
|
it('login', async function() {
|
|
256
267
|
await driver.get(\\"http://the-internet.herokuapp.com/login\\")
|
|
257
|
-
await driver.setRect(1440, 1177)
|
|
268
|
+
await driver.manage().window().setRect({ width: 1440, height: 1177 })
|
|
258
269
|
await driver.findElement(By.id(\\"username\\")).sendKeys(\\"tomsmith\\")
|
|
259
270
|
await driver.findElement(By.id(\\"password\\")).sendKeys(\\"SuperSecretPassword!\\")
|
|
260
271
|
await driver.findElement(By.css(\\"#login button\\")).click()
|
|
@@ -285,7 +296,9 @@ describe('valid credentials', function() {
|
|
|
285
296
|
await driver.findElement(By.linkText(\\"Form Authentication\\")).click()
|
|
286
297
|
await driver.findElement(By.id(\\"username\\")).sendKeys(vars[\\"username\\"])
|
|
287
298
|
await driver.findElement(By.id(\\"password\\")).sendKeys(vars[\\"password\\"])
|
|
288
|
-
await driver.
|
|
299
|
+
if (!!await driver.executeScript(\\"return (true)\\")) {
|
|
300
|
+
await driver.findElement(By.css(\\".fa\\")).click()
|
|
301
|
+
}
|
|
289
302
|
}
|
|
290
303
|
it('valid credentials', async function() {
|
|
291
304
|
vars[\\"username\\"] = \\"tomsmith\\"
|
|
@@ -323,7 +336,7 @@ describe('select window', function() {
|
|
|
323
336
|
}
|
|
324
337
|
it('select window', async function() {
|
|
325
338
|
await driver.get(\\"http://the-internet.herokuapp.com/\\")
|
|
326
|
-
await driver.setRect(1260, 1027)
|
|
339
|
+
await driver.manage().window().setRect({ width: 1260, height: 1027 })
|
|
327
340
|
await driver.findElement(By.linkText(\\"Multiple Windows\\")).click()
|
|
328
341
|
vars[\\"windowHandles\\"] = await driver.getAllWindowHandles()
|
|
329
342
|
await driver.findElement(By.linkText(\\"Click Here\\")).click()
|
|
@@ -356,7 +369,7 @@ describe('login', function() {
|
|
|
356
369
|
})
|
|
357
370
|
it('login', async function() {
|
|
358
371
|
await driver.get(\\"http://the-internet.herokuapp.com/login\\")
|
|
359
|
-
await driver.setRect(1440, 1177)
|
|
372
|
+
await driver.manage().window().setRect({ width: 1440, height: 1177 })
|
|
360
373
|
await driver.findElement(By.id(\\"username\\")).sendKeys(\\"tomsmith\\")
|
|
361
374
|
await driver.findElement(By.id(\\"password\\")).sendKeys(\\"SuperSecretPassword!\\")
|
|
362
375
|
await driver.findElement(By.css(\\"#login button\\")).click()
|
|
@@ -838,6 +838,14 @@ describe('command code emitter', () => {
|
|
|
838
838
|
}
|
|
839
839
|
return expect(prettify(command)).resolves.toMatchSnapshot()
|
|
840
840
|
})
|
|
841
|
+
it('should emit `waitForText` command', () => {
|
|
842
|
+
const command = {
|
|
843
|
+
command: 'waitForText',
|
|
844
|
+
target: 'css=#blah',
|
|
845
|
+
value: 'text',
|
|
846
|
+
}
|
|
847
|
+
return expect(prettify(command)).resolves.toMatchSnapshot()
|
|
848
|
+
})
|
|
841
849
|
it('should emit `answer on visible prompt` command', () => {
|
|
842
850
|
const command = {
|
|
843
851
|
command: 'webdriverAnswerOnVisiblePrompt',
|
|
@@ -17,7 +17,13 @@
|
|
|
17
17
|
|
|
18
18
|
import fs from 'fs'
|
|
19
19
|
import path from 'path'
|
|
20
|
-
import
|
|
20
|
+
import codeExport, {
|
|
21
|
+
emitTest,
|
|
22
|
+
emitSuite,
|
|
23
|
+
_emitMethod,
|
|
24
|
+
_findTestByName,
|
|
25
|
+
} from '../../src'
|
|
26
|
+
import Command from '../../src/command'
|
|
21
27
|
import { project as projectProcessor } from '@seleniumhq/side-utils'
|
|
22
28
|
|
|
23
29
|
function readFile(filename) {
|
|
@@ -132,6 +138,9 @@ describe('Code Export JavaScript Mocha', () => {
|
|
|
132
138
|
expect(results.body).toBeDefined()
|
|
133
139
|
expect(results.body).toMatchSnapshot()
|
|
134
140
|
})
|
|
141
|
+
it('should export the command emitter', () => {
|
|
142
|
+
expect(Command.emit).toStrictEqual(codeExport.emit.command)
|
|
143
|
+
})
|
|
135
144
|
})
|
|
136
145
|
|
|
137
146
|
function normalizeProject(project) {
|
package/dist/command.js
CHANGED
|
@@ -123,6 +123,7 @@ const emitters = {
|
|
|
123
123
|
waitForElementNotPresent: emitWaitForElementNotPresent,
|
|
124
124
|
waitForElementNotVisible: emitWaitForElementNotVisible,
|
|
125
125
|
webdriverAnswerOnVisiblePrompt: emitAnswerOnNextPrompt,
|
|
126
|
+
waitForText: emitWaitForText,
|
|
126
127
|
webdriverChooseCancelOnVisibleConfirmation: emitChooseCancelOnNextConfirmation,
|
|
127
128
|
webdriverChooseCancelOnVisiblePrompt: emitChooseCancelOnNextConfirmation,
|
|
128
129
|
webdriverChooseOkOnVisibleConfirmation: emitChooseOkOnNextConfirmation,
|
|
@@ -552,7 +553,7 @@ async function emitRunScript(script) {
|
|
|
552
553
|
|
|
553
554
|
async function emitSetWindowSize(size) {
|
|
554
555
|
const [width, height] = size.split('x');
|
|
555
|
-
return Promise.resolve(`await driver.setRect(${width}, ${height})`);
|
|
556
|
+
return Promise.resolve(`await driver.manage().window().setRect({ width: ${width}, height: ${height} })`);
|
|
556
557
|
}
|
|
557
558
|
|
|
558
559
|
async function emitSelect(selectElement, option) {
|
|
@@ -942,6 +943,11 @@ async function emitWaitForElementNotEditable(locator, timeout) {
|
|
|
942
943
|
return Promise.resolve(`await driver.wait(until.elementIsDisabled(await driver.findElement(${await _location.default.emit(locator)})), ${Math.floor(timeout)})`);
|
|
943
944
|
}
|
|
944
945
|
|
|
946
|
+
async function emitWaitForText(locator, text) {
|
|
947
|
+
const timeout = 30000;
|
|
948
|
+
return Promise.resolve(`await driver.wait(until.elementTextIs(await driver.findElement(${await _location.default.emit(locator)}), '${text}'), ${Math.floor(timeout)})`);
|
|
949
|
+
}
|
|
950
|
+
|
|
945
951
|
var _default = {
|
|
946
952
|
canEmit,
|
|
947
953
|
emit,
|
package/dist/index.js
CHANGED
|
@@ -60,13 +60,15 @@ async function emitTest({
|
|
|
60
60
|
tests,
|
|
61
61
|
project,
|
|
62
62
|
enableOriginTracing,
|
|
63
|
-
beforeEachOptions
|
|
63
|
+
beforeEachOptions,
|
|
64
|
+
enableDescriptionAsComment
|
|
64
65
|
}) {
|
|
65
66
|
global.baseUrl = baseUrl;
|
|
66
67
|
const testDeclaration = generateTestDeclaration(test.name);
|
|
67
68
|
const result = await _sideUtils.codeExport.emit.test(test, tests, _objectSpread2({}, opts, {
|
|
68
69
|
testDeclaration,
|
|
69
70
|
enableOriginTracing,
|
|
71
|
+
enableDescriptionAsComment,
|
|
70
72
|
project
|
|
71
73
|
}));
|
|
72
74
|
const suiteName = test.name;
|
|
@@ -92,12 +94,14 @@ async function emitSuite({
|
|
|
92
94
|
tests,
|
|
93
95
|
project,
|
|
94
96
|
enableOriginTracing,
|
|
95
|
-
beforeEachOptions
|
|
97
|
+
beforeEachOptions,
|
|
98
|
+
enableDescriptionAsComment
|
|
96
99
|
}) {
|
|
97
100
|
global.baseUrl = baseUrl;
|
|
98
101
|
const result = await _sideUtils.codeExport.emit.testsFromSuite(tests, suite, opts, {
|
|
99
102
|
enableOriginTracing,
|
|
100
103
|
generateTestDeclaration,
|
|
104
|
+
enableDescriptionAsComment,
|
|
101
105
|
project
|
|
102
106
|
});
|
|
103
107
|
const suiteDeclaration = generateSuiteDeclaration(suite.name);
|
|
@@ -119,6 +123,7 @@ var _default = {
|
|
|
119
123
|
emit: {
|
|
120
124
|
test: emitTest,
|
|
121
125
|
suite: emitSuite,
|
|
126
|
+
command: _command.default.emit,
|
|
122
127
|
locator: _location.default.emit
|
|
123
128
|
},
|
|
124
129
|
register: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seleniumhq/code-export-javascript-mocha",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.17.2",
|
|
4
4
|
"description": "Export Selenium IDE project contents to JavaScript Mocha",
|
|
5
5
|
"repository": "https://github.com/SeleniumHQ/selenium-ide",
|
|
6
6
|
"keywords": [
|
|
@@ -21,6 +21,6 @@
|
|
|
21
21
|
"@babel/preset-env": "^7.4.5"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@seleniumhq/side-utils": "^3.
|
|
24
|
+
"@seleniumhq/side-utils": "^3.17.2"
|
|
25
25
|
}
|
|
26
26
|
}
|
package/src/command.js
CHANGED
|
@@ -113,6 +113,7 @@ export const emitters = {
|
|
|
113
113
|
waitForElementNotPresent: emitWaitForElementNotPresent,
|
|
114
114
|
waitForElementNotVisible: emitWaitForElementNotVisible,
|
|
115
115
|
webdriverAnswerOnVisiblePrompt: emitAnswerOnNextPrompt,
|
|
116
|
+
waitForText: emitWaitForText,
|
|
116
117
|
webdriverChooseCancelOnVisibleConfirmation: emitChooseCancelOnNextConfirmation,
|
|
117
118
|
webdriverChooseCancelOnVisiblePrompt: emitChooseCancelOnNextConfirmation,
|
|
118
119
|
webdriverChooseOkOnVisibleConfirmation: emitChooseOkOnNextConfirmation,
|
|
@@ -540,7 +541,9 @@ async function emitRunScript(script) {
|
|
|
540
541
|
|
|
541
542
|
async function emitSetWindowSize(size) {
|
|
542
543
|
const [width, height] = size.split('x')
|
|
543
|
-
return Promise.resolve(
|
|
544
|
+
return Promise.resolve(
|
|
545
|
+
`await driver.manage().window().setRect({ width: ${width}, height: ${height} })`
|
|
546
|
+
)
|
|
544
547
|
}
|
|
545
548
|
|
|
546
549
|
async function emitSelect(selectElement, option) {
|
|
@@ -972,6 +975,15 @@ async function emitWaitForElementNotEditable(locator, timeout) {
|
|
|
972
975
|
)
|
|
973
976
|
}
|
|
974
977
|
|
|
978
|
+
async function emitWaitForText(locator, text) {
|
|
979
|
+
const timeout = 30000
|
|
980
|
+
return Promise.resolve(
|
|
981
|
+
`await driver.wait(until.elementTextIs(await driver.findElement(${await location.emit(
|
|
982
|
+
locator
|
|
983
|
+
)}), '${text}'), ${Math.floor(timeout)})`
|
|
984
|
+
)
|
|
985
|
+
}
|
|
986
|
+
|
|
975
987
|
export default {
|
|
976
988
|
canEmit,
|
|
977
989
|
emit,
|
package/src/index.js
CHANGED
|
@@ -61,6 +61,7 @@ export async function emitTest({
|
|
|
61
61
|
project,
|
|
62
62
|
enableOriginTracing,
|
|
63
63
|
beforeEachOptions,
|
|
64
|
+
enableDescriptionAsComment,
|
|
64
65
|
}) {
|
|
65
66
|
global.baseUrl = baseUrl
|
|
66
67
|
const testDeclaration = generateTestDeclaration(test.name)
|
|
@@ -68,6 +69,7 @@ export async function emitTest({
|
|
|
68
69
|
...opts,
|
|
69
70
|
testDeclaration,
|
|
70
71
|
enableOriginTracing,
|
|
72
|
+
enableDescriptionAsComment,
|
|
71
73
|
project,
|
|
72
74
|
})
|
|
73
75
|
const suiteName = test.name
|
|
@@ -93,11 +95,13 @@ export async function emitSuite({
|
|
|
93
95
|
project,
|
|
94
96
|
enableOriginTracing,
|
|
95
97
|
beforeEachOptions,
|
|
98
|
+
enableDescriptionAsComment,
|
|
96
99
|
}) {
|
|
97
100
|
global.baseUrl = baseUrl
|
|
98
101
|
const result = await exporter.emit.testsFromSuite(tests, suite, opts, {
|
|
99
102
|
enableOriginTracing,
|
|
100
103
|
generateTestDeclaration,
|
|
104
|
+
enableDescriptionAsComment,
|
|
101
105
|
project,
|
|
102
106
|
})
|
|
103
107
|
const suiteDeclaration = generateSuiteDeclaration(suite.name)
|
|
@@ -118,6 +122,7 @@ export default {
|
|
|
118
122
|
emit: {
|
|
119
123
|
test: emitTest,
|
|
120
124
|
suite: emitSuite,
|
|
125
|
+
command: emitter.emit,
|
|
121
126
|
locator: location.emit,
|
|
122
127
|
},
|
|
123
128
|
register: {
|
package/dist/hooks/afterAll.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
// Licensed to the Software Freedom Conservancy (SFC) under one
|
|
7
|
-
// or more contributor license agreements. See the NOTICE file
|
|
8
|
-
// distributed with this work for additional information
|
|
9
|
-
// regarding copyright ownership. The SFC licenses this file
|
|
10
|
-
// to you under the Apache License, Version 2.0 (the
|
|
11
|
-
// "License"); you may not use this file except in compliance
|
|
12
|
-
// with the License. You may obtain a copy of the License at
|
|
13
|
-
//
|
|
14
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
15
|
-
//
|
|
16
|
-
// Unless required by applicable law or agreed to in writing,
|
|
17
|
-
// software distributed under the License is distributed on an
|
|
18
|
-
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
19
|
-
// KIND, either express or implied. See the License for the
|
|
20
|
-
// specific language governing permissions and limitations
|
|
21
|
-
// under the License.
|
|
22
|
-
|
|
23
|
-
let afterAll = `
|
|
24
|
-
@AfterAll
|
|
25
|
-
public void finalTearDown() {
|
|
26
|
-
`;
|
|
27
|
-
|
|
28
|
-
let hooks = [];
|
|
29
|
-
|
|
30
|
-
function register(statement) {
|
|
31
|
-
hooks.push(statement);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function clear() {
|
|
35
|
-
hooks = [];
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function emit({ isOptional } = { isOptional: false }) {
|
|
39
|
-
if (isOptional && !hooks.length) return '';
|
|
40
|
-
return afterAll + hooks.join('\r\n') + ` }
|
|
41
|
-
`;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
exports.default = {
|
|
45
|
-
register,
|
|
46
|
-
clear,
|
|
47
|
-
emit
|
|
48
|
-
};
|
package/dist/hooks/afterEach.js
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
// Licensed to the Software Freedom Conservancy (SFC) under one
|
|
7
|
-
// or more contributor license agreements. See the NOTICE file
|
|
8
|
-
// distributed with this work for additional information
|
|
9
|
-
// regarding copyright ownership. The SFC licenses this file
|
|
10
|
-
// to you under the Apache License, Version 2.0 (the
|
|
11
|
-
// "License"); you may not use this file except in compliance
|
|
12
|
-
// with the License. You may obtain a copy of the License at
|
|
13
|
-
//
|
|
14
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
15
|
-
//
|
|
16
|
-
// Unless required by applicable law or agreed to in writing,
|
|
17
|
-
// software distributed under the License is distributed on an
|
|
18
|
-
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
19
|
-
// KIND, either express or implied. See the License for the
|
|
20
|
-
// specific language governing permissions and limitations
|
|
21
|
-
// under the License.
|
|
22
|
-
|
|
23
|
-
let afterEach = `
|
|
24
|
-
@After
|
|
25
|
-
public void tearDown() {
|
|
26
|
-
driver.quit();
|
|
27
|
-
`;
|
|
28
|
-
|
|
29
|
-
let hooks = [];
|
|
30
|
-
|
|
31
|
-
function register(statement) {
|
|
32
|
-
hooks.push(statement);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function clear() {
|
|
36
|
-
hooks = [];
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function emit({ isOptional } = { isOptional: false }) {
|
|
40
|
-
if (isOptional && !hooks.length) return '';
|
|
41
|
-
return afterEach + hooks.join('\r\n') + ` }
|
|
42
|
-
`;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
exports.default = {
|
|
46
|
-
register,
|
|
47
|
-
clear,
|
|
48
|
-
emit
|
|
49
|
-
};
|
package/dist/hooks/beforeAll.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
// Licensed to the Software Freedom Conservancy (SFC) under one
|
|
7
|
-
// or more contributor license agreements. See the NOTICE file
|
|
8
|
-
// distributed with this work for additional information
|
|
9
|
-
// regarding copyright ownership. The SFC licenses this file
|
|
10
|
-
// to you under the Apache License, Version 2.0 (the
|
|
11
|
-
// "License"); you may not use this file except in compliance
|
|
12
|
-
// with the License. You may obtain a copy of the License at
|
|
13
|
-
//
|
|
14
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
15
|
-
//
|
|
16
|
-
// Unless required by applicable law or agreed to in writing,
|
|
17
|
-
// software distributed under the License is distributed on an
|
|
18
|
-
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
19
|
-
// KIND, either express or implied. See the License for the
|
|
20
|
-
// specific language governing permissions and limitations
|
|
21
|
-
// under the License.
|
|
22
|
-
|
|
23
|
-
let beforeAll = `
|
|
24
|
-
@BeforeAll
|
|
25
|
-
public void initialSetUp() {
|
|
26
|
-
`;
|
|
27
|
-
|
|
28
|
-
let hooks = [];
|
|
29
|
-
|
|
30
|
-
function register(statement) {
|
|
31
|
-
hooks.push(statement);
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
function clear() {
|
|
35
|
-
hooks = [];
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
function emit({ isOptional } = { isOptional: false }) {
|
|
39
|
-
if (isOptional && !hooks.length) return '';
|
|
40
|
-
return beforeAll + hooks.join('\r\n') + ` }
|
|
41
|
-
`;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
exports.default = {
|
|
45
|
-
register,
|
|
46
|
-
clear,
|
|
47
|
-
emit
|
|
48
|
-
};
|
package/dist/hooks/beforeEach.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
// Licensed to the Software Freedom Conservancy (SFC) under one
|
|
7
|
-
// or more contributor license agreements. See the NOTICE file
|
|
8
|
-
// distributed with this work for additional information
|
|
9
|
-
// regarding copyright ownership. The SFC licenses this file
|
|
10
|
-
// to you under the Apache License, Version 2.0 (the
|
|
11
|
-
// "License"); you may not use this file except in compliance
|
|
12
|
-
// with the License. You may obtain a copy of the License at
|
|
13
|
-
//
|
|
14
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
15
|
-
//
|
|
16
|
-
// Unless required by applicable law or agreed to in writing,
|
|
17
|
-
// software distributed under the License is distributed on an
|
|
18
|
-
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
19
|
-
// KIND, either express or implied. See the License for the
|
|
20
|
-
// specific language governing permissions and limitations
|
|
21
|
-
// under the License.
|
|
22
|
-
|
|
23
|
-
let beforeEach = `
|
|
24
|
-
@Before
|
|
25
|
-
public void setUp() {
|
|
26
|
-
driver = new FirefoxDriver();
|
|
27
|
-
js = (JavascriptExecutor) driver;
|
|
28
|
-
`;
|
|
29
|
-
|
|
30
|
-
let hooks = [];
|
|
31
|
-
|
|
32
|
-
function register(statement) {
|
|
33
|
-
hooks.push(statement);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
function clear() {
|
|
37
|
-
hooks = [];
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function emit({ isOptional } = { isOptional: false }) {
|
|
41
|
-
if (isOptional && !hooks.length) return '';
|
|
42
|
-
return beforeEach + hooks.join('\r\n') + ` }
|
|
43
|
-
`;
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
exports.default = {
|
|
47
|
-
register,
|
|
48
|
-
clear,
|
|
49
|
-
emit
|
|
50
|
-
};
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
// Licensed to the Software Freedom Conservancy (SFC) under one
|
|
7
|
-
// or more contributor license agreements. See the NOTICE file
|
|
8
|
-
// distributed with this work for additional information
|
|
9
|
-
// regarding copyright ownership. The SFC licenses this file
|
|
10
|
-
// to you under the Apache License, Version 2.0 (the
|
|
11
|
-
// "License"); you may not use this file except in compliance
|
|
12
|
-
// with the License. You may obtain a copy of the License at
|
|
13
|
-
//
|
|
14
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
15
|
-
//
|
|
16
|
-
// Unless required by applicable law or agreed to in writing,
|
|
17
|
-
// software distributed under the License is distributed on an
|
|
18
|
-
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
19
|
-
// KIND, either express or implied. See the License for the
|
|
20
|
-
// specific language governing permissions and limitations
|
|
21
|
-
// under the License.
|
|
22
|
-
|
|
23
|
-
let dependencies = `
|
|
24
|
-
import org.junit.Test;
|
|
25
|
-
import org.junit.Before;
|
|
26
|
-
import org.junit.After;
|
|
27
|
-
import static org.junit.Assert.*;
|
|
28
|
-
import static org.hamcrest.CoreMatchers.is;
|
|
29
|
-
import static org.hamcrest.core.IsNot.not;
|
|
30
|
-
import org.openqa.selenium.By;
|
|
31
|
-
import org.openqa.selenium.WebDriver;
|
|
32
|
-
import org.openqa.selenium.firefox.FirefoxDriver;
|
|
33
|
-
import org.openqa.selenium.Dimension;
|
|
34
|
-
import org.openqa.selenium.WebElement;
|
|
35
|
-
import org.openqa.selenium.interactions.Actions;
|
|
36
|
-
import org.openqa.selenium.support.ui.ExpectedConditions;
|
|
37
|
-
import org.openqa.selenium.support.ui.WebDriverWait;
|
|
38
|
-
import org.openqa.selenium.JavascriptExecutor;
|
|
39
|
-
import org.openqa.selenium.Alert;
|
|
40
|
-
import org.openqa.selenium.Keys;
|
|
41
|
-
import java.util.HashMap;
|
|
42
|
-
import java.util.List;
|
|
43
|
-
import java.util.ArrayList;
|
|
44
|
-
|
|
45
|
-
`;
|
|
46
|
-
|
|
47
|
-
let hooks = [];
|
|
48
|
-
|
|
49
|
-
function register(statement) {
|
|
50
|
-
hooks.push(statement);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
function clear() {
|
|
54
|
-
hooks = [];
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
function emit({ isOptional } = { isOptional: false }) {
|
|
58
|
-
if (isOptional && !hooks.length) return '';
|
|
59
|
-
return dependencies + hooks.join('\r\n');
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
exports.default = {
|
|
63
|
-
register,
|
|
64
|
-
clear,
|
|
65
|
-
emit
|
|
66
|
-
};
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
// Licensed to the Software Freedom Conservancy (SFC) under one
|
|
7
|
-
// or more contributor license agreements. See the NOTICE file
|
|
8
|
-
// distributed with this work for additional information
|
|
9
|
-
// regarding copyright ownership. The SFC licenses this file
|
|
10
|
-
// to you under the Apache License, Version 2.0 (the
|
|
11
|
-
// "License"); you may not use this file except in compliance
|
|
12
|
-
// with the License. You may obtain a copy of the License at
|
|
13
|
-
//
|
|
14
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
15
|
-
//
|
|
16
|
-
// Unless required by applicable law or agreed to in writing,
|
|
17
|
-
// software distributed under the License is distributed on an
|
|
18
|
-
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
19
|
-
// KIND, either express or implied. See the License for the
|
|
20
|
-
// specific language governing permissions and limitations
|
|
21
|
-
// under the License.
|
|
22
|
-
|
|
23
|
-
let hooks = [];
|
|
24
|
-
|
|
25
|
-
function register(name, commands) {
|
|
26
|
-
let result = '';
|
|
27
|
-
result += `
|
|
28
|
-
public void ${name}() {
|
|
29
|
-
`;
|
|
30
|
-
if (commands) {
|
|
31
|
-
commands.forEach(command => {
|
|
32
|
-
result += `\t${command}
|
|
33
|
-
`;
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
result += `}`;
|
|
37
|
-
if (!hooks.includes(result)) hooks.push(result);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
function clear() {
|
|
41
|
-
hooks = [];
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function emit({ isOptional } = { isOptional: false }) {
|
|
45
|
-
if (isOptional && !hooks.length) return '';
|
|
46
|
-
return hooks.length ? hooks.join('\n\r') : '';
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
exports.default = {
|
|
50
|
-
register,
|
|
51
|
-
clear,
|
|
52
|
-
emit
|
|
53
|
-
};
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
// Licensed to the Software Freedom Conservancy (SFC) under one
|
|
7
|
-
// or more contributor license agreements. See the NOTICE file
|
|
8
|
-
// distributed with this work for additional information
|
|
9
|
-
// regarding copyright ownership. The SFC licenses this file
|
|
10
|
-
// to you under the Apache License, Version 2.0 (the
|
|
11
|
-
// "License"); you may not use this file except in compliance
|
|
12
|
-
// with the License. You may obtain a copy of the License at
|
|
13
|
-
//
|
|
14
|
-
// http://www.apache.org/licenses/LICENSE-2.0
|
|
15
|
-
//
|
|
16
|
-
// Unless required by applicable law or agreed to in writing,
|
|
17
|
-
// software distributed under the License is distributed on an
|
|
18
|
-
// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
19
|
-
// KIND, either express or implied. See the License for the
|
|
20
|
-
// specific language governing permissions and limitations
|
|
21
|
-
// under the License.
|
|
22
|
-
|
|
23
|
-
let variables = `
|
|
24
|
-
private WebDriver driver;
|
|
25
|
-
private HashMap<String, Object> vars = new HashMap<String, Object>();
|
|
26
|
-
JavascriptExecutor js;
|
|
27
|
-
`;
|
|
28
|
-
|
|
29
|
-
let hooks = [];
|
|
30
|
-
|
|
31
|
-
function register(statement) {
|
|
32
|
-
hooks.push(statement);
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function clear() {
|
|
36
|
-
hooks = [];
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function emit({ isOptional } = { isOptional: false }) {
|
|
40
|
-
if (isOptional && !hooks.length) return '';
|
|
41
|
-
return variables + hooks.join('\r\n');
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
exports.default = {
|
|
45
|
-
register,
|
|
46
|
-
clear,
|
|
47
|
-
emit
|
|
48
|
-
};
|