Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import * as Sentry from '@sentry/browser';

window.Sentry = Sentry;

Sentry.init({
dsn: 'https://[email protected]/1337',
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Sentry.showReportDialog({
eventId: 'test_id',
user: {
email: '[email protected]',
name: 'test',
},
lang: 'en-nz',
title: 'test_title',
subtitle: 'test_subtitle',
subtitle2: 'test_subtitle2',
labelName: 'test_label_name',
labelEmail: 'test_label_email',
labelComments: 'test_label_comments',
labelClose: 'test_label_close',
labelSubmit: 'test_label_submit',
errorGeneric: 'test_error_generic',
errorFormEntry: 'test_error_form_entry',
successMessage: 'test_success_message',
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import { expect } from '@playwright/test';

import { sentryTest } from '../../../../utils/fixtures';

sentryTest('should inject dialog script into <head> with correct attributes', async ({ getLocalTestPath, page }) => {
const url = await getLocalTestPath({ testDir: __dirname });

const dialogScriptSelector = 'head > script[src^="https://dsn.ingest.sentry.io/api/embed/error-page"]';

await page.goto(url);
const dialogScript = await page.waitForSelector(dialogScriptSelector, { state: 'attached' });
const dialogScriptSrc = await dialogScript.getAttribute('src');

expect(dialogScriptSrc?.startsWith('https://dsn.ingest.sentry.io/api/embed/error-page/?')).toBe(true);
// After `?` is searchParams.

const searchParams = new URLSearchParams(new URL(dialogScriptSrc || '').searchParams);

expect(searchParams.get('dsn')).toBe('https://[email protected]/1337');
expect(searchParams.get('eventId')).toBe('test_id');
expect(searchParams.get('name')).toBe('test');
expect(searchParams.get('email')).toBe('[email protected]');
expect(searchParams.get('lang')).toBe('en-nz');
expect(searchParams.get('title')).toBe('test_title');
expect(searchParams.get('subtitle')).toBe('test_subtitle');
expect(searchParams.get('subtitle2')).toBe('test_subtitle2');
expect(searchParams.get('labelName')).toBe('test_label_name');
expect(searchParams.get('labelEmail')).toBe('test_label_email');
expect(searchParams.get('labelComments')).toBe('test_label_comments');
expect(searchParams.get('labelClose')).toBe('test_label_close');
expect(searchParams.get('labelSubmit')).toBe('test_label_submit');
expect(searchParams.get('errorGeneric')).toBe('test_error_generic');
expect(searchParams.get('errorFormEntry')).toBe('test_error_form_entry');
expect(searchParams.get('successMessage')).toBe('test_success_message');
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<script src="{{htmlWebpackPlugin.options.initialization}}"></script>
</head>
<body>
<script src="{{htmlWebpackPlugin.options.subject}}"></script>
</body>
</html>