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

feat(avt): surface component avt test status #3735

Closed
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
88 changes: 80 additions & 8 deletions src/components/ComponentOverview/ComponentOverview.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import React from 'react';
import { Link } from 'gatsby';
import componentList from '../../data/components.json';
import * as avtTestData from '@carbon/react/.playwright/INTERNAL_AVT_REPORT_DO_NOT_USE.json';

class ComponentOverview extends React.Component {
renderItems = (currentItem) => {
Expand Down Expand Up @@ -45,15 +46,86 @@ class ComponentOverview extends React.Component {

render() {
return (
<div className="cds--row">
<div className="cds--col-lg-12 cds--no-gutter">
<ul className="component-overview">
{Object.keys(componentList.components).map((component) =>
this.renderItems(componentList.components[component])
)}
</ul>
<>
<div className="cds--row">
<div className="cds--col-lg-12 cds--col-no-gutter page-table__container">
<table className="page-table">
<thead>
<tr>
<th>Component</th>
<th>Has default avt test(s)</th>
<th>Has complex avt test(s)</th>
<th>Has keyboard nav avt test(s)</th>
</tr>
</thead>
<tbody>
{Object.keys(componentList.components).map((component) => {
const componentName =
componentList.components[component].component;
const componentTestData = avtTestData.default.suites.find(
(suite) => {
return suite.title
.toLowerCase()
.includes(componentName.toLowerCase().replace(' ', ''));
}
);

// Iterate through all specs in the suite, and all tags in
// each spec, to determine if there is _any_ spec that includes
// a tag we're looking for.
const hasDefaultAVT = componentTestData.suites.some(
(suite) => {
return suite.specs.some((spec) => {
return spec.tags.some((tag) => {
return tag.includes('avt-default-state');
});
});
}
);

const hasComplexAVT = componentTestData.suites.some(
(suite) => {
return suite.specs.some((spec) => {
return spec.tags.some((tag) => {
return tag.includes('avt-advanced-states');
});
});
}
);

const hasKeyboardNavAVT = componentTestData.suites.some(
(suite) => {
return suite.specs.some((spec) => {
return spec.tags.some((tag) => {
return tag.includes('avt-keyboard-nav');
});
});
}
);

return (
<tr key={`avt-tests-${componentName}`}>
<td>{componentName}</td>
<td>{hasDefaultAVT ? '✅' : '🚫'}</td>
<td>{hasComplexAVT ? '✅' : '🚫'}</td>
<td>{hasKeyboardNavAVT ? '✅' : '🚫'}</td>
</tr>
);
})}
</tbody>
</table>
</div>
</div>
<div className="cds--row">
<div className="cds--col-lg-12 cds--no-gutter">
<ul className="component-overview">
{Object.keys(componentList.components).map((component) =>
this.renderItems(componentList.components[component])
)}
</ul>
</div>
</div>
</div>
</>
);
}
}
Expand Down
Loading