@brillout/test-e2e 0.3.2 → 0.3.4
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/Logs.d.ts
CHANGED
|
@@ -6,8 +6,8 @@ export declare const Logs: {
|
|
|
6
6
|
hasErrorLogs: typeof hasErrorLogs;
|
|
7
7
|
flushEagerly: boolean;
|
|
8
8
|
};
|
|
9
|
-
type LogSource = 'stdout' | 'stderr' | 'Browser Error' | 'Browser Warning' | 'Browser Log' | 'Playwright' | 'run()' | 'run() failure' | 'test()' | 'Connection Error';
|
|
10
|
-
type LogEntry = {
|
|
9
|
+
declare type LogSource = 'stdout' | 'stderr' | 'Browser Error' | 'Browser Warning' | 'Browser Log' | 'Playwright' | 'run()' | 'run() failure' | 'test()' | 'Connection Error';
|
|
10
|
+
declare type LogEntry = {
|
|
11
11
|
logSource: LogSource;
|
|
12
12
|
logText: string;
|
|
13
13
|
logTimestamp: string;
|
package/dist/chai/types.d.ts
CHANGED
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
/// <reference types="chai-subset" />
|
|
2
1
|
export type { ChaiPlugin };
|
|
3
2
|
export type { Expect };
|
|
4
3
|
import type { use as chaiUse } from 'chai';
|
|
5
|
-
type FirstFunctionArgument<T> = T extends (arg: infer A) => unknown ? A : never;
|
|
6
|
-
type ChaiPlugin = FirstFunctionArgument<typeof chaiUse>;
|
|
7
|
-
type Assertion = Chai.Assertion & {
|
|
4
|
+
declare type FirstFunctionArgument<T> = T extends (arg: infer A) => unknown ? A : never;
|
|
5
|
+
declare type ChaiPlugin = FirstFunctionArgument<typeof chaiUse>;
|
|
6
|
+
declare type Assertion = Chai.Assertion & {
|
|
8
7
|
not: Assertion;
|
|
9
8
|
toContain: Assertion['contain'];
|
|
10
9
|
toMatch: Assertion['match'];
|
|
@@ -13,4 +12,4 @@ type Assertion = Chai.Assertion & {
|
|
|
13
12
|
toBeTruthy(): void;
|
|
14
13
|
toBee: Assertion['equal'];
|
|
15
14
|
};
|
|
16
|
-
type Expect = (value: any) => Assertion;
|
|
15
|
+
declare type Expect = (value: any) => Assertion;
|
package/dist/getConfig.d.ts
CHANGED
package/dist/getCurrentTest.d.ts
CHANGED
|
@@ -18,12 +18,7 @@ async function testScreenshotFixture() {
|
|
|
18
18
|
const pngActual = await takeScreenshot();
|
|
19
19
|
const fileContent = pngjs_1.PNG.sync.write(pngActual);
|
|
20
20
|
fs_1.default.writeFileSync(pngFixturPath, fileContent);
|
|
21
|
-
|
|
22
|
-
throw new Error([
|
|
23
|
-
'Screenshot fixture missing. Screenshot fixture created at following paths:',
|
|
24
|
-
` - ${pngFixturPath}`,
|
|
25
|
-
` - ${pngExpectPath}`,
|
|
26
|
-
].join('\n'));
|
|
21
|
+
throw new Error(`Screenshot fixture missing. Screenshot fixture created at ${pngFixturPath}. You can now re-run the test and the screenshot fixture test will pass.`);
|
|
27
22
|
}
|
|
28
23
|
const pngExpect = pngjs_1.PNG.sync.read(fs_1.default.readFileSync(pngFixturPath));
|
|
29
24
|
const pngActual = await takeScreenshot();
|
|
@@ -57,20 +52,20 @@ async function takeScreenshot() {
|
|
|
57
52
|
(0, utils_1.assert)(page);
|
|
58
53
|
let screenshotCurr;
|
|
59
54
|
let screenshotPrev;
|
|
60
|
-
let attemps =
|
|
55
|
+
let attemps = 15;
|
|
61
56
|
while (attemps-- > 0) {
|
|
62
57
|
screenshotPrev = screenshotCurr;
|
|
63
58
|
screenshotCurr = pngjs_1.PNG.sync.read(await page.screenshot());
|
|
64
59
|
if (screenshotPrev) {
|
|
65
60
|
const { width, height } = screenshotCurr;
|
|
66
61
|
const numDiffPixels = (0, pixelmatch_1.default)(screenshotPrev.data, screenshotCurr.data, null, width, height, {
|
|
67
|
-
threshold: 0
|
|
62
|
+
threshold: 0,
|
|
68
63
|
});
|
|
69
64
|
if (numDiffPixels === 0) {
|
|
70
65
|
return screenshotCurr;
|
|
71
66
|
}
|
|
72
67
|
}
|
|
73
|
-
await (0, utils_1.sleep)(
|
|
68
|
+
await (0, utils_1.sleep)(1000);
|
|
74
69
|
}
|
|
75
70
|
throw new Error("Couldn't take a stable screenshot. The UI seems to be continously changing.");
|
|
76
71
|
}
|