blob: 4d8cf6628c209f99400b7daaba88913c88d70b33 [file] [log] [blame]
/**
* @license
* Copyright 2021 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';
describe('Error', () => {
let page: Page;
beforeAll(async () => {
page = await newPage();
await page.goto(baseURL + '/@bad-request');
});
afterAll(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();
});
test('no page errors', () => {
expect(pageErrors).toHaveLength(0);
});
});