@o3r/testing 12.4.15 → 12.4.16
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": "12.4.
|
3
|
+
"version": "12.4.16",
|
4
4
|
"publishConfig": {
|
5
5
|
"access": "public"
|
6
6
|
},
|
@@ -112,9 +112,9 @@
|
|
112
112
|
"@material/slider": "^14.0.0",
|
113
113
|
"@ngrx/store": "^19.0.0",
|
114
114
|
"@ngx-translate/core": "^15.0.0 || ~16.0.4",
|
115
|
-
"@o3r/core": "^12.4.
|
116
|
-
"@o3r/localization": "^12.4.
|
117
|
-
"@o3r/schematics": "^12.4.
|
115
|
+
"@o3r/core": "^12.4.16",
|
116
|
+
"@o3r/localization": "^12.4.16",
|
117
|
+
"@o3r/schematics": "^12.4.16",
|
118
118
|
"@playwright/test": "^1.49.0",
|
119
119
|
"@schematics/angular": "^19.0.0",
|
120
120
|
"pixelmatch": "^6.0.0",
|
@@ -183,7 +183,7 @@
|
|
183
183
|
}
|
184
184
|
},
|
185
185
|
"dependencies": {
|
186
|
-
"@o3r/schematics": "^12.4.
|
186
|
+
"@o3r/schematics": "^12.4.16",
|
187
187
|
"esbuild": "~0.25.1",
|
188
188
|
"module-from-string": "^3.2.0",
|
189
189
|
"tslib": "^2.6.2"
|
@@ -210,11 +210,11 @@
|
|
210
210
|
"@ngx-translate/core": "~16.0.4",
|
211
211
|
"@nx/eslint-plugin": "~20.8.0",
|
212
212
|
"@nx/jest": "~20.8.0",
|
213
|
-
"@o3r/build-helpers": "^12.4.
|
214
|
-
"@o3r/core": "^12.4.
|
215
|
-
"@o3r/eslint-plugin": "^12.4.
|
216
|
-
"@o3r/localization": "^12.4.
|
217
|
-
"@o3r/test-helpers": "^12.4.
|
213
|
+
"@o3r/build-helpers": "^12.4.16",
|
214
|
+
"@o3r/core": "^12.4.16",
|
215
|
+
"@o3r/eslint-plugin": "^12.4.16",
|
216
|
+
"@o3r/localization": "^12.4.16",
|
217
|
+
"@o3r/test-helpers": "^12.4.16",
|
218
218
|
"@playwright/test": "~1.54.0",
|
219
219
|
"@schematics/angular": "~19.2.0",
|
220
220
|
"@stylistic/eslint-plugin": "~3.1.0",
|
@@ -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;IACrB,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,KAAK;QAChB,MAA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AU,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"]}
|