@@ -26,15 +26,18 @@ const LOCAL_GOLDENS = path.join(SCREENSHOT_DIR, `golds`);
26
26
const LOCAL_DIFFS = path . join ( SCREENSHOT_DIR , `diff` ) ;
27
27
28
28
// Directory to which untrusted screenshot results are temporarily written
29
- // (without authentication required) before they are verified and copied to
30
- // the final storage location.
29
+ // (without authentication required) before they are verified and copied to
30
+ // the final storage location.
31
31
const TEMP_FOLDER = 'untrustedInbox' ;
32
32
const FIREBASE_REPORT = `${ TEMP_FOLDER } /screenshot/reports` ;
33
33
const FIREBASE_IMAGE = `${ TEMP_FOLDER } /screenshot/images` ;
34
34
const FIREBASE_DATA_GOLDENS = `screenshot/goldens` ;
35
35
const FIREBASE_STORAGE_GOLDENS = 'goldens' ;
36
36
37
+ /** Time in ms until the process will be exited if the last action took too long (6 minutes). */
37
38
const lastActionTimeout = 1000 * 60 * 6 ;
39
+
40
+ /** Time in ms that specifies how often the last action should be checked (45 seconds). */
38
41
const lastActionRefreshInterval = 1000 * 45 ;
39
42
40
43
/** Task which upload screenshots generated from e2e test. */
@@ -47,19 +50,20 @@ task('screenshots', () => {
47
50
} else if ( prNumber ) {
48
51
const firebaseApp = connectFirebaseScreenshots ( ) ;
49
52
const database = firebaseApp . database ( ) ;
50
-
51
53
let lastActionTime = Date . now ( ) ;
52
54
53
- // If this task hasn't completed in 8 minutes, close the firebase connection.
55
+ // If the last action of the task takes longer than 6 minutes, close the firebase connection.
54
56
const timeoutId = setInterval ( ( ) => {
55
57
if ( lastActionTime + lastActionTimeout <= Date . now ( ) ) {
56
58
clearTimeout ( timeoutId ) ;
57
59
console . error ( 'Last action for screenshot tests did not finish in ' +
58
- ( lastActionTime / 1000 / 60 ) + ' minutes. Closing Firebase connection...' ) ;
60
+ ( lastActionTimeout / 1000 / 60 ) + ' minutes. Closing Firebase connection...' ) ;
59
61
return firebaseApp . delete ( ) . then ( ( ) => process . exit ( 1 ) ) ;
60
62
}
61
63
} , lastActionRefreshInterval ) ;
62
64
65
+ console . log ( ` Starting screenshots task after e2e task ran...` ) ;
66
+
63
67
return uploadTravisJobInfo ( database , prNumber )
64
68
. then ( ( ) => {
65
69
console . log ( ` Downloading screenshot golds from Firebase...` ) ;
0 commit comments