test: relax 'should work for canvas' expecation

This commit is contained in:
Max Schmitt 2024-09-24 00:53:59 +02:00
parent 26dc8955d3
commit 2db13efa8e

View file

@ -280,12 +280,16 @@ it.describe('page screenshot', () => {
expect(screenshot).toMatchSnapshot('screenshot-clip-odd-size.png'); expect(screenshot).toMatchSnapshot('screenshot-clip-odd-size.png');
}); });
it('should work for canvas', async ({ page, server, isElectron, isMac }) => { it('should work for canvas', async ({ page, server, isElectron, isMac, browserName }) => {
it.fixme(isElectron && isMac, 'Fails on the bots'); it.fixme(isElectron && isMac, 'Fails on the bots');
await page.setViewportSize({ width: 500, height: 500 }); await page.setViewportSize({ width: 500, height: 500 });
await page.goto(server.PREFIX + '/screenshots/canvas.html'); await page.goto(server.PREFIX + '/screenshots/canvas.html');
const screenshot = await page.screenshot(); const screenshot = await page.screenshot();
expect(screenshot).toMatchSnapshot('screenshot-canvas.png'); // rendering on macOS-14-arm14+ is different compared to Intel macs.
let maxDiffPixels = 0;
if (browserName === 'chromium' && isMac && os.arch() === 'arm64' && parseInt(os.release(), 10) >= 23)
maxDiffPixels = 4;
expect(screenshot).toMatchSnapshot('screenshot-canvas.png', { maxDiffPixels });
}); });
it('should capture canvas changes', async ({ page, isElectron, browserName, isMac, isWebView2 }) => { it('should capture canvas changes', async ({ page, isElectron, browserName, isMac, isWebView2 }) => {