Skip to content

Commit

Permalink
improve integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
Lms24 committed Jul 31, 2023
1 parent f3b1f37 commit 1182786
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ import { sentryTest } from '../../../utils/fixtures';
import { getFirstSentryEnvelopeRequest } from '../../../utils/helpers';

sentryTest(
'should add source context lines around stack frames from errors in Html',
'should add source context lines around stack frames from errors in Html inline JS',
async ({ getLocalTestPath, page }) => {
const url = await getLocalTestPath({ testDir: __dirname });

const eventPromise = getFirstSentryEnvelopeRequest<Event>(page, url);

await page.click('#inline-error-btn');
const clickPromise = page.click('#inline-error-btn');

const eventData = await eventPromise;
const [eventData] = await Promise.all([eventPromise, clickPromise]);

expect(eventData.exception?.values).toHaveLength(1);

Expand All @@ -23,14 +23,12 @@ sentryTest(
stacktrace: {
frames: [
{
colno: 97,
lineno: 7,
pre_context: [' <meta charset="utf-8">', ' </head>', ' <body>'],
context_line:
' <button id="inline-error-btn" onclick="throw new Error(\'Error with context lines\')">Click me</button>',
post_context: [
' <button id="script-error-btn">Click me too</button>',
' <script defer="" src="init.bundle.js"></script><script defer="" src="subject.bundle.js"></script>',
expect.stringContaining('subject.bundle.js'), // this line varies in the test based on tarball/cdn bundle (+variants)
' <footer>',
],
},
Expand All @@ -40,7 +38,7 @@ sentryTest(
},
);

sentryTest('should not add source context lines to errors from scripts', async ({ getLocalTestPath, page }) => {
sentryTest('should not add source context lines to errors from script files', async ({ getLocalTestPath, page }) => {
const url = await getLocalTestPath({ testDir: __dirname });

const eventPromise = getFirstSentryEnvelopeRequest<Event>(page, url);
Expand Down

0 comments on commit 1182786

Please sign in to comment.