@deot/dev-test 2.0.1 → 2.1.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.cjs.js +44 -25
- package/dist/index.d.ts +4 -1
- package/dist/index.es.js +44 -25
- package/package.json +3 -3
package/dist/index.cjs.js
CHANGED
|
@@ -343,37 +343,40 @@ class Launch {
|
|
|
343
343
|
!page.isClosed() && page.close();
|
|
344
344
|
});
|
|
345
345
|
}
|
|
346
|
-
this._page =
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
`Error from Puppeteer-loaded page:
|
|
346
|
+
this._page = new Promise((resolve) => {
|
|
347
|
+
(async () => {
|
|
348
|
+
let page = await this.browser.newPage();
|
|
349
|
+
await page.evaluateOnNewDocument(
|
|
350
|
+
/* istanbul ignore next */
|
|
351
|
+
() => {
|
|
352
|
+
localStorage.clear();
|
|
353
|
+
}
|
|
354
|
+
);
|
|
355
|
+
page.on(
|
|
356
|
+
"console",
|
|
357
|
+
/* istanbul ignore next */
|
|
358
|
+
(e) => {
|
|
359
|
+
if (e.type() === "error") {
|
|
360
|
+
const err = e.args()[0];
|
|
361
|
+
console.error(
|
|
362
|
+
`Error from Puppeteer-loaded page:
|
|
364
363
|
`,
|
|
365
|
-
|
|
366
|
-
|
|
364
|
+
err.remoteObject().description
|
|
365
|
+
);
|
|
366
|
+
}
|
|
367
367
|
}
|
|
368
|
-
|
|
369
|
-
|
|
368
|
+
);
|
|
369
|
+
this.page = page;
|
|
370
|
+
this.operater = new Operater(page);
|
|
371
|
+
resolve(page);
|
|
372
|
+
})();
|
|
370
373
|
});
|
|
371
374
|
}
|
|
372
375
|
return this._page;
|
|
373
376
|
}
|
|
374
377
|
}
|
|
375
378
|
|
|
376
|
-
const TIME_OUT =
|
|
379
|
+
const TIME_OUT = 60 * 1e3;
|
|
377
380
|
const impl = () => {
|
|
378
381
|
let launch = new Launch();
|
|
379
382
|
beforeAll(async () => {
|
|
@@ -383,10 +386,16 @@ const impl = () => {
|
|
|
383
386
|
await launch.createPage(true);
|
|
384
387
|
});
|
|
385
388
|
afterEach(async () => {
|
|
386
|
-
|
|
389
|
+
/* istanbul ignore else -- @preserve */
|
|
390
|
+
if (!launch.page.isClosed()) {
|
|
391
|
+
await launch.page.close();
|
|
392
|
+
}
|
|
387
393
|
});
|
|
388
394
|
afterAll(async () => {
|
|
389
|
-
|
|
395
|
+
/* istanbul ignore else -- @preserve */
|
|
396
|
+
if (launch.browser.isConnected()) {
|
|
397
|
+
await launch.browser.close();
|
|
398
|
+
}
|
|
390
399
|
});
|
|
391
400
|
return launch;
|
|
392
401
|
};
|
|
@@ -413,9 +422,19 @@ const expectByPolling = async (poll, expected, options) => {
|
|
|
413
422
|
}
|
|
414
423
|
}
|
|
415
424
|
};
|
|
425
|
+
const def = (target, key, value, options) => {
|
|
426
|
+
return Object.defineProperty(target, key, {
|
|
427
|
+
value,
|
|
428
|
+
enumerable: false,
|
|
429
|
+
writable: true,
|
|
430
|
+
configurable: true,
|
|
431
|
+
...options
|
|
432
|
+
});
|
|
433
|
+
};
|
|
416
434
|
|
|
417
435
|
const utils = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
418
436
|
__proto__: null,
|
|
437
|
+
def,
|
|
419
438
|
expectByPolling,
|
|
420
439
|
sleep
|
|
421
440
|
}, Symbol.toStringTag, { value: 'Module' }));
|
package/dist/index.d.ts
CHANGED
|
@@ -28,6 +28,8 @@ export declare class Command {
|
|
|
28
28
|
press(key: string, timeout?: number): Promise<void>;
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
+
declare const def: <T = object>(target: T, key: PropertyKey, value?: any, options?: PropertyDescriptor) => T;
|
|
32
|
+
|
|
31
33
|
declare namespace E2E {
|
|
32
34
|
export {
|
|
33
35
|
TIME_OUT,
|
|
@@ -86,7 +88,8 @@ declare const TIME_OUT: number;
|
|
|
86
88
|
declare namespace Utils {
|
|
87
89
|
export {
|
|
88
90
|
sleep,
|
|
89
|
-
expectByPolling
|
|
91
|
+
expectByPolling,
|
|
92
|
+
def
|
|
90
93
|
}
|
|
91
94
|
}
|
|
92
95
|
export { Utils }
|
package/dist/index.es.js
CHANGED
|
@@ -320,37 +320,40 @@ class Launch {
|
|
|
320
320
|
!page.isClosed() && page.close();
|
|
321
321
|
});
|
|
322
322
|
}
|
|
323
|
-
this._page =
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
`Error from Puppeteer-loaded page:
|
|
323
|
+
this._page = new Promise((resolve) => {
|
|
324
|
+
(async () => {
|
|
325
|
+
let page = await this.browser.newPage();
|
|
326
|
+
await page.evaluateOnNewDocument(
|
|
327
|
+
/* istanbul ignore next */
|
|
328
|
+
() => {
|
|
329
|
+
localStorage.clear();
|
|
330
|
+
}
|
|
331
|
+
);
|
|
332
|
+
page.on(
|
|
333
|
+
"console",
|
|
334
|
+
/* istanbul ignore next */
|
|
335
|
+
(e) => {
|
|
336
|
+
if (e.type() === "error") {
|
|
337
|
+
const err = e.args()[0];
|
|
338
|
+
console.error(
|
|
339
|
+
`Error from Puppeteer-loaded page:
|
|
341
340
|
`,
|
|
342
|
-
|
|
343
|
-
|
|
341
|
+
err.remoteObject().description
|
|
342
|
+
);
|
|
343
|
+
}
|
|
344
344
|
}
|
|
345
|
-
|
|
346
|
-
|
|
345
|
+
);
|
|
346
|
+
this.page = page;
|
|
347
|
+
this.operater = new Operater(page);
|
|
348
|
+
resolve(page);
|
|
349
|
+
})();
|
|
347
350
|
});
|
|
348
351
|
}
|
|
349
352
|
return this._page;
|
|
350
353
|
}
|
|
351
354
|
}
|
|
352
355
|
|
|
353
|
-
const TIME_OUT =
|
|
356
|
+
const TIME_OUT = 60 * 1e3;
|
|
354
357
|
const impl = () => {
|
|
355
358
|
let launch = new Launch();
|
|
356
359
|
beforeAll(async () => {
|
|
@@ -360,10 +363,16 @@ const impl = () => {
|
|
|
360
363
|
await launch.createPage(true);
|
|
361
364
|
});
|
|
362
365
|
afterEach(async () => {
|
|
363
|
-
|
|
366
|
+
/* istanbul ignore else -- @preserve */
|
|
367
|
+
if (!launch.page.isClosed()) {
|
|
368
|
+
await launch.page.close();
|
|
369
|
+
}
|
|
364
370
|
});
|
|
365
371
|
afterAll(async () => {
|
|
366
|
-
|
|
372
|
+
/* istanbul ignore else -- @preserve */
|
|
373
|
+
if (launch.browser.isConnected()) {
|
|
374
|
+
await launch.browser.close();
|
|
375
|
+
}
|
|
367
376
|
});
|
|
368
377
|
return launch;
|
|
369
378
|
};
|
|
@@ -390,9 +399,19 @@ const expectByPolling = async (poll, expected, options) => {
|
|
|
390
399
|
}
|
|
391
400
|
}
|
|
392
401
|
};
|
|
402
|
+
const def = (target, key, value, options) => {
|
|
403
|
+
return Object.defineProperty(target, key, {
|
|
404
|
+
value,
|
|
405
|
+
enumerable: false,
|
|
406
|
+
writable: true,
|
|
407
|
+
configurable: true,
|
|
408
|
+
...options
|
|
409
|
+
});
|
|
410
|
+
};
|
|
393
411
|
|
|
394
412
|
const utils = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
395
413
|
__proto__: null,
|
|
414
|
+
def,
|
|
396
415
|
expectByPolling,
|
|
397
416
|
sleep
|
|
398
417
|
}, Symbol.toStringTag, { value: 'Module' }));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deot/dev-test",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"main": "dist/index.es.js",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"type": "module",
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"access": "public"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@deot/dev-shared": "^2.
|
|
16
|
-
"puppeteer": "^20.
|
|
15
|
+
"@deot/dev-shared": "^2.1.0",
|
|
16
|
+
"puppeteer": "^20.8.0"
|
|
17
17
|
}
|
|
18
18
|
}
|