Commit b8adbff7 authored by tom's avatar tom

update screenshots

parent 1517d8dd
import { Box } from '@chakra-ui/react';
import React from 'react'; import React from 'react';
import * as addressMock from 'mocks/address/address'; import * as addressMock from 'mocks/address/address';
import * as tokenMock from 'mocks/tokens/tokenInfo'; import * as tokenMock from 'mocks/tokens/tokenInfo';
import { test, expect } from 'playwright/lib'; import { test, expect } from 'playwright/lib';
import * as pwConfig from 'playwright/utils/config';
import CsvExport from './CsvExport'; import CsvExport from './CsvExport';
test('base view +@mobile +@dark-mode', async({ render, page, mockApiResponse }) => { test('base view +@mobile +@dark-mode', async({ render, mockApiResponse }) => {
const hooksConfig = { const hooksConfig = {
router: { router: {
query: { address: addressMock.hash, type: 'transactions', filterType: 'address', filterValue: 'from' }, query: { address: addressMock.hash, type: 'transactions', filterType: 'address', filterValue: 'from' },
...@@ -17,15 +15,12 @@ test('base view +@mobile +@dark-mode', async({ render, page, mockApiResponse }) ...@@ -17,15 +15,12 @@ test('base view +@mobile +@dark-mode', async({ render, page, mockApiResponse })
await mockApiResponse('address', addressMock.validator, { pathParams: { hash: addressMock.hash } }); await mockApiResponse('address', addressMock.validator, { pathParams: { hash: addressMock.hash } });
await mockApiResponse('config_csv_export', { limit: 42123 }); await mockApiResponse('config_csv_export', { limit: 42123 });
const component = await render(<Box sx={{ '.recaptcha': { w: '304px', h: '78px' } }}><CsvExport/></Box>, { hooksConfig }); const component = await render(<CsvExport/>, { hooksConfig });
await expect(component).toHaveScreenshot({ await expect(component).toHaveScreenshot();
mask: [ page.locator('.recaptcha') ],
maskColor: pwConfig.maskColor,
});
}); });
test('token holders', async({ render, page, mockApiResponse }) => { test('token holders', async({ render, mockApiResponse }) => {
const hooksConfig = { const hooksConfig = {
router: { router: {
query: { address: addressMock.hash, type: 'holders' }, query: { address: addressMock.hash, type: 'holders' },
...@@ -34,10 +29,7 @@ test('token holders', async({ render, page, mockApiResponse }) => { ...@@ -34,10 +29,7 @@ test('token holders', async({ render, page, mockApiResponse }) => {
await mockApiResponse('address', addressMock.token, { pathParams: { hash: addressMock.hash } }); await mockApiResponse('address', addressMock.token, { pathParams: { hash: addressMock.hash } });
await mockApiResponse('token', tokenMock.tokenInfo, { pathParams: { hash: addressMock.hash } }); await mockApiResponse('token', tokenMock.tokenInfo, { pathParams: { hash: addressMock.hash } });
const component = await render(<Box sx={{ '.recaptcha': { w: '304px', h: '78px' } }}><CsvExport/></Box>, { hooksConfig }); const component = await render(<CsvExport/>, { hooksConfig });
await expect(component).toHaveScreenshot({ await expect(component).toHaveScreenshot();
mask: [ page.locator('.recaptcha') ],
maskColor: pwConfig.maskColor,
});
}); });
import { Box } from '@chakra-ui/react';
import React from 'react'; import React from 'react';
import { publicTagTypes as configMock } from 'mocks/metadata/publicTagTypes'; import { publicTagTypes as configMock } from 'mocks/metadata/publicTagTypes';
import { base as useInfoMock } from 'mocks/user/profile'; import { base as useInfoMock } from 'mocks/user/profile';
import { expect, test } from 'playwright/lib'; import { expect, test } from 'playwright/lib';
import * as pwConfig from 'playwright/utils/config';
import * as mocks from './mocks'; import * as mocks from './mocks';
import PublicTagsSubmitForm from './PublicTagsSubmitForm'; import PublicTagsSubmitForm from './PublicTagsSubmitForm';
...@@ -13,9 +11,7 @@ const onSubmitResult = () => {}; ...@@ -13,9 +11,7 @@ const onSubmitResult = () => {};
test('base view +@mobile', async({ render }) => { test('base view +@mobile', async({ render }) => {
const component = await render( const component = await render(
<Box sx={{ '.recaptcha': { w: '304px', h: '78px' } }}> <PublicTagsSubmitForm config={ configMock } onSubmitResult={ onSubmitResult } userInfo={ useInfoMock }/>,
<PublicTagsSubmitForm config={ configMock } onSubmitResult={ onSubmitResult } userInfo={ useInfoMock }/>
</Box>,
); );
await component.getByLabel(/Smart contract \/ Address/i).fill(mocks.address1); await component.getByLabel(/Smart contract \/ Address/i).fill(mocks.address1);
...@@ -30,8 +26,5 @@ test('base view +@mobile', async({ render }) => { ...@@ -30,8 +26,5 @@ test('base view +@mobile', async({ render }) => {
await component.getByLabel(/connection/i).focus(); await component.getByLabel(/connection/i).focus();
await component.getByLabel(/connection/i).blur(); await component.getByLabel(/connection/i).blur();
await expect(component).toHaveScreenshot({ await expect(component).toHaveScreenshot();
mask: [ component.locator('.recaptcha') ],
maskColor: pwConfig.maskColor,
});
}); });
...@@ -41,14 +41,11 @@ test('block lost consensus', async({ render }) => { ...@@ -41,14 +41,11 @@ test('block lost consensus', async({ render }) => {
await expect(component).toHaveScreenshot(); await expect(component).toHaveScreenshot();
}); });
test('too many requests +@mobile', async({ render, page }) => { test('too many requests +@mobile', async({ render }) => {
const error = { const error = {
message: 'Too many requests', message: 'Too many requests',
cause: { status: 429 }, cause: { status: 429 },
} as Error; } as Error;
const component = await render(<AppError error={ error }/>); const component = await render(<AppError error={ error }/>);
await expect(component).toHaveScreenshot({ await expect(component).toHaveScreenshot();
mask: [ page.locator('.recaptcha') ],
maskColor: pwConfig.maskColor,
});
}); });
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment