@@ -2,6 +2,7 @@ import fs from 'fs'
22import { Context } from '../types.js'
33import { chromium , firefox , webkit , Browser } from '@playwright/test'
44import constants from './constants.js' ;
5+ import chalk from 'chalk' ;
56
67let isPollingActive = false ;
78
@@ -270,16 +271,23 @@ export async function startPolling(ctx: Context, task: any): Promise<void> {
270271
271272 // Display summary
272273 ctx . log . info (
273- `\nSummary of Mismatches:\n` +
274- `Total Variants with Mismatches: ${ totalVariantsWithMismatches } out of ${ totalVariants } \n` +
275- `Total Screenshots with Mismatches: ${ totalScreenshotsWithMismatches } out of ${ totalScreenshots } \n` +
276- `Branch Name: ${ resp . build . branch } \n` +
277- `Project Name: ${ resp . project . name } \n` +
278- `Build ID: ${ resp . build . build_id } \n`
279- ) ;
274+ chalk . green . bold (
275+ `\nSummary of Mismatches:\n` +
276+ `${ chalk . yellow ( 'Total Variants with Mismatches:' ) } ${ chalk . white ( totalVariantsWithMismatches ) } out of ${ chalk . white ( totalVariants ) } \n` +
277+ `${ chalk . yellow ( 'Total Screenshots with Mismatches:' ) } ${ chalk . white ( totalScreenshotsWithMismatches ) } out of ${ chalk . white ( totalScreenshots ) } \n` +
278+ `${ chalk . yellow ( 'Branch Name:' ) } ${ chalk . white ( resp . build . branch ) } \n` +
279+ `${ chalk . yellow ( 'Project Name:' ) } ${ chalk . white ( resp . project . name ) } \n` +
280+ `${ chalk . yellow ( 'Build ID:' ) } ${ chalk . white ( resp . build . build_id ) } \n`
281+ )
282+ ) ;
280283 }
281284 } catch ( error : any ) {
282- ctx . log . error ( `Error fetching screenshot data: ${ error . message } ` ) ;
285+ if ( error . message . includes ( 'ENOTFOUND' ) ) {
286+ ctx . log . error ( 'Error: Network error occurred while fetching build results. Please check your connection and try again.' ) ;
287+ clearInterval ( intervalId ) ;
288+ } else {
289+ ctx . log . error ( `Error fetching screenshot data: ${ error . message } ` ) ;
290+ }
283291 clearInterval ( intervalId ) ;
284292 isPollingActive = false ;
285293 }
0 commit comments