Skip to content

Commit

Permalink
console: add test id to relationship expanders on /table/browse (hasu…
Browse files Browse the repository at this point in the history
  • Loading branch information
Rishichandra Wawhal authored Mar 27, 2020
1 parent 5113003 commit ad07c06
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
12 changes: 3 additions & 9 deletions console/cypress/integration/data/insert-browse/spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -479,15 +479,9 @@ export const checkViewRelationship = () => {
cy.wait(1000);
cy.get(getElementFromAlias('table-browse-rows')).click();
cy.wait(1000);
cy.get('a')
.contains('View')
.first()
.click();
cy.wait(5000);
cy.get('a')
.contains('Close')
.first()
.click();
cy.get(getElementFromAlias('view-relationship-0')).click();
cy.wait(1000);
cy.get(getElementFromAlias('close-relationship-0')).click();
};

export const passDeleteRow = () => {
Expand Down
19 changes: 15 additions & 4 deletions console/src/components/Services/Data/TableBrowseRows/ViewRows.js
Original file line number Diff line number Diff line change
Expand Up @@ -525,9 +525,14 @@ const ViewRows = ({
const getRelCellContent = () => {
let cellValue = '';

const getRelExpander = (value, className, clickHandler) => {
const getRelExpander = (value, className, clickHandler, testId) => {
return (
<a href="#" className={className} onClick={clickHandler}>
<a
href="#"
onClick={clickHandler}
className={className}
data-test={testId}
>
{value}
</a>
);
Expand All @@ -545,7 +550,8 @@ const ViewRows = ({
cellValue = getRelExpander(
'Close',
styles.expanded,
handleCloseClick
handleCloseClick,
`close-relationship-${rowIndex}`
);
} else {
const currentFkey = rel.rel_def.foreign_key_constraint_on;
Expand Down Expand Up @@ -576,7 +582,12 @@ const ViewRows = ({
}
};

cellValue = getRelExpander('View', '', handleViewClick);
cellValue = getRelExpander(
'View',
'',
handleViewClick,
`view-relationship-${rowIndex}`
);
}
}

Expand Down

0 comments on commit ad07c06

Please sign in to comment.