Skip to content

Commit

Permalink
Fix flaky tests for Trace Analytics and Panels (#852) (#853)
Browse files Browse the repository at this point in the history
* Fix flaky tests for Trace Analytics and Panels

Signed-off-by: Derek Ho <[email protected]>

* Fix flakiness on change date filter

Signed-off-by: Derek Ho <[email protected]>

---------

Signed-off-by: Derek Ho <[email protected]>
(cherry picked from commit 04d70f0)

Co-authored-by: Derek Ho <[email protected]>
  • Loading branch information
opensearch-trigger-bot[bot] and derek-ho authored Oct 8, 2023
1 parent e53ba8e commit 1dd1c26
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ describe('Testing dashboard table', () => {
});

it('Redirects to traces table with filter', () => {
cy.get('.euiLink').contains('13').click();
cy.get('[data-test-subj="dashboard-table-traces-button"]')
.contains('13')
.click();
cy.wait(delayTime);

cy.contains(' (13)').should('exist');
Expand Down Expand Up @@ -107,7 +109,9 @@ describe('Testing plots', () => {

it('Renders service map', () => {
// plotly scale texts are in attribute "data-unformatted"
cy.get('text.ytitle[data-unformatted="Latency (ms)"]').should('exist');
cy.get('text.ytitle[data-unformatted="Average duration (ms)"]').should(
'exist'
);
cy.get('text[data-unformatted="200"]').should('exist');
cy.get('.vis-network').should('exist');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,9 @@
import {
PANEL_DELAY as delay,
TEST_PANEL,
PPL_VISUALIZATIONS,
PPL_VISUALIZATIONS_NAMES,
supressResizeObserverIssue,
BASE_PATH,
} from '../../../utils/constants';

const moveToEventsHome = () => {
cy.visit(`${BASE_PATH}/app/observability-logs#`);
cy.wait(delay * 3);
};

const moveToPanelHome = () => {
cy.visit(`${BASE_PATH}/app/observability-dashboards#`);
cy.wait(delay * 3);
Expand All @@ -35,40 +27,6 @@ const moveToTestPanel = () => {
cy.wait(delay);
};

describe('Creating visualizations', () => {
beforeEach(() => {
moveToEventsHome();
});

it('Create first visualization in event analytics', () => {
cy.get('[id^=autocomplete-textarea]').focus().type(PPL_VISUALIZATIONS[0], {
delay: 50,
});
cy.get('.euiButton__text').contains('Refresh').trigger('mouseover').click();
cy.wait(delay);
supressResizeObserverIssue();
cy.get('button[id="main-content-vis"]')
.contains('Visualizations')
.trigger('mouseover')
.click();
cy.wait(delay * 2);
cy.get('[data-test-subj="eventExplorer__saveManagementPopover"]')
.trigger('mouseover')
.click();
cy.wait(1000);
cy.get('[data-test-subj="eventExplorer__querySaveName"]')
.focus()
.type(PPL_VISUALIZATIONS_NAMES[0], {
delay: 50,
});
cy.get('[data-test-subj="eventExplorer__querySaveConfirm"]')
.trigger('mouseover')
.click();
cy.wait(delay);
cy.get('.euiToastHeader__title').contains('successfully').should('exist');
});
});

describe('Testing panels table', () => {
beforeEach(() => {
moveToPanelHome();
Expand Down Expand Up @@ -112,6 +70,7 @@ describe('Testing panels table', () => {
});

it('Deletes panels', () => {
cy.get('.panel-header-count').contains('(2)');
cy.get('.euiCheckbox__input[data-test-subj="checkboxSelectAll"]')
.trigger('mouseover')
.click();
Expand Down Expand Up @@ -166,6 +125,7 @@ describe('Testing a panel', () => {
});
cy.get('.euiLink').contains('This year').trigger('mouseover').click();
cy.wait(delay * 2);
moveToTestPanel();
cy.get(
'.euiSuperDatePicker__prettyFormat[data-test-subj="superDatePickerShowDatesButton"]'
)
Expand Down
5 changes: 1 addition & 4 deletions cypress/utils/plugins/observability-dashboards/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,7 @@ export const setTimeFilter = (setEndTime = false, refresh = true) => {
timeout: TIMEOUT_DELAY,
}).click();
cy.get('.euiQuickSelect__applyButton').click();
cy.get('.euiSuperDatePicker__prettyFormatLink').click();
cy.get(
'button.euiDatePopoverButton--start[data-test-subj="superDatePickerstartDatePopoverButton"]'
).click();
cy.get('[data-test-subj="superDatePickerShowDatesButton"]').click();
cy.get('.euiTab__content').contains('Absolute').click();
cy.get('input[data-test-subj="superDatePickerAbsoluteDateInput"]', {
timeout: TIMEOUT_DELAY,
Expand Down

0 comments on commit 1dd1c26

Please sign in to comment.