@@ -62,7 +62,16 @@ for (const fileName of ['parse.js', 'parse.min.js']) {
62
62
'https://raw.githubusercontent.com/parse-community/parse-server/master/.github/parse-server-logo.png' ;
63
63
const file = new Parse . File ( 'parse-server-logo' , { uri : parseLogo } ) ;
64
64
file . save ( ) . then ( ( ) => { } ) ;
65
- file . cancel ( ) ;
65
+
66
+ return new Promise ( ( resolve ) => {
67
+ const intervalId = setInterval ( ( ) => {
68
+ if ( file . _requestTask && typeof file . _requestTask . abort === 'function' ) {
69
+ file . cancel ( ) ;
70
+ clearInterval ( intervalId ) ;
71
+ resolve ( ) ;
72
+ }
73
+ } , 1 ) ;
74
+ } ) ;
66
75
} ) ;
67
76
await promise ;
68
77
expect ( requestsCount ) . toBe ( 1 ) ;
@@ -89,6 +98,7 @@ for (const fileName of ['parse.js', 'parse.min.js']) {
89
98
promise . resolve ( ) ;
90
99
}
91
100
} ) ;
101
+ console . log ( 'beforeEvaluation' ) ;
92
102
await page . evaluate ( async ( ) => {
93
103
const parseLogo =
94
104
'https://raw.githubusercontent.com/parse-community/parse-server/master/.github/parse-server-logo.png' ;
@@ -97,15 +107,21 @@ for (const fileName of ['parse.js', 'parse.min.js']) {
97
107
const base64 = await logo . getData ( ) ;
98
108
99
109
const file = new Parse . File ( 'parse-base64.txt' , { base64 } ) ;
100
- const intervalId = setInterval ( ( ) => {
101
- if ( file . _requestTask && typeof file . _requestTask . abort === 'function' ) {
102
- file . cancel ( ) ;
103
- clearInterval ( intervalId ) ;
104
- }
105
- } , 1 ) ;
106
110
file . save ( ) . then ( ( ) => { } ) ;
111
+
112
+ return new Promise ( ( resolve ) => {
113
+ const intervalId = setInterval ( ( ) => {
114
+ if ( file . _requestTask && typeof file . _requestTask . abort === 'function' ) {
115
+ file . cancel ( ) ;
116
+ clearInterval ( intervalId ) ;
117
+ resolve ( ) ;
118
+ }
119
+ } , 1 ) ;
120
+ } ) ;
107
121
} ) ;
122
+ console . log ( 'beforePromise' ) ;
108
123
await promise ;
124
+ console . log ( 'afterPromise' ) ;
109
125
expect ( requestsCount ) . toBe ( 3 ) ;
110
126
expect ( abortedCount ) . toBe ( 1 ) ;
111
127
} ) ;
0 commit comments