Skip to content

Commit

Permalink
test(Slider): update screenshots
Browse files Browse the repository at this point in the history
  • Loading branch information
itwillwork committed May 23, 2024
1 parent 7eb6a22 commit 7ab87ce
Show file tree
Hide file tree
Showing 59 changed files with 28 additions and 24 deletions.
14 changes: 5 additions & 9 deletions playwright/core/mountFixture.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
import React from 'react';

import type {JsonObject} from '@playwright/experimental-ct-core/types/component';
import type {MountOptions} from '@playwright/experimental-ct-react';

import type {MountFixture, PlaywrightFixture} from './types';

export const mountFixture: PlaywrightFixture<MountFixture> = async ({mount: baseMount}, use) => {
const mount = async (
component: JSX.Element,
options?: MountOptions<JsonObject> | undefined,
) => {
const mount: MountFixture = async (component, options) => {
const {wrapDivStyles, ...restOptions} = options || {};

return await baseMount(
<div
style={{padding: 20, width: 'fit-content', height: 'fit-content'}}
style={{padding: 20, width: 'fit-content', height: 'fit-content', ...wrapDivStyles}}
className="playwright-wrapper-test"
>
{component}
</div>,
options,
restOptions,
);
};

Expand Down
4 changes: 3 additions & 1 deletion playwright/core/types.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type React from 'react';

import type {JsonObject} from '@playwright/experimental-ct-core/types/component';
import type {MountOptions, MountResult} from '@playwright/experimental-ct-react';
import type {
Expand All @@ -13,7 +15,7 @@ import type {
interface ComponentFixtures {
mount<HooksConfig extends JsonObject>(
component: JSX.Element,
options?: MountOptions<HooksConfig>,
options?: MountOptions<HooksConfig> & {wrapDivStyles?: React.CSSProperties},
): Promise<MountResult>;
}

Expand Down
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.
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.
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.
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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
34 changes: 20 additions & 14 deletions src/components/Slider/__tests__/Slider.visual.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,87 +4,93 @@ import {test} from '~playwright/core';

import {SliderStories} from './helpersPlaywright';

const mountOptions = {
wrapDivStyles: {
minWidth: 300,
},
};

test.describe('Slider', () => {
test('render story: <Default>', async ({mount, expectScreenshot}) => {
await mount(<SliderStories.Default />);
await mount(<SliderStories.Default />, mountOptions);

await expectScreenshot();
});

test('render story: <DefaultRange>', async ({mount, expectScreenshot}) => {
await mount(<SliderStories.DefaultRange />);
await mount(<SliderStories.DefaultRange />, mountOptions);

await expectScreenshot();
});

test('render story: <Size>', async ({mount, expectScreenshot}) => {
await mount(<SliderStories.Size />);
await mount(<SliderStories.Size />, mountOptions);

await expectScreenshot();
});

test('render story: <SizeRange>', async ({mount, expectScreenshot}) => {
await mount(<SliderStories.SizeRange />);
await mount(<SliderStories.SizeRange />, mountOptions);

await expectScreenshot();
});

test('render story: <Disabled>', async ({mount, expectScreenshot}) => {
await mount(<SliderStories.Disabled />);
await mount(<SliderStories.Disabled />, mountOptions);

await expectScreenshot();
});

test('render story: <DisabledRange>', async ({mount, expectScreenshot}) => {
await mount(<SliderStories.DisabledRange />);
await mount(<SliderStories.DisabledRange />, mountOptions);

await expectScreenshot();
});

test('render story: <Error>', async ({mount, expectScreenshot}) => {
await mount(<SliderStories.Error />);
await mount(<SliderStories.Error />, mountOptions);

await expectScreenshot();
});

test('render story: <ErrorRange>', async ({mount, expectScreenshot}) => {
await mount(<SliderStories.ErrorRange />);
await mount(<SliderStories.ErrorRange />, mountOptions);

await expectScreenshot();
});

test('render story: <Tooltip>', async ({mount, expectScreenshot}) => {
await mount(<SliderStories.Tooltip />);
await mount(<SliderStories.Tooltip />, mountOptions);

await expectScreenshot();
});

test('render story: <TooltipRange>', async ({mount, expectScreenshot}) => {
await mount(<SliderStories.TooltipRange />);
await mount(<SliderStories.TooltipRange />, mountOptions);

await expectScreenshot();
});

test('render story: <MarksCount>', async ({mount, expectScreenshot}) => {
await mount(<SliderStories.MarksCount />);
await mount(<SliderStories.MarksCount />, mountOptions);

await expectScreenshot();
});

test('render story: <MarksCountRange>', async ({mount, expectScreenshot}) => {
await mount(<SliderStories.MarksCountRange />);
await mount(<SliderStories.MarksCountRange />, mountOptions);

await expectScreenshot();
});

test('render story: <AvailableValues>', async ({mount, expectScreenshot}) => {
await mount(<SliderStories.AvailableValues />);
await mount(<SliderStories.AvailableValues />, mountOptions);

await expectScreenshot();
});

test('render story: <AvailableValuesRange>', async ({mount, expectScreenshot}) => {
await mount(<SliderStories.AvailableValuesRange />);
await mount(<SliderStories.AvailableValuesRange />, mountOptions);

await expectScreenshot();
});
Expand Down

0 comments on commit 7ab87ce

Please sign in to comment.