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

[Backport main] Fix flaky tests in core dashboard. #1382

Merged
merged 2 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ on:
- '.github/workflows/cypress-workflow-bundle-snapshot-based-ci-groups.yml'
- 'cypress/**/core-opensearch-dashboards/**'
- 'cypress/utils/dashboards/**'
- 'package.json'
- '.github/actions/start-opensearch/action.yml'

push:
Expand All @@ -14,6 +15,7 @@ on:
- '.github/workflows/cypress-workflow-bundle-snapshot-based-ci-groups.yml'
- 'cypress/**/core-opensearch-dashboards/**'
- 'cypress/utils/dashboards/**'
- 'package.json'
- '.github/actions/start-opensearch/action.yml'

env:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@ on:
paths:
- 'cypress/**/core-opensearch-dashboards/**'
- 'cypress/utils/dashboards/**'
- '.github/workflows/cypress-workflow-bundle-snapshot-based.yml'
push:
branches: ['**']
paths:
- 'cypress/**/core-opensearch-dashboards/**'
- 'cypress/utils/dashboards/**'
- '.github/workflows/cypress-workflow-bundle-snapshot-based.yml'

jobs:
tests-with-security:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ describe('discover_advanced_setting', () => {
it('check legacy table respects Number of rows setting', function () {
cy.switchDiscoverTable('legacy');
cy.wait(2000); // Intentional Wait to account for low performant env
cy.get('[aria-label="Next"]').should('have.length', 5);
cy.get('[aria-label="Toggle row details"]').should('have.length', 5);
});

after(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ describe('discover histogram', { scrollBehavior: false }, () => {
);
cy.deleteIndex('long-window-logstash-0');
cy.deleteSavedObjectByType('index-pattern');
cy.clearCache();
});

it('should visualize monthly data with different day intervals', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,7 @@ describe('discover_table', () => {
cy.reload();
cy.deleteIndexPattern('nestedindex');
cy.deleteIndex('nestedindex');
cy.clearCache();
miscUtils.visitPage(
`app/data-explorer/discover#/?_g=(filters:!(),time:(from:'2015-09-19T13:31:44.000Z',to:'2015-09-24T01:31:44.000Z'))`
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ describe('shared links', () => {
cy.fleshTenantSettings();
});

after(() => {
cy.deleteIndex(indexSet.join(','));
cy.clearCache();
});

describe('shared links with state in query', () => {
it('should allow for copying the snapshot URL', function () {
const url = `http://localhost:5601/app/data-explorer/discover#/?_a=(discover:(columns:!(_source),isDirty:!f,sort:!()),metadata:(indexPattern:'logstash-*',view:discover))&_g=(filters:!(),refreshInterval:(pause:!t,value:0),time:(from:'2015-09-19T13:31:44.000Z',to:'2015-09-24T01:31:44.000Z'))&_q=(filters:!(),query:(language:kuery,query:''))`;
Expand Down Expand Up @@ -125,9 +130,9 @@ describe('shared links', () => {
});

after(() => {
cy.setAdvancedSetting({
'state:storeStateInSessionStorage': false,
});
CURRENT_TENANT.newTenant = 'global';
cy.fleshTenantSettings();
cy.deleteSavedObjectByType('config');
});

it('should allow for copying the snapshot URL', function () {
Expand Down
8 changes: 8 additions & 0 deletions cypress/utils/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/

import { BASE_PATH, IM_API, BACKEND_BASE_PATH } from './constants';
import { devToolsRequest } from './helpers';

export const DisableLocalCluster = !!Cypress.env('DISABLE_LOCAL_CLUSTER'); // = hideLocalCluster

Expand Down Expand Up @@ -678,3 +679,10 @@ Cypress.Commands.add('removeSampleDataFromDataSource', (dataSourceTitle) => {
.should('be.visible')
.click();
});

Cypress.Commands.add('clearCache', () => {
devToolsRequest(`/_cache/clear?query=true&request=true`, 'POST');
devToolsRequest(`/_flush`, 'POST');
devToolsRequest(`/_forcemerge`, 'POST');
cy.wait(5000);
});
Loading