@chromatic-com/playwright 0.14.8 → 0.14.10
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/index.js +13 -5
- package/dist/index.mjs +13 -5
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3679,6 +3679,10 @@ var _ArchiveFile = class _ArchiveFile {
|
|
|
3679
3679
|
if (!queryString)
|
|
3680
3680
|
return pathname;
|
|
3681
3681
|
const safeQueryString = this.hash(queryString);
|
|
3682
|
+
const extension = path2__default.default.extname(pathname);
|
|
3683
|
+
if (extension) {
|
|
3684
|
+
return `${pathname.substring(0, pathname.length - extension.length)}-${safeQueryString}${extension}`;
|
|
3685
|
+
}
|
|
3682
3686
|
return `${pathname}-${safeQueryString}`;
|
|
3683
3687
|
}
|
|
3684
3688
|
truncateFileName(pathname) {
|
|
@@ -3919,9 +3923,13 @@ var STORIES_FILE_EXT = "stories.json";
|
|
|
3919
3923
|
var uniqueId = {
|
|
3920
3924
|
value: 1
|
|
3921
3925
|
};
|
|
3922
|
-
function storiesFileName(testTitle) {
|
|
3926
|
+
function storiesFileName(testTitle, overwriteDuplicateNames = true) {
|
|
3927
|
+
let title = sanitize(testTitle);
|
|
3928
|
+
if (!overwriteDuplicateNames) {
|
|
3929
|
+
title += "-" + uniqueId.value++;
|
|
3930
|
+
}
|
|
3923
3931
|
const fileName = [
|
|
3924
|
-
|
|
3932
|
+
title,
|
|
3925
3933
|
STORIES_FILE_EXT
|
|
3926
3934
|
].join(".");
|
|
3927
3935
|
const maxByteLength = MAX_FILE_NAME_BYTE_LENGTH - 25;
|
|
@@ -4022,7 +4030,7 @@ function findDefaultViewport(viewports) {
|
|
|
4022
4030
|
__name(findDefaultViewport, "findDefaultViewport");
|
|
4023
4031
|
|
|
4024
4032
|
// ../shared/src/write-archive/index.ts
|
|
4025
|
-
async function writeTestResult(e2eTestInfo, domSnapshots, archive, chromaticStorybookParams) {
|
|
4033
|
+
async function writeTestResult(e2eTestInfo, domSnapshots, archive, chromaticStorybookParams, testRunner) {
|
|
4026
4034
|
const { titlePath, outputDir, pageUrl } = e2eTestInfo;
|
|
4027
4035
|
const titlePathWithoutFileExtensions = titlePath.map((pathPart) => (
|
|
4028
4036
|
// make sure we remove file extensions, even if the file name doesn't have .spec or .test or.cy
|
|
@@ -4057,7 +4065,7 @@ async function writeTestResult(e2eTestInfo, domSnapshots, archive, chromaticStor
|
|
|
4057
4065
|
const snapshotFile = snapshotFileName(snapshotId(title, name), domSnapshot.viewport);
|
|
4058
4066
|
await outputFile(path2.join(archiveDir, snapshotFile), mappedSnapshot);
|
|
4059
4067
|
}));
|
|
4060
|
-
const storiesFile = storiesFileName(title);
|
|
4068
|
+
const storiesFile = storiesFileName(title, testRunner !== "vitest");
|
|
4061
4069
|
const storiesJson = createStories(title, domSnapshots, chromaticStorybookParams);
|
|
4062
4070
|
await outputJSONFile(path2.join(finalOutputDir, storiesFile), storiesJson);
|
|
4063
4071
|
const errors = Object.entries(archive).filter(([, r]) => "error" in r);
|
|
@@ -4256,7 +4264,7 @@ var performChromaticSnapshot = /* @__PURE__ */ __name(async ({ page, delay, diff
|
|
|
4256
4264
|
prefersReducedMotion,
|
|
4257
4265
|
cropToViewport,
|
|
4258
4266
|
ignoreSelectors
|
|
4259
|
-
});
|
|
4267
|
+
}, "playwright");
|
|
4260
4268
|
trackComplete();
|
|
4261
4269
|
} finally {
|
|
4262
4270
|
chromaticSnapshots.delete(testId);
|
package/dist/index.mjs
CHANGED
|
@@ -3673,6 +3673,10 @@ var _ArchiveFile = class _ArchiveFile {
|
|
|
3673
3673
|
if (!queryString)
|
|
3674
3674
|
return pathname;
|
|
3675
3675
|
const safeQueryString = this.hash(queryString);
|
|
3676
|
+
const extension = path2.extname(pathname);
|
|
3677
|
+
if (extension) {
|
|
3678
|
+
return `${pathname.substring(0, pathname.length - extension.length)}-${safeQueryString}${extension}`;
|
|
3679
|
+
}
|
|
3676
3680
|
return `${pathname}-${safeQueryString}`;
|
|
3677
3681
|
}
|
|
3678
3682
|
truncateFileName(pathname) {
|
|
@@ -3913,9 +3917,13 @@ var STORIES_FILE_EXT = "stories.json";
|
|
|
3913
3917
|
var uniqueId = {
|
|
3914
3918
|
value: 1
|
|
3915
3919
|
};
|
|
3916
|
-
function storiesFileName(testTitle) {
|
|
3920
|
+
function storiesFileName(testTitle, overwriteDuplicateNames = true) {
|
|
3921
|
+
let title = sanitize(testTitle);
|
|
3922
|
+
if (!overwriteDuplicateNames) {
|
|
3923
|
+
title += "-" + uniqueId.value++;
|
|
3924
|
+
}
|
|
3917
3925
|
const fileName = [
|
|
3918
|
-
|
|
3926
|
+
title,
|
|
3919
3927
|
STORIES_FILE_EXT
|
|
3920
3928
|
].join(".");
|
|
3921
3929
|
const maxByteLength = MAX_FILE_NAME_BYTE_LENGTH - 25;
|
|
@@ -4016,7 +4024,7 @@ function findDefaultViewport(viewports) {
|
|
|
4016
4024
|
__name(findDefaultViewport, "findDefaultViewport");
|
|
4017
4025
|
|
|
4018
4026
|
// ../shared/src/write-archive/index.ts
|
|
4019
|
-
async function writeTestResult(e2eTestInfo, domSnapshots, archive, chromaticStorybookParams) {
|
|
4027
|
+
async function writeTestResult(e2eTestInfo, domSnapshots, archive, chromaticStorybookParams, testRunner) {
|
|
4020
4028
|
const { titlePath, outputDir, pageUrl } = e2eTestInfo;
|
|
4021
4029
|
const titlePathWithoutFileExtensions = titlePath.map((pathPart) => (
|
|
4022
4030
|
// make sure we remove file extensions, even if the file name doesn't have .spec or .test or.cy
|
|
@@ -4051,7 +4059,7 @@ async function writeTestResult(e2eTestInfo, domSnapshots, archive, chromaticStor
|
|
|
4051
4059
|
const snapshotFile = snapshotFileName(snapshotId(title, name), domSnapshot.viewport);
|
|
4052
4060
|
await outputFile(join(archiveDir, snapshotFile), mappedSnapshot);
|
|
4053
4061
|
}));
|
|
4054
|
-
const storiesFile = storiesFileName(title);
|
|
4062
|
+
const storiesFile = storiesFileName(title, testRunner !== "vitest");
|
|
4055
4063
|
const storiesJson = createStories(title, domSnapshots, chromaticStorybookParams);
|
|
4056
4064
|
await outputJSONFile(join(finalOutputDir, storiesFile), storiesJson);
|
|
4057
4065
|
const errors = Object.entries(archive).filter(([, r]) => "error" in r);
|
|
@@ -4250,7 +4258,7 @@ var performChromaticSnapshot = /* @__PURE__ */ __name(async ({ page, delay, diff
|
|
|
4250
4258
|
prefersReducedMotion,
|
|
4251
4259
|
cropToViewport,
|
|
4252
4260
|
ignoreSelectors
|
|
4253
|
-
});
|
|
4261
|
+
}, "playwright");
|
|
4254
4262
|
trackComplete();
|
|
4255
4263
|
} finally {
|
|
4256
4264
|
chromaticSnapshots.delete(testId);
|