@deot/dev-test 2.0.1 → 2.0.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/dist/index.cjs.js +42 -25
- package/dist/index.d.ts +4 -1
- package/dist/index.es.js +42 -25
- package/package.json +1 -1
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,14 @@ const impl = () => {
|
|
|
383
386
|
await launch.createPage(true);
|
|
384
387
|
});
|
|
385
388
|
afterEach(async () => {
|
|
386
|
-
|
|
389
|
+
if (!launch.page.isClosed()) {
|
|
390
|
+
await launch.page.close();
|
|
391
|
+
}
|
|
387
392
|
});
|
|
388
393
|
afterAll(async () => {
|
|
389
|
-
|
|
394
|
+
if (launch.browser.isConnected()) {
|
|
395
|
+
await launch.browser.close();
|
|
396
|
+
}
|
|
390
397
|
});
|
|
391
398
|
return launch;
|
|
392
399
|
};
|
|
@@ -413,9 +420,19 @@ const expectByPolling = async (poll, expected, options) => {
|
|
|
413
420
|
}
|
|
414
421
|
}
|
|
415
422
|
};
|
|
423
|
+
const def = (target, key, value, options) => {
|
|
424
|
+
Object.defineProperty(target, key, {
|
|
425
|
+
value,
|
|
426
|
+
enumerable: false,
|
|
427
|
+
writable: true,
|
|
428
|
+
configurable: true,
|
|
429
|
+
...options
|
|
430
|
+
});
|
|
431
|
+
};
|
|
416
432
|
|
|
417
433
|
const utils = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
418
434
|
__proto__: null,
|
|
435
|
+
def,
|
|
419
436
|
expectByPolling,
|
|
420
437
|
sleep
|
|
421
438
|
}, 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: (target: object, key: PropertyKey, value?: any, options?: PropertyDescriptor) => void;
|
|
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,14 @@ const impl = () => {
|
|
|
360
363
|
await launch.createPage(true);
|
|
361
364
|
});
|
|
362
365
|
afterEach(async () => {
|
|
363
|
-
|
|
366
|
+
if (!launch.page.isClosed()) {
|
|
367
|
+
await launch.page.close();
|
|
368
|
+
}
|
|
364
369
|
});
|
|
365
370
|
afterAll(async () => {
|
|
366
|
-
|
|
371
|
+
if (launch.browser.isConnected()) {
|
|
372
|
+
await launch.browser.close();
|
|
373
|
+
}
|
|
367
374
|
});
|
|
368
375
|
return launch;
|
|
369
376
|
};
|
|
@@ -390,9 +397,19 @@ const expectByPolling = async (poll, expected, options) => {
|
|
|
390
397
|
}
|
|
391
398
|
}
|
|
392
399
|
};
|
|
400
|
+
const def = (target, key, value, options) => {
|
|
401
|
+
Object.defineProperty(target, key, {
|
|
402
|
+
value,
|
|
403
|
+
enumerable: false,
|
|
404
|
+
writable: true,
|
|
405
|
+
configurable: true,
|
|
406
|
+
...options
|
|
407
|
+
});
|
|
408
|
+
};
|
|
393
409
|
|
|
394
410
|
const utils = /*#__PURE__*/Object.freeze(/*#__PURE__*/Object.defineProperty({
|
|
395
411
|
__proto__: null,
|
|
412
|
+
def,
|
|
396
413
|
expectByPolling,
|
|
397
414
|
sleep
|
|
398
415
|
}, Symbol.toStringTag, { value: 'Module' }));
|