test: update download test expectations (#6394)
This commit is contained in:
parent
5326f39021
commit
86df1df8e7
|
|
@ -58,3 +58,15 @@ export function expectedSSLError(browserName: string): string {
|
|||
}
|
||||
return expectedSSLError;
|
||||
}
|
||||
|
||||
export function chromiumVersionLessThan(a: string, b: string) {
|
||||
const left: number[] = a.split('.').map(e => Number(e));
|
||||
const right: number[] = b.split('.').map(e => Number(e));
|
||||
for (let i = 0; i < 4; i++) {
|
||||
if (left[i] > right[i])
|
||||
return false;
|
||||
if (left[i] < right[i])
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
@ -19,6 +19,7 @@ import fs from 'fs';
|
|||
import path from 'path';
|
||||
import util from 'util';
|
||||
import crypto from 'crypto';
|
||||
import { chromiumVersionLessThan } from './config/utils';
|
||||
|
||||
it.describe('download event', () => {
|
||||
it.beforeEach(async ({server}) => {
|
||||
|
|
@ -361,7 +362,7 @@ it.describe('download event', () => {
|
|||
expect(fs.existsSync(path.join(path1, '..'))).toBeFalsy();
|
||||
});
|
||||
|
||||
it('should close the context without awaiting the failed download', async ({browser, server, httpsServer, browserName}, testInfo) => {
|
||||
it('should close the context without awaiting the failed download', async ({browser, server, httpsServer, browserName, browserVersion}, testInfo) => {
|
||||
it.skip(browserName !== 'chromium', 'Only Chromium downloads on alt-click');
|
||||
|
||||
const page = await browser.newPage({ acceptDownloads: true });
|
||||
|
|
@ -379,7 +380,10 @@ it.describe('download event', () => {
|
|||
page.context().close(),
|
||||
]);
|
||||
expect(downloadPath).toBe(null);
|
||||
expect(saveError.message).toContain('File deleted upon browser context closure.');
|
||||
if (chromiumVersionLessThan(browserVersion, '91.0.4472.0'))
|
||||
expect(saveError.message).toContain('File deleted upon browser context closure.');
|
||||
else
|
||||
expect(saveError.message).toContain('File not found on disk. Check download.failure() for details.');
|
||||
});
|
||||
|
||||
it('should close the context without awaiting the download', async ({browser, server, browserName, platform}, testInfo) => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue