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: [M3-5858] - Cypress component tests #10134

Merged
Merged
Show file tree
Hide file tree
Changes from 8 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
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
"cy:e2e": "yarn workspace linode-manager cy:e2e",
"cy:ci": "yarn cy:e2e",
"cy:debug": "yarn workspace linode-manager cy:debug",
"cy:component": "yarn workspace linode-manager cy:component",
"cy:rec-snap": "yarn workspace linode-manager cy:rec-snap",
"changeset": "node scripts/changelog/changeset.mjs",
"generate-changelogs": "node scripts/changelog/generate-changelogs.mjs",
Expand Down
15 changes: 15 additions & 0 deletions packages/manager/cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { fetchAccount } from './cypress/support/plugins/fetch-account';
import { fetchLinodeRegions } from './cypress/support/plugins/fetch-linode-regions';
import { splitCypressRun } from './cypress/support/plugins/split-run';
import { enableJunitReport } from './cypress/support/plugins/junit-report';
import cypressViteConfig from './cypress/vite.config';

/**
* Exports a Cypress configuration object.
Expand Down Expand Up @@ -43,6 +44,20 @@ export default defineConfig({
retries: process.env['CI'] ? 2 : 0,

experimentalMemoryManagement: true,

component: {
devServer: {
framework: 'react',
bundler: 'vite',
viteConfig: cypressViteConfig,
},
indexHtmlFile: './cypress/support/component/index.html',
supportFile: './cypress/support/component/setup.tsx',
specPattern: './cypress/component/**/*.spec.tsx',
viewportWidth: 500,
viewportHeight: 500,
},

e2e: {
experimentalRunAllSpecs: true,

Expand Down
26 changes: 26 additions & 0 deletions packages/manager/cypress/component/poc/beta-chip.spec.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import * as React from 'react';
import { BetaChip } from 'src/components/BetaChip/BetaChip';
import { describeComponent } from 'support/util/components';
import { checkComponentA11y } from 'support/util/accessibility';

describeComponent('BetaChip', (theme) => {
it('renders "BETA" text indicator with primary color', () => {
cy.mountWithTheme(<BetaChip color="primary" />, theme);
cy.findByText('beta').should('be.visible');
});

it('renders "BETA" text indicator with default color', () => {
cy.mountWithTheme(<BetaChip color="default" />, theme);
cy.findByText('beta').should('be.visible');
});

it('passes aXe check with primary color', () => {
cy.mountWithTheme(<BetaChip color="primary" />, theme);
checkComponentA11y();
});

it('passes aXe check with default color', () => {
cy.mountWithTheme(<BetaChip color="default" />, theme);
checkComponentA11y();
});
});
Loading
Loading