Skip to content

Commit

Permalink
Fix conditional testing
Browse files Browse the repository at this point in the history
Signed-off-by: Eugene Lee <eugenesk@amazon.com>
  • Loading branch information
eugenesk24 committed May 2, 2022
1 parent 496ff81 commit 8529823
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -116,13 +116,15 @@ describe('Creating application', () => {
cy.visit(
`${Cypress.env('opensearchDashboards')}/app/observability-dashboards#/operational_panels/`
);
if (cy.get('.euiButton').contains('Create panel').length < 2) {
cy.get('[data-test-subj="operationalPanelSearchBar"]').type(`${nameOne}'s Panel`, {delay: TYPING_DELAY});
cy.wait(delay);
cy.get('.euiTableCellContent__text').contains('No items found').should('exist');
cy.get('.euiFormControlLayoutClearButton').click();
cy.wait(delay);
}
cy.get('body').then(($body) => {
if ($body.find('[data-test-subj="customPanels__emptyCreateNewPanels"]').length == 1) {
cy.get('[data-test-subj="operationalPanelSearchBar"]').type(`${nameOne}'s Panel`, {delay: TYPING_DELAY});
cy.wait(delay);
cy.get('.euiTableCellContent__text').contains('No items found').should('exist');
cy.get('.euiFormControlLayoutClearButton').click();
cy.wait(delay);
}
});
});

it('Redirects to home page on cancel', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,11 @@ export const CustomPanelTable = ({
<EuiSpacer size="m" />
<EuiFlexGroup justifyContent="center">
<EuiFlexItem grow={false}>
<EuiButton fullWidth={false} onClick={() => createPanel()}>
<EuiButton
data-test-subj="customPanels__emptyCreateNewPanels"
fullWidth={false}
onClick={() => createPanel()}
>
Create panel
</EuiButton>
</EuiFlexItem>
Expand Down

0 comments on commit 8529823

Please sign in to comment.