Commit b65ae1b5 authored by tom's avatar tom

more test fixes

parent 7914ba1b
...@@ -15,7 +15,7 @@ import useAdaptiveTabs from './useAdaptiveTabs'; ...@@ -15,7 +15,7 @@ import useAdaptiveTabs from './useAdaptiveTabs';
import useScrollToActiveTab from './useScrollToActiveTab'; import useScrollToActiveTab from './useScrollToActiveTab';
import { menuButton, getTabValue } from './utils'; import { menuButton, getTabValue } from './utils';
interface SlotProps extends HTMLChakraProps<'div'> { export interface SlotProps extends HTMLChakraProps<'div'> {
widthAllocation?: 'available' | 'fixed'; widthAllocation?: 'available' | 'fixed';
} }
...@@ -99,6 +99,7 @@ const AdaptiveTabsList = (props: Props) => { ...@@ -99,6 +99,7 @@ const AdaptiveTabsList = (props: Props) => {
marginBottom={ 6 } marginBottom={ 6 }
mx={{ base: '-12px', lg: 'unset' }} mx={{ base: '-12px', lg: 'unset' }}
px={{ base: '12px', lg: 'unset' }} px={{ base: '12px', lg: 'unset' }}
w={{ base: 'calc(100% + 24px)', lg: '100%' }}
overflowX={{ base: 'auto', lg: 'initial' }} overflowX={{ base: 'auto', lg: 'initial' }}
overscrollBehaviorX="contain" overscrollBehaviorX="contain"
css={{ css={{
...@@ -155,18 +156,26 @@ const AdaptiveTabsList = (props: Props) => { ...@@ -155,18 +156,26 @@ const AdaptiveTabsList = (props: Props) => {
} }
return ( return (
<Skeleton loading={ isLoading } key={ value } asChild> <TabsTrigger
<TabsTrigger key={ value }
value={ value } value={ value }
ref={ ref } ref={ ref }
scrollSnapAlign="start" scrollSnapAlign="start"
flexShrink={ 0 } flexShrink={ 0 }
{ ...getItemStyles(index, tabsCut) } { ...getItemStyles(index, tabsCut) }
> >
{ typeof tab.title === 'function' ? tab.title() : tab.title } { isLoading ? (
<TabsCounter count={ tab.count }/> <Skeleton loading>
</TabsTrigger> { typeof tab.title === 'function' ? tab.title() : tab.title }
</Skeleton> <TabsCounter count={ tab.count }/>
</Skeleton>
) : (
<>
{ typeof tab.title === 'function' ? tab.title() : tab.title }
<TabsCounter count={ tab.count }/>
</>
) }
</TabsTrigger>
); );
}) } }) }
{ {
......
...@@ -105,7 +105,7 @@ const Marketplace = () => { ...@@ -105,7 +105,7 @@ const Marketplace = () => {
tabs.unshift({ tabs.unshift({
id: MarketplaceCategory.FAVORITES, id: MarketplaceCategory.FAVORITES,
title: () => <IconSvg name="heart_filled" boxSize={ 5 } verticalAlign="middle" mt={ -1 }/>, title: () => <IconSvg name="heart_filled" boxSize={ 5 }/>,
count: favoriteApps.length, count: favoriteApps.length,
component: null, component: null,
}); });
......
...@@ -4,6 +4,7 @@ import config from 'configs/app'; ...@@ -4,6 +4,7 @@ import config from 'configs/app';
import * as addressMock from 'mocks/address/address'; import * as addressMock from 'mocks/address/address';
import * as poolMock from 'mocks/pools/pool'; import * as poolMock from 'mocks/pools/pool';
import { test, expect } from 'playwright/lib'; import { test, expect } from 'playwright/lib';
import * as pwConfig from 'playwright/utils/config';
import Pool from './Pool'; import Pool from './Pool';
...@@ -14,12 +15,15 @@ const hooksConfig = { ...@@ -14,12 +15,15 @@ const hooksConfig = {
}, },
}; };
test('base view +@mobile +@dark-mode', async({ render, mockApiResponse, mockTextAd, mockAssetResponse }) => { test('base view +@mobile +@dark-mode', async({ render, mockApiResponse, mockTextAd, mockAssetResponse, page }) => {
await mockTextAd(); await mockTextAd();
await mockApiResponse('pool', poolMock.base, { pathParams: { chainId: config.chain.id, hash: addressHash } }); await mockApiResponse('pool', poolMock.base, { pathParams: { chainId: config.chain.id, hash: addressHash } });
await mockApiResponse('address', addressMock.contract, { pathParams: { hash: poolMock.base.contract_address } }); await mockApiResponse('address', addressMock.contract, { pathParams: { hash: poolMock.base.contract_address } });
await mockAssetResponse(poolMock.base.quote_token_icon_url as string, './playwright/mocks/image_s.jpg'); await mockAssetResponse(poolMock.base.quote_token_icon_url as string, './playwright/mocks/image_s.jpg');
await mockAssetResponse(poolMock.base.base_token_icon_url as string, './playwright/mocks/image_md.jpg'); await mockAssetResponse(poolMock.base.base_token_icon_url as string, './playwright/mocks/image_md.jpg');
const component = await render(<Pool/>, { hooksConfig }); const component = await render(<Pool/>, { hooksConfig });
await expect(component).toHaveScreenshot(); await expect(component).toHaveScreenshot({
mask: [ page.locator(pwConfig.adsBannerSelector) ],
maskColor: pwConfig.maskColor,
});
}); });
...@@ -184,7 +184,7 @@ const TokenPageContent = () => { ...@@ -184,7 +184,7 @@ const TokenPageContent = () => {
return ( return (
<> <>
<span>Contract</span> <span>Contract</span>
<IconSvg name="status/success" boxSize="14px" color="green.500" ml={ 1 }/> <IconSvg name="status/success" boxSize="14px" color="green.500"/>
</> </>
); );
} }
......
...@@ -107,7 +107,7 @@ test.describe('bridged tokens', () => { ...@@ -107,7 +107,7 @@ test.describe('bridged tokens', () => {
await expect(component).toHaveScreenshot(); await expect(component).toHaveScreenshot();
await component.getByRole('button', { name: /filter/i }).click(); await component.getByRole('button', { name: /filter/i }).click();
await component.locator('label').filter({ hasText: /poa/i }).click(); await page.locator('label').filter({ hasText: /poa/i }).click();
await page.click('body'); await page.click('body');
await expect(component).toHaveScreenshot(); await expect(component).toHaveScreenshot();
......
...@@ -12,6 +12,7 @@ import useIsMobile from 'lib/hooks/useIsMobile'; ...@@ -12,6 +12,7 @@ import useIsMobile from 'lib/hooks/useIsMobile';
import getQueryParamString from 'lib/router/getQueryParamString'; import getQueryParamString from 'lib/router/getQueryParamString';
import { TOKEN_INFO_ERC_20 } from 'stubs/token'; import { TOKEN_INFO_ERC_20 } from 'stubs/token';
import { generateListStub } from 'stubs/utils'; import { generateListStub } from 'stubs/utils';
import type { SlotProps } from 'toolkit/components/AdaptiveTabs/AdaptiveTabsList';
import RoutedTabs from 'toolkit/components/RoutedTabs/RoutedTabs'; import RoutedTabs from 'toolkit/components/RoutedTabs/RoutedTabs';
import PopoverFilter from 'ui/shared/filters/PopoverFilter'; import PopoverFilter from 'ui/shared/filters/PopoverFilter';
import TokenTypeFilter from 'ui/shared/filters/TokenTypeFilter'; import TokenTypeFilter from 'ui/shared/filters/TokenTypeFilter';
...@@ -33,9 +34,9 @@ const TAB_LIST_PROPS = { ...@@ -33,9 +34,9 @@ const TAB_LIST_PROPS = {
}; };
const TABS_HEIGHT = 88; const TABS_HEIGHT = 88;
const TABS_RIGHT_SLOT_PROPS = { const TABS_RIGHT_SLOT_PROPS: SlotProps = {
ml: 8, ml: 8,
flexGrow: 1, widthAllocation: 'available',
}; };
const bridgedTokensFeature = config.features.bridgedTokens; const bridgedTokensFeature = config.features.bridgedTokens;
......
...@@ -9,7 +9,7 @@ import { test, expect } from 'playwright/lib'; ...@@ -9,7 +9,7 @@ import { test, expect } from 'playwright/lib';
import GasInfoTooltip from './GasInfoTooltip'; import GasInfoTooltip from './GasInfoTooltip';
import GasPrice from './GasPrice'; import GasPrice from './GasPrice';
const dataUpdatedAt = Date.now() - 30 * SECOND; const dataUpdatedAt = Date.now() - 3_000 * SECOND;
test.use({ viewport: { width: 300, height: 300 } }); test.use({ viewport: { width: 300, height: 300 } });
......
...@@ -18,11 +18,7 @@ test('input on regular page +@mobile +@dark-mode', async({ render, page }) => { ...@@ -18,11 +18,7 @@ test('input on regular page +@mobile +@dark-mode', async({ render, page }) => {
}); });
test('input on home page +@mobile +@dark-mode', async({ render, page }) => { test('input on home page +@mobile +@dark-mode', async({ render, page }) => {
await render( await render(<SearchBarInput { ...props } isHomepage/>);
<div className="light">
<SearchBarInput { ...props } isHomepage/>
</div>,
);
const input = page.getByPlaceholder(/search by/i); const input = page.getByPlaceholder(/search by/i);
await expect(input).toHaveScreenshot(); await expect(input).toHaveScreenshot();
}); });
...@@ -110,8 +110,9 @@ test('without testnet warning', async({ render, page, mockEnvs }) => { ...@@ -110,8 +110,9 @@ test('without testnet warning', async({ render, page, mockEnvs }) => {
}); });
}); });
test('stability customization', async({ render, page, mockEnvs }) => { test('stability customization', async({ render, page, mockEnvs, mockAssetResponse }) => {
await mockEnvs(ENVS_MAP.stabilityEnvs); await mockEnvs(ENVS_MAP.stabilityEnvs);
await mockAssetResponse(txMock.stabilityTx.stability_fee?.token.icon_url as string, './playwright/mocks/image_s.jpg');
const component = await render(<TxInfo data={ txMock.stabilityTx } isLoading={ false }/>); const component = await render(<TxInfo data={ txMock.stabilityTx } isLoading={ false }/>);
await expect(component).toHaveScreenshot({ await expect(component).toHaveScreenshot({
......
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