Skip to content

Commit

Permalink
Revert "Group Percy snapshots by test case name (#5299)" (#5335)
Browse files Browse the repository at this point in the history
This reverts commit 7ff9e82.
  • Loading branch information
jmuzina authored Sep 5, 2024
1 parent 7ff9e82 commit b881bed
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 19 deletions.
9 changes: 4 additions & 5 deletions snapshots.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,19 +130,18 @@ async function getPercyConfigURLs() {
let urls = [];

for (let link of links) {
for (const theme of SNAPSHOT_COLOR_THEMES) {
const url = new URL(`${link}?${COLOR_THEME_QUERY_PARAM_NAME}=${theme}`);
const path = url.pathname.replace(/\/?$/, '/');
const path = new URL(link).pathname.replace(/\/?$/, '/');

for (const theme of SNAPSHOT_COLOR_THEMES) {
const url = `${link}?${COLOR_THEME_QUERY_PARAM_NAME}=${theme}`;
const name = `${path.slice(0, path.length - 1)}?${COLOR_THEME_QUERY_PARAM_NAME}=${theme}`;
const widths = await getWidthsForExample(path, theme);

// Default theme captured responsively, other themes captured at the largest width
urls.push({
url: url.href,
url,
name,
widths,
testCase: url.pathname.replace(/standalone\//g, ''),
});
}
}
Expand Down
14 changes: 0 additions & 14 deletions tests/snapshots.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,17 +110,3 @@ test('Returns snapshots with only the expected set of color themes', async () =>
}, new Set());
expect(JSON.stringify(encounteredThemes)).toBe(JSON.stringify(new Set(SNAPSHOT_COLOR_THEMES)));
});

test('Returns snapshots with unique combination of test case and name', async () => {
const snapshots = await snapshotsTest();
const encounteredTestCaseAndName = new Map();
const failedSnapshots = [];
snapshots.forEach((snapshot) => {
const key = `${snapshot.testCase}-${snapshot.name}`;
if (encounteredTestCaseAndName.has(key)) {
failedSnapshots.push(snapshot);
}
encounteredTestCaseAndName.set(key, snapshot.url);
});
expect(failedSnapshots).toHaveLength(0);
});

0 comments on commit b881bed

Please sign in to comment.