Skip to content

Commit 4d5e9f8

Browse files
authored
Merge pull request #156 from mean-weasel/fix/live-production-venue-path
test: cover production redaction failure UX
2 parents a321881 + b8b1d2b commit 4d5e9f8

1 file changed

Lines changed: 46 additions & 5 deletions

File tree

e2e/widget.live.spec.ts

Lines changed: 46 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ const expectedWidgetOrigin =
2222
? 'https://bugdrop.neonwatty.workers.dev'
2323
: undefined);
2424
const expectedWidgetSha256 = process.env.EXPECTED_WIDGET_SHA256;
25+
const venuePath = process.env.LIVE_VENUE_PATH || '/';
2526

2627
if (bypassSecret) {
2728
test.beforeEach(async ({ context }) => {
@@ -70,7 +71,7 @@ async function addCorsBlockedImage(page: Page) {
7071

7172
async function openScreenshotOptions(page: Page, title: string) {
7273
await mockInstalledRepo(page);
73-
await page.goto(process.env.LIVE_TARGET === 'preview' ? '/' : '/test/');
74+
await page.goto(venuePath);
7475

7576
const host = page.locator('#bugdrop-host');
7677
const button = host.locator('css=.bd-trigger');
@@ -263,7 +264,7 @@ test.describe('Widget Loading (Live)', () => {
263264
}
264265
});
265266

266-
await page.goto(process.env.LIVE_TARGET === 'preview' ? '/' : '/test/');
267+
await page.goto(venuePath);
267268
await page.waitForTimeout(2000);
268269

269270
// Widget host element should exist
@@ -286,7 +287,7 @@ test.describe('Widget Loading (Live)', () => {
286287
});
287288

288289
test('venue loads the expected deployed widget asset', async ({ page, request }) => {
289-
await page.goto(process.env.LIVE_TARGET === 'preview' ? '/' : '/test/');
290+
await page.goto(venuePath);
290291

291292
const widgetSrc = await page.evaluate(() => {
292293
return (
@@ -312,7 +313,7 @@ test.describe('Widget Loading (Live)', () => {
312313

313314
test.describe('Feedback Button (Live)', () => {
314315
test('feedback button is visible and clickable', async ({ page }) => {
315-
await page.goto(process.env.LIVE_TARGET === 'preview' ? '/' : '/test/');
316+
await page.goto(venuePath);
316317

317318
const button = page.locator('#bugdrop-host').locator('css=.bd-trigger');
318319
await expect(button).toBeVisible({ timeout: 10_000 });
@@ -489,7 +490,7 @@ test.describe('Screenshot Capture (Live)', () => {
489490
});
490491
});
491492

492-
await page.goto(process.env.LIVE_TARGET === 'preview' ? '/' : '/test/');
493+
await page.goto(venuePath);
493494

494495
const host = page.locator('#bugdrop-host');
495496
const button = host.locator('css=.bd-trigger');
@@ -611,6 +612,46 @@ test.describe('Screenshot Capture (Live)', () => {
611612
await countBlackPixelsInDataUrl(page, submittedScreenshot as string, latestRegion)
612613
).toBeLessThan(20);
613614
});
615+
616+
test('privacy masking failure UX works on the deployed production widget', async ({ page }) => {
617+
test.skip(
618+
process.env.LIVE_TARGET !== 'production',
619+
'The production failure fixture is hosted on the production Vercel venue.'
620+
);
621+
622+
await mockInstalledRepo(page);
623+
const payloads = await trackLiveFeedbackPayloads(page);
624+
await page.goto('/redaction-failure.html');
625+
626+
const host = page.locator('#bugdrop-host');
627+
await expect(host.locator('css=.bd-trigger')).toBeVisible({ timeout: 10_000 });
628+
await host.locator('css=.bd-trigger').click();
629+
630+
await expect(host.locator('css=[data-action="continue"]')).toBeVisible({ timeout: 5_000 });
631+
await host.locator('css=[data-action="continue"]').click();
632+
633+
await expect(host.locator('css=#title')).toBeVisible({ timeout: 5_000 });
634+
await host.locator('css=#title').fill('Live privacy masking failure');
635+
await host.locator('css=#include-screenshot').check();
636+
await host.locator('css=#submit-btn').click();
637+
638+
await expect(host.locator('css=[data-action="capture"]')).toBeVisible({ timeout: 5_000 });
639+
await host.locator('css=[data-action="capture"]').click();
640+
641+
await expect(host.locator('css=.bd-title')).toHaveText('Privacy masking failed', {
642+
timeout: 10_000,
643+
});
644+
await expect(host.locator('css=.bd-error-message__text')).toContainText(
645+
'Automatic redaction of private fields could not be applied'
646+
);
647+
await expect(host.locator('css=button').filter({ hasText: 'Try Again' })).toHaveCount(0);
648+
649+
await host.locator('css=button').filter({ hasText: 'Continue without screenshot' }).click();
650+
await expect(host.locator('css=.bd-success-icon')).toBeVisible({ timeout: 10_000 });
651+
652+
expect(payloads).toHaveLength(1);
653+
expect(payloads[0].screenshot).toBeNull();
654+
});
614655
});
615656

616657
test.describe('Feedback Submission (Live)', () => {

0 commit comments

Comments
 (0)