Repository navigation
Expand file tree
/
Copy pathAppError.pw.tsx
More file actions
51 lines (43 loc) · 1.76 KB
/
Copy pathAppError.pw.tsx
File metadata and controls
51 lines (43 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import React from 'react';
import { test, expect } from 'playwright/lib';
import * as pwConfig from 'playwright/utils/config';
import AppError from './AppError';
test('status code 404', async({ render, page }) => {
const error = { message: 'Not found', cause: { status: 404 } } as Error;
const component = await render(<AppError error={ error }/>);
await expect(component).toHaveScreenshot({
mask: [ page.locator(pwConfig.adsBannerSelector) ],
maskColor: pwConfig.maskColor,
});
});
test('status code 422', async({ render }) => {
const error = { message: 'Unprocessable entry', cause: { status: 422 } } as Error;
const component = await render(<AppError error={ error }/>);
await expect(component).toHaveScreenshot();
});
test('status code 500', async({ render }) => {
const error = { message: 'Unknown error', cause: { status: 500 } } as Error;
const component = await render(<AppError error={ error }/>);
await expect(component).toHaveScreenshot();
});
test('tx not found', async({ render }) => {
const error = { message: 'Not found', cause: { status: 404, resource: 'tx' } } as Error;
const component = await render(<AppError error={ error }/>);
await expect(component).toHaveScreenshot();
});
test('block lost consensus', async({ render }) => {
const error = {
message: 'Not found',
cause: { payload: { message: 'Block lost consensus', hash: 'hash' } },
} as Error;
const component = await render(<AppError error={ error }/>);
await expect(component).toHaveScreenshot();
});
test('too many requests +@mobile', async({ render }) => {
const error = {
message: 'Too many requests',
cause: { status: 429 },
} as Error;
const component = await render(<AppError error={ error }/>);
await expect(component).toHaveScreenshot();
});