mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
* add prefix to API resources * fix pw tests * refactor config * remove unnecessary prefixes in resource names * fixes * update screenshots
39 lines
1.2 KiB
TypeScript
39 lines
1.2 KiB
TypeScript
import React from 'react';
|
|
|
|
import { userOpData } from 'mocks/userOps/userOp';
|
|
import { ENVS_MAP } from 'playwright/fixtures/mockEnvs';
|
|
import { test, expect, devices } from 'playwright/lib';
|
|
|
|
import UserOp from './UserOp';
|
|
|
|
const hooksConfig = {
|
|
router: {
|
|
query: { hash: userOpData.hash },
|
|
isReady: true,
|
|
},
|
|
};
|
|
|
|
test.beforeEach(async({ mockEnvs }) => {
|
|
await mockEnvs(ENVS_MAP.userOps);
|
|
});
|
|
|
|
test('base view', async({ render, mockTextAd, mockApiResponse }) => {
|
|
await mockTextAd();
|
|
await mockApiResponse('general:user_op', userOpData, { pathParams: { hash: userOpData.hash } });
|
|
const component = await render(<UserOp/>, { hooksConfig });
|
|
await component.getByText('View details').click();
|
|
await expect(component).toHaveScreenshot();
|
|
});
|
|
|
|
test.describe('mobile', () => {
|
|
test.use({ viewport: devices['iPhone 13 Pro'].viewport });
|
|
|
|
test('base view', async({ render, mockTextAd, mockApiResponse }) => {
|
|
await mockTextAd();
|
|
await mockApiResponse('general:user_op', userOpData, { pathParams: { hash: userOpData.hash } });
|
|
const component = await render(<UserOp/>, { hooksConfig });
|
|
await component.getByText('View details').click();
|
|
await expect(component).toHaveScreenshot();
|
|
});
|
|
});
|