@o3r/testing 13.2.0-prerelease.2 → 13.2.0-prerelease.20
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/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@o3r/testing",
|
3
|
-
"version": "13.2.0-prerelease.
|
3
|
+
"version": "13.2.0-prerelease.20",
|
4
4
|
"publishConfig": {
|
5
5
|
"access": "public"
|
6
6
|
},
|
@@ -100,9 +100,9 @@
|
|
100
100
|
"@material/slider": "^14.0.0",
|
101
101
|
"@ngrx/store": "^20.0.0",
|
102
102
|
"@ngx-translate/core": "^15.0.0 || ~16.0.4",
|
103
|
-
"@o3r/core": "^13.2.0-prerelease.
|
104
|
-
"@o3r/localization": "^13.2.0-prerelease.
|
105
|
-
"@o3r/schematics": "^13.2.0-prerelease.
|
103
|
+
"@o3r/core": "^13.2.0-prerelease.20",
|
104
|
+
"@o3r/localization": "^13.2.0-prerelease.20",
|
105
|
+
"@o3r/schematics": "^13.2.0-prerelease.20",
|
106
106
|
"@playwright/test": "^1.49.0",
|
107
107
|
"@schematics/angular": "^20.0.0",
|
108
108
|
"pixelmatch": "^7.0.0",
|
@@ -111,7 +111,7 @@
|
|
111
111
|
"temporal-polyfill": "^0.3.0",
|
112
112
|
"ts-node": "~10.9.2",
|
113
113
|
"type-fest": "^4.30.1",
|
114
|
-
"typescript": "^5.
|
114
|
+
"typescript": "^5.9.0"
|
115
115
|
},
|
116
116
|
"peerDependenciesMeta": {
|
117
117
|
"@amadeus-it-group/kassette": {
|
@@ -167,7 +167,7 @@
|
|
167
167
|
}
|
168
168
|
},
|
169
169
|
"dependencies": {
|
170
|
-
"@o3r/schematics": "^13.2.0-prerelease.
|
170
|
+
"@o3r/schematics": "^13.2.0-prerelease.20",
|
171
171
|
"esbuild": "~0.25.1",
|
172
172
|
"module-from-string": "^3.2.0",
|
173
173
|
"tslib": "^2.6.2"
|
@@ -194,20 +194,20 @@
|
|
194
194
|
"@ngx-translate/core": "~16.0.4",
|
195
195
|
"@nx/eslint-plugin": "~21.5.0",
|
196
196
|
"@nx/jest": "~21.5.0",
|
197
|
-
"@o3r/build-helpers": "^13.2.0-prerelease.
|
198
|
-
"@o3r/core": "^13.2.0-prerelease.
|
199
|
-
"@o3r/eslint-plugin": "^13.2.0-prerelease.
|
200
|
-
"@o3r/localization": "^13.2.0-prerelease.
|
201
|
-
"@o3r/test-helpers": "^13.2.0-prerelease.
|
197
|
+
"@o3r/build-helpers": "^13.2.0-prerelease.20",
|
198
|
+
"@o3r/core": "^13.2.0-prerelease.20",
|
199
|
+
"@o3r/eslint-plugin": "^13.2.0-prerelease.20",
|
200
|
+
"@o3r/localization": "^13.2.0-prerelease.20",
|
201
|
+
"@o3r/test-helpers": "^13.2.0-prerelease.20",
|
202
202
|
"@playwright/test": "~1.55.0",
|
203
203
|
"@schematics/angular": "~20.2.0",
|
204
204
|
"@stylistic/eslint-plugin": "~5.3.0",
|
205
205
|
"@swc/helpers": "~0.5.0",
|
206
206
|
"@types/jest": "~29.5.2",
|
207
|
-
"@types/node": "
|
207
|
+
"@types/node": "~22.0.0",
|
208
208
|
"@types/pixelmatch": "^5.2.3",
|
209
209
|
"@types/pngjs": "^6.0.0",
|
210
|
-
"@typescript-eslint/parser": "~8.
|
210
|
+
"@typescript-eslint/parser": "~8.43.0",
|
211
211
|
"angular-eslint": "~20.2.0",
|
212
212
|
"concurrently": "^9.1.0",
|
213
213
|
"cpy-cli": "^6.0.0",
|
@@ -217,7 +217,7 @@
|
|
217
217
|
"eslint-plugin-import": "~2.32.0",
|
218
218
|
"eslint-plugin-import-newlines": "~1.4.0",
|
219
219
|
"eslint-plugin-jest": "~29.0.0",
|
220
|
-
"eslint-plugin-jsdoc": "~54.
|
220
|
+
"eslint-plugin-jsdoc": "~54.7.0",
|
221
221
|
"eslint-plugin-prefer-arrow": "~1.2.3",
|
222
222
|
"eslint-plugin-unicorn": "~60.0.0",
|
223
223
|
"eslint-plugin-unused-imports": "~4.2.0",
|
@@ -240,7 +240,7 @@
|
|
240
240
|
"ts-node": "~10.9.2",
|
241
241
|
"type-fest": "^4.30.1",
|
242
242
|
"typescript": "~5.9.2",
|
243
|
-
"typescript-eslint": "~8.
|
243
|
+
"typescript-eslint": "~8.43.0",
|
244
244
|
"zone.js": "~0.15.0"
|
245
245
|
},
|
246
246
|
"generatorDependencies": {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/visual-testing-reporter/index.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,KAAK,KAAK,EACX,MAAM,2BAA2B,CAAC;AAEnC;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,MAAM,2BAA2B,GAAG,qBAAqB,EAAE,CAAC;AAElE;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C,qCAAqC;IACrC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,qBAAa,+BAAgC,YAAW,QAAQ;IAC9D,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;gBAExB,OAAO,EAAE,4BAA4B;IAIjD;;OAEG;IACI,aAAa;IAIpB;;OAEG;IACI,OAAO,CAAC,CAAC,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK;IAI1C;;OAEG;IACU,KAAK;
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/visual-testing-reporter/index.ts"],"names":[],"mappings":"AAQA,OAAO,EACL,KAAK,UAAU,EACf,KAAK,QAAQ,EACb,KAAK,KAAK,EACX,MAAM,2BAA2B,CAAC;AAEnC;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC;;OAEG;IACH,MAAM,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,MAAM,2BAA2B,GAAG,qBAAqB,EAAE,CAAC;AAElE;;GAEG;AACH,MAAM,WAAW,4BAA4B;IAC3C,qCAAqC;IACrC,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;GAEG;AACH,qBAAa,+BAAgC,YAAW,QAAQ;IAC9D,OAAO,CAAC,KAAK,CAAS;IACtB,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;gBAExB,OAAO,EAAE,4BAA4B;IAIjD;;OAEG;IACI,aAAa;IAIpB;;OAEG;IACI,OAAO,CAAC,CAAC,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK;IAI1C;;OAEG;IACU,KAAK;CAkCnB;AAED,eAAe,+BAA+B,CAAC"}
|
@@ -26,7 +26,7 @@ class VisualTestingPlaywrightReporter {
|
|
26
26
|
* @inheritdoc
|
27
27
|
*/
|
28
28
|
async onEnd() {
|
29
|
-
const fileNameExtractor = /snapshot:\s*(?<
|
29
|
+
const fileNameExtractor = /snapshot:\s*(?<dir>(?:[\w-]+[\\/]+)*)(?<filename>[\w-]+)\.(?<extension>\w+)/i;
|
30
30
|
const screenshotsToUpdate = this.suite.allTests().flatMap((test) => test.results.flatMap((result) => result.errors
|
31
31
|
.reduce((acc, error) => {
|
32
32
|
if (error.matcherResult?.name === 'toHaveScreenshot'
|
@@ -38,10 +38,10 @@ class VisualTestingPlaywrightReporter {
|
|
38
38
|
}
|
39
39
|
else if (fileNameExtractor.test(error.message)) {
|
40
40
|
// Playwright > 1.51
|
41
|
-
const { filename, extension } = fileNameExtractor.exec(error.message).groups;
|
41
|
+
const { dir, filename, extension } = fileNameExtractor.exec(error.message).groups;
|
42
42
|
if (filename && extension) {
|
43
|
-
const attachmentMatcherActual = new RegExp(
|
44
|
-
const attachmentMatcherExpected = new RegExp(
|
43
|
+
const attachmentMatcherActual = new RegExp(`${dir}${filename}-actual.${extension}`);
|
44
|
+
const attachmentMatcherExpected = new RegExp(`${dir}${filename}-expected.${extension}`);
|
45
45
|
const actual = result.attachments.find((attachment) => attachmentMatcherActual.test(attachment.name));
|
46
46
|
const expected = result.attachments.find((attachment) => attachmentMatcherExpected.test(attachment.name));
|
47
47
|
if (actual?.path && expected?.path) {
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/visual-testing-reporter/index.ts"],"names":[],"mappings":";;;AAAA,+CAG0B;AAC1B,yCAGmB;AAkCnB;;GAEG;AACH,MAAa,+BAA+B;IAI1C,YAAY,OAAqC;QAC/C,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,IAAA,gBAAI,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,+CAA+C,CAAC,CAAC;IAC/G,CAAC;IAED;;OAEG;IACI,aAAa;QAClB,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;OAEG;IACI,OAAO,CAAC,CAAa,EAAE,KAAY;QACxC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;IACrB,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,KAAK;QAChB,MAAM,iBAAiB,GAAG,
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/visual-testing-reporter/index.ts"],"names":[],"mappings":";;;AAAA,+CAG0B;AAC1B,yCAGmB;AAkCnB;;GAEG;AACH,MAAa,+BAA+B;IAI1C,YAAY,OAAqC;QAC/C,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,IAAA,gBAAI,EAAC,OAAO,CAAC,GAAG,EAAE,EAAE,+CAA+C,CAAC,CAAC;IAC/G,CAAC;IAED;;OAEG;IACI,aAAa;QAClB,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;OAEG;IACI,OAAO,CAAC,CAAa,EAAE,KAAY;QACxC,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC;I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AAM,GAAG,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,uBAAuB,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;oBACtG,MAAM,QAAQ,GAAG,MAAM,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,UAAU,EAAE,EAAE,CAAC,yBAAyB,CAAC,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC;oBAC1G,IAAI,MAAM,EAAE,IAAI,IAAI,QAAQ,EAAE,IAAI,EAAE,CAAC;wBACnC,GAAG,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,IAAI,EAAE,QAAQ,EAAE,QAAQ,CAAC,IAAI,EAAE,CAAC,CAAC;oBAC7D,CAAC;gBACH,CAAC;YACH,CAAC;YACD,OAAO,GAAG,CAAC;QACb,CAAC,EAAE,EAA6B,CAAC,CACpC,CACF,CAAC;QACF,MAAM,IAAA,gBAAK,EAAC,IAAA,mBAAO,EAAC,IAAI,CAAC,UAAU,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC3D,OAAO,IAAA,oBAAS,EAAC,IAAI,CAAC,UAAU,EAAE,IAAI,CAAC,SAAS,CAAC,mBAAmB,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IAClF,CAAC;CACF;AA3DD,0EA2DC;AAED,kBAAe,+BAA+B,CAAC","sourcesContent":["import {\n mkdir,\n writeFile,\n} from 'node:fs/promises';\nimport {\n dirname,\n join,\n} from 'node:path';\nimport {\n type FullConfig,\n type Reporter,\n type Suite,\n} from '@playwright/test/reporter';\n\n/**\n * The screenshot information\n */\nexport interface ScreenshotInformation {\n /**\n * The path of the actual screenshot\n */\n actual: string;\n /**\n * The path of the expected screenshot\n */\n expected: string;\n}\n\n/**\n * The report of the visual testing campaign\n */\nexport type VisualTestingReporterReport = ScreenshotInformation[];\n\n/**\n * Configuration for the visual testing reporter\n */\nexport interface VisualTestingReporterOptions {\n /** The output file for the report */\n outputFile?: string;\n}\n\n/**\n * Playwright reporter for visual testing\n */\nexport class VisualTestingPlaywrightReporter implements Reporter {\n private suite!: Suite;\n private readonly outputFile: string;\n\n constructor(options: VisualTestingReporterOptions) {\n this.outputFile = options.outputFile || join(process.cwd(), 'playwright-reports/visual-testing/report.json');\n }\n\n /**\n * @inheritdoc\n */\n public printsToStdio() {\n return false;\n }\n\n /**\n * @inheritdoc\n */\n public onBegin(_: FullConfig, suite: Suite) {\n this.suite = suite;\n }\n\n /**\n * @inheritdoc\n */\n public async onEnd() {\n const fileNameExtractor = /snapshot:\\s*(?<dir>(?:[\\w-]+[\\\\/]+)*)(?<filename>[\\w-]+)\\.(?<extension>\\w+)/i;\n const screenshotsToUpdate: VisualTestingReporterReport = this.suite.allTests().flatMap((test) =>\n test.results.flatMap((result) =>\n result.errors\n .reduce((acc, error: any) => {\n if (error.matcherResult?.name === 'toHaveScreenshot'\n && typeof error.matcherResult.actual === 'string'\n && typeof error.matcherResult.expected === 'string'\n && !error.matcherResult.pass) {\n // Playwright <= 1.51\n acc.push({ actual: error.matcherResult.actual, expected: error.matcherResult.expected });\n } else if (fileNameExtractor.test(error.message)) {\n // Playwright > 1.51\n const { dir, filename, extension } = fileNameExtractor.exec(error.message)!.groups as RegExpExecArray['groups'] & {\n dir: string; filename: string; extension: string;\n };\n if (filename && extension) {\n const attachmentMatcherActual = new RegExp(`${dir}${filename}-actual.${extension}`);\n const attachmentMatcherExpected = new RegExp(`${dir}${filename}-expected.${extension}`);\n const actual = result.attachments.find((attachment) => attachmentMatcherActual.test(attachment.name));\n const expected = result.attachments.find((attachment) => attachmentMatcherExpected.test(attachment.name));\n if (actual?.path && expected?.path) {\n acc.push({ actual: actual.path, expected: expected.path });\n }\n }\n }\n return acc;\n }, [] as ScreenshotInformation[])\n )\n );\n await mkdir(dirname(this.outputFile), { recursive: true });\n return writeFile(this.outputFile, JSON.stringify(screenshotsToUpdate, null, 2));\n }\n}\n\nexport default VisualTestingPlaywrightReporter;\n"]}
|