Skip to content

Commit

Permalink
test(plasma-b2c): update tests for ButtonGroup and IconButton
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorYar committed Aug 30, 2024
1 parent f9fc554 commit ae55b93
Show file tree
Hide file tree
Showing 28 changed files with 288 additions and 1 deletion.
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.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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.
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.
Original file line number Diff line number Diff line change
@@ -0,0 +1,124 @@
import React from 'react';
import { mount, CypressTestDecorator, getComponent } from '@salutejs/plasma-cy-utils';

describe('plasma-b2c: ButtonGroup', () => {
const ButtonGroup = getComponent('ButtonGroup');
const Button = getComponent('Button');

const getButtons = () => [
<Button text="Button" />,
<Button text="Button" />,
<Button text="Button" />,
<Button text="Button" />,
<Button text="Button" />,
];

it('[PLASMA-T820] ButtonGroup: view=default, size=m, orientation=horizontal', () => {
mount(
<CypressTestDecorator>
<ButtonGroup view="default" size="m" orientation="horizontal">
{getButtons()}
</ButtonGroup>
</CypressTestDecorator>,
);

cy.matchImageSnapshot();
});

it('[PLASMA-T821] ButtonGroup: view=accent, size=l, shape=default', () => {
mount(
<CypressTestDecorator>
<ButtonGroup view="accent" size="l" shape="default">
{getButtons()}
</ButtonGroup>
</CypressTestDecorator>,
);

cy.viewport(1366, 768);
cy.matchImageSnapshot();
});

it('[PLASMA-T822] ButtonGroup: view=secondary, gap=none', () => {
mount(
<CypressTestDecorator>
<ButtonGroup view="secondary" gap="none">
{getButtons()}
</ButtonGroup>
</CypressTestDecorator>,
);

cy.matchImageSnapshot();
});

it('[PLASMA-T823] ButtonGroup: view=success, orientation=vertical', () => {
mount(
<CypressTestDecorator>
<ButtonGroup view="success" orientation="vertical">
{getButtons()}
</ButtonGroup>
</CypressTestDecorator>,
);

cy.matchImageSnapshot();
});

it('[PLASMA-T824] ButtonGroup: view=warning, shape=segmented', () => {
mount(
<CypressTestDecorator>
<ButtonGroup view="warning" shape="segmented">
{getButtons()}
</ButtonGroup>
</CypressTestDecorator>,
);

cy.matchImageSnapshot();
});

it('[PLASMA-T825] ButtonGroup: view=critical, stretching=filled', () => {
mount(
<CypressTestDecorator>
<ButtonGroup view="critical" stretching="filled">
{getButtons()}
</ButtonGroup>
</CypressTestDecorator>,
);

cy.matchImageSnapshot();
});

it('[PLASMA-T826] ButtonGroup: size=xxs, gap=wide', () => {
mount(
<CypressTestDecorator>
<ButtonGroup size="xxs" gap="wide">
{getButtons()}
</ButtonGroup>
</CypressTestDecorator>,
);

cy.matchImageSnapshot();
});

it('[PLASMA-T1206] ButtonGroup: size=s, view=clear', () => {
mount(
<CypressTestDecorator>
<ButtonGroup size="s" view="clear">
{getButtons()}
</ButtonGroup>
</CypressTestDecorator>,
);

cy.matchImageSnapshot();
});

it('[PLASMA-T1207] ButtonGroup: size=xs, gap=dense', () => {
mount(
<CypressTestDecorator>
<ButtonGroup size="xs" gap="dense">
{getButtons()}
</ButtonGroup>
</CypressTestDecorator>,
);

cy.matchImageSnapshot();
});
});

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
import React from 'react';
import type { FC, PropsWithChildren } from 'react';
import { IconClose } from '@salutejs/plasma-icons';
import { standard as standardTypo } from '@salutejs/plasma-typo';
import { createGlobalStyle } from 'styled-components';
import { mount, CypressTestDecorator, getComponent } from '@salutejs/plasma-cy-utils';

const Icon = () => <IconClose color="inherit" />;
const StandardTypoStyle = createGlobalStyle(standardTypo);

describe('plasma-b2c: IconButton', () => {
const IconButton = getComponent('IconButton');

const CypressTestDecoratorWithTypo: FC<PropsWithChildren> = ({ children }) => (
<CypressTestDecorator>
<StandardTypoStyle />
{children}
</CypressTestDecorator>
);

it('[PLASMA-T925] IconButton: view=default, size=m', () => {
mount(
<CypressTestDecoratorWithTypo>
<IconButton view="default" size="m">
<Icon size="s" />
</IconButton>
</CypressTestDecoratorWithTypo>,
);

cy.matchImageSnapshot();
});

it('[PLASMA-T926] IconButton: view=accent, size=l', () => {
mount(
<CypressTestDecoratorWithTypo>
<IconButton view="accent" size="l">
<Icon size="s" />
</IconButton>
</CypressTestDecoratorWithTypo>,
);

cy.matchImageSnapshot();
});

it('[PLASMA-T927] IconButton: view=secondary, size=s', () => {
mount(
<CypressTestDecoratorWithTypo>
<IconButton view="secondary" size="s">
<Icon size="s" />
</IconButton>
</CypressTestDecoratorWithTypo>,
);

cy.matchImageSnapshot();
});

it('[PLASMA-T928] IconButton: view=success, size=xs', () => {
mount(
<CypressTestDecoratorWithTypo>
<IconButton view="success" size="xs">
<Icon size="s" />
</IconButton>
</CypressTestDecoratorWithTypo>,
);

cy.matchImageSnapshot();
});

it('[PLASMA-T929] IconButton: view=warning, isLoading', () => {
mount(
<CypressTestDecoratorWithTypo>
<IconButton view="warning" isLoading>
<Icon size="s" />
</IconButton>
</CypressTestDecoratorWithTypo>,
);

cy.matchImageSnapshot();
});

it('[PLASMA-T930] IconButton: disabled', () => {
mount(
<CypressTestDecoratorWithTypo>
<IconButton disabled>
<Icon size="s" />
</IconButton>
</CypressTestDecoratorWithTypo>,
);

cy.matchImageSnapshot();
});

it('[PLASMA-T931] IconButton: view=critical, pin=square-clear', () => {
mount(
<CypressTestDecoratorWithTypo>
<IconButton view="critical" pin="square-clear">
<Icon size="s" />
</IconButton>
</CypressTestDecoratorWithTypo>,
);

cy.matchImageSnapshot();
});

it('[PLASMA-T932] IconButton: view=clear, pin=clear-square', () => {
mount(
<CypressTestDecoratorWithTypo>
<IconButton view="clear" pin="clear-square">
<Icon size="s" />
</IconButton>
</CypressTestDecoratorWithTypo>,
);

cy.matchImageSnapshot();
});

it('[PLASMA-T933] IconButton: pin=clear-clear', () => {
mount(
<CypressTestDecoratorWithTypo>
<IconButton pin="clear-clear">
<Icon size="s" />
</IconButton>
</CypressTestDecoratorWithTypo>,
);

cy.matchImageSnapshot();
});

it('[PLASMA-T934] IconButton: pin=clear-circle', () => {
mount(
<CypressTestDecoratorWithTypo>
<IconButton pin="clear-circle">
<Icon size="s" />
</IconButton>
</CypressTestDecoratorWithTypo>,
);

cy.matchImageSnapshot();
});

it('[PLASMA-T935] IconButton: pin=circle-clear', () => {
mount(
<CypressTestDecoratorWithTypo>
<IconButton pin="circle-clear">
<Icon size="s" />
</IconButton>
</CypressTestDecoratorWithTypo>,
);

cy.matchImageSnapshot();
});

it('[PLASMA-T936] IconButton: pin=circle-circle', () => {
mount(
<CypressTestDecoratorWithTypo>
<IconButton pin="circle-circle">
<Icon size="s" />
</IconButton>
</CypressTestDecoratorWithTypo>,
);

cy.matchImageSnapshot();
});
});

0 comments on commit ae55b93

Please sign in to comment.