Skip to content

Commit 6a453ef

Browse files
Fix flaky tests in core dashboard. (#1371) (#1382)
* feat: troubleshoot Signed-off-by: SuZhou-Joe <[email protected]> * feat: troubleshoot Signed-off-by: SuZhou-Joe <[email protected]> * feat: troubleshoot Signed-off-by: SuZhou-Joe <[email protected]> * feat: troubleshoot Signed-off-by: SuZhou-Joe <[email protected]> * feat: troubleshoot Signed-off-by: SuZhou-Joe <[email protected]> * feat: troubleshoot Signed-off-by: SuZhou-Joe <[email protected]> * feat: troubleshoot Signed-off-by: SuZhou-Joe <[email protected]> * feat: troubleshoot Signed-off-by: SuZhou-Joe <[email protected]> * feat: troubleshoot Signed-off-by: SuZhou-Joe <[email protected]> * feat: troubleshoot Signed-off-by: SuZhou-Joe <[email protected]> * feat: troubleshoot Signed-off-by: SuZhou-Joe <[email protected]> * feat: troubleshoot Signed-off-by: SuZhou-Joe <[email protected]> * feat: troubleshoot Signed-off-by: SuZhou-Joe <[email protected]> * feat: troubleshoot Signed-off-by: SuZhou-Joe <[email protected]> * feat: troubleshoot Signed-off-by: SuZhou-Joe <[email protected]> * feat: troubleshoot Signed-off-by: SuZhou-Joe <[email protected]> * feat: troubleshoot Signed-off-by: SuZhou-Joe <[email protected]> * feat: troubleshoot Signed-off-by: SuZhou-Joe <[email protected]> * feat: troubleshoot Signed-off-by: SuZhou-Joe <[email protected]> * feat: troubleshoot Signed-off-by: SuZhou-Joe <[email protected]> * feat: troubleshoot Signed-off-by: SuZhou-Joe <[email protected]> * feat: troubleshoot Signed-off-by: SuZhou-Joe <[email protected]> * feat: troubleshoot Signed-off-by: SuZhou-Joe <[email protected]> * feat: troubleshoot Signed-off-by: SuZhou-Joe <[email protected]> * feat: troubleshoot Signed-off-by: SuZhou-Joe <[email protected]> * feat: troubleshoot Signed-off-by: SuZhou-Joe <[email protected]> * feat: troubleshoot Signed-off-by: SuZhou-Joe <[email protected]> * feat: troubleshoot Signed-off-by: SuZhou-Joe <[email protected]> * feat: troubleshoot Signed-off-by: SuZhou-Joe <[email protected]> * feat: troubleshoot Signed-off-by: SuZhou-Joe <[email protected]> * feat: troubleshoot Signed-off-by: SuZhou-Joe <[email protected]> * feat: troubleshoot Signed-off-by: SuZhou-Joe <[email protected]> * fix: discover advanced settings Signed-off-by: SuZhou-Joe <[email protected]> * fix: discover tabe spec Signed-off-by: SuZhou-Joe <[email protected]> * troubleshoot Signed-off-by: SuZhou-Joe <[email protected]> * troubleshoot Signed-off-by: SuZhou-Joe <[email protected]> --------- Signed-off-by: SuZhou-Joe <[email protected]> (cherry picked from commit 5af3c7a) Signed-off-by: SuZhou-Joe <[email protected]> Co-authored-by: SuZhou-Joe <[email protected]>
1 parent 8f24bfd commit 6a453ef

File tree

7 files changed

+23
-4
lines changed

7 files changed

+23
-4
lines changed

.github/workflows/cypress-workflow-bundle-snapshot-based-ci-groups.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ on:
66
- '.github/workflows/cypress-workflow-bundle-snapshot-based-ci-groups.yml'
77
- 'cypress/**/core-opensearch-dashboards/**'
88
- 'cypress/utils/dashboards/**'
9+
- 'package.json'
910
- '.github/actions/start-opensearch/action.yml'
1011

1112
push:
@@ -14,6 +15,7 @@ on:
1415
- '.github/workflows/cypress-workflow-bundle-snapshot-based-ci-groups.yml'
1516
- 'cypress/**/core-opensearch-dashboards/**'
1617
- 'cypress/utils/dashboards/**'
18+
- 'package.json'
1719
- '.github/actions/start-opensearch/action.yml'
1820

1921
env:

.github/workflows/cypress-workflow-bundle-snapshot-based.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,13 @@ on:
55
paths:
66
- 'cypress/**/core-opensearch-dashboards/**'
77
- 'cypress/utils/dashboards/**'
8+
- '.github/workflows/cypress-workflow-bundle-snapshot-based.yml'
89
push:
910
branches: ['**']
1011
paths:
1112
- 'cypress/**/core-opensearch-dashboards/**'
1213
- 'cypress/utils/dashboards/**'
14+
- '.github/workflows/cypress-workflow-bundle-snapshot-based.yml'
1315

1416
jobs:
1517
tests-with-security:

cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/data_explorer/discover_advanced_settings.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ describe('discover_advanced_setting', () => {
216216
it('check legacy table respects Number of rows setting', function () {
217217
cy.switchDiscoverTable('legacy');
218218
cy.wait(2000); // Intentional Wait to account for low performant env
219-
cy.get('[aria-label="Next"]').should('have.length', 5);
219+
cy.get('[aria-label="Toggle row details"]').should('have.length', 5);
220220
});
221221

222222
after(() => {

cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/data_explorer/discover_histogram.spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ describe('discover histogram', { scrollBehavior: false }, () => {
6868
);
6969
cy.deleteIndex('long-window-logstash-0');
7070
cy.deleteSavedObjectByType('index-pattern');
71+
cy.clearCache();
7172
});
7273

7374
it('should visualize monthly data with different day intervals', () => {

cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/data_explorer/discover_table.spec.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,7 @@ describe('discover_table', () => {
505505
cy.reload();
506506
cy.deleteIndexPattern('nestedindex');
507507
cy.deleteIndex('nestedindex');
508+
cy.clearCache();
508509
miscUtils.visitPage(
509510
`app/data-explorer/discover#/?_g=(filters:!(),time:(from:'2015-09-19T13:31:44.000Z',to:'2015-09-24T01:31:44.000Z'))`
510511
);

cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/data_explorer/shared_links.spec.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ describe('shared links', () => {
5858
cy.fleshTenantSettings();
5959
});
6060

61+
after(() => {
62+
cy.deleteIndex(indexSet.join(','));
63+
cy.clearCache();
64+
});
65+
6166
describe('shared links with state in query', () => {
6267
it('should allow for copying the snapshot URL', function () {
6368
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:''))`;
@@ -125,9 +130,9 @@ describe('shared links', () => {
125130
});
126131

127132
after(() => {
128-
cy.setAdvancedSetting({
129-
'state:storeStateInSessionStorage': false,
130-
});
133+
CURRENT_TENANT.newTenant = 'global';
134+
cy.fleshTenantSettings();
135+
cy.deleteSavedObjectByType('config');
131136
});
132137

133138
it('should allow for copying the snapshot URL', function () {

cypress/utils/commands.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*/
55

66
import { BASE_PATH, IM_API, BACKEND_BASE_PATH } from './constants';
7+
import { devToolsRequest } from './helpers';
78

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

@@ -681,3 +682,10 @@ Cypress.Commands.add('removeSampleDataFromDataSource', (dataSourceTitle) => {
681682
.should('be.visible')
682683
.click();
683684
});
685+
686+
Cypress.Commands.add('clearCache', () => {
687+
devToolsRequest(`/_cache/clear?query=true&request=true`, 'POST');
688+
devToolsRequest(`/_flush`, 'POST');
689+
devToolsRequest(`/_forcemerge`, 'POST');
690+
cy.wait(5000);
691+
});

0 commit comments

Comments
 (0)