@@ -13,8 +13,6 @@ const envelopeRequestParser = (request: Request | null): Event => {
13
13
return envelope . split ( '\n' ) . map ( line => JSON . parse ( line ) ) [ 2 ] ;
14
14
} ;
15
15
16
- type SentryRequestType = 'event' | 'transaction' ;
17
-
18
16
/**
19
17
* Run script at the given path inside the test environment.
20
18
*
@@ -26,16 +24,6 @@ async function runScriptInSandbox(page: Page, path: string): Promise<void> {
26
24
await page . addScriptTag ( { path } ) ;
27
25
}
28
26
29
- /**
30
- * Wait and get Sentry's request sending the event.
31
- *
32
- * @param {Page } page
33
- * @returns {* } {Promise<Request>}
34
- */
35
- async function waitForSentryRequest ( page : Page , requestType : SentryRequestType = 'event' ) : Promise < Request > {
36
- return page . waitForRequest ( requestType === 'event' ? storeUrlRegex : envelopeUrlRegex ) ;
37
- }
38
-
39
27
/**
40
28
* Wait and get Sentry's request sending the event at the given URL, or the current page
41
29
*
@@ -44,9 +32,7 @@ async function waitForSentryRequest(page: Page, requestType: SentryRequestType =
44
32
* @return {* } {Promise<Event>}
45
33
*/
46
34
async function getSentryRequest ( page : Page , url ?: string ) : Promise < Event > {
47
- const request = ( await Promise . all ( [ url ? page . goto ( url ) : Promise . resolve ( null ) , waitForSentryRequest ( page ) ] ) ) [ 1 ] ;
48
-
49
- return storeRequestParser ( request ) ;
35
+ return ( await getMultipleSentryRequests ( page , 1 , url ) ) [ 0 ] ;
50
36
}
51
37
52
38
/**
@@ -57,15 +43,7 @@ async function getSentryRequest(page: Page, url?: string): Promise<Event> {
57
43
* @return {* } {Promise<Event>}
58
44
*/
59
45
async function getSentryTransactionRequest ( page : Page , url ?: string ) : Promise < Event > {
60
- const request = (
61
- await Promise . all ( [ url ? page . goto ( url ) : Promise . resolve ( null ) , waitForSentryRequest ( page , 'transaction' ) ] )
62
- ) [ 1 ] ;
63
-
64
- try {
65
- return envelopeRequestParser ( request ) ;
66
- } catch ( err ) {
67
- return Promise . reject ( err ) ;
68
- }
46
+ return ( await getMultipleSentryTransactionRequests ( page , 1 , url ) ) [ 0 ] ;
69
47
}
70
48
71
49
/**
@@ -170,7 +148,6 @@ async function injectScriptAndGetEvents(page: Page, url: string, scriptPath: str
170
148
171
149
export {
172
150
runScriptInSandbox ,
173
- waitForSentryRequest ,
174
151
getMultipleSentryRequests ,
175
152
getMultipleSentryTransactionRequests ,
176
153
getSentryRequest ,
0 commit comments