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 1
1
import { expect } from '@playwright/test' ;
2
2
3
3
import { sentryTest } from '../../../../utils/fixtures' ;
4
- import { envelopeRequestParser , waitForErrorRequest } from '../../../../utils/helpers' ;
4
+ import { envelopeRequestParser , waitForErrorRequestOnUrl } from '../../../../utils/helpers' ;
5
5
6
6
sentryTest ( 'captureException works' , async ( { getLocalTestUrl, page } ) => {
7
- const req = waitForErrorRequest ( page ) ;
8
-
9
7
const url = await getLocalTestUrl ( { testDir : __dirname } ) ;
10
- await page . goto ( url ) ;
8
+ const req = await waitForErrorRequestOnUrl ( page , url ) ;
11
9
12
- const eventData = envelopeRequestParser ( await req ) ;
10
+ const eventData = envelopeRequestParser ( req ) ;
13
11
14
12
expect ( eventData . message ) . toBe ( 'Test exception' ) ;
15
13
} ) ;
Original file line number Diff line number Diff line change 1
1
import { expect } from '@playwright/test' ;
2
2
3
3
import { sentryTest } from '../../../../utils/fixtures' ;
4
- import { envelopeRequestParser , waitForErrorRequest } from '../../../../utils/helpers' ;
4
+ import { envelopeRequestParser , waitForErrorRequestOnUrl } from '../../../../utils/helpers' ;
5
5
6
6
sentryTest ( 'error handler works with a recursive custom error handler' , async ( { getLocalTestUrl, page } ) => {
7
- const req = waitForErrorRequest ( page ) ;
8
-
9
7
const url = await getLocalTestUrl ( { testDir : __dirname } ) ;
10
- await page . goto ( url ) ;
8
+ const req = await waitForErrorRequestOnUrl ( page , url ) ;
11
9
12
- const eventData = envelopeRequestParser ( await req ) ;
10
+ const eventData = envelopeRequestParser ( req ) ;
13
11
expect ( eventData . exception ?. values ?. length ) . toBe ( 1 ) ;
14
12
expect ( eventData . exception ?. values ?. [ 0 ] ?. value ) . toBe ( 'window.doSomethingWrong is not a function' ) ;
15
13
} ) ;
Original file line number Diff line number Diff line change 1
1
import { expect } from '@playwright/test' ;
2
2
3
3
import { sentryTest } from '../../../../utils/fixtures' ;
4
- import { envelopeRequestParser , waitForErrorRequest } from '../../../../utils/helpers' ;
4
+ import { envelopeRequestParser , waitForErrorRequestOnUrl } from '../../../../utils/helpers' ;
5
5
6
6
sentryTest ( 'error handler works' , async ( { getLocalTestUrl, page } ) => {
7
- const req = waitForErrorRequest ( page ) ;
8
-
9
7
const url = await getLocalTestUrl ( { testDir : __dirname } ) ;
10
- await page . goto ( url ) ;
8
+ const req = await waitForErrorRequestOnUrl ( page , url ) ;
11
9
12
- const eventData = envelopeRequestParser ( await req ) ;
10
+ const eventData = envelopeRequestParser ( req ) ;
13
11
expect ( eventData . exception ?. values ?. length ) . toBe ( 1 ) ;
14
12
expect ( eventData . exception ?. values ?. [ 0 ] ?. value ) . toBe ( 'window.doSomethingWrong is not a function' ) ;
15
13
} ) ;
Original file line number Diff line number Diff line change 1
1
import { expect } from '@playwright/test' ;
2
2
3
3
import { sentryTest } from '../../../../utils/fixtures' ;
4
- import { envelopeRequestParser , waitForErrorRequest } from '../../../../utils/helpers' ;
4
+ import { envelopeRequestParser , waitForErrorRequestOnUrl } from '../../../../utils/helpers' ;
5
5
6
6
sentryTest ( 'error handler works for later errors' , async ( { getLocalTestUrl, page } ) => {
7
- const req = waitForErrorRequest ( page ) ;
8
-
9
7
const url = await getLocalTestUrl ( { testDir : __dirname } ) ;
10
- await page . goto ( url ) ;
8
+ const req = await waitForErrorRequestOnUrl ( page , url ) ;
11
9
12
- const eventData = envelopeRequestParser ( await req ) ;
10
+ const eventData = envelopeRequestParser ( req ) ;
13
11
14
12
expect ( eventData . exception ?. values ?. length ) . toBe ( 1 ) ;
15
13
expect ( eventData . exception ?. values ?. [ 0 ] ?. value ) . toBe ( 'window.doSomethingWrong is not a function' ) ;
Original file line number Diff line number Diff line change 1
1
import { expect } from '@playwright/test' ;
2
2
3
3
import { sentryTest } from '../../../../utils/fixtures' ;
4
- import { envelopeRequestParser , shouldSkipTracingTest , waitForTransactionRequest } from '../../../../utils/helpers' ;
4
+ import {
5
+ envelopeRequestParser ,
6
+ shouldSkipTracingTest ,
7
+ waitForTransactionRequestOnUrl ,
8
+ } from '../../../../utils/helpers' ;
5
9
6
10
sentryTest ( 'should create a pageload transaction' , async ( { getLocalTestUrl, page } ) => {
7
11
if ( shouldSkipTracingTest ( ) ) {
8
12
sentryTest . skip ( ) ;
9
13
}
10
14
11
- const req = waitForTransactionRequest ( page ) ;
12
-
13
15
const url = await getLocalTestUrl ( { testDir : __dirname } ) ;
14
- await page . goto ( url ) ;
16
+ const req = await waitForTransactionRequestOnUrl ( page , url ) ;
15
17
16
- const eventData = envelopeRequestParser ( await req ) ;
18
+ const eventData = envelopeRequestParser ( req ) ;
17
19
const timeOrigin = await page . evaluate < number > ( 'window._testBaseTimestamp' ) ;
18
20
19
21
const { start_timestamp : startTimestamp } = eventData ;
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ import path from 'path';
4
4
5
5
import { sentryTest , TEST_HOST } from '../../../../utils/fixtures' ;
6
6
import { LOADER_CONFIGS } from '../../../../utils/generatePlugin' ;
7
- import { envelopeRequestParser , waitForErrorRequest } from '../../../../utils/helpers' ;
7
+ import { envelopeRequestParser , waitForErrorRequestOnUrl } from '../../../../utils/helpers' ;
8
8
9
9
const bundle = process . env . PW_BUNDLE || '' ;
10
10
const isLazy = LOADER_CONFIGS [ bundle ] ?. lazy ;
@@ -40,13 +40,10 @@ sentryTest('it does not download the SDK if the SDK was loaded in the meanwhile'
40
40
return fs . existsSync ( filePath ) ? route . fulfill ( { path : filePath } ) : route . continue ( ) ;
41
41
} ) ;
42
42
43
- const req = waitForErrorRequest ( page ) ;
44
-
45
43
const url = await getLocalTestUrl ( { testDir : __dirname , skipRouteHandler : true } ) ;
44
+ const req = await waitForErrorRequestOnUrl ( page , url ) ;
46
45
47
- await page . goto ( url ) ;
48
-
49
- const eventData = envelopeRequestParser ( await req ) ;
46
+ const eventData = envelopeRequestParser ( req ) ;
50
47
51
48
await waitForFunction ( ( ) => cdnLoadedCount === 2 ) ;
52
49
Original file line number Diff line number Diff line change 1
1
import { expect } from '@playwright/test' ;
2
2
3
3
import { sentryTest } from '../../../../utils/fixtures' ;
4
- import { envelopeRequestParser , waitForErrorRequest } from '../../../../utils/helpers' ;
4
+ import { envelopeRequestParser , waitForErrorRequestOnUrl } from '../../../../utils/helpers' ;
5
5
6
6
sentryTest ( 'captureException works' , async ( { getLocalTestUrl, page } ) => {
7
- const req = waitForErrorRequest ( page ) ;
8
-
9
7
const url = await getLocalTestUrl ( { testDir : __dirname } ) ;
10
- await page . goto ( url ) ;
8
+ const req = await waitForErrorRequestOnUrl ( page , url ) ;
11
9
12
- const eventData = envelopeRequestParser ( await req ) ;
10
+ const eventData = envelopeRequestParser ( req ) ;
13
11
14
12
expect ( eventData . message ) . toBe ( 'Test exception' ) ;
15
13
} ) ;
Original file line number Diff line number Diff line change 1
1
import { expect } from '@playwright/test' ;
2
2
3
3
import { sentryTest } from '../../../../utils/fixtures' ;
4
- import { envelopeRequestParser , waitForErrorRequest } from '../../../../utils/helpers' ;
4
+ import { envelopeRequestParser , waitForErrorRequestOnUrl } from '../../../../utils/helpers' ;
5
5
6
6
sentryTest ( 'captureException works inside of onLoad' , async ( { getLocalTestUrl, page } ) => {
7
- const req = waitForErrorRequest ( page ) ;
8
-
9
7
const url = await getLocalTestUrl ( { testDir : __dirname } ) ;
10
- await page . goto ( url ) ;
8
+ const req = await waitForErrorRequestOnUrl ( page , url ) ;
11
9
12
- const eventData = envelopeRequestParser ( await req ) ;
10
+ const eventData = envelopeRequestParser ( req ) ;
13
11
14
12
expect ( eventData . message ) . toBe ( 'Test exception' ) ;
15
13
} ) ;
Original file line number Diff line number Diff line change 1
1
import { expect } from '@playwright/test' ;
2
2
3
3
import { sentryTest } from '../../../../utils/fixtures' ;
4
- import { envelopeRequestParser , shouldSkipTracingTest , waitForTransactionRequest } from '../../../../utils/helpers' ;
4
+ import {
5
+ envelopeRequestParser ,
6
+ shouldSkipTracingTest ,
7
+ waitForTransactionRequestOnUrl ,
8
+ } from '../../../../utils/helpers' ;
5
9
6
10
sentryTest ( 'should handle custom added BrowserTracing integration' , async ( { getLocalTestUrl, page } ) => {
7
11
if ( shouldSkipTracingTest ( ) ) {
8
12
sentryTest . skip ( ) ;
9
13
}
10
14
11
- const req = waitForTransactionRequest ( page ) ;
12
-
13
15
const url = await getLocalTestUrl ( { testDir : __dirname } ) ;
14
- await page . goto ( url ) ;
16
+ const req = await waitForTransactionRequestOnUrl ( page , url ) ;
15
17
16
- const eventData = envelopeRequestParser ( await req ) ;
18
+ const eventData = envelopeRequestParser ( req ) ;
17
19
const timeOrigin = await page . evaluate < number > ( 'window._testBaseTimestamp' ) ;
18
20
19
21
const { start_timestamp : startTimestamp } = eventData ;
Original file line number Diff line number Diff line change 1
1
import { expect } from '@playwright/test' ;
2
2
3
3
import { sentryTest } from '../../../../utils/fixtures' ;
4
- import { envelopeRequestParser , waitForErrorRequest } from '../../../../utils/helpers' ;
4
+ import { envelopeRequestParser , waitForErrorRequestOnUrl } from '../../../../utils/helpers' ;
5
5
6
6
sentryTest ( 'error handler works' , async ( { getLocalTestUrl, page } ) => {
7
- const req = waitForErrorRequest ( page ) ;
8
-
9
7
const url = await getLocalTestUrl ( { testDir : __dirname } ) ;
10
- await page . goto ( url ) ;
8
+ const req = await waitForErrorRequestOnUrl ( page , url ) ;
11
9
12
- const eventData = envelopeRequestParser ( await req ) ;
10
+ const eventData = envelopeRequestParser ( req ) ;
13
11
14
12
expect ( eventData . exception ?. values ?. length ) . toBe ( 1 ) ;
15
13
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