Skip to content

Commit

Permalink
test: Fix flakey Playwright tests due to static assets (#13199)
Browse files Browse the repository at this point in the history
Our playwright tests can be flakey caused by the build process when
generating static assets. Even though we check if file exists before
symlinking, it can at times fail because file already exists. I have not
dug/thought about why this happens -- just catch/ignore and move on.

Closes #11902
  • Loading branch information
billyvg authored Aug 2, 2024
1 parent 5f3f531 commit a7fbe01
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion dev-packages/browser-integration-tests/utils/staticAssets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,16 @@ export function addStaticAssetSymlink(localOutPath: string, originalPath: string

// Only copy files once
if (!fs.existsSync(newPath)) {
fs.symlinkSync(originalPath, newPath);
try {
fs.symlinkSync(originalPath, newPath);
} catch (error) {
// There must be some race condition here as some of our tests flakey
// because the file already exists. Let's catch and ignore
// only ignore these kind of errors
if (!`${error}`.includes('file already exists')) {
throw error;
}
}
}

symlinkAsset(newPath, path.join(localOutPath, fileName));
Expand Down

0 comments on commit a7fbe01

Please sign in to comment.