Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] mobile expamle #1934

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions playwright/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,12 @@ const config: PlaywrightTestConfig = {
deviceScaleFactor: 2,
},
},
{
name: 'Mobile Safari',
use: {
...devices['iPhone 13'],
},
},
],
};

Expand Down
9 changes: 3 additions & 6 deletions playwright/playwright/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,16 @@ import React from 'react';
import {beforeMount} from '@playwright/experimental-ct-react/hooks';

import {ToasterProvider} from '../../src/components/Toaster';
import {MobileProvider} from '../../src/components/mobile/MobileProvider';
import {ThemeProvider} from '../../src/components/theme/ThemeProvider';

import './index.scss';

beforeMount(async ({App}) => {
return (
<ThemeProvider>
<MobileProvider>
<ToasterProvider>
<App />
</ToasterProvider>
</MobileProvider>
<ToasterProvider>
<App />
</ToasterProvider>
</ThemeProvider>
);
});
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.
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.
24 changes: 24 additions & 0 deletions src/components/Button/__tests__/ButtonMobile.visual.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import React from 'react';

import {test} from '~playwright/core';

import {MobileProvider} from '../../../components/mobile';

import {ButtonStories} from './helpersPlaywright';

test.describe('Button Mobile', {tag: '@Button @Mobile'}, () => {
test.use({
viewport: {width: 390, height: 844},
isMobile: true,
});

test('render story: <Default>', async ({mount, expectScreenshot}) => {
await mount(
<MobileProvider mobile={true}>
<ButtonStories.Default />
</MobileProvider>,
);

await expectScreenshot();
});
});
Loading