@@ -18,6 +18,7 @@ import { test as it, expect } from './config/browserTest';
1818import fs from 'fs' ;
1919import path from 'path' ;
2020import util from 'util' ;
21+ import { chromiumVersionLessThan } from './config/utils' ;
2122
2223it . describe ( 'download event' , ( ) => {
2324 it . beforeEach ( async ( { server} ) => {
@@ -360,7 +361,7 @@ it.describe('download event', () => {
360361 expect ( fs . existsSync ( path . join ( path1 , '..' ) ) ) . toBeFalsy ( ) ;
361362 } ) ;
362363
363- it ( 'should close the context without awaiting the failed download' , async ( { browser, server, httpsServer, browserName} , testInfo ) => {
364+ it ( 'should close the context without awaiting the failed download' , async ( { browser, server, httpsServer, browserName, browserVersion } , testInfo ) => {
364365 it . skip ( browserName !== 'chromium' , 'Only Chromium downloads on alt-click' ) ;
365366
366367 const page = await browser . newPage ( { acceptDownloads : true } ) ;
@@ -378,7 +379,10 @@ it.describe('download event', () => {
378379 page . context ( ) . close ( ) ,
379380 ] ) ;
380381 expect ( downloadPath ) . toBe ( null ) ;
381- expect ( saveError . message ) . toContain ( 'File not found on disk. Check download.failure() for details.' ) ;
382+ if ( chromiumVersionLessThan ( browserVersion , '91.0.4472.0' ) )
383+ expect ( saveError . message ) . toContain ( 'File deleted upon browser context closure.' ) ;
384+ else
385+ expect ( saveError . message ) . toContain ( 'File not found on disk. Check download.failure() for details.' ) ;
382386 } ) ;
383387
384388 it ( 'should close the context without awaiting the download' , async ( { browser, server, browserName, platform} , testInfo ) => {
0 commit comments