@stencil/playwright 0.2.3 → 1.2.3-next.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/dist/index.js +13 -10
- package/dist/index.js.map +2 -2
- package/dist/playwright-page.d.ts +1 -1
- package/package.json +22 -10
- package/dist/index.cjs +0 -957
- package/dist/index.cjs.map +0 -7
package/dist/index.cjs
DELETED
|
@@ -1,957 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
9
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
-
};
|
|
11
|
-
var __export = (target, all) => {
|
|
12
|
-
for (var name in all)
|
|
13
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
14
|
-
};
|
|
15
|
-
var __copyProps = (to, from, except, desc) => {
|
|
16
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
-
for (let key of __getOwnPropNames(from))
|
|
18
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
19
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
20
|
-
}
|
|
21
|
-
return to;
|
|
22
|
-
};
|
|
23
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
24
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
25
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
26
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
27
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
28
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
29
|
-
mod
|
|
30
|
-
));
|
|
31
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
|
-
|
|
33
|
-
// node_modules/deepmerge/dist/cjs.js
|
|
34
|
-
var require_cjs = __commonJS({
|
|
35
|
-
"node_modules/deepmerge/dist/cjs.js"(exports2, module2) {
|
|
36
|
-
"use strict";
|
|
37
|
-
var isMergeableObject = function isMergeableObject2(value) {
|
|
38
|
-
return isNonNullObject(value) && !isSpecial(value);
|
|
39
|
-
};
|
|
40
|
-
function isNonNullObject(value) {
|
|
41
|
-
return !!value && typeof value === "object";
|
|
42
|
-
}
|
|
43
|
-
function isSpecial(value) {
|
|
44
|
-
var stringValue = Object.prototype.toString.call(value);
|
|
45
|
-
return stringValue === "[object RegExp]" || stringValue === "[object Date]" || isReactElement(value);
|
|
46
|
-
}
|
|
47
|
-
var canUseSymbol = typeof Symbol === "function" && Symbol.for;
|
|
48
|
-
var REACT_ELEMENT_TYPE = canUseSymbol ? Symbol.for("react.element") : 60103;
|
|
49
|
-
function isReactElement(value) {
|
|
50
|
-
return value.$$typeof === REACT_ELEMENT_TYPE;
|
|
51
|
-
}
|
|
52
|
-
function emptyTarget(val) {
|
|
53
|
-
return Array.isArray(val) ? [] : {};
|
|
54
|
-
}
|
|
55
|
-
function cloneUnlessOtherwiseSpecified(value, options) {
|
|
56
|
-
return options.clone !== false && options.isMergeableObject(value) ? deepmerge(emptyTarget(value), value, options) : value;
|
|
57
|
-
}
|
|
58
|
-
function defaultArrayMerge(target, source, options) {
|
|
59
|
-
return target.concat(source).map(function(element) {
|
|
60
|
-
return cloneUnlessOtherwiseSpecified(element, options);
|
|
61
|
-
});
|
|
62
|
-
}
|
|
63
|
-
function getMergeFunction(key, options) {
|
|
64
|
-
if (!options.customMerge) {
|
|
65
|
-
return deepmerge;
|
|
66
|
-
}
|
|
67
|
-
var customMerge = options.customMerge(key);
|
|
68
|
-
return typeof customMerge === "function" ? customMerge : deepmerge;
|
|
69
|
-
}
|
|
70
|
-
function getEnumerableOwnPropertySymbols(target) {
|
|
71
|
-
return Object.getOwnPropertySymbols ? Object.getOwnPropertySymbols(target).filter(function(symbol) {
|
|
72
|
-
return Object.propertyIsEnumerable.call(target, symbol);
|
|
73
|
-
}) : [];
|
|
74
|
-
}
|
|
75
|
-
function getKeys(target) {
|
|
76
|
-
return Object.keys(target).concat(getEnumerableOwnPropertySymbols(target));
|
|
77
|
-
}
|
|
78
|
-
function propertyIsOnObject(object, property) {
|
|
79
|
-
try {
|
|
80
|
-
return property in object;
|
|
81
|
-
} catch (_) {
|
|
82
|
-
return false;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
function propertyIsUnsafe(target, key) {
|
|
86
|
-
return propertyIsOnObject(target, key) && !(Object.hasOwnProperty.call(target, key) && Object.propertyIsEnumerable.call(target, key));
|
|
87
|
-
}
|
|
88
|
-
function mergeObject(target, source, options) {
|
|
89
|
-
var destination = {};
|
|
90
|
-
if (options.isMergeableObject(target)) {
|
|
91
|
-
getKeys(target).forEach(function(key) {
|
|
92
|
-
destination[key] = cloneUnlessOtherwiseSpecified(target[key], options);
|
|
93
|
-
});
|
|
94
|
-
}
|
|
95
|
-
getKeys(source).forEach(function(key) {
|
|
96
|
-
if (propertyIsUnsafe(target, key)) {
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
if (propertyIsOnObject(target, key) && options.isMergeableObject(source[key])) {
|
|
100
|
-
destination[key] = getMergeFunction(key, options)(target[key], source[key], options);
|
|
101
|
-
} else {
|
|
102
|
-
destination[key] = cloneUnlessOtherwiseSpecified(source[key], options);
|
|
103
|
-
}
|
|
104
|
-
});
|
|
105
|
-
return destination;
|
|
106
|
-
}
|
|
107
|
-
function deepmerge(target, source, options) {
|
|
108
|
-
options = options || {};
|
|
109
|
-
options.arrayMerge = options.arrayMerge || defaultArrayMerge;
|
|
110
|
-
options.isMergeableObject = options.isMergeableObject || isMergeableObject;
|
|
111
|
-
options.cloneUnlessOtherwiseSpecified = cloneUnlessOtherwiseSpecified;
|
|
112
|
-
var sourceIsArray = Array.isArray(source);
|
|
113
|
-
var targetIsArray = Array.isArray(target);
|
|
114
|
-
var sourceAndTargetTypesMatch = sourceIsArray === targetIsArray;
|
|
115
|
-
if (!sourceAndTargetTypesMatch) {
|
|
116
|
-
return cloneUnlessOtherwiseSpecified(source, options);
|
|
117
|
-
} else if (sourceIsArray) {
|
|
118
|
-
return options.arrayMerge(target, source, options);
|
|
119
|
-
} else {
|
|
120
|
-
return mergeObject(target, source, options);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
deepmerge.all = function deepmergeAll(array, options) {
|
|
124
|
-
if (!Array.isArray(array)) {
|
|
125
|
-
throw new Error("first argument should be an array");
|
|
126
|
-
}
|
|
127
|
-
return array.reduce(function(prev, next) {
|
|
128
|
-
return deepmerge(prev, next, options);
|
|
129
|
-
}, {});
|
|
130
|
-
};
|
|
131
|
-
var deepmerge_1 = deepmerge;
|
|
132
|
-
module2.exports = deepmerge_1;
|
|
133
|
-
}
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
// node_modules/fast-deep-equal/index.js
|
|
137
|
-
var require_fast_deep_equal = __commonJS({
|
|
138
|
-
"node_modules/fast-deep-equal/index.js"(exports2, module2) {
|
|
139
|
-
"use strict";
|
|
140
|
-
module2.exports = function equal(a, b) {
|
|
141
|
-
if (a === b) return true;
|
|
142
|
-
if (a && b && typeof a == "object" && typeof b == "object") {
|
|
143
|
-
if (a.constructor !== b.constructor) return false;
|
|
144
|
-
var length, i, keys;
|
|
145
|
-
if (Array.isArray(a)) {
|
|
146
|
-
length = a.length;
|
|
147
|
-
if (length != b.length) return false;
|
|
148
|
-
for (i = length; i-- !== 0; )
|
|
149
|
-
if (!equal(a[i], b[i])) return false;
|
|
150
|
-
return true;
|
|
151
|
-
}
|
|
152
|
-
if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
|
|
153
|
-
if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
|
|
154
|
-
if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
|
|
155
|
-
keys = Object.keys(a);
|
|
156
|
-
length = keys.length;
|
|
157
|
-
if (length !== Object.keys(b).length) return false;
|
|
158
|
-
for (i = length; i-- !== 0; )
|
|
159
|
-
if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
|
|
160
|
-
for (i = length; i-- !== 0; ) {
|
|
161
|
-
var key = keys[i];
|
|
162
|
-
if (!equal(a[key], b[key])) return false;
|
|
163
|
-
}
|
|
164
|
-
return true;
|
|
165
|
-
}
|
|
166
|
-
return a !== a && b !== b;
|
|
167
|
-
};
|
|
168
|
-
}
|
|
169
|
-
});
|
|
170
|
-
|
|
171
|
-
// src/index.ts
|
|
172
|
-
var index_exports = {};
|
|
173
|
-
__export(index_exports, {
|
|
174
|
-
createConfig: () => createConfig,
|
|
175
|
-
goto: () => goto,
|
|
176
|
-
locator: () => locator,
|
|
177
|
-
matchers: () => matchers,
|
|
178
|
-
setContent: () => setContent,
|
|
179
|
-
spyOnEvent: () => spyOnEvent,
|
|
180
|
-
test: () => test,
|
|
181
|
-
waitForChanges: () => waitForChanges
|
|
182
|
-
});
|
|
183
|
-
module.exports = __toCommonJS(index_exports);
|
|
184
|
-
|
|
185
|
-
// src/create-config.ts
|
|
186
|
-
var import_deepmerge = __toESM(require_cjs());
|
|
187
|
-
|
|
188
|
-
// src/load-config-meta.ts
|
|
189
|
-
var import_compiler = require("@stencil/core/compiler");
|
|
190
|
-
|
|
191
|
-
// node_modules/find-up/index.js
|
|
192
|
-
var import_node_path2 = __toESM(require("node:path"), 1);
|
|
193
|
-
|
|
194
|
-
// node_modules/locate-path/index.js
|
|
195
|
-
var import_node_process = __toESM(require("node:process"), 1);
|
|
196
|
-
var import_node_path = __toESM(require("node:path"), 1);
|
|
197
|
-
var import_node_fs = __toESM(require("node:fs"), 1);
|
|
198
|
-
var import_node_url = require("node:url");
|
|
199
|
-
|
|
200
|
-
// node_modules/p-locate/node_modules/yocto-queue/index.js
|
|
201
|
-
var Node = class {
|
|
202
|
-
value;
|
|
203
|
-
next;
|
|
204
|
-
constructor(value) {
|
|
205
|
-
this.value = value;
|
|
206
|
-
}
|
|
207
|
-
};
|
|
208
|
-
var Queue = class {
|
|
209
|
-
#head;
|
|
210
|
-
#tail;
|
|
211
|
-
#size;
|
|
212
|
-
constructor() {
|
|
213
|
-
this.clear();
|
|
214
|
-
}
|
|
215
|
-
enqueue(value) {
|
|
216
|
-
const node = new Node(value);
|
|
217
|
-
if (this.#head) {
|
|
218
|
-
this.#tail.next = node;
|
|
219
|
-
this.#tail = node;
|
|
220
|
-
} else {
|
|
221
|
-
this.#head = node;
|
|
222
|
-
this.#tail = node;
|
|
223
|
-
}
|
|
224
|
-
this.#size++;
|
|
225
|
-
}
|
|
226
|
-
dequeue() {
|
|
227
|
-
const current = this.#head;
|
|
228
|
-
if (!current) {
|
|
229
|
-
return;
|
|
230
|
-
}
|
|
231
|
-
this.#head = this.#head.next;
|
|
232
|
-
this.#size--;
|
|
233
|
-
return current.value;
|
|
234
|
-
}
|
|
235
|
-
peek() {
|
|
236
|
-
if (!this.#head) {
|
|
237
|
-
return;
|
|
238
|
-
}
|
|
239
|
-
return this.#head.value;
|
|
240
|
-
}
|
|
241
|
-
clear() {
|
|
242
|
-
this.#head = void 0;
|
|
243
|
-
this.#tail = void 0;
|
|
244
|
-
this.#size = 0;
|
|
245
|
-
}
|
|
246
|
-
get size() {
|
|
247
|
-
return this.#size;
|
|
248
|
-
}
|
|
249
|
-
*[Symbol.iterator]() {
|
|
250
|
-
let current = this.#head;
|
|
251
|
-
while (current) {
|
|
252
|
-
yield current.value;
|
|
253
|
-
current = current.next;
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
*drain() {
|
|
257
|
-
while (this.#head) {
|
|
258
|
-
yield this.dequeue();
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
};
|
|
262
|
-
|
|
263
|
-
// node_modules/p-locate/node_modules/p-limit/index.js
|
|
264
|
-
function pLimit(concurrency) {
|
|
265
|
-
if (!((Number.isInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency > 0)) {
|
|
266
|
-
throw new TypeError("Expected `concurrency` to be a number from 1 and up");
|
|
267
|
-
}
|
|
268
|
-
const queue = new Queue();
|
|
269
|
-
let activeCount = 0;
|
|
270
|
-
const next = () => {
|
|
271
|
-
activeCount--;
|
|
272
|
-
if (queue.size > 0) {
|
|
273
|
-
queue.dequeue()();
|
|
274
|
-
}
|
|
275
|
-
};
|
|
276
|
-
const run = async (fn, resolve, args) => {
|
|
277
|
-
activeCount++;
|
|
278
|
-
const result = (async () => fn(...args))();
|
|
279
|
-
resolve(result);
|
|
280
|
-
try {
|
|
281
|
-
await result;
|
|
282
|
-
} catch {
|
|
283
|
-
}
|
|
284
|
-
next();
|
|
285
|
-
};
|
|
286
|
-
const enqueue = (fn, resolve, args) => {
|
|
287
|
-
queue.enqueue(run.bind(void 0, fn, resolve, args));
|
|
288
|
-
(async () => {
|
|
289
|
-
await Promise.resolve();
|
|
290
|
-
if (activeCount < concurrency && queue.size > 0) {
|
|
291
|
-
queue.dequeue()();
|
|
292
|
-
}
|
|
293
|
-
})();
|
|
294
|
-
};
|
|
295
|
-
const generator = (fn, ...args) => new Promise((resolve) => {
|
|
296
|
-
enqueue(fn, resolve, args);
|
|
297
|
-
});
|
|
298
|
-
Object.defineProperties(generator, {
|
|
299
|
-
activeCount: {
|
|
300
|
-
get: () => activeCount
|
|
301
|
-
},
|
|
302
|
-
pendingCount: {
|
|
303
|
-
get: () => queue.size
|
|
304
|
-
},
|
|
305
|
-
clearQueue: {
|
|
306
|
-
value: () => {
|
|
307
|
-
queue.clear();
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
});
|
|
311
|
-
return generator;
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
// node_modules/p-locate/index.js
|
|
315
|
-
var EndError = class extends Error {
|
|
316
|
-
constructor(value) {
|
|
317
|
-
super();
|
|
318
|
-
this.value = value;
|
|
319
|
-
}
|
|
320
|
-
};
|
|
321
|
-
var testElement = async (element, tester) => tester(await element);
|
|
322
|
-
var finder = async (element) => {
|
|
323
|
-
const values = await Promise.all(element);
|
|
324
|
-
if (values[1] === true) {
|
|
325
|
-
throw new EndError(values[0]);
|
|
326
|
-
}
|
|
327
|
-
return false;
|
|
328
|
-
};
|
|
329
|
-
async function pLocate(iterable, tester, {
|
|
330
|
-
concurrency = Number.POSITIVE_INFINITY,
|
|
331
|
-
preserveOrder = true
|
|
332
|
-
} = {}) {
|
|
333
|
-
const limit = pLimit(concurrency);
|
|
334
|
-
const items = [...iterable].map((element) => [element, limit(testElement, element, tester)]);
|
|
335
|
-
const checkLimit = pLimit(preserveOrder ? 1 : Number.POSITIVE_INFINITY);
|
|
336
|
-
try {
|
|
337
|
-
await Promise.all(items.map((element) => checkLimit(finder, element)));
|
|
338
|
-
} catch (error) {
|
|
339
|
-
if (error instanceof EndError) {
|
|
340
|
-
return error.value;
|
|
341
|
-
}
|
|
342
|
-
throw error;
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
// node_modules/locate-path/index.js
|
|
347
|
-
var typeMappings = {
|
|
348
|
-
directory: "isDirectory",
|
|
349
|
-
file: "isFile"
|
|
350
|
-
};
|
|
351
|
-
function checkType(type) {
|
|
352
|
-
if (type === "both" || Object.hasOwn(typeMappings, type)) {
|
|
353
|
-
return;
|
|
354
|
-
}
|
|
355
|
-
throw new Error(`Invalid type specified: ${type}`);
|
|
356
|
-
}
|
|
357
|
-
var matchType = (type, stat) => type === "both" ? stat.isFile() || stat.isDirectory() : stat[typeMappings[type]]();
|
|
358
|
-
var toPath = (urlOrPath) => urlOrPath instanceof URL ? (0, import_node_url.fileURLToPath)(urlOrPath) : urlOrPath;
|
|
359
|
-
async function locatePath(paths, {
|
|
360
|
-
cwd = import_node_process.default.cwd(),
|
|
361
|
-
type = "file",
|
|
362
|
-
allowSymlinks = true,
|
|
363
|
-
concurrency,
|
|
364
|
-
preserveOrder
|
|
365
|
-
} = {}) {
|
|
366
|
-
checkType(type);
|
|
367
|
-
cwd = toPath(cwd);
|
|
368
|
-
const statFunction = allowSymlinks ? import_node_fs.promises.stat : import_node_fs.promises.lstat;
|
|
369
|
-
return pLocate(paths, async (path_) => {
|
|
370
|
-
try {
|
|
371
|
-
const stat = await statFunction(import_node_path.default.resolve(cwd, path_));
|
|
372
|
-
return matchType(type, stat);
|
|
373
|
-
} catch {
|
|
374
|
-
return false;
|
|
375
|
-
}
|
|
376
|
-
}, { concurrency, preserveOrder });
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
// node_modules/unicorn-magic/node.js
|
|
380
|
-
var import_node_util = require("node:util");
|
|
381
|
-
var import_node_child_process = require("node:child_process");
|
|
382
|
-
var import_node_url2 = require("node:url");
|
|
383
|
-
var execFileOriginal = (0, import_node_util.promisify)(import_node_child_process.execFile);
|
|
384
|
-
function toPath2(urlOrPath) {
|
|
385
|
-
return urlOrPath instanceof URL ? (0, import_node_url2.fileURLToPath)(urlOrPath) : urlOrPath;
|
|
386
|
-
}
|
|
387
|
-
var TEN_MEGABYTES_IN_BYTES = 10 * 1024 * 1024;
|
|
388
|
-
|
|
389
|
-
// node_modules/find-up/index.js
|
|
390
|
-
var findUpStop = Symbol("findUpStop");
|
|
391
|
-
async function findUpMultiple(name, options = {}) {
|
|
392
|
-
let directory = import_node_path2.default.resolve(toPath2(options.cwd) ?? "");
|
|
393
|
-
const { root } = import_node_path2.default.parse(directory);
|
|
394
|
-
const stopAt = import_node_path2.default.resolve(directory, toPath2(options.stopAt) ?? root);
|
|
395
|
-
const limit = options.limit ?? Number.POSITIVE_INFINITY;
|
|
396
|
-
const paths = [name].flat();
|
|
397
|
-
const runMatcher = async (locateOptions) => {
|
|
398
|
-
if (typeof name !== "function") {
|
|
399
|
-
return locatePath(paths, locateOptions);
|
|
400
|
-
}
|
|
401
|
-
const foundPath = await name(locateOptions.cwd);
|
|
402
|
-
if (typeof foundPath === "string") {
|
|
403
|
-
return locatePath([foundPath], locateOptions);
|
|
404
|
-
}
|
|
405
|
-
return foundPath;
|
|
406
|
-
};
|
|
407
|
-
const matches = [];
|
|
408
|
-
while (true) {
|
|
409
|
-
const foundPath = await runMatcher({ ...options, cwd: directory });
|
|
410
|
-
if (foundPath === findUpStop) {
|
|
411
|
-
break;
|
|
412
|
-
}
|
|
413
|
-
if (foundPath) {
|
|
414
|
-
matches.push(import_node_path2.default.resolve(directory, foundPath));
|
|
415
|
-
}
|
|
416
|
-
if (directory === stopAt || matches.length >= limit) {
|
|
417
|
-
break;
|
|
418
|
-
}
|
|
419
|
-
directory = import_node_path2.default.dirname(directory);
|
|
420
|
-
}
|
|
421
|
-
return matches;
|
|
422
|
-
}
|
|
423
|
-
async function findUp(name, options = {}) {
|
|
424
|
-
const matches = await findUpMultiple(name, { ...options, limit: 1 });
|
|
425
|
-
return matches[0];
|
|
426
|
-
}
|
|
427
|
-
|
|
428
|
-
// src/load-config-meta.ts
|
|
429
|
-
var import_fs = require("fs");
|
|
430
|
-
var import_path = require("path");
|
|
431
|
-
var DEFAULT_NAMESPACE = "app";
|
|
432
|
-
var DEFAULT_BASE_URL = "http://localhost:3333";
|
|
433
|
-
var DEFAULT_WEB_SERVER_URL = `${DEFAULT_BASE_URL}/ping`;
|
|
434
|
-
var DEFAULT_STENCIL_ENTRY_PATH_PREFIX = "./build";
|
|
435
|
-
var DEFAULT_STENCIL_ENTRY_PATH = `${DEFAULT_STENCIL_ENTRY_PATH_PREFIX}/${DEFAULT_NAMESPACE}`;
|
|
436
|
-
var loadConfigMeta = async () => {
|
|
437
|
-
let baseURL = DEFAULT_BASE_URL;
|
|
438
|
-
let webServerUrl = DEFAULT_WEB_SERVER_URL;
|
|
439
|
-
let stencilNamespace = DEFAULT_NAMESPACE;
|
|
440
|
-
let stencilEntryPath = DEFAULT_STENCIL_ENTRY_PATH;
|
|
441
|
-
const stencilConfigPath = await findUp(["stencil.config.ts", "stencil.config.js"]);
|
|
442
|
-
if (stencilConfigPath && (0, import_fs.existsSync)(stencilConfigPath)) {
|
|
443
|
-
const { devServer, fsNamespace, outputTargets } = (await (0, import_compiler.loadConfig)({ configPath: stencilConfigPath })).config;
|
|
444
|
-
const wwwTarget = outputTargets.find((o) => o.type === "www");
|
|
445
|
-
if (wwwTarget) {
|
|
446
|
-
let relativePath = (0, import_path.relative)(devServer.root, wwwTarget.dir);
|
|
447
|
-
relativePath = relativePath === "" ? "." : relativePath;
|
|
448
|
-
if (!relativePath.startsWith(".")) {
|
|
449
|
-
relativePath = `./${relativePath}`;
|
|
450
|
-
}
|
|
451
|
-
stencilEntryPath = `${relativePath}/build/${fsNamespace}`;
|
|
452
|
-
} else {
|
|
453
|
-
stencilEntryPath = `${DEFAULT_STENCIL_ENTRY_PATH_PREFIX}/${fsNamespace}`;
|
|
454
|
-
console.warn(
|
|
455
|
-
`No "www" output target found in the Stencil config. Using default entry path: "${stencilEntryPath}". Tests using 'setContent' may fail to execute.`
|
|
456
|
-
);
|
|
457
|
-
}
|
|
458
|
-
baseURL = `${devServer.protocol}://${devServer.address}:${devServer.port}`;
|
|
459
|
-
webServerUrl = `${baseURL}${devServer.pingRoute ?? ""}`;
|
|
460
|
-
stencilNamespace = fsNamespace;
|
|
461
|
-
} else {
|
|
462
|
-
const msg = stencilConfigPath ? `Unable to find your project's Stencil configuration file, starting from '${stencilConfigPath}'. Falling back to defaults.` : `No Stencil config file was found matching the glob 'stencil.config.{ts,js}' in the current or parent directories. Falling back to defaults.`;
|
|
463
|
-
console.warn(msg);
|
|
464
|
-
}
|
|
465
|
-
return {
|
|
466
|
-
baseURL,
|
|
467
|
-
webServerUrl,
|
|
468
|
-
stencilNamespace,
|
|
469
|
-
stencilEntryPath
|
|
470
|
-
};
|
|
471
|
-
};
|
|
472
|
-
|
|
473
|
-
// src/create-config.ts
|
|
474
|
-
var createConfig = async (overrides = {}) => {
|
|
475
|
-
const { webServerUrl, baseURL, stencilEntryPath, stencilNamespace } = await loadConfigMeta();
|
|
476
|
-
process.env["STENCIL_NAMESPACE" /* STENCIL_NAMESPACE */] = stencilNamespace;
|
|
477
|
-
process.env["STENCIL_ENTRY_PATH" /* STENCIL_ENTRY_PATH */] = stencilEntryPath;
|
|
478
|
-
return (0, import_deepmerge.default)(
|
|
479
|
-
{
|
|
480
|
-
testMatch: "*.e2e.ts",
|
|
481
|
-
use: {
|
|
482
|
-
baseURL
|
|
483
|
-
},
|
|
484
|
-
webServer: {
|
|
485
|
-
command: "stencil build --dev --watch --serve --no-open",
|
|
486
|
-
url: webServerUrl,
|
|
487
|
-
reuseExistingServer: !!!process.env.CI,
|
|
488
|
-
// Max time to wait for dev server to start before aborting, defaults to 60000 (60 seconds)
|
|
489
|
-
timeout: void 0,
|
|
490
|
-
// Pipe the dev server output to the console
|
|
491
|
-
// Gives visibility to the developer if the dev server fails to start
|
|
492
|
-
stdout: "pipe"
|
|
493
|
-
}
|
|
494
|
-
},
|
|
495
|
-
overrides
|
|
496
|
-
);
|
|
497
|
-
};
|
|
498
|
-
|
|
499
|
-
// src/matchers/to-have-first-received-event-detail.ts
|
|
500
|
-
var import_test = require("@playwright/test");
|
|
501
|
-
var import_fast_deep_equal = __toESM(require_fast_deep_equal());
|
|
502
|
-
function toHaveFirstReceivedEventDetail(eventSpy, eventDetail) {
|
|
503
|
-
if (eventSpy === null || eventSpy === void 0) {
|
|
504
|
-
return {
|
|
505
|
-
message: () => `expected spy to have received event, but it was not defined`,
|
|
506
|
-
pass: false
|
|
507
|
-
};
|
|
508
|
-
}
|
|
509
|
-
if (typeof eventSpy.then === "function") {
|
|
510
|
-
return {
|
|
511
|
-
message: () => `expected spy to have received event, but it was not resolved (did you forget an await operator?).`,
|
|
512
|
-
pass: false
|
|
513
|
-
};
|
|
514
|
-
}
|
|
515
|
-
if (eventSpy.eventName === null || eventSpy.eventName === void 0) {
|
|
516
|
-
return {
|
|
517
|
-
message: () => `toHaveReceivedEventDetail did not receive an event spy`,
|
|
518
|
-
pass: false
|
|
519
|
-
};
|
|
520
|
-
}
|
|
521
|
-
if (eventSpy.firstEvent === null || eventSpy.firstEvent === void 0) {
|
|
522
|
-
return {
|
|
523
|
-
message: () => `event "${eventSpy.eventName}" was not received`,
|
|
524
|
-
pass: false
|
|
525
|
-
};
|
|
526
|
-
}
|
|
527
|
-
const pass = (0, import_fast_deep_equal.default)(eventSpy.firstEvent.detail, eventDetail);
|
|
528
|
-
(0, import_test.expect)(eventSpy.lastEvent.detail).toEqual(eventDetail);
|
|
529
|
-
return {
|
|
530
|
-
message: () => `expected event "${eventSpy.eventName}" detail to ${pass ? "not " : ""}equal`,
|
|
531
|
-
pass
|
|
532
|
-
};
|
|
533
|
-
}
|
|
534
|
-
|
|
535
|
-
// src/matchers/to-have-nth-received-event-detail.ts
|
|
536
|
-
var import_test2 = require("@playwright/test");
|
|
537
|
-
var import_fast_deep_equal2 = __toESM(require_fast_deep_equal());
|
|
538
|
-
function toHaveNthReceivedEventDetail(eventSpy, index, eventDetail) {
|
|
539
|
-
if (eventSpy === null || eventSpy === void 0) {
|
|
540
|
-
return {
|
|
541
|
-
message: () => `expected spy to have received event, but it was not defined`,
|
|
542
|
-
pass: false
|
|
543
|
-
};
|
|
544
|
-
}
|
|
545
|
-
if (typeof eventSpy.then === "function") {
|
|
546
|
-
return {
|
|
547
|
-
message: () => `expected spy to have received event, but it was not resolved (did you forget an await operator?).`,
|
|
548
|
-
pass: false
|
|
549
|
-
};
|
|
550
|
-
}
|
|
551
|
-
if (eventSpy.eventName === null || eventSpy.eventName === void 0) {
|
|
552
|
-
return {
|
|
553
|
-
message: () => `toHaveReceivedEventDetail did not receive an event spy`,
|
|
554
|
-
pass: false
|
|
555
|
-
};
|
|
556
|
-
}
|
|
557
|
-
if (eventSpy.firstEvent === null || eventSpy.firstEvent === void 0) {
|
|
558
|
-
return {
|
|
559
|
-
message: () => `event "${eventSpy.eventName}" was not received`,
|
|
560
|
-
pass: false
|
|
561
|
-
};
|
|
562
|
-
}
|
|
563
|
-
const event = eventSpy.events[index];
|
|
564
|
-
if (event === null || event === void 0) {
|
|
565
|
-
return {
|
|
566
|
-
message: () => `event at index ${index} was not received`,
|
|
567
|
-
pass: false
|
|
568
|
-
};
|
|
569
|
-
}
|
|
570
|
-
const pass = (0, import_fast_deep_equal2.default)(event.detail, eventDetail);
|
|
571
|
-
(0, import_test2.expect)(event.detail).toEqual(eventDetail);
|
|
572
|
-
return {
|
|
573
|
-
message: () => `expected event "${eventSpy.eventName}" detail to ${pass ? "not " : ""}equal`,
|
|
574
|
-
pass
|
|
575
|
-
};
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
// src/matchers/to-have-received-event.ts
|
|
579
|
-
function toHaveReceivedEvent(eventSpy) {
|
|
580
|
-
if (eventSpy === void 0 || eventSpy === null) {
|
|
581
|
-
return {
|
|
582
|
-
message: () => `expected spy to have received event, but it was not defined`,
|
|
583
|
-
pass: false
|
|
584
|
-
};
|
|
585
|
-
}
|
|
586
|
-
if (typeof eventSpy.then === "function") {
|
|
587
|
-
return {
|
|
588
|
-
message: () => `expected spy to have received event, but it was not resolved (did you forget an await operator?).`,
|
|
589
|
-
pass: false
|
|
590
|
-
};
|
|
591
|
-
}
|
|
592
|
-
const pass = eventSpy.events.length > 0;
|
|
593
|
-
if (pass) {
|
|
594
|
-
return {
|
|
595
|
-
message: () => `expected to have called ${eventSpy.eventName} event`,
|
|
596
|
-
pass: true
|
|
597
|
-
};
|
|
598
|
-
}
|
|
599
|
-
return {
|
|
600
|
-
message: () => `expected to have not called ${eventSpy.eventName} event`,
|
|
601
|
-
pass: false
|
|
602
|
-
};
|
|
603
|
-
}
|
|
604
|
-
|
|
605
|
-
// src/matchers/to-have-received-event-detail.ts
|
|
606
|
-
var import_test3 = require("@playwright/test");
|
|
607
|
-
var import_fast_deep_equal3 = __toESM(require_fast_deep_equal());
|
|
608
|
-
function toHaveReceivedEventDetail(eventSpy, eventDetail) {
|
|
609
|
-
if (eventSpy === null || eventSpy === void 0) {
|
|
610
|
-
return {
|
|
611
|
-
message: () => `toHaveReceivedEventDetail event spy is null`,
|
|
612
|
-
pass: false
|
|
613
|
-
};
|
|
614
|
-
}
|
|
615
|
-
if (typeof eventSpy.then === "function") {
|
|
616
|
-
return {
|
|
617
|
-
message: () => `expected spy to have received event, but it was not resolved (did you forget an await operator?).`,
|
|
618
|
-
pass: false
|
|
619
|
-
};
|
|
620
|
-
}
|
|
621
|
-
if (!eventSpy.eventName) {
|
|
622
|
-
return {
|
|
623
|
-
message: () => `toHaveReceivedEventDetail did not receive an event spy`,
|
|
624
|
-
pass: false
|
|
625
|
-
};
|
|
626
|
-
}
|
|
627
|
-
if (eventSpy.lastEvent === null || eventSpy.lastEvent === void 0) {
|
|
628
|
-
return {
|
|
629
|
-
message: () => `event "${eventSpy.eventName}" was not received`,
|
|
630
|
-
pass: false
|
|
631
|
-
};
|
|
632
|
-
}
|
|
633
|
-
const pass = (0, import_fast_deep_equal3.default)(eventSpy.lastEvent.detail, eventDetail);
|
|
634
|
-
(0, import_test3.expect)(eventSpy.lastEvent.detail).toEqual(eventDetail);
|
|
635
|
-
return {
|
|
636
|
-
message: () => `expected event "${eventSpy.eventName}" detail to ${pass ? "not " : ""}equal`,
|
|
637
|
-
pass
|
|
638
|
-
};
|
|
639
|
-
}
|
|
640
|
-
|
|
641
|
-
// src/matchers/to-have-received-event-times.ts
|
|
642
|
-
function toHaveReceivedEventTimes(eventSpy, count) {
|
|
643
|
-
if (!eventSpy) {
|
|
644
|
-
return {
|
|
645
|
-
message: () => `toHaveReceivedEventTimes event spy is null`,
|
|
646
|
-
pass: false
|
|
647
|
-
};
|
|
648
|
-
}
|
|
649
|
-
if (typeof eventSpy.then === "function") {
|
|
650
|
-
return {
|
|
651
|
-
message: () => `expected spy to have received event, but it was not resolved (did you forget an await operator?).`,
|
|
652
|
-
pass: false
|
|
653
|
-
};
|
|
654
|
-
}
|
|
655
|
-
if (!eventSpy.eventName) {
|
|
656
|
-
return {
|
|
657
|
-
message: () => `toHaveReceivedEventTimes did not receive an event spy`,
|
|
658
|
-
pass: false
|
|
659
|
-
};
|
|
660
|
-
}
|
|
661
|
-
const pass = eventSpy.length === count;
|
|
662
|
-
return {
|
|
663
|
-
message: () => `expected event "${eventSpy.eventName}" to have been called ${count} times, but it was called ${eventSpy.events.length} times`,
|
|
664
|
-
pass
|
|
665
|
-
};
|
|
666
|
-
}
|
|
667
|
-
|
|
668
|
-
// src/matchers/index.ts
|
|
669
|
-
var matchers = {
|
|
670
|
-
toHaveReceivedEvent,
|
|
671
|
-
toHaveReceivedEventDetail,
|
|
672
|
-
toHaveReceivedEventTimes,
|
|
673
|
-
toHaveFirstReceivedEventDetail,
|
|
674
|
-
toHaveNthReceivedEventDetail
|
|
675
|
-
};
|
|
676
|
-
|
|
677
|
-
// src/page/utils/goto.ts
|
|
678
|
-
var goto = async (page, url, originalFn, options) => {
|
|
679
|
-
const result = await Promise.all([
|
|
680
|
-
page.waitForFunction(() => window.testAppLoaded === true, {
|
|
681
|
-
// This timeout was taken from the existing Playwright adapter in the Ionic Framework repository.
|
|
682
|
-
// They tested this number and found it to be a reliable timeout for the Stencil components to be hydrated.
|
|
683
|
-
timeout: 4750
|
|
684
|
-
}),
|
|
685
|
-
originalFn(url, options)
|
|
686
|
-
]);
|
|
687
|
-
return result[1];
|
|
688
|
-
};
|
|
689
|
-
|
|
690
|
-
// src/page/event-spy.ts
|
|
691
|
-
var EventSpy = class {
|
|
692
|
-
constructor(eventName) {
|
|
693
|
-
this.eventName = eventName;
|
|
694
|
-
/**
|
|
695
|
-
* Keeping track of a cursor ensures that no two spy.next() calls point to the same event.
|
|
696
|
-
*/
|
|
697
|
-
this.cursor = 0;
|
|
698
|
-
this.queuedHandler = [];
|
|
699
|
-
this.events = [];
|
|
700
|
-
}
|
|
701
|
-
get length() {
|
|
702
|
-
return this.events.length;
|
|
703
|
-
}
|
|
704
|
-
get firstEvent() {
|
|
705
|
-
return this.events[0] ?? null;
|
|
706
|
-
}
|
|
707
|
-
get lastEvent() {
|
|
708
|
-
return this.events[this.events.length - 1] ?? null;
|
|
709
|
-
}
|
|
710
|
-
next() {
|
|
711
|
-
const { cursor } = this;
|
|
712
|
-
this.cursor++;
|
|
713
|
-
const next = this.events[cursor];
|
|
714
|
-
if (next !== void 0) {
|
|
715
|
-
return Promise.resolve(next);
|
|
716
|
-
} else {
|
|
717
|
-
let resolve;
|
|
718
|
-
const promise = new Promise((r) => resolve = r);
|
|
719
|
-
this.queuedHandler.push(resolve);
|
|
720
|
-
return promise.then(() => this.events[cursor]);
|
|
721
|
-
}
|
|
722
|
-
}
|
|
723
|
-
push(ev) {
|
|
724
|
-
this.events.push(ev);
|
|
725
|
-
const next = this.queuedHandler.shift();
|
|
726
|
-
if (next) {
|
|
727
|
-
next();
|
|
728
|
-
}
|
|
729
|
-
}
|
|
730
|
-
};
|
|
731
|
-
var initPageEvents = async (page) => {
|
|
732
|
-
page._e2eEventsIds = 0;
|
|
733
|
-
page._e2eEvents = /* @__PURE__ */ new Map();
|
|
734
|
-
await page.exposeFunction("stencilOnEvent", (id, ev) => {
|
|
735
|
-
const context = page._e2eEvents.get(id);
|
|
736
|
-
if (context) {
|
|
737
|
-
context.callback(ev);
|
|
738
|
-
}
|
|
739
|
-
});
|
|
740
|
-
};
|
|
741
|
-
var addE2EListener = async (page, elmHandle, eventName, callback) => {
|
|
742
|
-
const id = page._e2eEventsIds++;
|
|
743
|
-
page._e2eEvents.set(id, {
|
|
744
|
-
eventName,
|
|
745
|
-
callback
|
|
746
|
-
});
|
|
747
|
-
await elmHandle.evaluate(
|
|
748
|
-
(elm, [eventName2, id2]) => {
|
|
749
|
-
window.stencilSerializeEventTarget = (target) => {
|
|
750
|
-
if (!target) {
|
|
751
|
-
return null;
|
|
752
|
-
}
|
|
753
|
-
if (target === window) {
|
|
754
|
-
return { serializedWindow: true };
|
|
755
|
-
}
|
|
756
|
-
if (target === document) {
|
|
757
|
-
return { serializedDocument: true };
|
|
758
|
-
}
|
|
759
|
-
if (target.nodeType != null) {
|
|
760
|
-
const serializedElement = {
|
|
761
|
-
serializedElement: true,
|
|
762
|
-
nodeName: target.nodeName,
|
|
763
|
-
nodeValue: target.nodeValue,
|
|
764
|
-
nodeType: target.nodeType,
|
|
765
|
-
tagName: target.tagName,
|
|
766
|
-
className: target.className,
|
|
767
|
-
id: target.id
|
|
768
|
-
};
|
|
769
|
-
return serializedElement;
|
|
770
|
-
}
|
|
771
|
-
return null;
|
|
772
|
-
};
|
|
773
|
-
window.serializeStencilEvent = (orgEv) => {
|
|
774
|
-
const serializedEvent = {
|
|
775
|
-
bubbles: orgEv.bubbles,
|
|
776
|
-
cancelBubble: orgEv.cancelBubble,
|
|
777
|
-
cancelable: orgEv.cancelable,
|
|
778
|
-
composed: orgEv.composed,
|
|
779
|
-
currentTarget: window.stencilSerializeEventTarget(orgEv.currentTarget),
|
|
780
|
-
defaultPrevented: orgEv.defaultPrevented,
|
|
781
|
-
detail: orgEv.detail,
|
|
782
|
-
eventPhase: orgEv.eventPhase,
|
|
783
|
-
isTrusted: orgEv.isTrusted,
|
|
784
|
-
returnValue: orgEv.returnValue,
|
|
785
|
-
srcElement: window.stencilSerializeEventTarget(orgEv.srcElement),
|
|
786
|
-
target: window.stencilSerializeEventTarget(orgEv.target),
|
|
787
|
-
timeStamp: orgEv.timeStamp,
|
|
788
|
-
type: orgEv.type,
|
|
789
|
-
isSerializedEvent: true
|
|
790
|
-
};
|
|
791
|
-
return serializedEvent;
|
|
792
|
-
};
|
|
793
|
-
elm.addEventListener(eventName2, (ev) => {
|
|
794
|
-
window.stencilOnEvent(id2, window.serializeStencilEvent(ev));
|
|
795
|
-
});
|
|
796
|
-
},
|
|
797
|
-
[eventName, id]
|
|
798
|
-
);
|
|
799
|
-
};
|
|
800
|
-
|
|
801
|
-
// src/page/utils/locator.ts
|
|
802
|
-
var locator = (page, originalFn, selector, options) => {
|
|
803
|
-
const locator2 = originalFn(selector, options);
|
|
804
|
-
locator2.spyOnEvent = async (eventName) => {
|
|
805
|
-
const spy = new EventSpy(eventName);
|
|
806
|
-
const handle = await locator2.evaluateHandle((node) => node);
|
|
807
|
-
await addE2EListener(page, handle, eventName, (ev) => spy.push(ev));
|
|
808
|
-
return spy;
|
|
809
|
-
};
|
|
810
|
-
return locator2;
|
|
811
|
-
};
|
|
812
|
-
|
|
813
|
-
// src/page/utils/set-content.ts
|
|
814
|
-
var setContent = async (page, html, testInfo, options) => {
|
|
815
|
-
if (page.isClosed()) {
|
|
816
|
-
throw new Error("setContent unavailable: page is already closed");
|
|
817
|
-
}
|
|
818
|
-
const baseUrl = testInfo.project.use.baseURL;
|
|
819
|
-
const baseEntryPath = process.env.STENCIL_ENTRY_PATH;
|
|
820
|
-
const output = `
|
|
821
|
-
<!DOCTYPE html>
|
|
822
|
-
<html lang="en">
|
|
823
|
-
<head>
|
|
824
|
-
<title>Stencil Playwright Test</title>
|
|
825
|
-
<meta charset="UTF-8" />
|
|
826
|
-
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0" />
|
|
827
|
-
<script src="${baseEntryPath}.js" nomodule></script>
|
|
828
|
-
<script type="module" src="${baseEntryPath}.esm.js"></script>
|
|
829
|
-
</head>
|
|
830
|
-
<body>
|
|
831
|
-
${html}
|
|
832
|
-
</body>
|
|
833
|
-
</html>
|
|
834
|
-
`;
|
|
835
|
-
if (baseUrl) {
|
|
836
|
-
await page.route(baseUrl, (route) => {
|
|
837
|
-
if (route.request().url() === `${baseUrl}/`) {
|
|
838
|
-
route.fulfill({
|
|
839
|
-
status: 200,
|
|
840
|
-
contentType: "text/html",
|
|
841
|
-
body: output
|
|
842
|
-
});
|
|
843
|
-
} else {
|
|
844
|
-
route.continue();
|
|
845
|
-
}
|
|
846
|
-
});
|
|
847
|
-
await page.goto(`${baseUrl}#`, options);
|
|
848
|
-
} else {
|
|
849
|
-
throw new Error("setContent unavailable: no dev server base URL provided");
|
|
850
|
-
}
|
|
851
|
-
};
|
|
852
|
-
|
|
853
|
-
// src/page/utils/spy-on-event.ts
|
|
854
|
-
var spyOnEvent = async (page, eventName) => {
|
|
855
|
-
const spy = new EventSpy(eventName);
|
|
856
|
-
const handle = await page.evaluateHandle(() => window);
|
|
857
|
-
await addE2EListener(page, handle, eventName, (ev) => spy.push(ev));
|
|
858
|
-
return spy;
|
|
859
|
-
};
|
|
860
|
-
|
|
861
|
-
// src/page/utils/wait-for-changes.ts
|
|
862
|
-
var waitForChanges = async (page, timeoutMs = 100) => {
|
|
863
|
-
try {
|
|
864
|
-
if (page.isClosed()) {
|
|
865
|
-
return;
|
|
866
|
-
}
|
|
867
|
-
await page.evaluate(() => {
|
|
868
|
-
return new Promise((resolve) => {
|
|
869
|
-
requestAnimationFrame(() => {
|
|
870
|
-
const promiseChain = [];
|
|
871
|
-
const waitComponentOnReady = (elm, promises) => {
|
|
872
|
-
if ("shadowRoot" in elm && elm.shadowRoot instanceof ShadowRoot) {
|
|
873
|
-
waitComponentOnReady(elm.shadowRoot, promises);
|
|
874
|
-
}
|
|
875
|
-
const children = elm.children;
|
|
876
|
-
const len = children.length;
|
|
877
|
-
for (let i = 0; i < len; i++) {
|
|
878
|
-
const childElm = children[i];
|
|
879
|
-
const childStencilElm = childElm;
|
|
880
|
-
if (childElm.tagName.includes("-") && typeof childStencilElm.componentOnReady === "function") {
|
|
881
|
-
promises.push(childStencilElm.componentOnReady());
|
|
882
|
-
}
|
|
883
|
-
waitComponentOnReady(childElm, promises);
|
|
884
|
-
}
|
|
885
|
-
};
|
|
886
|
-
waitComponentOnReady(document.documentElement, promiseChain);
|
|
887
|
-
Promise.all(promiseChain).then(() => resolve()).catch(() => resolve());
|
|
888
|
-
});
|
|
889
|
-
});
|
|
890
|
-
});
|
|
891
|
-
if (page.isClosed()) {
|
|
892
|
-
return;
|
|
893
|
-
}
|
|
894
|
-
await page.waitForTimeout(timeoutMs);
|
|
895
|
-
} catch (e) {
|
|
896
|
-
console.error(e);
|
|
897
|
-
}
|
|
898
|
-
};
|
|
899
|
-
|
|
900
|
-
// src/playwright-page.ts
|
|
901
|
-
var import_test4 = require("@playwright/test");
|
|
902
|
-
async function extendPageFixture(page) {
|
|
903
|
-
if (!process.env["STENCIL_NAMESPACE" /* STENCIL_NAMESPACE */] || !process.env["STENCIL_ENTRY_PATH" /* STENCIL_ENTRY_PATH */]) {
|
|
904
|
-
const { stencilNamespace, stencilEntryPath } = await loadConfigMeta();
|
|
905
|
-
if (!process.env["STENCIL_NAMESPACE" /* STENCIL_NAMESPACE */]) {
|
|
906
|
-
process.env["STENCIL_NAMESPACE" /* STENCIL_NAMESPACE */] = stencilNamespace;
|
|
907
|
-
}
|
|
908
|
-
if (!process.env["STENCIL_ENTRY_PATH" /* STENCIL_ENTRY_PATH */]) {
|
|
909
|
-
process.env["STENCIL_ENTRY_PATH" /* STENCIL_ENTRY_PATH */] = stencilEntryPath;
|
|
910
|
-
}
|
|
911
|
-
}
|
|
912
|
-
const originalGoto = page.goto.bind(page);
|
|
913
|
-
const originalLocator = page.locator.bind(page);
|
|
914
|
-
await page.addInitScript(() => {
|
|
915
|
-
window.addEventListener("appload", () => {
|
|
916
|
-
window.testAppLoaded = true;
|
|
917
|
-
});
|
|
918
|
-
});
|
|
919
|
-
page.goto = (url, options) => goto(page, url, originalGoto, options);
|
|
920
|
-
page.setContent = (html, options) => setContent(page, html, test.info(), options);
|
|
921
|
-
page.locator = (selector, options) => locator(page, originalLocator, selector, options);
|
|
922
|
-
page.waitForChanges = (timeoutMs) => waitForChanges(page, timeoutMs);
|
|
923
|
-
page.spyOnEvent = (eventName) => spyOnEvent(page, eventName);
|
|
924
|
-
await initPageEvents(page);
|
|
925
|
-
return page;
|
|
926
|
-
}
|
|
927
|
-
var test = import_test4.test.extend({
|
|
928
|
-
page: async ({ page }, use) => {
|
|
929
|
-
page = await extendPageFixture(page);
|
|
930
|
-
await use(page);
|
|
931
|
-
},
|
|
932
|
-
skip: {
|
|
933
|
-
browser: (browserNameOrFunction, reason = `The functionality that is being tested is not applicable to this browser.`) => {
|
|
934
|
-
const browserName = import_test4.test.info().project.use.browserName;
|
|
935
|
-
if (typeof browserNameOrFunction === "function") {
|
|
936
|
-
import_test4.test.skip(browserNameOrFunction(browserName), reason);
|
|
937
|
-
} else {
|
|
938
|
-
import_test4.test.skip(browserName === browserNameOrFunction, reason);
|
|
939
|
-
}
|
|
940
|
-
},
|
|
941
|
-
mode: (mode, reason = `The functionality that is being tested is not applicable to ${mode} mode`) => {
|
|
942
|
-
import_test4.test.skip(import_test4.test.info().project.metadata.mode === mode, reason);
|
|
943
|
-
}
|
|
944
|
-
}
|
|
945
|
-
});
|
|
946
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
947
|
-
0 && (module.exports = {
|
|
948
|
-
createConfig,
|
|
949
|
-
goto,
|
|
950
|
-
locator,
|
|
951
|
-
matchers,
|
|
952
|
-
setContent,
|
|
953
|
-
spyOnEvent,
|
|
954
|
-
test,
|
|
955
|
-
waitForChanges
|
|
956
|
-
});
|
|
957
|
-
//# sourceMappingURL=index.cjs.map
|