-
Notifications
You must be signed in to change notification settings - Fork 677
/
visual.test.ts
34 lines (30 loc) · 1.14 KB
/
visual.test.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
import { deepStrictEqual as equal, ok } from "assert";
import { RegSuitCore } from "reg-suit-core";
import { captureRegressionScreenshots } from "../capture-screenshots";
describe("Visual Test", () => {
let test: (name: string, cb: () => Promise<void>) => void = it;
if (process.env["SKIP_VISUAL_TEST"]) {
test = it.skip;
}
test("Successfully compares to baseline", async function () {
await captureRegressionScreenshots();
const reg = new RegSuitCore({
configFileName: ".config/regconfig.json",
});
const processor = reg.createProcessor();
const result = await processor.compare(
await processor.getExpectedKey()
);
ok(
result.comparisonResult.passedItems.length > 1,
"No baselines compared. captureRegressionScreenshots is probably broken."
);
equal(
result.comparisonResult.newItems,
[],
"Cannot run visual test without previously created baseline"
);
equal(result.comparisonResult.deletedItems, []);
equal(result.comparisonResult.failedItems, []);
});
});