Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Refactor playwright bundle generation #8029

Merged
merged 2 commits into from
May 4, 2023

Conversation

mydea
Copy link
Member

@mydea mydea commented May 3, 2023

While working on #8024, I noticed that bundle tests were failing, because we couldn't really run the playwright tests in bundle mode when serving the app on a URL instead via file://. This is because of the way we reference bundle files, which have been referenced as e.g. <script src="/Users/francesco/git/sentry-javascript/packages/browser/build/bundle.min.js">. This doesn't play well with serving from a URL like https://sentry-test.io/cdn.bundle.js.

In order to make this work and streamline this, I refactored this to instead keep a tmp/static folder for all of the integration tests, where we can cache static files that are the same for all test runs (e.g. cdn.bundle.js, the integrations or loader.js). Where possible, we make those symlinks. Then we put a symlink to these files into the dist folder of each test, and can reference them from there. This works in both file & URL serving mode.

Instead of using linked files for the CDN tests, we place symlinks in the `dist` folder and reference those. This makes it easier to test stuff that relies on URLs as well.
@mydea mydea requested review from lforst, Lms24 and AbhiPrasad May 3, 2023 13:07
@mydea mydea self-assigned this May 3, 2023
@github-actions
Copy link
Contributor

github-actions bot commented May 3, 2023

size-limit report 📦

Path Size
@sentry/browser - ES5 CDN Bundle (gzipped + minified) 21.02 KB (+0.05% 🔺)
@sentry/browser - ES5 CDN Bundle (minified) 65.66 KB (+0.06% 🔺)
@sentry/browser - ES6 CDN Bundle (gzipped + minified) 19.56 KB (+0.05% 🔺)
@sentry/browser - ES6 CDN Bundle (minified) 58.12 KB (+0.06% 🔺)
@sentry/browser - Webpack (gzipped + minified) 21.17 KB (+0.04% 🔺)
@sentry/browser - Webpack (minified) 69.07 KB (+0.05% 🔺)
@sentry/react - Webpack (gzipped + minified) 21.19 KB (+0.03% 🔺)
@sentry/nextjs Client - Webpack (gzipped + minified) 49.09 KB (+0.02% 🔺)
@sentry/browser + @sentry/tracing - ES5 CDN Bundle (gzipped + minified) 28.65 KB (+0.04% 🔺)
@sentry/browser + @sentry/tracing - ES6 CDN Bundle (gzipped + minified) 26.87 KB (+0.03% 🔺)
@sentry/replay ES6 CDN Bundle (gzipped + minified) 46.87 KB (+0.03% 🔺)
@sentry/replay - Webpack (gzipped + minified) 40.67 KB (0%)
@sentry/browser + @sentry/tracing + @sentry/replay - ES6 CDN Bundle (gzipped + minified) 65.75 KB (+0.02% 🔺)
@sentry/browser + @sentry/replay - ES6 CDN Bundle (gzipped + minified) 58.64 KB (+0.02% 🔺)

@mydea mydea merged commit 4800458 into develop May 4, 2023
50 checks passed
@mydea mydea deleted the fn/integration-tests-static branch May 4, 2023 06:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants