Skip to content

Commit

Permalink
test(plasma-b2c): update tests for new testing model
Browse files Browse the repository at this point in the history
  • Loading branch information
IgorYar committed Dec 23, 2024
1 parent e5268b2 commit 8a5a864
Show file tree
Hide file tree
Showing 62 changed files with 263 additions and 191 deletions.
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.
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.
Binary file not shown.
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.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Original file line number Diff line number Diff line change
Expand Up @@ -52,60 +52,40 @@ describe('plasma-b2c: Breadcrumbs', () => {
</CypressTestDecorator>
);

it('[PLASMA-T1160] Breadcrumbs: size=m', () => {
it('[PLASMA-T1379] Breadcrumbs: size=l, showItems=1', () => {
mount(
<CypressTestDecoratorWithTypo>
<Breadcrumbs items={items} size="m" />
<Breadcrumbs items={items} size="l" showItems={1} />
</CypressTestDecoratorWithTypo>,
);

cy.matchImageSnapshot();
});

it('[PLASMA-T1161] Breadcrumbs: size=l', () => {
it('[PLASMA-T1380] Breadcrumbs: size=m, showItems=2', () => {
mount(
<CypressTestDecoratorWithTypo>
<Breadcrumbs items={items} size="l" />
<Breadcrumbs items={items} size="m" showItems={2} />
</CypressTestDecoratorWithTypo>,
);

cy.matchImageSnapshot();
});

it('[PLASMA-T1162] Breadcrumbs: size=s', () => {
it('[PLASMA-T1381] Breadcrumbs: size=s, showItems=3', () => {
mount(
<CypressTestDecoratorWithTypo>
<Breadcrumbs items={items} size="s" />
<Breadcrumbs items={items} size="s" showItems={3} />
</CypressTestDecoratorWithTypo>,
);

cy.matchImageSnapshot();
});

it('[PLASMA-T1163] Breadcrumbs: size=xs', () => {
it('[PLASMA-T1382] Breadcrumbs: size=xs, showItems=4', () => {
mount(
<CypressTestDecoratorWithTypo>
<Breadcrumbs items={items} size="xs" />
</CypressTestDecoratorWithTypo>,
);

cy.matchImageSnapshot();
});

it('[PLASMA-T1165] Breadcrumbs: showItems=4', () => {
mount(
<CypressTestDecoratorWithTypo>
<Breadcrumbs items={items} showItems={4} />
</CypressTestDecoratorWithTypo>,
);

cy.matchImageSnapshot();
});

it('[PLASMA-T1168] Breadcrumbs: showItems=1', () => {
mount(
<CypressTestDecoratorWithTypo>
<Breadcrumbs items={items} showItems={1} />
<Breadcrumbs items={items} size="xs" showItems={4} />
</CypressTestDecoratorWithTypo>,
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ describe('plasma-b2c: Card', () => {
</CypressTestDecorator>
);

it('[PLASMA-T710] Card: default', () => {
it('[PLASMA-T1720] Card: ratio=1/1, roundness=0', () => {
mount(
<CypressTestDecoratorWithTypo>
<Card style={{ width: '50%', color: 'black' }} scaleOnFocus>
<Card style={{ width: '50%', color: 'black' }} roundness="0">
<CardBody>
<CardMedia src={src} placeholder={src} ratio="1/1" />
<CardBadge style={{ left: '1rem', top: '1rem' }} text="Test in badge" />
Expand All @@ -44,12 +44,54 @@ describe('plasma-b2c: Card', () => {
cy.matchImageSnapshot();
});

it('[PLASMA-T711] Card: roundness=0', () => {
it('[PLASMA-T1721] Card: ratio=1/2, roundness=16', () => {
mount(
<CypressTestDecoratorWithTypo>
<Card style={{ width: '50%', color: 'black' }} scaleOnFocus roundness="0">
<Card style={{ width: '50%', color: 'black' }} roundness="16">
<CardBody>
<CardMedia src={src} placeholder={src} ratio="1/1" />
<CardMedia src={src} placeholder={src} ratio="1/2" />
<CardBadge style={{ left: '1rem', top: '1rem' }} text="Test in badge" />
<CardContent>
<BodyM>Label</BodyM>
<H4 bold>Tittle</H4>
<BodyM>description</BodyM>
</CardContent>
</CardBody>
</Card>
</CypressTestDecoratorWithTypo>,
);

cy.mockImage('img', 'images/320_320_0.jpg');
cy.matchImageSnapshot();
});

it('[PLASMA-T1722] Card: ratio=4/3, roundness=32, scaleOnFocus', () => {
mount(
<CypressTestDecoratorWithTypo>
<Card style={{ width: '50%', color: 'black' }} roundness="32" scaleOnFocus>
<CardBody>
<CardMedia src={src} placeholder={src} ratio="4/3" />
<CardBadge style={{ left: '1rem', top: '1rem' }} text="Test in badge" />
<CardContent>
<BodyM>Label</BodyM>
<H4 bold>Tittle</H4>
<BodyM>description</BodyM>
</CardContent>
</CardBody>
</Card>
</CypressTestDecoratorWithTypo>,
);

cy.mockImage('img', 'images/320_320_0.jpg');
cy.matchImageSnapshot();
});

it('[PLASMA-T1723] Card: ratio=16/9, roundness=250', () => {
mount(
<CypressTestDecoratorWithTypo>
<Card style={{ width: '50%', color: 'black' }} roundness="250">
<CardBody>
<CardMedia src={src} placeholder={src} ratio="16/9" />
<CardBadge style={{ left: '1rem', top: '1rem' }} text="Test in badge" />
<CardContent>
<BodyM>Label</BodyM>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
import React from 'react';
import { mount, CypressTestDecorator, getComponent } from '@salutejs/plasma-cy-utils';

import { Chip as ChipB2C } from '../Chip';

import { ChipGroup as ChipGroupB2C } from '.';

describe('plasma-b2c: ChipGroup', () => {
const ChipGroup = getComponent('ChipGroup') as typeof ChipGroupB2C;
const Chip = getComponent('Chip') as typeof ChipB2C;

const getChips = (itemsCount = 5) =>
Array(itemsCount)
.fill(true)
.map((_, i) => <Chip text={`Chip ${i}`} key={`chip_${i}`} hasClear={false} />);

const getCustomChips = () => [
<Chip view="default" size="l" text="Chip 1" hasClear={false} />,
<Chip view="accent" text="Chip 2" hasClear={false} />,
<Chip view="secondary" size="s" text="Chip 3" hasClear={false} />,
];

it('[PLASMA-T1599] ChipGroup: size=l, view=default, gap=dense', () => {
mount(
<CypressTestDecorator>
<ChipGroup view="default" size="l" gap="dense">
{getChips()}
</ChipGroup>
</CypressTestDecorator>,
);

cy.matchImageSnapshot();
});

it('[PLASMA-T1600] ChipGroup: size=m, view=secondary, gap=wide, isWrapped', () => {
mount(
<CypressTestDecorator>
<ChipGroup view="secondary" size="m" gap="wide" isWrapped>
{getChips(20)}
</ChipGroup>
</CypressTestDecorator>,
);

cy.matchImageSnapshot();
});

it('[PLASMA-T1601] ChipGroup: size=s, view=accent', () => {
mount(
<CypressTestDecorator>
<ChipGroup view="accent" size="s">
{getChips(20)}
</ChipGroup>
</CypressTestDecorator>,
);

cy.matchImageSnapshot();
});

it('[PLASMA-T1602] ChipGroup: size=xs', () => {
mount(
<CypressTestDecorator>
<ChipGroup view="default" size="xs">
{getChips()}
</ChipGroup>
</CypressTestDecorator>,
);

cy.matchImageSnapshot();
});

it('[PLASMA-T1780] ChipGroup: isCommonChipStyles=false', () => {
mount(
<CypressTestDecorator>
<ChipGroup isCommonChipStyles={false}>{getCustomChips()}</ChipGroup>
</CypressTestDecorator>,
);

cy.matchImageSnapshot();
});

it('[PLASMA-T1781] ChipGroup: isCommonChipStyles', () => {
mount(
<CypressTestDecorator>
<ChipGroup isCommonChipStyles>{getCustomChips()}</ChipGroup>
</CypressTestDecorator>,
);

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

0 comments on commit 8a5a864

Please sign in to comment.