Skip to content

Commit

Permalink
Merge pull request #859 from blockscout/mob-tabs
Browse files Browse the repository at this point in the history
change padding
  • Loading branch information
tom2drum authored Jun 7, 2023
2 parents cdf3c4a + a95a6f2 commit 1c43662
Show file tree
Hide file tree
Showing 25 changed files with 93 additions and 6 deletions.
69 changes: 65 additions & 4 deletions ui/address/AddressTokens.pw.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Box } from '@chakra-ui/react';
import { test as base, expect } from '@playwright/experimental-ct-react';
import { test as base, expect, devices } from '@playwright/experimental-ct-react';
import React from 'react';

import { withName } from 'mocks/address/address';
Expand Down Expand Up @@ -56,7 +56,7 @@ const test = base.extend({
},
});

test('erc20 +@mobile +@dark-mode', async({ mount }) => {
test('erc20 +@dark-mode', async({ mount }) => {
const hooksConfig = {
router: {
query: { hash: ADDRESS_HASH, tab: 'tokens_erc20' },
Expand All @@ -75,7 +75,7 @@ test('erc20 +@mobile +@dark-mode', async({ mount }) => {
await expect(component).toHaveScreenshot();
});

test('erc721 +@mobile +@dark-mode', async({ mount }) => {
test('erc721 +@dark-mode', async({ mount }) => {
const hooksConfig = {
router: {
query: { hash: ADDRESS_HASH, tab: 'tokens_erc721' },
Expand All @@ -94,7 +94,7 @@ test('erc721 +@mobile +@dark-mode', async({ mount }) => {
await expect(component).toHaveScreenshot();
});

test('erc1155 +@mobile +@dark-mode', async({ mount }) => {
test('erc1155 +@dark-mode', async({ mount }) => {
const hooksConfig = {
router: {
query: { hash: ADDRESS_HASH, tab: 'tokens_erc1155' },
Expand All @@ -112,3 +112,64 @@ test('erc1155 +@mobile +@dark-mode', async({ mount }) => {

await expect(component).toHaveScreenshot();
});

test.describe('mobile', () => {
test.use({ viewport: devices['iPhone 13 Pro'].viewport });

test('erc20', async({ mount }) => {
const hooksConfig = {
router: {
query: { hash: ADDRESS_HASH, tab: 'tokens_erc20' },
isReady: true,
},
};

const component = await mount(
<TestApp>
<Box h={{ base: '134px', lg: 6 }}/>
<AddressTokens/>
</TestApp>,
{ hooksConfig },
);

await expect(component).toHaveScreenshot();
});

test('erc721', async({ mount }) => {
const hooksConfig = {
router: {
query: { hash: ADDRESS_HASH, tab: 'tokens_erc721' },
isReady: true,
},
};

const component = await mount(
<TestApp>
<Box h={{ base: '134px', lg: 6 }}/>
<AddressTokens/>
</TestApp>,
{ hooksConfig },
);

await expect(component).toHaveScreenshot();
});

test('erc1155', async({ mount }) => {
const hooksConfig = {
router: {
query: { hash: ADDRESS_HASH, tab: 'tokens_erc1155' },
isReady: true,
},
};

const component = await mount(
<TestApp>
<Box h={{ base: '134px', lg: 6 }}/>
<AddressTokens/>
</TestApp>,
{ hooksConfig },
);

await expect(component).toHaveScreenshot();
});
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
Binary file not shown.
28 changes: 26 additions & 2 deletions ui/pages/Blocks.pw.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { test as base, expect } from '@playwright/experimental-ct-react';
import { test as base, expect, devices } from '@playwright/experimental-ct-react';
import React from 'react';

import * as textAdMock from 'mocks/ad/textAd';
Expand Down Expand Up @@ -40,7 +40,7 @@ test.beforeEach(async({ page }) => {
});
});

test('base view +@mobile +@dark-mode', async({ mount, page }) => {
test('base view +@dark-mode', async({ mount, page }) => {
await page.route(BLOCKS_API_URL, (route) => route.fulfill({
status: 200,
body: JSON.stringify(blockMock.baseListResponse),
Expand All @@ -61,6 +61,30 @@ test('base view +@mobile +@dark-mode', async({ mount, page }) => {
await expect(component).toHaveScreenshot();
});

test.describe('mobile', () => {
test.use({ viewport: devices['iPhone 13 Pro'].viewport });
test(' base view', async({ mount, page }) => {
await page.route(BLOCKS_API_URL, (route) => route.fulfill({
status: 200,
body: JSON.stringify(blockMock.baseListResponse),
}));
await page.route(STATS_API_URL, (route) => route.fulfill({
status: 200,
body: JSON.stringify(statsMock.base),
}));

const component = await mount(
<TestApp>
<Blocks/>
</TestApp>,
{ hooksConfig },
);
await page.waitForResponse(BLOCKS_API_URL);

await expect(component).toHaveScreenshot();
});
});

test('new item from socket', async({ mount, page, createSocket }) => {
await page.route(BLOCKS_API_URL, (route) => route.fulfill({
status: 200,
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
2 changes: 2 additions & 0 deletions ui/shared/Tabs/TabsWithScroll.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ const TabsWithScroll = ({
>
<TabList
marginBottom={{ base: 6, lg: 8 }}
mx={{ base: '-16px', lg: 'unset' }}
px={{ base: '16px', lg: 'unset' }}
flexWrap="nowrap"
whiteSpace="nowrap"
ref={ listRef }
Expand Down

0 comments on commit 1c43662

Please sign in to comment.