Skip to content

Commit

Permalink
feat(Table): add e2e snapshots for expandable stories
Browse files Browse the repository at this point in the history
  • Loading branch information
lesha1201 committed Nov 27, 2019
1 parent 19f6362 commit 1b5e531
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 1 deletion.
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.
8 changes: 8 additions & 0 deletions e2e/__tests__/table.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ const SUITES = [
baisy.suite('Components/Table', 'with condensed modifier'),
baisy.suite('Components/Table', 'with bordered modifier'),
baisy.suite('Components/Table', 'with custom no data component'),
baisy.suite('Components/Table', 'with expandable rows')
.setEnhancer(async (iframe) => {
await (await iframe.waitForSelector('button[data-testid="expand-row-1"]')).click();
}),
baisy.suite('Components/Table', 'with controlled expandable rows', 'all expanded')
.setEnhancer(async (iframe) => {
await (await iframe.waitForXPath('//button[contains(., "Expand all")]')).click();
}),
];


Expand Down
2 changes: 1 addition & 1 deletion src/components/Table/Table.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ export const WithExpandableRows = () => {
({ name: columnName }, rowData, { expandRow, isExpanded }) => {
if (columnName === 'id') {
return (
<Button variant="link" onClick={ () => expandRow() } withIconAutosize={ false }>
<Button data-testid={ `expand-row-${rowData[columnName]}` } variant="link" onClick={ () => expandRow() } withIconAutosize={ false }>
<Icon name={ isExpanded ? 'ChevronTop' : 'ChevronDown' } size="sm" />
<span>{ rowData[columnName] }</span>
</Button>
Expand Down

0 comments on commit 1b5e531

Please sign in to comment.