Skip to content

Commit

Permalink
fix name clashing of graphics test cases when using BRANCH_SPECIFIC_T…
Browse files Browse the repository at this point in the history
…EST mode
  • Loading branch information
SlicedSilver committed Nov 11, 2024
1 parent 71415dd commit d050b3a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions tests/e2e/graphics/generate-golden-content.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ rmRf(goldenOutputPath);
fs.mkdirSync(goldenOutputPath, { recursive: true });

for (const groupName of Object.keys(testCases)) {
generateTestCases(testCases[groupName]);
generateTestCases(groupName, testCases[groupName]);
}

function generateTestCases(groupTestCases: TestCase[]): void {
function generateTestCases(groupName: string, groupTestCases: TestCase[]): void {
for (const testCase of groupTestCases) {
const testCaseOutDir = path.join(goldenOutputPath, testCase.name);
const testCaseOutDir = path.join(goldenOutputPath, groupName, testCase.name);
rmRf(testCaseOutDir);
fs.mkdirSync(testCaseOutDir, { recursive: true });
path.join(testCaseOutDir, 'test-content.html');
Expand Down
8 changes: 4 additions & 4 deletions tests/e2e/graphics/graphics-test-cases.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ void describe(`Graphics tests with devicePixelRatio=${devicePixelRatioStr} (${bu
const currentGroupOutDir = path.join(currentDprOutDir, groupName);

if (groupName.length === 0) {
registerTestCases(testCases[groupName], screenshoter, currentGroupOutDir);
registerTestCases(testCases[groupName], screenshoter, currentGroupOutDir, groupName);
} else {
void describe(groupName, () => {
registerTestCases(testCases[groupName], screenshoter, currentGroupOutDir);
registerTestCases(testCases[groupName], screenshoter, currentGroupOutDir, groupName);
});
}
}
Expand All @@ -82,7 +82,7 @@ void describe(`Graphics tests with devicePixelRatio=${devicePixelRatioStr} (${bu
});
});

function registerTestCases(testCases: TestCase[], screenshoter: Screenshoter, outDir: string): void {
function registerTestCases(testCases: TestCase[], screenshoter: Screenshoter, outDir: string, groupName: string): void {
const attempts: Record<string, number> = {};
testCases.forEach((testCase: TestCase) => {
attempts[testCase.name] = 0;
Expand All @@ -108,7 +108,7 @@ function registerTestCases(testCases: TestCase[], screenshoter: Screenshoter, ou
if (goldenContentDir) {
try {
const content = fs.readFileSync(
path.join(goldenContentDir, testCase.name, 'test-content.html'),
path.join(goldenContentDir, groupName, testCase.name, 'test-content.html'),
{ encoding: 'utf-8' }
);
return content.replace('PATH_TO_STANDALONE_MODULE', goldenStandalonePath);
Expand Down

0 comments on commit d050b3a

Please sign in to comment.