mirror of
https://github.com/luxfi/explore.git
synced 2026-09-24 00:28:18 +00:00
* fail the app start if multichain config or essential dapps config were not generated properly * add timeouts for essential dapps and multichain config generators * fix "add to wallet" button in address tokens table * [skip ci] update docs * fix tx tables when there are no fee and value columns * add support for promoted multichain provider * fixes * change action button logic * fix tests * fix * hide "add network" button for multichain * shorten the amount of txs on multichain homepage * change name formatting for multichain button * add bright color variants and lg size for badges * fix y-axis margin calculation for chart with custom tick formatter * superchain bug fixes * bump versions of react and nextjs * update screenshot * bump dappscout-iframe --------- Co-authored-by: Max Alekseenko <[email protected]>
81 lines
3.7 KiB
TypeScript
81 lines
3.7 KiB
TypeScript
import { Box } from '@chakra-ui/react';
|
|
import React from 'react';
|
|
|
|
import * as addressMock from 'mocks/address/address';
|
|
import * as tokensMock from 'mocks/address/tokens';
|
|
import { test, expect } from 'playwright/lib';
|
|
|
|
import AddressNetWorth from './AddressNetWorth';
|
|
|
|
const ADDRESS_HASH = addressMock.hash;
|
|
const ICON_URL = 'https://localhost:3000/my-icon.png';
|
|
const ICON_URL_PROMO = 'https://localhost:3000/my-icon-promo.png';
|
|
|
|
test.beforeEach(async({ mockApiResponse }) => {
|
|
await mockApiResponse('general:address_tokens', tokensMock.erc20List, { pathParams: { hash: ADDRESS_HASH }, queryParams: { type: 'ERC-20' } });
|
|
await mockApiResponse('general:address_tokens', tokensMock.erc721List, { pathParams: { hash: ADDRESS_HASH }, queryParams: { type: 'ERC-721' } });
|
|
await mockApiResponse('general:address_tokens', tokensMock.erc1155List, { pathParams: { hash: ADDRESS_HASH }, queryParams: { type: 'ERC-1155' } });
|
|
await mockApiResponse('general:address_tokens', tokensMock.erc404List, { pathParams: { hash: ADDRESS_HASH }, queryParams: { type: 'ERC-404' } });
|
|
});
|
|
|
|
test('base view', async({ render }) => {
|
|
const component = await render(<AddressNetWorth addressData={ addressMock.eoa } addressHash={ ADDRESS_HASH }/>);
|
|
|
|
await expect(component).toHaveScreenshot();
|
|
});
|
|
|
|
test('with single multichain button internal +@dark-mode', async({ render, mockEnvs, mockAssetResponse }) => {
|
|
await mockEnvs([
|
|
[
|
|
'NEXT_PUBLIC_MULTICHAIN_BALANCE_PROVIDER_CONFIG',
|
|
`[{"name": "duck", "dapp_id": "duck", "url_template": "https://duck.url/{address}", "logo": "${ ICON_URL }"}]` ],
|
|
]);
|
|
await mockAssetResponse(ICON_URL, './playwright/mocks/image_svg.svg');
|
|
|
|
const component = await render(<AddressNetWorth addressData={ addressMock.eoa } addressHash={ ADDRESS_HASH }/>);
|
|
|
|
await expect(component).toHaveScreenshot();
|
|
});
|
|
|
|
test('with single multichain button external', async({ render, mockEnvs, mockAssetResponse }) => {
|
|
await mockEnvs([
|
|
[ 'NEXT_PUBLIC_MULTICHAIN_BALANCE_PROVIDER_CONFIG', `[{"name": "duck", "url_template": "https://duck.url/{address}", "logo": "${ ICON_URL }"}]` ],
|
|
]);
|
|
await mockAssetResponse(ICON_URL, './playwright/mocks/image_svg.svg');
|
|
|
|
const component = await render(<AddressNetWorth addressData={ addressMock.eoa } addressHash={ ADDRESS_HASH }/>);
|
|
|
|
await expect(component).toHaveScreenshot();
|
|
});
|
|
|
|
test('with two multichain button and promo', async({ render, mockEnvs, mockAssetResponse }) => {
|
|
await mockEnvs([
|
|
[ 'NEXT_PUBLIC_MULTICHAIN_BALANCE_PROVIDER_CONFIG', `[
|
|
{"name": "duck", "url_template": "https://duck.url/{address}", "logo": "${ ICON_URL }"},
|
|
{"name": "duck2", "url_template": "https://duck.url/{address}", "logo": "${ ICON_URL }"},
|
|
{"name": "duck3", "url_template": "https://duck.url/{address}", "logo": "${ ICON_URL_PROMO }", "promo": true}
|
|
]` ],
|
|
]);
|
|
await mockAssetResponse(ICON_URL, './playwright/mocks/image_svg.svg');
|
|
await mockAssetResponse(ICON_URL_PROMO, './playwright/mocks/image_s.jpg');
|
|
|
|
const component = await render(<AddressNetWorth addressData={ addressMock.eoa } addressHash={ ADDRESS_HASH }/>);
|
|
|
|
await expect(component).toHaveScreenshot();
|
|
});
|
|
|
|
test('with multichain button internal small screen', async({ render, mockEnvs, mockAssetResponse }) => {
|
|
await mockEnvs([
|
|
[
|
|
'NEXT_PUBLIC_MULTICHAIN_BALANCE_PROVIDER_CONFIG',
|
|
`[{"name": "duck", "dapp_id": "duck", "url_template": "https://duck.url/{address}", "logo": "${ ICON_URL }"}]` ],
|
|
]);
|
|
await mockAssetResponse(ICON_URL, './playwright/mocks/image_svg.svg');
|
|
|
|
const component = await render(
|
|
<Box w="300px"><AddressNetWorth addressData={ addressMock.eoa } addressHash={ ADDRESS_HASH }/></Box>,
|
|
);
|
|
|
|
await expect(component).toHaveScreenshot();
|
|
});
|