@seleniumhq/side-runtime 4.0.0-alpha.31 → 4.0.0-alpha.32
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/dist/__tests__/callstack.spec.d.ts +2 -0
- package/dist/__tests__/callstack.spec.d.ts.map +1 -0
- package/dist/__tests__/callstack.spec.js +63 -0
- package/dist/__tests__/callstack.spec.js.map +1 -0
- package/dist/__tests__/integration/playback-webdriver.spec.d.ts +2 -0
- package/dist/__tests__/integration/playback-webdriver.spec.d.ts.map +1 -0
- package/dist/__tests__/integration/playback-webdriver.spec.js +249 -0
- package/dist/__tests__/integration/playback-webdriver.spec.js.map +1 -0
- package/dist/__tests__/playback-tree/command-leveler.spec.d.ts +2 -0
- package/dist/__tests__/playback-tree/command-leveler.spec.d.ts.map +1 -0
- package/dist/__tests__/playback-tree/command-leveler.spec.js +69 -0
- package/dist/__tests__/playback-tree/command-leveler.spec.js.map +1 -0
- package/dist/__tests__/playback-tree/command-node.spec.d.ts +2 -0
- package/dist/__tests__/playback-tree/command-node.spec.d.ts.map +1 -0
- package/dist/__tests__/playback-tree/command-node.spec.js +232 -0
- package/dist/__tests__/playback-tree/command-node.spec.js.map +1 -0
- package/dist/__tests__/playback-tree/playback-tree.spec.d.ts +2 -0
- package/dist/__tests__/playback-tree/playback-tree.spec.d.ts.map +1 -0
- package/dist/__tests__/playback-tree/playback-tree.spec.js +463 -0
- package/dist/__tests__/playback-tree/playback-tree.spec.js.map +1 -0
- package/dist/__tests__/playback-tree/syntax-validation.spec.d.ts +2 -0
- package/dist/__tests__/playback-tree/syntax-validation.spec.d.ts.map +1 -0
- package/dist/__tests__/playback-tree/syntax-validation.spec.js +224 -0
- package/dist/__tests__/playback-tree/syntax-validation.spec.js.map +1 -0
- package/dist/__tests__/playback.spec.d.ts +2 -0
- package/dist/__tests__/playback.spec.d.ts.map +1 -0
- package/dist/__tests__/playback.spec.js +2162 -0
- package/dist/__tests__/playback.spec.js.map +1 -0
- package/dist/__tests__/preprocessors.spec.d.ts +2 -0
- package/dist/__tests__/preprocessors.spec.d.ts.map +1 -0
- package/dist/__tests__/preprocessors.spec.js +141 -0
- package/dist/__tests__/preprocessors.spec.js.map +1 -0
- package/dist/__tests__/util/FakeExecutor.d.ts +32 -0
- package/dist/__tests__/util/FakeExecutor.d.ts.map +1 -0
- package/dist/__tests__/util/FakeExecutor.js +81 -0
- package/dist/__tests__/util/FakeExecutor.js.map +1 -0
- package/dist/__tests__/util/JestFakeExecutor.d.ts +32 -0
- package/dist/__tests__/util/JestFakeExecutor.d.ts.map +1 -0
- package/dist/__tests__/util/JestFakeExecutor.js +79 -0
- package/dist/__tests__/util/JestFakeExecutor.js.map +1 -0
- package/dist/__tests__/utils.spec.d.ts +2 -0
- package/dist/__tests__/utils.spec.d.ts.map +1 -0
- package/dist/__tests__/utils.spec.js +40 -0
- package/dist/__tests__/utils.spec.js.map +1 -0
- package/dist/__tests__/webdriver.spec.d.ts +2 -0
- package/dist/__tests__/webdriver.spec.d.ts.map +1 -0
- package/dist/__tests__/webdriver.spec.js +522 -0
- package/dist/__tests__/webdriver.spec.js.map +1 -0
- package/dist/playback-tree/command-leveler.js +3 -2
- package/dist/playback-tree/command-leveler.js.map +1 -1
- package/dist/playback-tree/command-node.d.ts.map +1 -1
- package/dist/playback-tree/command-node.js +18 -5
- package/dist/playback-tree/command-node.js.map +1 -1
- package/dist/playback-tree/commands.d.ts +10 -10
- package/dist/playback-tree/commands.d.ts.map +1 -1
- package/dist/playback-tree/commands.js.map +1 -1
- package/dist/playback-tree/index.js +4 -2
- package/dist/playback-tree/index.js.map +1 -1
- package/dist/playback-tree/syntax-validation.d.ts.map +1 -1
- package/dist/playback-tree/syntax-validation.js +3 -2
- package/dist/playback-tree/syntax-validation.js.map +1 -1
- package/dist/playback.d.ts +1 -1
- package/dist/playback.d.ts.map +1 -1
- package/dist/playback.js +16 -8
- package/dist/playback.js.map +1 -1
- package/dist/preprocessors.d.ts +1 -1
- package/dist/preprocessors.d.ts.map +1 -1
- package/dist/preprocessors.js +12 -28
- package/dist/preprocessors.js.map +1 -1
- package/dist/recording-syncronizer-webdriver.d.ts +3 -3
- package/dist/recording-syncronizer.d.ts +4 -3
- package/dist/recording-syncronizer.d.ts.map +1 -1
- package/dist/recording-syncronizer.js +1 -1
- package/dist/recording-syncronizer.js.map +1 -1
- package/dist/types.d.ts +1 -1
- package/dist/types.d.ts.map +1 -1
- package/dist/webdriver.d.ts +13 -24
- package/dist/webdriver.d.ts.map +1 -1
- package/dist/webdriver.js +110 -74
- package/dist/webdriver.js.map +1 -1
- package/package.json +8 -6
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"callstack.spec.d.ts","sourceRoot":"","sources":["../../src/__tests__/callstack.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use strict";
|
|
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
|
+
const callstack_1 = __importDefault(require("../callstack"));
|
|
23
|
+
describe('Call stack', () => {
|
|
24
|
+
it('should be able to call and unwind', () => {
|
|
25
|
+
const callee = {
|
|
26
|
+
id: '2',
|
|
27
|
+
name: 'open',
|
|
28
|
+
commands: [
|
|
29
|
+
{
|
|
30
|
+
id: 'a',
|
|
31
|
+
command: 'open',
|
|
32
|
+
target: '',
|
|
33
|
+
value: '',
|
|
34
|
+
},
|
|
35
|
+
],
|
|
36
|
+
};
|
|
37
|
+
const proc = {
|
|
38
|
+
callee,
|
|
39
|
+
caller: {
|
|
40
|
+
position: undefined,
|
|
41
|
+
tree: undefined,
|
|
42
|
+
},
|
|
43
|
+
};
|
|
44
|
+
const cs = new callstack_1.default();
|
|
45
|
+
expect(cs.length).toBe(0);
|
|
46
|
+
cs.call(proc);
|
|
47
|
+
expect(cs.length).toBe(1);
|
|
48
|
+
expect(cs.unwind()).toBe(proc);
|
|
49
|
+
expect(cs.length).toBe(0);
|
|
50
|
+
});
|
|
51
|
+
it('should throw if trying to unwind an empty stack', () => {
|
|
52
|
+
const cs = new callstack_1.default();
|
|
53
|
+
expect(() => cs.unwind()).toThrow();
|
|
54
|
+
});
|
|
55
|
+
it('should access the current executing procedure', () => {
|
|
56
|
+
const cs = new callstack_1.default();
|
|
57
|
+
const proc = {};
|
|
58
|
+
cs.call(proc);
|
|
59
|
+
expect(cs.top()).toBe(proc);
|
|
60
|
+
expect(cs.length).toBe(1);
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
//# sourceMappingURL=callstack.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"callstack.spec.js","sourceRoot":"","sources":["../../src/__tests__/callstack.spec.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;AAC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AG,IAAI,mBAAS,EAAE,CAAA;QAC1B,MAAM,IAAI,GAAG,EAA0B,CAAA;QACvC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QACb,MAAM,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;QAC3B,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IAC3B,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"playback-webdriver.spec.d.ts","sourceRoot":"","sources":["../../../src/__tests__/integration/playback-webdriver.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
"use strict";
|
|
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
|
+
const selenium_webdriver_1 = require("selenium-webdriver");
|
|
23
|
+
const webdriver_testkit_1 = require("@seleniumhq/webdriver-testkit");
|
|
24
|
+
const playback_1 = __importDefault(require("../../playback"));
|
|
25
|
+
const variables_1 = __importDefault(require("../../variables"));
|
|
26
|
+
const webdriver_1 = __importDefault(require("../../webdriver"));
|
|
27
|
+
jest.setTimeout(30000);
|
|
28
|
+
const port = 8080;
|
|
29
|
+
describe('Playback using webdriver', () => {
|
|
30
|
+
let driver, executor, variables;
|
|
31
|
+
beforeAll(async () => {
|
|
32
|
+
variables = new variables_1.default();
|
|
33
|
+
driver = await (0, webdriver_testkit_1.createHeadlessChrome)();
|
|
34
|
+
executor = new webdriver_1.default({ driver, implicitWait: 5000 });
|
|
35
|
+
});
|
|
36
|
+
afterEach(() => {
|
|
37
|
+
executor.hooks = {};
|
|
38
|
+
});
|
|
39
|
+
afterAll(async () => {
|
|
40
|
+
await driver.quit();
|
|
41
|
+
});
|
|
42
|
+
afterEach(async () => {
|
|
43
|
+
try {
|
|
44
|
+
await driver.actions({ bridge: true }).clear();
|
|
45
|
+
}
|
|
46
|
+
catch (err) {
|
|
47
|
+
// chromedriver doesn't support clear()
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
it('should run a test using WebDriverExecutor', async () => {
|
|
51
|
+
const test = {
|
|
52
|
+
id: '1',
|
|
53
|
+
name: 'test',
|
|
54
|
+
commands: [
|
|
55
|
+
{
|
|
56
|
+
id: 'a',
|
|
57
|
+
command: 'open',
|
|
58
|
+
target: '/check.html',
|
|
59
|
+
value: '',
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
id: 'b',
|
|
63
|
+
command: 'uncheck',
|
|
64
|
+
target: 'id=t',
|
|
65
|
+
value: '',
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
id: 'c',
|
|
69
|
+
command: 'check',
|
|
70
|
+
target: 'id=f',
|
|
71
|
+
value: '',
|
|
72
|
+
},
|
|
73
|
+
],
|
|
74
|
+
};
|
|
75
|
+
const playback = new playback_1.default({
|
|
76
|
+
baseUrl: `http://localhost:${port}`,
|
|
77
|
+
executor,
|
|
78
|
+
getTestByName: () => test,
|
|
79
|
+
logger: console,
|
|
80
|
+
variables,
|
|
81
|
+
});
|
|
82
|
+
await (await playback.play(test))();
|
|
83
|
+
const element = await driver.findElement(selenium_webdriver_1.By.id('f'));
|
|
84
|
+
expect(await element.isSelected()).toBeTruthy();
|
|
85
|
+
});
|
|
86
|
+
it('should utilize before and after commands', async () => {
|
|
87
|
+
const test = {
|
|
88
|
+
id: '1',
|
|
89
|
+
name: 'test',
|
|
90
|
+
commands: [
|
|
91
|
+
{
|
|
92
|
+
id: 'a',
|
|
93
|
+
command: 'open',
|
|
94
|
+
target: '/check.html',
|
|
95
|
+
value: '',
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
id: 'b',
|
|
99
|
+
command: 'uncheck',
|
|
100
|
+
target: 'id=t',
|
|
101
|
+
value: '',
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
id: 'c',
|
|
105
|
+
command: 'check',
|
|
106
|
+
target: 'id=f',
|
|
107
|
+
value: '',
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
};
|
|
111
|
+
const playback = new playback_1.default({
|
|
112
|
+
executor,
|
|
113
|
+
variables,
|
|
114
|
+
baseUrl: `http://localhost:${port}/`,
|
|
115
|
+
});
|
|
116
|
+
executor.hooks = {
|
|
117
|
+
onAfterCommand: jest.fn(),
|
|
118
|
+
onBeforeCommand: jest.fn(),
|
|
119
|
+
};
|
|
120
|
+
await (await playback.play(test))();
|
|
121
|
+
expect(executor.hooks.onBeforeCommand).toHaveBeenCalledTimes(3);
|
|
122
|
+
expect(executor.hooks.onAfterCommand).toHaveBeenCalledTimes(3);
|
|
123
|
+
expect(executor.hooks.onBeforeCommand.mock.calls[0]).toEqual([
|
|
124
|
+
{
|
|
125
|
+
command: test.commands[0],
|
|
126
|
+
},
|
|
127
|
+
]);
|
|
128
|
+
expect(executor.hooks.onAfterCommand.mock.calls[0]).toEqual([
|
|
129
|
+
{
|
|
130
|
+
command: test.commands[0],
|
|
131
|
+
},
|
|
132
|
+
]);
|
|
133
|
+
});
|
|
134
|
+
it('should inform of a new window', async () => {
|
|
135
|
+
const test = {
|
|
136
|
+
id: '1',
|
|
137
|
+
name: 'test',
|
|
138
|
+
commands: [
|
|
139
|
+
{
|
|
140
|
+
id: 'a',
|
|
141
|
+
command: 'open',
|
|
142
|
+
target: '/windows.html',
|
|
143
|
+
value: '',
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
id: 'b',
|
|
147
|
+
command: 'click',
|
|
148
|
+
target: 'css=a',
|
|
149
|
+
value: '',
|
|
150
|
+
opensWindow: true,
|
|
151
|
+
windowHandleName: 'new',
|
|
152
|
+
windowTimeout: 200,
|
|
153
|
+
},
|
|
154
|
+
],
|
|
155
|
+
};
|
|
156
|
+
const playback = new playback_1.default({
|
|
157
|
+
executor,
|
|
158
|
+
variables,
|
|
159
|
+
baseUrl: `http://localhost:${port}/`,
|
|
160
|
+
});
|
|
161
|
+
executor.hooks = {
|
|
162
|
+
onWindowAppeared: jest.fn(),
|
|
163
|
+
};
|
|
164
|
+
await (await playback.play(test))();
|
|
165
|
+
expect(executor.hooks.onWindowAppeared).toHaveBeenCalledTimes(1);
|
|
166
|
+
expect(executor.hooks.onWindowAppeared.mock.calls[0]).toMatchObject([
|
|
167
|
+
{
|
|
168
|
+
command: test.commands[1],
|
|
169
|
+
windowHandleName: test.commands[1].windowHandleName,
|
|
170
|
+
windowHandle: expect.stringMatching(/^\w+$/),
|
|
171
|
+
},
|
|
172
|
+
]);
|
|
173
|
+
});
|
|
174
|
+
it('should wait for hook execution to complete', async () => {
|
|
175
|
+
let didExecute = false;
|
|
176
|
+
const test = {
|
|
177
|
+
id: '1',
|
|
178
|
+
name: 'test',
|
|
179
|
+
commands: [
|
|
180
|
+
{
|
|
181
|
+
id: 'a',
|
|
182
|
+
command: 'open',
|
|
183
|
+
target: '/windows.html',
|
|
184
|
+
value: '',
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
id: 'b',
|
|
188
|
+
command: 'click',
|
|
189
|
+
target: 'css=a',
|
|
190
|
+
value: '',
|
|
191
|
+
opensWindow: true,
|
|
192
|
+
windowHandleName: 'new',
|
|
193
|
+
windowTimeout: 200,
|
|
194
|
+
},
|
|
195
|
+
],
|
|
196
|
+
};
|
|
197
|
+
const playback = new playback_1.default({
|
|
198
|
+
executor,
|
|
199
|
+
variables,
|
|
200
|
+
baseUrl: `http://localhost:${port}/`,
|
|
201
|
+
});
|
|
202
|
+
executor.hooks = {
|
|
203
|
+
onWindowAppeared: () => {
|
|
204
|
+
return new Promise((res) => {
|
|
205
|
+
setTimeout(() => {
|
|
206
|
+
didExecute = true;
|
|
207
|
+
res();
|
|
208
|
+
}, 10);
|
|
209
|
+
});
|
|
210
|
+
},
|
|
211
|
+
};
|
|
212
|
+
await (await playback.play(test))();
|
|
213
|
+
expect(didExecute).toBeTruthy();
|
|
214
|
+
});
|
|
215
|
+
it('should perform locator fallback', async () => {
|
|
216
|
+
const test = {
|
|
217
|
+
id: '1',
|
|
218
|
+
name: 'test',
|
|
219
|
+
commands: [
|
|
220
|
+
{
|
|
221
|
+
id: 'a',
|
|
222
|
+
command: 'open',
|
|
223
|
+
target: '/check.html',
|
|
224
|
+
value: '',
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
id: 'b',
|
|
228
|
+
command: 'uncheck',
|
|
229
|
+
target: 'id=nan',
|
|
230
|
+
value: '',
|
|
231
|
+
targetFallback: [
|
|
232
|
+
['id=stillnan', 'id'],
|
|
233
|
+
['id=t', 'id'],
|
|
234
|
+
['id=broken', 'id'],
|
|
235
|
+
],
|
|
236
|
+
},
|
|
237
|
+
],
|
|
238
|
+
};
|
|
239
|
+
const playback = new playback_1.default({
|
|
240
|
+
executor,
|
|
241
|
+
variables,
|
|
242
|
+
baseUrl: `http://localhost:${port}/`,
|
|
243
|
+
});
|
|
244
|
+
await (await playback.play(test))();
|
|
245
|
+
const element = await driver.findElement(selenium_webdriver_1.By.id('t'));
|
|
246
|
+
expect(await element.isSelected()).toBeFalsy();
|
|
247
|
+
});
|
|
248
|
+
});
|
|
249
|
+
//# sourceMappingURL=playback-webdriver.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"playback-webdriver.spec.js","sourceRoot":"","sources":["../../../src/__tests__/integration/playback-webdriver.spec.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,2DAAkD;AAClD,qEAAoE;AACpE,8DAAqC;AACrC,gEAAuC;AACvC,gEAA+C;AAG/C,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,CAAA;AAEtB,MAAM,IAAI,GAAG,IAAI,CAAA;AACjB,QAAQ,CAAC,0BAA0B,EAAE,GAAG,EAAE;IACxC,IAAI,MAAiB,EAAE,QAA2B,EAAE,SAAoB,CAAA;IACxE,SAAS,CAAC,KAAK,IAAI,EAAE;QACnB,SAAS,GAAG,IAAI,mBAAS,EAAE,CAAA;QAC3B,MAAM,GAAG,MAAM,IAAA,wCAAoB,GAAE,CAAA;QACrC,QAAQ,GAAG,IAAI,mBAAiB,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,IAAI,EAAE,CAAC,CAAA;IAClE,CAAC,CAAC,CAAA;IACF,SAAS,CAAC,GAAG,EAAE;QACb,QAAQ,CAAC,KAAK,GAAG,EAAE,CAAA;IACrB,CAAC,CAAC,CAAA;IACF,QAAQ,CAAC,KAAK,IAAI,EAAE;QAClB,MAAM,MAAM,CAAC,IAAI,EAAE,CAAA;IACrB,CAAC,CAAC,CAAA;IACF,SAA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EAAE,EAAE,GAAG;YACP,IAAI,EAAE,MAAM;YACZ,QAAQ,EAAE;gBACR;oBACE,EAAE,EAAE,GAAG;oBACP,OAAO,EAAE,MAAM;oBACf,MAAM,EAAE,aAAa;oBACrB,KAAK,EAAE,EAAE;iBACV;gBACD;oBACE,EAAE,EAAE,GAAG;oBACP,OAAO,EAAE,SAAS;oBAClB,MAAM,EAAE,QAAQ;oBAChB,KAAK,EAAE,EAAE;oBACT,cAAc,EAAE;wBACd,CAAC,aAAa,EAAE,IAAI,CAAC;wBACrB,CAAC,MAAM,EAAE,IAAI,CAAC;wBACd,CAAC,WAAW,EAAE,IAAI,CAAC;qBACpB;iBACF;aACF;SACF,CAAA;QACD,MAAM,QAAQ,GAAG,IAAI,kBAAQ,CAAC;YAC5B,QAAQ;YACR,SAAS;YACT,OAAO,EAAE,oBAAoB,IAAI,GAAG;SACnB,CAAC,CAAA;QACpB,MAAM,CACJ,MAAM,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,CAC1B,EAAE,CAAA;QACH,MAAM,OAAO,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,uBAAE,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAA;QACpD,MAAM,CAAC,MAAM,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC,SAAS,EAAE,CAAA;IAChD,CAAC,CAAC,CAAA;AACJ,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-leveler.spec.d.ts","sourceRoot":"","sources":["../../../src/__tests__/playback-tree/command-leveler.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
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
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
19
|
+
const commands_1 = require("../../playback-tree/commands");
|
|
20
|
+
const command_leveler_1 = require("../../playback-tree/command-leveler");
|
|
21
|
+
function createCommand(command) {
|
|
22
|
+
return {
|
|
23
|
+
id: 'a',
|
|
24
|
+
command,
|
|
25
|
+
target: '',
|
|
26
|
+
value: '',
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
describe('Control Flow', () => {
|
|
30
|
+
describe('Preprocess', () => {
|
|
31
|
+
describe('Leveling', () => {
|
|
32
|
+
test('returns leveled command stack', () => {
|
|
33
|
+
let stack = (0, command_leveler_1.deriveCommandLevels)([
|
|
34
|
+
createCommand(commands_1.ControlFlowCommandNames.if),
|
|
35
|
+
createCommand('command'),
|
|
36
|
+
createCommand(commands_1.ControlFlowCommandNames.else),
|
|
37
|
+
createCommand(commands_1.ControlFlowCommandNames.while),
|
|
38
|
+
createCommand('command'),
|
|
39
|
+
createCommand(commands_1.ControlFlowCommandNames.end),
|
|
40
|
+
createCommand(commands_1.ControlFlowCommandNames.do),
|
|
41
|
+
createCommand('command'),
|
|
42
|
+
createCommand(commands_1.ControlFlowCommandNames.while),
|
|
43
|
+
createCommand('command'),
|
|
44
|
+
createCommand(commands_1.ControlFlowCommandNames.end),
|
|
45
|
+
createCommand(commands_1.ControlFlowCommandNames.repeatIf),
|
|
46
|
+
createCommand(commands_1.ControlFlowCommandNames.forEach),
|
|
47
|
+
createCommand(commands_1.ControlFlowCommandNames.end),
|
|
48
|
+
createCommand(commands_1.ControlFlowCommandNames.end),
|
|
49
|
+
]);
|
|
50
|
+
expect(stack[0]).toEqual(0); // if
|
|
51
|
+
expect(stack[1]).toEqual(1); // command
|
|
52
|
+
expect(stack[2]).toEqual(0); // else
|
|
53
|
+
expect(stack[3]).toEqual(1); // while
|
|
54
|
+
expect(stack[4]).toEqual(2); // command
|
|
55
|
+
expect(stack[5]).toEqual(1); // end
|
|
56
|
+
expect(stack[6]).toEqual(1); // do
|
|
57
|
+
expect(stack[7]).toEqual(2); // command
|
|
58
|
+
expect(stack[8]).toEqual(2); // while
|
|
59
|
+
expect(stack[9]).toEqual(3); // command
|
|
60
|
+
expect(stack[10]).toEqual(2); // end
|
|
61
|
+
expect(stack[11]).toEqual(1); // repeatIf
|
|
62
|
+
expect(stack[12]).toEqual(1); // forEach
|
|
63
|
+
expect(stack[13]).toEqual(1); // end
|
|
64
|
+
expect(stack[14]).toEqual(0); // end
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
//# sourceMappingURL=command-leveler.spec.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-leveler.spec.js","sourceRoot":"","sources":["../../../src/__tests__/playback-tree/command-leveler.spec.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,2DAAsE;AACtE,yEAAyE;AAEzE,SAAS,aAAa,CAAC,OAAe;IACpC,OAAO;QACL,EAAE,EAAE,GAAG;QACP,OAAO;QACP,MAAM,EAAE,EAAE;QACV,KAAK,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,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"command-node.spec.d.ts","sourceRoot":"","sources":["../../../src/__tests__/playback-tree/command-node.spec.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,232 @@
|
|
|
1
|
+
"use strict";
|
|
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
|
+
const commands_1 = require("../../playback-tree/commands");
|
|
23
|
+
const command_node_1 = require("../../playback-tree/command-node");
|
|
24
|
+
const variables_1 = __importDefault(require("../../variables"));
|
|
25
|
+
const FakeExecutor_1 = __importDefault(require("../util/FakeExecutor"));
|
|
26
|
+
describe('Command Node', () => {
|
|
27
|
+
let variables;
|
|
28
|
+
beforeEach(() => {
|
|
29
|
+
variables = new variables_1.default();
|
|
30
|
+
});
|
|
31
|
+
it('control flow check returns correct result', () => {
|
|
32
|
+
let node = new command_node_1.CommandNode(undefined);
|
|
33
|
+
// @ts-expect-error
|
|
34
|
+
node.right = 'asdf';
|
|
35
|
+
expect(node.isControlFlow()).toBeTruthy();
|
|
36
|
+
node.left = undefined;
|
|
37
|
+
// @ts-expect-error
|
|
38
|
+
node.right = 'asdf';
|
|
39
|
+
expect(node.isControlFlow()).toBeTruthy();
|
|
40
|
+
});
|
|
41
|
+
it('retry limit defaults to 1000', () => {
|
|
42
|
+
const command = {
|
|
43
|
+
id: 'a',
|
|
44
|
+
command: commands_1.ControlFlowCommandNames.times,
|
|
45
|
+
target: '',
|
|
46
|
+
value: '',
|
|
47
|
+
};
|
|
48
|
+
const node = new command_node_1.CommandNode(command);
|
|
49
|
+
node.timesVisited = 999;
|
|
50
|
+
expect(node._isRetryLimit()).toBeFalsy();
|
|
51
|
+
node.timesVisited = 1000;
|
|
52
|
+
expect(node._isRetryLimit()).toBeTruthy();
|
|
53
|
+
});
|
|
54
|
+
it('retry limit can be overriden', () => {
|
|
55
|
+
const command = {
|
|
56
|
+
id: 'a',
|
|
57
|
+
command: commands_1.ControlFlowCommandNames.repeatIf,
|
|
58
|
+
target: '',
|
|
59
|
+
value: '5',
|
|
60
|
+
};
|
|
61
|
+
const node = new command_node_1.CommandNode(command);
|
|
62
|
+
node.timesVisited = 5;
|
|
63
|
+
expect(node._isRetryLimit()).toBeTruthy();
|
|
64
|
+
});
|
|
65
|
+
it('forEach fetches count from preset variable', () => {
|
|
66
|
+
const collectionName = 'blah';
|
|
67
|
+
variables.set(collectionName, [
|
|
68
|
+
{ a: 'a1', b: 'b1' },
|
|
69
|
+
{ a: 'a2', b: 'b2' },
|
|
70
|
+
]);
|
|
71
|
+
const command = {
|
|
72
|
+
id: 'a',
|
|
73
|
+
command: commands_1.ControlFlowCommandNames.forEach,
|
|
74
|
+
target: collectionName,
|
|
75
|
+
value: 'iteratorVar',
|
|
76
|
+
};
|
|
77
|
+
const node = new command_node_1.CommandNode(command);
|
|
78
|
+
expect(node.evaluateForEach(variables)).toEqual(true);
|
|
79
|
+
});
|
|
80
|
+
it('forEach errors without a valid variable', () => {
|
|
81
|
+
const command = {
|
|
82
|
+
id: 'a',
|
|
83
|
+
command: commands_1.ControlFlowCommandNames.forEach,
|
|
84
|
+
target: 'asdf',
|
|
85
|
+
value: '',
|
|
86
|
+
};
|
|
87
|
+
const node = new command_node_1.CommandNode(command);
|
|
88
|
+
const result = node.evaluateForEach(variables);
|
|
89
|
+
expect(result).toEqual('Invalid variable provided.');
|
|
90
|
+
});
|
|
91
|
+
it('forEach stores iterated collection entry on a variable using the provided name', () => {
|
|
92
|
+
const collectionName = 'asdf';
|
|
93
|
+
variables.set(collectionName, [
|
|
94
|
+
{ a: 'a1', b: 'b1' },
|
|
95
|
+
{ a: 'a2', b: 'b2' },
|
|
96
|
+
]);
|
|
97
|
+
const command = {
|
|
98
|
+
id: 'a',
|
|
99
|
+
command: commands_1.ControlFlowCommandNames.forEach,
|
|
100
|
+
target: collectionName,
|
|
101
|
+
value: 'iteratorVar',
|
|
102
|
+
};
|
|
103
|
+
const node = new command_node_1.CommandNode(command);
|
|
104
|
+
node.evaluateForEach(variables);
|
|
105
|
+
expect(variables.get('iteratorVar')).toEqual({ a: 'a1', b: 'b1' });
|
|
106
|
+
});
|
|
107
|
+
it('forEach resets timesVisited after completing', () => {
|
|
108
|
+
const collection = { name: 'asdf', value: [{ a: 'a' }, { b: 'b' }] };
|
|
109
|
+
variables.set(collection.name, collection.value);
|
|
110
|
+
const node = new command_node_1.CommandNode({
|
|
111
|
+
id: 'a',
|
|
112
|
+
command: commands_1.ControlFlowCommandNames.forEach,
|
|
113
|
+
target: collection.name,
|
|
114
|
+
value: 'iteratorVar',
|
|
115
|
+
});
|
|
116
|
+
node.timesVisited = collection.value.length + 1;
|
|
117
|
+
node.evaluateForEach(variables);
|
|
118
|
+
expect(node.timesVisited).toEqual(-1);
|
|
119
|
+
});
|
|
120
|
+
it('execute resolves with an error message when too many retries attempted in a loop', () => {
|
|
121
|
+
const command = {
|
|
122
|
+
id: 'a',
|
|
123
|
+
command: commands_1.ControlFlowCommandNames.while,
|
|
124
|
+
target: '',
|
|
125
|
+
value: '2',
|
|
126
|
+
};
|
|
127
|
+
const executor = new FakeExecutor_1.default();
|
|
128
|
+
const node = new command_node_1.CommandNode(command);
|
|
129
|
+
node.timesVisited = 3;
|
|
130
|
+
return node.execute(executor).catch((err) => {
|
|
131
|
+
expect(err.message).toEqual('Max retry limit exceeded. To override it, specify a new limit in the value input field.');
|
|
132
|
+
});
|
|
133
|
+
});
|
|
134
|
+
it("evaluate resolves with an error message on 'times' when an invalid number is provided", async () => {
|
|
135
|
+
const command = {
|
|
136
|
+
id: 'a',
|
|
137
|
+
command: commands_1.ControlFlowCommandNames.times,
|
|
138
|
+
target: 'asdf',
|
|
139
|
+
value: '',
|
|
140
|
+
};
|
|
141
|
+
const executor = new FakeExecutor_1.default();
|
|
142
|
+
executor.init({ variables: new variables_1.default() });
|
|
143
|
+
const node = new command_node_1.CommandNode(command);
|
|
144
|
+
try {
|
|
145
|
+
await node._evaluate(executor);
|
|
146
|
+
}
|
|
147
|
+
catch (err) {
|
|
148
|
+
expect(err.message).toEqual('Invalid number provided as a target.');
|
|
149
|
+
}
|
|
150
|
+
});
|
|
151
|
+
it('timesVisited only increments for control flow commands', () => {
|
|
152
|
+
let command = {
|
|
153
|
+
id: 'a',
|
|
154
|
+
command: commands_1.ControlFlowCommandNames.times,
|
|
155
|
+
target: '',
|
|
156
|
+
value: '',
|
|
157
|
+
};
|
|
158
|
+
let node = new command_node_1.CommandNode(command);
|
|
159
|
+
expect(node.timesVisited).toBe(0);
|
|
160
|
+
node._incrementTimesVisited();
|
|
161
|
+
expect(node.timesVisited).toBe(1);
|
|
162
|
+
const nextCommand = {
|
|
163
|
+
id: 'a',
|
|
164
|
+
command: 'command',
|
|
165
|
+
target: '',
|
|
166
|
+
value: '',
|
|
167
|
+
};
|
|
168
|
+
node = new command_node_1.CommandNode(nextCommand);
|
|
169
|
+
expect(node.timesVisited).toBe(0);
|
|
170
|
+
node._incrementTimesVisited();
|
|
171
|
+
expect(node.timesVisited).toBe(0);
|
|
172
|
+
});
|
|
173
|
+
it("evaluationResult returns the 'right' node on true", () => {
|
|
174
|
+
const command = {
|
|
175
|
+
id: 'a',
|
|
176
|
+
command: 'a',
|
|
177
|
+
target: '',
|
|
178
|
+
value: '',
|
|
179
|
+
};
|
|
180
|
+
const node = new command_node_1.CommandNode(command);
|
|
181
|
+
// @ts-expect-error
|
|
182
|
+
node.right = 'b';
|
|
183
|
+
// @ts-expect-error
|
|
184
|
+
node.left = 'c';
|
|
185
|
+
const result = node._evaluationResult({ value: true });
|
|
186
|
+
expect(result.next).toEqual('b');
|
|
187
|
+
});
|
|
188
|
+
it("evaluationResult returns the 'left' node on false", () => {
|
|
189
|
+
const command = {
|
|
190
|
+
id: 'a',
|
|
191
|
+
command: 'a',
|
|
192
|
+
target: '',
|
|
193
|
+
value: '',
|
|
194
|
+
};
|
|
195
|
+
const node = new command_node_1.CommandNode(command);
|
|
196
|
+
// @ts-expect-error
|
|
197
|
+
node.right = 'b';
|
|
198
|
+
// @ts-expect-error
|
|
199
|
+
node.left = 'c';
|
|
200
|
+
const result = node._evaluationResult({ value: false });
|
|
201
|
+
expect(result.next).toEqual('c');
|
|
202
|
+
});
|
|
203
|
+
it("executionResult returns the 'next' node on non-controlflow commands", () => {
|
|
204
|
+
const command = {
|
|
205
|
+
id: 'a',
|
|
206
|
+
command: 'open',
|
|
207
|
+
target: '',
|
|
208
|
+
value: '',
|
|
209
|
+
};
|
|
210
|
+
let nodeA = new command_node_1.CommandNode(command);
|
|
211
|
+
const nodeB = new command_node_1.CommandNode(command);
|
|
212
|
+
nodeA.next = nodeB;
|
|
213
|
+
expect(nodeA._executionResult().next).toEqual(nodeB);
|
|
214
|
+
});
|
|
215
|
+
it("executionResult returns a 'next' node on control flow", () => {
|
|
216
|
+
const command = {
|
|
217
|
+
id: 'a',
|
|
218
|
+
command: commands_1.ControlFlowCommandNames.if,
|
|
219
|
+
target: '',
|
|
220
|
+
value: '',
|
|
221
|
+
};
|
|
222
|
+
let nodeA = new command_node_1.CommandNode(command);
|
|
223
|
+
// @ts-expect-error
|
|
224
|
+
nodeA.left = 'asdf';
|
|
225
|
+
const nodeB = new command_node_1.CommandNode(command);
|
|
226
|
+
const result = {
|
|
227
|
+
next: nodeB,
|
|
228
|
+
};
|
|
229
|
+
expect(nodeA._executionResult(result).next).toEqual(nodeB);
|
|
230
|
+
});
|
|
231
|
+
});
|
|
232
|
+
//# sourceMappingURL=command-node.spec.js.map
|