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

test(tag): add vrt #9449

Merged
merged 2 commits into from
Aug 17, 2021
Merged
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
53 changes: 53 additions & 0 deletions packages/react/src/components/Tag/Tag-test.e2e.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/**
* Copyright IBM Corp. 2016, 2018
*
* This source code is licensed under the Apache-2.0 license found in the
* LICENSE file in the root directory of this source tree.
*/

import 'carbon-components/scss/components/tag/_tag.scss';

import React from 'react';
import { mount } from '@cypress/react';
import Tag from './Tag';
import TagSkeleton from './Tag.Skeleton';
import { Tag16 } from '@carbon/icons-react';

describe('Tag', () => {
beforeEach(() => {
mount(
<>
<Tag>This is a tag</Tag>
<Tag onClick={() => {}}>This is an interactive tag</Tag>
<Tag size="sm">This is a small tag</Tag>
<Tag filter>This is a filter tag</Tag>
<Tag renderIcon={Tag16}>Custom icon</Tag>
<Tag filter disabled>
Disabled filter tag
</Tag>
<Tag type="magenta">magenta</Tag>
<Tag type="red">red</Tag>
<Tag type="purple">purple</Tag>
<Tag type="blue">blue</Tag>
<Tag type="cyan">cyan</Tag>
<Tag type="teal">teal</Tag>
<Tag type="green">green</Tag>
<Tag type="gray">gray</Tag>
<Tag type="cool-gray">cool-gray</Tag>
<Tag type="warm-gray">warm-gray</Tag>
<Tag type="high-contrast">high-contrast</Tag>
<TagSkeleton />
<TagSkeleton size="sm" />
</>
);
});

it('should render', () => {
cy.findByText(/warm-gray/).should('be.visible');

// snapshots should always be taken _after_ an assertion that
// a element/component should be visible. This is to ensure
// the DOM has settled and the element has fully loaded.
cy.percySnapshot();
});
});