Skip to content

Commit d73a567

Browse files
authored
fix(browser-integration-tests): Fix feedback addon CDN bundle integration test setup (#13108)
- Add symlinks to lazy-loaded feedback sub-integrations whenever we discover that `feedbackIntegration` is imported in a test app - Stop forwarding the CDN bundle request to the actual CDN but throw a hard error instead
1 parent d222dd5 commit d73a567

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

dev-packages/browser-integration-tests/utils/fixtures.ts

+8-2
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,18 @@ const sentryTest = base.extend<TestFixtures>({
6868
// Ensure feedback can be lazy loaded
6969
await page.route(`https://browser.sentry-cdn.com/${SDK_VERSION}/feedback-modal.min.js`, route => {
7070
const filePath = path.resolve(testDir, './dist/feedback-modal.bundle.js');
71-
return fs.existsSync(filePath) ? route.fulfill({ path: filePath }) : route.continue();
71+
if (!fs.existsSync(filePath)) {
72+
throw new Error(`Feedback modal bundle (${filePath}) not found`);
73+
}
74+
return route.fulfill({ path: filePath });
7275
});
7376

7477
await page.route(`https://browser.sentry-cdn.com/${SDK_VERSION}/feedback-screenshot.min.js`, route => {
7578
const filePath = path.resolve(testDir, './dist/feedback-screenshot.bundle.js');
76-
return fs.existsSync(filePath) ? route.fulfill({ path: filePath }) : route.continue();
79+
if (!fs.existsSync(filePath)) {
80+
throw new Error(`Feedback screenshot bundle (${filePath}) not found`);
81+
}
82+
return route.fulfill({ path: filePath });
7783
});
7884
}
7985

dev-packages/browser-integration-tests/utils/generatePlugin.ts

+13
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,19 @@ class SentryScenarioGenerationPlugin {
272272
fileName,
273273
);
274274

275+
if (integration === 'feedback') {
276+
addStaticAssetSymlink(
277+
this.localOutPath,
278+
path.resolve(PACKAGES_DIR, 'feedback', 'build/bundles/feedback-modal.js'),
279+
'feedback-modal.bundle.js',
280+
);
281+
addStaticAssetSymlink(
282+
this.localOutPath,
283+
path.resolve(PACKAGES_DIR, 'feedback', 'build/bundles/feedback-screenshot.js'),
284+
'feedback-screenshot.bundle.js',
285+
);
286+
}
287+
275288
const integrationObject = createHtmlTagObject('script', {
276289
src: fileName,
277290
});

0 commit comments

Comments
 (0)