Files
0890eb286a Improvements for NFT media (#2643)
* Show NFT image for token transfers

Fixes #2547

* rewrite logic of loading NFT media

* make amends to NftEntity

* show original media size only in the modal

* immutable envs

* tests

* fix fallback condition

* fixes

* fix one more test

* Removing blockscout-ci-cd from helm repo

---------

Co-authored-by: Nick Zenchik <[email protected]>
2025-03-25 13:53:27 +01:00

94 lines
2.3 KiB
TypeScript

import { Box } from '@chakra-ui/react';
import React from 'react';
import { tokenInfoERC20a, tokenInfoERC721a, tokenInfoERC1155a } from 'mocks/tokens/tokenInfo';
import * as tokenInstanceMock from 'mocks/tokens/tokenInstance';
import * as tokenTransferMock from 'mocks/tokens/tokenTransfer';
import { test, expect } from 'playwright/lib';
import TokenTransfer from './TokenTransfer';
test('erc20 +@mobile', async({ render }) => {
const component = await render(
<Box pt={{ base: '134px', lg: '100px' }}>
<TokenTransfer
// @ts-ignore:
transfersQuery={{
data: {
items: [ tokenTransferMock.erc20 ],
next_page_params: null,
},
// @ts-ignore:
pagination: { page: 1, isVisible: true },
}}
// @ts-ignore:
tokenQuery={{
data: tokenInfoERC20a,
}}
/>
</Box>,
);
await expect(component).toHaveScreenshot();
});
test('erc721 +@mobile', async({ render, mockAssetResponse }) => {
await mockAssetResponse(tokenInstanceMock.base.image_url as string, './playwright/mocks/image_s.jpg');
const component = await render(
<Box pt={{ base: '134px', lg: '100px' }}>
<TokenTransfer
// @ts-ignore:
transfersQuery={{
data: {
items: [ tokenTransferMock.erc721 ],
next_page_params: null,
},
// @ts-ignore:
pagination: { page: 1, isVisible: true },
}}
// @ts-ignore:
tokenQuery={{
data: tokenInfoERC721a,
}}
/>
</Box>,
);
await expect(component).toHaveScreenshot();
});
test('erc1155 +@mobile', async({ render }) => {
const component = await render(
<Box pt={{ base: '134px', lg: '100px' }}>
<TokenTransfer
// @ts-ignore:
transfersQuery={{
data: {
items: [
tokenTransferMock.erc1155A,
tokenTransferMock.erc1155B,
tokenTransferMock.erc1155C,
tokenTransferMock.erc1155D,
],
next_page_params: null,
},
// @ts-ignore:
pagination: { page: 1, isVisible: true },
}}
// @ts-ignore:
tokenQuery={{
data: tokenInfoERC1155a,
}}
/>
</Box>,
);
await expect(component).toHaveScreenshot();
});