mirror of
https://github.com/hanzonet/explore.git
synced 2026-10-30 18:16:57 +00:00
* add prefix to API resources * fix pw tests * refactor config * remove unnecessary prefixes in resource names * fixes * update screenshots
36 lines
1.3 KiB
TypeScript
36 lines
1.3 KiB
TypeScript
import React from 'react';
|
|
|
|
import * as blockEpochMock from 'mocks/blocks/epoch';
|
|
import { test, expect } from 'playwright/lib';
|
|
|
|
import BlockEpochElectionRewards from './BlockEpochElectionRewards';
|
|
|
|
const heightOrHash = '1234';
|
|
const hooksConfig = {
|
|
router: {
|
|
query: { height_or_hash: heightOrHash },
|
|
},
|
|
};
|
|
|
|
test('base view', async({ render, mockApiResponse }) => {
|
|
await mockApiResponse(
|
|
'general:block_election_rewards',
|
|
blockEpochMock.electionRewardDetails1,
|
|
{ pathParams: { height_or_hash: heightOrHash, reward_type: 'voter' } },
|
|
);
|
|
const component = await render(<BlockEpochElectionRewards data={ blockEpochMock.blockEpoch1 }/>, { hooksConfig });
|
|
await component.getByRole('cell', { name: 'Voting rewards' }).click();
|
|
await expect(component).toHaveScreenshot();
|
|
});
|
|
|
|
test('base view +@mobile -@default', async({ render, mockApiResponse }) => {
|
|
await mockApiResponse(
|
|
'general:block_election_rewards',
|
|
blockEpochMock.electionRewardDetails1,
|
|
{ pathParams: { height_or_hash: heightOrHash, reward_type: 'voter' } },
|
|
);
|
|
const component = await render(<BlockEpochElectionRewards data={ blockEpochMock.blockEpoch1 }/>, { hooksConfig });
|
|
await component.locator('div').filter({ hasText: 'Voting rewards' }).nth(3).click();
|
|
await expect(component).toHaveScreenshot();
|
|
});
|