blob: d1e17f780fdcf7161236b8e04c7dd22b24e54b5d [file] [log] [blame]
/**
* @license
* Copyright 2020 The Go Authors. All rights reserved.
* Use of this source code is governed by a BSD-style
* license that can be found in the LICENSE file.
*/
import './global-types';
import puppeteer, { Page } from 'puppeteer';
const baseUrl = process.env.FRONTEND_URL ?? '';
describe('Error', () => {
let page: Page;
beforeEach(async () => {
page = await browser.newPage();
await page.goto(baseUrl + '/@bad-request');
});
afterEach(async () => {
await page.close();
});
test('accessibility tree matches snapshot', async () => {
const a11yTree = await page.accessibility.snapshot();
expect(a11yTree).toMatchSnapshot();
});
test('desktop viewport matches image snapshot', async () => {
const image = await page.screenshot({ fullPage: true });
expect(image).toMatchImageSnapshot();
});
test('mobile viewport matches image snapshot', async () => {
await page.emulate(puppeteer.devices['Pixel 2']);
const image = await page.screenshot({ fullPage: true });
expect(image).toMatchImageSnapshot();
});
});