@applitools/eyes-playwright 1.29.5 → 1.30.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/CHANGELOG.md +56 -0
- package/dist/fixture/build/rollup.config.js +16 -0
- package/dist/fixture/cli.js +216 -0
- package/dist/fixture/defaults/batch/name.js +75 -0
- package/dist/fixture/defaults/eyesConfiguration.js +66 -0
- package/dist/fixture/example/playwright-website.spec.ts +18 -0
- package/dist/fixture/getEyes.js +56 -0
- package/dist/fixture/images/link.svg +4 -0
- package/dist/fixture/images/visual-text.svg +3 -0
- package/dist/fixture/index.js +141 -0
- package/dist/fixture/reportRenderer.js +549 -0
- package/dist/fixture/reporter.js +108 -0
- package/dist/fixture/reporterStyle.css +88 -0
- package/dist/fixture/toHaveScreenshot.js +147 -0
- package/package.json +47 -5
- package/types/fixture.d.ts +48 -0
- package/types/index.d.ts +86 -79
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.InternalData = void 0;
|
|
27
|
+
const os = __importStar(require("os"));
|
|
28
|
+
const fs = __importStar(require("fs"));
|
|
29
|
+
const path = __importStar(require("path"));
|
|
30
|
+
const playwrightPath = require.resolve('playwright');
|
|
31
|
+
const HtmlReporter = require(path.join(path.dirname(playwrightPath), '/lib/reporters/html')).default;
|
|
32
|
+
const pluginsFile = require.resolve('../../dist/fixture/reportRenderer.js');
|
|
33
|
+
const styleFile = require.resolve('./reporterStyle.css');
|
|
34
|
+
const createInjectedScript = (testResultsMap) => `
|
|
35
|
+
<script>window.__icons = {
|
|
36
|
+
visualTest: \`${fs.readFileSync(require.resolve('./images/visual-text.svg'), 'utf-8')}\`,
|
|
37
|
+
link: \`${fs.readFileSync(require.resolve('./images/link.svg'), 'utf-8')}\`,
|
|
38
|
+
}</script>
|
|
39
|
+
<script>
|
|
40
|
+
${fs.readFileSync(pluginsFile, 'utf-8')}
|
|
41
|
+
window.__testResultsMap = ${JSON.stringify(testResultsMap)};
|
|
42
|
+
window.__initEyesReport();
|
|
43
|
+
</script>
|
|
44
|
+
<style type="text/css">${fs.readFileSync(styleFile, 'utf-8')}</style>
|
|
45
|
+
`;
|
|
46
|
+
class EyesReporter extends HtmlReporter {
|
|
47
|
+
constructor(options) {
|
|
48
|
+
super(options);
|
|
49
|
+
this.internalIds = [];
|
|
50
|
+
}
|
|
51
|
+
onTestEnd(test, result) {
|
|
52
|
+
var _a;
|
|
53
|
+
(_a = super.onTestEnd) === null || _a === void 0 ? void 0 : _a.call(this, test, result);
|
|
54
|
+
const index = result.attachments.findIndex(a => a.name === 'internalId');
|
|
55
|
+
if (index > -1) {
|
|
56
|
+
const internalId = result.attachments[index].body.toString();
|
|
57
|
+
this.internalIds.push(internalId);
|
|
58
|
+
result.attachments.splice(index, 1);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
async onEnd(result) {
|
|
62
|
+
await super.onEnd(result);
|
|
63
|
+
const testResultsMap = {};
|
|
64
|
+
for (const internalId of this.internalIds) {
|
|
65
|
+
const content = await exports.InternalData.consume(internalId);
|
|
66
|
+
if (content) {
|
|
67
|
+
testResultsMap[content.key] = content.data;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
try {
|
|
71
|
+
const filePath = path.join(this._outputFolder, 'index.html');
|
|
72
|
+
fs.appendFileSync(filePath, createInjectedScript(testResultsMap));
|
|
73
|
+
}
|
|
74
|
+
catch (e) {
|
|
75
|
+
// eslint-disable-next-line no-console
|
|
76
|
+
console.error('Error modifying index.html:', e);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
exports.default = EyesReporter;
|
|
81
|
+
exports.InternalData = {
|
|
82
|
+
async write({ testInfo, data }) {
|
|
83
|
+
const internalId = testInfo.attachments.find(a => a.name === 'internalId').body.toString();
|
|
84
|
+
const key = `${testInfo.testId}--${testInfo.retry}`;
|
|
85
|
+
this.ensureFolder();
|
|
86
|
+
await fs.promises.writeFile(this.getPathForInternalId(internalId), JSON.stringify({ key, data }));
|
|
87
|
+
},
|
|
88
|
+
async consume(internalId) {
|
|
89
|
+
const filepath = this.getPathForInternalId(internalId);
|
|
90
|
+
try {
|
|
91
|
+
const content = await fs.promises.readFile(filepath, 'utf-8').then(JSON.parse);
|
|
92
|
+
await fs.promises.unlink(filepath);
|
|
93
|
+
return content;
|
|
94
|
+
}
|
|
95
|
+
catch (err) {
|
|
96
|
+
// TODO no eyes results for test - this is ok, could be that no visual tests occurred for this playwright test
|
|
97
|
+
}
|
|
98
|
+
},
|
|
99
|
+
ensureFolder() {
|
|
100
|
+
const folderPath = path.join(os.tmpdir(), 'eyes-report-files');
|
|
101
|
+
if (!fs.existsSync(folderPath)) {
|
|
102
|
+
fs.mkdirSync(folderPath);
|
|
103
|
+
}
|
|
104
|
+
},
|
|
105
|
+
getPathForInternalId(internalId) {
|
|
106
|
+
return path.join(os.tmpdir(), 'eyes-report-files', internalId);
|
|
107
|
+
},
|
|
108
|
+
};
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
.hidden {
|
|
2
|
+
display: none;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.eyes-test-results>.chip-body {
|
|
6
|
+
padding: 0;
|
|
7
|
+
height: 850px;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
.eyes-test-results>.chip-body>iframe {
|
|
11
|
+
width: 100%;
|
|
12
|
+
height: 100%;
|
|
13
|
+
border: none;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.eyes-filter .test-file-test:not(.eyes-test){
|
|
17
|
+
display: none;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.eyes-batch-link {
|
|
21
|
+
display: flex;
|
|
22
|
+
justify-content: flex-end;
|
|
23
|
+
margin-top: 8px;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.eyes-info {
|
|
27
|
+
display: flex;
|
|
28
|
+
}
|
|
29
|
+
.eyes-info-link {
|
|
30
|
+
text-decoration: none;
|
|
31
|
+
color: inherit;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.test-header-info {
|
|
35
|
+
font-weight: normal;
|
|
36
|
+
display: inline-flex;
|
|
37
|
+
flex-direction: row;
|
|
38
|
+
align-items: center;
|
|
39
|
+
gap: 5px;
|
|
40
|
+
}
|
|
41
|
+
.test-header-info>a {
|
|
42
|
+
display: inline-flex;
|
|
43
|
+
}
|
|
44
|
+
.test-header-info>a>span {
|
|
45
|
+
display: inline-flex;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.visual-test-icon {
|
|
49
|
+
text-align: center;
|
|
50
|
+
align-content: center;
|
|
51
|
+
font-size: 24px;
|
|
52
|
+
height: 26px;
|
|
53
|
+
width: 26px;
|
|
54
|
+
margin-right: 5px;
|
|
55
|
+
}
|
|
56
|
+
.eyes-info>.status-text {
|
|
57
|
+
font-size: 14px;
|
|
58
|
+
text-align: center;
|
|
59
|
+
vertical-align: middle;
|
|
60
|
+
margin: auto;
|
|
61
|
+
color: rgba(0, 0, 0, 0.35);
|
|
62
|
+
text-transform: capitalize;
|
|
63
|
+
padding: 0 5px;
|
|
64
|
+
}
|
|
65
|
+
.eyes-info>.status-bar {
|
|
66
|
+
align-self: stretch;
|
|
67
|
+
border-radius: 0.25rem;
|
|
68
|
+
flex-shrink: 0;
|
|
69
|
+
width: 5px;
|
|
70
|
+
}
|
|
71
|
+
.eyes-info>.status-bar.aborted {
|
|
72
|
+
background: #ff8f00;
|
|
73
|
+
}
|
|
74
|
+
.eyes-info>.status-bar.unresolved {
|
|
75
|
+
background: #ff8f00;
|
|
76
|
+
}
|
|
77
|
+
.eyes-info>.status-bar.failed {
|
|
78
|
+
background: #e80600;
|
|
79
|
+
}
|
|
80
|
+
.eyes-info>.status-bar.passed {
|
|
81
|
+
background: #24b24b;
|
|
82
|
+
}
|
|
83
|
+
.eyes-info>.status-bar.new {
|
|
84
|
+
background: #24b24b;
|
|
85
|
+
}
|
|
86
|
+
.eyes-info>.status-bar.running {
|
|
87
|
+
background: #0067c6;
|
|
88
|
+
}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.expectTypes = exports.expect = void 0;
|
|
4
|
+
const test_1 = require("@playwright/test");
|
|
5
|
+
const index_1 = require("./index");
|
|
6
|
+
const getEyes_1 = require("./getEyes");
|
|
7
|
+
exports.expect = test_1.expect.extend({
|
|
8
|
+
async toHaveScreenshot(pageOrLocator, nameOrOptions = {}, optOptions = {}) {
|
|
9
|
+
var _a, _b, _c, _d, _e;
|
|
10
|
+
const testInfo = index_1.test.info();
|
|
11
|
+
if (!testInfo) {
|
|
12
|
+
throw new Error(`toHaveScreenshot() must be called during the test`);
|
|
13
|
+
}
|
|
14
|
+
if ((_a = testInfo._projectInternal) === null || _a === void 0 ? void 0 : _a.ignoreSnapshots)
|
|
15
|
+
return { pass: !this.isNot, message: () => '', name: 'toHaveScreenshot', expected: nameOrOptions };
|
|
16
|
+
if (this.isNot) {
|
|
17
|
+
// eslint-disable-next-line no-console
|
|
18
|
+
console.warn("Applitools visual tests don't support negating visual assertions - the `.not` will be ignored");
|
|
19
|
+
// uncomment if we'll decide to fallback to the Playwright default not.toHaveScreenshot mechanism
|
|
20
|
+
// if (typeof nameOrOptions === 'string' || Array.isArray(nameOrOptions)) {
|
|
21
|
+
// await baseExpect(pageOrLocator).not.toHaveScreenshot(nameOrOptions, optOptions)
|
|
22
|
+
// } else {
|
|
23
|
+
// await baseExpect(pageOrLocator).not.toHaveScreenshot({...nameOrOptions, ...optOptions})
|
|
24
|
+
// }
|
|
25
|
+
}
|
|
26
|
+
expectTypes(pageOrLocator, ['Page', 'Locator'], 'toHaveScreenshot');
|
|
27
|
+
const [page, locator] = pageOrLocator.constructor.name === 'Page'
|
|
28
|
+
? [pageOrLocator, undefined]
|
|
29
|
+
: [pageOrLocator.page(), pageOrLocator];
|
|
30
|
+
const options = {
|
|
31
|
+
...optOptions,
|
|
32
|
+
...(typeof nameOrOptions === 'object' ? nameOrOptions : {}),
|
|
33
|
+
};
|
|
34
|
+
const unsupportedOptions = [
|
|
35
|
+
{
|
|
36
|
+
flag: options.animations === 'disabled',
|
|
37
|
+
message: 'animations option is not supported by Applitools',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
flag: options.caret === 'initial',
|
|
41
|
+
message: '`caret: initial` is not supported by Applitools',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
flag: locator && options.clip,
|
|
45
|
+
message: 'using both locator and clip options at the same time is not supported by Applitools',
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
flag: options.omitBackground,
|
|
49
|
+
message: 'the omitBackground option is not supported by Applitools',
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
flag: options.scale === 'css',
|
|
53
|
+
message: 'the CSS scale option is not supported by Applitools',
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
flag: options.style,
|
|
57
|
+
message: 'style option is not supported by Applitools',
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
flag: options.stylePath,
|
|
61
|
+
message: 'stylePath option is not supported by Applitools',
|
|
62
|
+
},
|
|
63
|
+
];
|
|
64
|
+
for (const { flag, message } of unsupportedOptions) {
|
|
65
|
+
if (flag) {
|
|
66
|
+
// eslint-disable-next-line no-console
|
|
67
|
+
console.warn(`Warning - ${message}. This option will be ignored.`);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
const redundantOptions = [
|
|
71
|
+
{
|
|
72
|
+
flag: options.maskColor,
|
|
73
|
+
message: 'maskColor option is not used by Applitools',
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
flag: options.quality,
|
|
77
|
+
message: 'quality option is not used by Applitools',
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
flag: options.maxDiffPixelRatio,
|
|
81
|
+
message: 'maxDiffPixelRatio option is not used by Applitools',
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
flag: options.maxDiffPixels,
|
|
85
|
+
message: 'maxDiffPixels option is not used by Applitools',
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
flag: options.threshold,
|
|
89
|
+
message: 'threshold option is not used by Applitools',
|
|
90
|
+
},
|
|
91
|
+
];
|
|
92
|
+
for (const { flag, message } of redundantOptions) {
|
|
93
|
+
if (flag) {
|
|
94
|
+
// eslint-disable-next-line no-console
|
|
95
|
+
console.warn(`${message}, because Applitools utilizes smarter comparison algorithms that mimic the humn eyesight, and therefore do not require using that option. Feel free to remove that hard-coded configuration as it's not used and no longer needed.`);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
const configuration = (_b = page.__eyesConfig) !== null && _b !== void 0 ? _b : {};
|
|
99
|
+
configuration.properties = [
|
|
100
|
+
...((_c = configuration.properties) !== null && _c !== void 0 ? _c : []),
|
|
101
|
+
{
|
|
102
|
+
name: 'playwright: expect.toHaveScreenshot options',
|
|
103
|
+
value: JSON.stringify(options),
|
|
104
|
+
},
|
|
105
|
+
{
|
|
106
|
+
name: 'playwright: syntax used',
|
|
107
|
+
value: 'toHaveScreenshot',
|
|
108
|
+
},
|
|
109
|
+
];
|
|
110
|
+
if (this.isNot) {
|
|
111
|
+
configuration.properties.push({
|
|
112
|
+
name: 'negated',
|
|
113
|
+
value: 'true',
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
await (await (0, getEyes_1.getEyes)({
|
|
117
|
+
testInfo,
|
|
118
|
+
eyesConfig: (_d = page.__eyesConfig) !== null && _d !== void 0 ? _d : {},
|
|
119
|
+
eyesRunner: (_e = page.__eyesRunner) !== null && _e !== void 0 ? _e : {},
|
|
120
|
+
page,
|
|
121
|
+
})).check({
|
|
122
|
+
name: typeof nameOrOptions === 'string'
|
|
123
|
+
? nameOrOptions
|
|
124
|
+
: Array.isArray(nameOrOptions)
|
|
125
|
+
? nameOrOptions.join('-')
|
|
126
|
+
: typeof (nameOrOptions === null || nameOrOptions === void 0 ? void 0 : nameOrOptions.name) === 'string'
|
|
127
|
+
? nameOrOptions.name
|
|
128
|
+
: undefined,
|
|
129
|
+
region: locator !== null && locator !== void 0 ? locator : options.clip,
|
|
130
|
+
fully: options.fullPage,
|
|
131
|
+
ignoreRegions: options.mask,
|
|
132
|
+
});
|
|
133
|
+
return {
|
|
134
|
+
pass: true,
|
|
135
|
+
message: () => 'screenshot taken, comparison is in progress. The results will be reported after the test ends (soft assertion).',
|
|
136
|
+
};
|
|
137
|
+
},
|
|
138
|
+
});
|
|
139
|
+
function expectTypes(receiver, types, matcherName) {
|
|
140
|
+
if (typeof receiver !== 'object' || !types.includes(receiver.constructor.name)) {
|
|
141
|
+
const commaSeparated = types.slice();
|
|
142
|
+
const lastType = commaSeparated.pop();
|
|
143
|
+
const typesString = commaSeparated.length ? commaSeparated.join(', ') + ' or ' + lastType : lastType;
|
|
144
|
+
throw new Error(`${matcherName} can be only used with ${typesString} object${types.length > 1 ? 's' : ''}`);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
exports.expectTypes = expectTypes;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@applitools/eyes-playwright",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.30.0",
|
|
4
4
|
"description": "Applitools Eyes SDK for Playwright",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"eyes-playwright",
|
|
@@ -25,31 +25,73 @@
|
|
|
25
25
|
"dist",
|
|
26
26
|
"types"
|
|
27
27
|
],
|
|
28
|
+
"exports": {
|
|
29
|
+
".": {
|
|
30
|
+
"types": "./types/index.d.ts",
|
|
31
|
+
"default": "./dist/index.js"
|
|
32
|
+
},
|
|
33
|
+
"./reporter": {
|
|
34
|
+
"types": "./types/fixture/fixture/reporter.d.ts",
|
|
35
|
+
"default": "./dist/fixture/reporter.js"
|
|
36
|
+
},
|
|
37
|
+
"./fixture": {
|
|
38
|
+
"types": "./types/fixture.d.ts",
|
|
39
|
+
"default": "./dist/fixture/index.js"
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
"bin": {
|
|
43
|
+
"eyes-setup": "./dist/fixture/cli.js"
|
|
44
|
+
},
|
|
28
45
|
"scripts": {
|
|
29
46
|
"lint": "run --top-level eslint '**/*.ts'",
|
|
30
|
-
"build": "run
|
|
47
|
+
"build": "run build:ts && run build:report && run build:cli",
|
|
48
|
+
"build:ts": "run build:ts:sdk && run build:ts:fixture",
|
|
49
|
+
"build:ts:sdk": "run --top-level tspc --project ./tsconfig.build.json",
|
|
50
|
+
"build:ts:fixture": "run --top-level tspc --project ./tsconfig.fixture.json",
|
|
51
|
+
"build:report": "rollup --config src/fixture/build/rollup.config.ts --configPlugin typescript && cp src/fixture/reporterStyle.css dist/fixture && cp -R src/fixture/images dist/fixture",
|
|
52
|
+
"build:cli": "cp -R src/fixture/example dist/fixture",
|
|
31
53
|
"generate:tests": "NODE_OPTIONS='--experimental-import-meta-resolve --experimental-loader=@applitools/generic/dist/code-loader.js' generic ./test/generic/config.mjs",
|
|
32
54
|
"test": "APPLITOOLS_SHOW_LOGS=true APPLITOOLS_LOG_FILE=\"./logs/$(uuidgen).log\" APPLITOOLS_BATCH_NAME='JS Tests: eyes-playwright' APPLITOOLS_BATCH_ID=$(uuidgen) run --top-level mocha './**/*.spec.{js,ts}' --parallel --jobs ${MOCHA_JOBS:-15} --exit",
|
|
33
55
|
"test:coverage": "APPLITOOLS_SHOW_LOGS=true APPLITOOLS_LOG_FILE=\"./logs/$(uuidgen).log\" APPLITOOLS_BATCH_NAME='JS Coverage Tests: eyes-playwright' APPLITOOLS_BATCH_ID=$(uuidgen) MOCHA_GROUP=coverage run --top-level mocha './test/generated-coverage/*.spec.js' --parallel --jobs ${MOCHA_JOBS:-15} --exit",
|
|
56
|
+
"test:fixture": "APPLITOOLS_SHOW_LOGS=true APPLITOOLS_LOG_FILE=\"./logs/$(uuidgen).log\" APPLITOOLS_BATCH_NAME='JS Coverage Tests: eyes-playwright-fixture' APPLITOOLS_BATCH_ID=$(uuidgen) run playwright test",
|
|
34
57
|
"setup": "run playwright:setup",
|
|
35
58
|
"playwright:setup": "yarn playwright install --with-deps chromium firefox webkit",
|
|
36
59
|
"up:framework": "echo \"$(jq '.devDependencies.playwright = $ENV.APPLITOOLS_FRAMEWORK_VERSION' ./package.json)\" > ./package.json"
|
|
37
60
|
},
|
|
38
61
|
"dependencies": {
|
|
39
|
-
"@applitools/eyes": "1.
|
|
40
|
-
"@applitools/spec-driver-playwright": "1.
|
|
62
|
+
"@applitools/eyes": "1.26.0",
|
|
63
|
+
"@applitools/spec-driver-playwright": "1.5.0",
|
|
64
|
+
"@applitools/utils": "1.7.4",
|
|
65
|
+
"@inquirer/prompts": "7.0.1",
|
|
66
|
+
"chalk": "4.1.2",
|
|
67
|
+
"yargs": "17.7.2"
|
|
41
68
|
},
|
|
42
69
|
"devDependencies": {
|
|
43
70
|
"@applitools/api-extractor": "^1.2.22",
|
|
44
71
|
"@applitools/bongo": "^5.10.0",
|
|
45
72
|
"@applitools/generic": "^3.9.1",
|
|
46
73
|
"@applitools/test-utils": "^1.5.17",
|
|
74
|
+
"@playwright/test": "1.47.0",
|
|
75
|
+
"@rollup/plugin-commonjs": "^28.0.0",
|
|
76
|
+
"@rollup/plugin-node-resolve": "^15.3.0",
|
|
77
|
+
"@rollup/plugin-typescript": "^12.1.0",
|
|
47
78
|
"@types/node": "^12.20.55",
|
|
48
|
-
"
|
|
79
|
+
"jszip": "^3.10.1",
|
|
80
|
+
"playwright": "1.47.0",
|
|
81
|
+
"rollup": "^4.1.4"
|
|
49
82
|
},
|
|
50
83
|
"peerDependencies": {
|
|
84
|
+
"@playwright/test": ">=1.0.0",
|
|
51
85
|
"playwright": ">=1.0.0"
|
|
52
86
|
},
|
|
87
|
+
"peerDependenciesMeta": {
|
|
88
|
+
"@playwright/test": {
|
|
89
|
+
"optional": true
|
|
90
|
+
},
|
|
91
|
+
"playwright": {
|
|
92
|
+
"optional": true
|
|
93
|
+
}
|
|
94
|
+
},
|
|
53
95
|
"engines": {
|
|
54
96
|
"node": ">=12.13.0"
|
|
55
97
|
},
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ConfigurationPlain,
|
|
3
|
+
RunnerOptionsPlain,
|
|
4
|
+
TestResultContainer,
|
|
5
|
+
LogHandlerPlain,
|
|
6
|
+
Eyes as BaseEyes,
|
|
7
|
+
CheckSettingsAutomationPlain,
|
|
8
|
+
MatchResult,
|
|
9
|
+
} from "./index"
|
|
10
|
+
import {test as base, type TestInfo} from '@playwright/test'
|
|
11
|
+
|
|
12
|
+
export type EyesFixture = {
|
|
13
|
+
eyesConfig: EyesConfig
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export type EyesConfig = Omit<
|
|
17
|
+
ConfigurationPlain,
|
|
18
|
+
'concurrentSessions' | 'dontCloseBatches' | 'displayName' | 'testName'
|
|
19
|
+
> & {
|
|
20
|
+
displayName?: string | ((testInfo: TestInfo) => string)
|
|
21
|
+
testName?: string | ((testInfo: TestInfo) => string)
|
|
22
|
+
logConfig?:
|
|
23
|
+
| LogHandlerPlain
|
|
24
|
+
| ((testInfo: TestInfo) => LogHandlerPlain)
|
|
25
|
+
| LogHandlerPlain[]
|
|
26
|
+
| ((testInfo: TestInfo) => LogHandlerPlain[])
|
|
27
|
+
} & RunnerOptionsPlain & {
|
|
28
|
+
type?: 'ufg' | 'classic'
|
|
29
|
+
/**
|
|
30
|
+
* * If set to "afterEach", visual differences will be thrown after each test.
|
|
31
|
+
* * If set to "afterAll", visual differences will be thrown after all tests (more performant, but less granular).
|
|
32
|
+
* * If set to false, visual differences will not be thrown - best used with Eyes' CSM integration.
|
|
33
|
+
*/
|
|
34
|
+
failTestsOnDiff?: 'afterEach' | 'afterAll' | false
|
|
35
|
+
afterAll?: (results: Array<TestResultContainer>) => Promise<void>
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
type Eyes = Pick<BaseEyes, 'locate' | 'extractText' | 'extractTextRegions'> & {
|
|
39
|
+
check(name?: string, checkSettings?: CheckSettingsAutomationPlain): Promise<MatchResult>
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
type EyesTestFixture = EyesFixture & {
|
|
43
|
+
eyes: Eyes
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
type EyesWorkerFixture = EyesFixture
|
|
47
|
+
|
|
48
|
+
export const test: ReturnType<typeof base.extend<EyesTestFixture, EyesWorkerFixture>>
|