mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
* update csv export text * fix pw tests * base layout and customization for home page and search results page * refactor rest of the pages * refactor AppError * move header padding to layout * move nextjs utils to separate folder * combine PageServer and Page * make useQueryClientConfig hook * add tests * remove unused var * fix envs for pw * fix pw tests
80 lines
2.1 KiB
TypeScript
80 lines
2.1 KiB
TypeScript
import { test, expect } from '@playwright/experimental-ct-react';
|
|
import React from 'react';
|
|
|
|
import TestApp from 'playwright/TestApp';
|
|
import * as configs from 'playwright/utils/configs';
|
|
|
|
import AppError from './AppError';
|
|
|
|
test('status code 404', async({ mount }) => {
|
|
const error = { message: 'Not found', cause: { status: 404 } } as Error;
|
|
const component = await mount(
|
|
<TestApp>
|
|
<AppError error={ error }/>
|
|
</TestApp>,
|
|
);
|
|
await expect(component).toHaveScreenshot();
|
|
});
|
|
|
|
test('status code 422', async({ mount }) => {
|
|
const error = { message: 'Unprocessable entry', cause: { status: 422 } } as Error;
|
|
const component = await mount(
|
|
<TestApp>
|
|
<AppError error={ error }/>
|
|
</TestApp>,
|
|
);
|
|
await expect(component).toHaveScreenshot();
|
|
});
|
|
|
|
test('status code 500', async({ mount }) => {
|
|
const error = { message: 'Unknown error', cause: { status: 500 } } as Error;
|
|
const component = await mount(
|
|
<TestApp>
|
|
<AppError error={ error }/>
|
|
</TestApp>,
|
|
);
|
|
await expect(component).toHaveScreenshot();
|
|
});
|
|
|
|
test('invalid tx hash', async({ mount }) => {
|
|
const error = { message: 'Invalid tx hash', cause: { status: 404 } } as Error;
|
|
const component = await mount(
|
|
<TestApp>
|
|
<AppError error={ error }/>
|
|
</TestApp>,
|
|
);
|
|
await expect(component).toHaveScreenshot();
|
|
});
|
|
|
|
test('block lost consensus', async({ mount }) => {
|
|
const error = {
|
|
message: 'Not found',
|
|
cause: { payload: { message: 'Block lost consensus', hash: 'hash' } },
|
|
} as Error;
|
|
const component = await mount(
|
|
<TestApp>
|
|
<AppError error={ error }/>
|
|
</TestApp>,
|
|
);
|
|
await expect(component).toHaveScreenshot();
|
|
});
|
|
|
|
test('too many requests +@mobile', async({ mount, page }) => {
|
|
const error = {
|
|
message: 'Too many requests',
|
|
cause: { status: 429 },
|
|
} as Error;
|
|
|
|
const component = await mount(
|
|
<TestApp>
|
|
<AppError error={ error }/>
|
|
</TestApp>,
|
|
);
|
|
await page.waitForResponse('https://www.google.com/recaptcha/api2/**');
|
|
|
|
await expect(component).toHaveScreenshot({
|
|
mask: [ page.locator('.recaptcha') ],
|
|
maskColor: configs.maskColor,
|
|
});
|
|
});
|