Skip to content

Commit

Permalink
test: add tests for ProgressLine Component (#61)
Browse files Browse the repository at this point in the history
  • Loading branch information
Temidayo32 authored Jun 7, 2024
1 parent 8e8b1af commit 3587382
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions nightwatch/components/progressLine.spec.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import ProgressLine from '../../src/components/ProgressLine';
import GlobalStyles from '../../src/components/GlobalStyles';

export default {
title: 'ProgressLine Component',
component: ProgressLine
};

export const ProgressLineComponent = () => {
// Define sample visualPartition props
const visualPartition = [
{ percentage: 20, color: 'red' },
{ percentage: 30, color: 'blue' },
{ percentage: 50, color: 'green' }
];

return (
<>
<GlobalStyles />
<ProgressLine visualPartition={visualPartition} />
</>
);
};

ProgressLineComponent.test = async (browser, { component }) => {
// Check if the ProgressLine component is visible
browser.expect(component).to.be.visible;

// Check if the correct number of Graph elements are present based on the visualPartition prop
browser.expect.elements('div[class*="ProgressLine__Graph"]').count.to.equal(3);
browser.expect.element(`div[class*="ProgressLine__Graph"]:first-child`).to.have.css('background-color')
browser.expect.element(`div[class*="ProgressLine__Graph"]:first-child`).to.have.css('width')
};

0 comments on commit 3587382

Please sign in to comment.