File tree Expand file tree Collapse file tree 13 files changed +58
-61
lines changed
packages/browser-integration-tests Expand file tree Collapse file tree 13 files changed +58
-61
lines changed Original file line number Diff line number Diff line change 11import { expect } from '@playwright/test' ;
22
33import { sentryTest } from '../../../../utils/fixtures' ;
4- import { envelopeRequestParser , waitForErrorRequest } from '../../../../utils/helpers' ;
4+ import { envelopeRequestParser , waitForErrorRequestOnUrl } from '../../../../utils/helpers' ;
55
66sentryTest ( 'captureException works' , async ( { getLocalTestUrl, page } ) => {
7- const req = waitForErrorRequest ( page ) ;
8-
97 const url = await getLocalTestUrl ( { testDir : __dirname } ) ;
10- await page . goto ( url ) ;
8+ const req = await waitForErrorRequestOnUrl ( page , url ) ;
119
12- const eventData = envelopeRequestParser ( await req ) ;
10+ const eventData = envelopeRequestParser ( req ) ;
1311
1412 expect ( eventData . message ) . toBe ( 'Test exception' ) ;
1513} ) ;
Original file line number Diff line number Diff line change 11import { expect } from '@playwright/test' ;
22
33import { sentryTest } from '../../../../utils/fixtures' ;
4- import { envelopeRequestParser , waitForErrorRequest } from '../../../../utils/helpers' ;
4+ import { envelopeRequestParser , waitForErrorRequestOnUrl } from '../../../../utils/helpers' ;
55
66sentryTest ( 'error handler works with a recursive custom error handler' , async ( { getLocalTestUrl, page } ) => {
7- const req = waitForErrorRequest ( page ) ;
8-
97 const url = await getLocalTestUrl ( { testDir : __dirname } ) ;
10- await page . goto ( url ) ;
8+ const req = await waitForErrorRequestOnUrl ( page , url ) ;
119
12- const eventData = envelopeRequestParser ( await req ) ;
10+ const eventData = envelopeRequestParser ( req ) ;
1311 expect ( eventData . exception ?. values ?. length ) . toBe ( 1 ) ;
1412 expect ( eventData . exception ?. values ?. [ 0 ] ?. value ) . toBe ( 'window.doSomethingWrong is not a function' ) ;
1513} ) ;
Original file line number Diff line number Diff line change 11import { expect } from '@playwright/test' ;
22
33import { sentryTest } from '../../../../utils/fixtures' ;
4- import { envelopeRequestParser , waitForErrorRequest } from '../../../../utils/helpers' ;
4+ import { envelopeRequestParser , waitForErrorRequestOnUrl } from '../../../../utils/helpers' ;
55
66sentryTest ( 'error handler works' , async ( { getLocalTestUrl, page } ) => {
7- const req = waitForErrorRequest ( page ) ;
8-
97 const url = await getLocalTestUrl ( { testDir : __dirname } ) ;
10- await page . goto ( url ) ;
8+ const req = await waitForErrorRequestOnUrl ( page , url ) ;
119
12- const eventData = envelopeRequestParser ( await req ) ;
10+ const eventData = envelopeRequestParser ( req ) ;
1311 expect ( eventData . exception ?. values ?. length ) . toBe ( 1 ) ;
1412 expect ( eventData . exception ?. values ?. [ 0 ] ?. value ) . toBe ( 'window.doSomethingWrong is not a function' ) ;
1513} ) ;
Original file line number Diff line number Diff line change 11import { expect } from '@playwright/test' ;
22
33import { sentryTest } from '../../../../utils/fixtures' ;
4- import { envelopeRequestParser , waitForErrorRequest } from '../../../../utils/helpers' ;
4+ import { envelopeRequestParser , waitForErrorRequestOnUrl } from '../../../../utils/helpers' ;
55
66sentryTest ( 'error handler works for later errors' , async ( { getLocalTestUrl, page } ) => {
7- const req = waitForErrorRequest ( page ) ;
8-
97 const url = await getLocalTestUrl ( { testDir : __dirname } ) ;
10- await page . goto ( url ) ;
8+ const req = await waitForErrorRequestOnUrl ( page , url ) ;
119
12- const eventData = envelopeRequestParser ( await req ) ;
10+ const eventData = envelopeRequestParser ( req ) ;
1311
1412 expect ( eventData . exception ?. values ?. length ) . toBe ( 1 ) ;
1513 expect ( eventData . exception ?. values ?. [ 0 ] ?. value ) . toBe ( 'window.doSomethingWrong is not a function' ) ;
Original file line number Diff line number Diff line change 11import { expect } from '@playwright/test' ;
22
33import { sentryTest } from '../../../../utils/fixtures' ;
4- import { envelopeRequestParser , shouldSkipTracingTest , waitForTransactionRequest } from '../../../../utils/helpers' ;
4+ import {
5+ envelopeRequestParser ,
6+ shouldSkipTracingTest ,
7+ waitForTransactionRequestOnUrl ,
8+ } from '../../../../utils/helpers' ;
59
610sentryTest ( 'should create a pageload transaction' , async ( { getLocalTestUrl, page } ) => {
711 if ( shouldSkipTracingTest ( ) ) {
812 sentryTest . skip ( ) ;
913 }
1014
11- const req = waitForTransactionRequest ( page ) ;
12-
1315 const url = await getLocalTestUrl ( { testDir : __dirname } ) ;
14- await page . goto ( url ) ;
16+ const req = await waitForTransactionRequestOnUrl ( page , url ) ;
1517
16- const eventData = envelopeRequestParser ( await req ) ;
18+ const eventData = envelopeRequestParser ( req ) ;
1719 const timeOrigin = await page . evaluate < number > ( 'window._testBaseTimestamp' ) ;
1820
1921 const { start_timestamp : startTimestamp } = eventData ;
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import path from 'path';
44
55import { sentryTest , TEST_HOST } from '../../../../utils/fixtures' ;
66import { LOADER_CONFIGS } from '../../../../utils/generatePlugin' ;
7- import { envelopeRequestParser , waitForErrorRequest } from '../../../../utils/helpers' ;
7+ import { envelopeRequestParser , waitForErrorRequestOnUrl } from '../../../../utils/helpers' ;
88
99const bundle = process . env . PW_BUNDLE || '' ;
1010const isLazy = LOADER_CONFIGS [ bundle ] ?. lazy ;
@@ -40,13 +40,10 @@ sentryTest('it does not download the SDK if the SDK was loaded in the meanwhile'
4040 return fs . existsSync ( filePath ) ? route . fulfill ( { path : filePath } ) : route . continue ( ) ;
4141 } ) ;
4242
43- const req = waitForErrorRequest ( page ) ;
44-
4543 const url = await getLocalTestUrl ( { testDir : __dirname , skipRouteHandler : true } ) ;
44+ const req = await waitForErrorRequestOnUrl ( page , url ) ;
4645
47- await page . goto ( url ) ;
48-
49- const eventData = envelopeRequestParser ( await req ) ;
46+ const eventData = envelopeRequestParser ( req ) ;
5047
5148 await waitForFunction ( ( ) => cdnLoadedCount === 2 ) ;
5249
Original file line number Diff line number Diff line change 11import { expect } from '@playwright/test' ;
22
33import { sentryTest } from '../../../../utils/fixtures' ;
4- import { envelopeRequestParser , waitForErrorRequest } from '../../../../utils/helpers' ;
4+ import { envelopeRequestParser , waitForErrorRequestOnUrl } from '../../../../utils/helpers' ;
55
66sentryTest ( 'captureException works' , async ( { getLocalTestUrl, page } ) => {
7- const req = waitForErrorRequest ( page ) ;
8-
97 const url = await getLocalTestUrl ( { testDir : __dirname } ) ;
10- await page . goto ( url ) ;
8+ const req = await waitForErrorRequestOnUrl ( page , url ) ;
119
12- const eventData = envelopeRequestParser ( await req ) ;
10+ const eventData = envelopeRequestParser ( req ) ;
1311
1412 expect ( eventData . message ) . toBe ( 'Test exception' ) ;
1513} ) ;
Original file line number Diff line number Diff line change 11import { expect } from '@playwright/test' ;
22
33import { sentryTest } from '../../../../utils/fixtures' ;
4- import { envelopeRequestParser , waitForErrorRequest } from '../../../../utils/helpers' ;
4+ import { envelopeRequestParser , waitForErrorRequestOnUrl } from '../../../../utils/helpers' ;
55
66sentryTest ( 'captureException works inside of onLoad' , async ( { getLocalTestUrl, page } ) => {
7- const req = waitForErrorRequest ( page ) ;
8-
97 const url = await getLocalTestUrl ( { testDir : __dirname } ) ;
10- await page . goto ( url ) ;
8+ const req = await waitForErrorRequestOnUrl ( page , url ) ;
119
12- const eventData = envelopeRequestParser ( await req ) ;
10+ const eventData = envelopeRequestParser ( req ) ;
1311
1412 expect ( eventData . message ) . toBe ( 'Test exception' ) ;
1513} ) ;
Original file line number Diff line number Diff line change 11import { expect } from '@playwright/test' ;
22
33import { sentryTest } from '../../../../utils/fixtures' ;
4- import { envelopeRequestParser , shouldSkipTracingTest , waitForTransactionRequest } from '../../../../utils/helpers' ;
4+ import {
5+ envelopeRequestParser ,
6+ shouldSkipTracingTest ,
7+ waitForTransactionRequestOnUrl ,
8+ } from '../../../../utils/helpers' ;
59
610sentryTest ( 'should handle custom added BrowserTracing integration' , async ( { getLocalTestUrl, page } ) => {
711 if ( shouldSkipTracingTest ( ) ) {
812 sentryTest . skip ( ) ;
913 }
1014
11- const req = waitForTransactionRequest ( page ) ;
12-
1315 const url = await getLocalTestUrl ( { testDir : __dirname } ) ;
14- await page . goto ( url ) ;
16+ const req = await waitForTransactionRequestOnUrl ( page , url ) ;
1517
16- const eventData = envelopeRequestParser ( await req ) ;
18+ const eventData = envelopeRequestParser ( req ) ;
1719 const timeOrigin = await page . evaluate < number > ( 'window._testBaseTimestamp' ) ;
1820
1921 const { start_timestamp : startTimestamp } = eventData ;
Original file line number Diff line number Diff line change 11import { expect } from '@playwright/test' ;
22
33import { sentryTest } from '../../../../utils/fixtures' ;
4- import { envelopeRequestParser , waitForErrorRequest } from '../../../../utils/helpers' ;
4+ import { envelopeRequestParser , waitForErrorRequestOnUrl } from '../../../../utils/helpers' ;
55
66sentryTest ( 'error handler works' , async ( { getLocalTestUrl, page } ) => {
7- const req = waitForErrorRequest ( page ) ;
8-
97 const url = await getLocalTestUrl ( { testDir : __dirname } ) ;
10- await page . goto ( url ) ;
8+ const req = await waitForErrorRequestOnUrl ( page , url ) ;
119
12- const eventData = envelopeRequestParser ( await req ) ;
10+ const eventData = envelopeRequestParser ( req ) ;
1311
1412 expect ( eventData . exception ?. values ?. length ) . toBe ( 1 ) ;
1513 expect ( eventData . exception ?. values ?. [ 0 ] ?. value ) . toBe ( 'window.doSomethingWrong is not a function' ) ;
You can’t perform that action at this time.
0 commit comments