Skip to content

Commit a78106c

Browse files
fix data source flaky tests (#1383) (#1396)
* troubleshoot Signed-off-by: SuZhou-Joe <[email protected]> * troubleshoot Signed-off-by: SuZhou-Joe <[email protected]> * troubleshoot Signed-off-by: SuZhou-Joe <[email protected]> * troubleshoot Signed-off-by: SuZhou-Joe <[email protected]> * troubleshoot Signed-off-by: SuZhou-Joe <[email protected]> * troubleshoot Signed-off-by: SuZhou-Joe <[email protected]> * troubleshoot Signed-off-by: SuZhou-Joe <[email protected]> * troubleshoot Signed-off-by: SuZhou-Joe <[email protected]> * troubleshoot Signed-off-by: SuZhou-Joe <[email protected]> * troubleshoot Signed-off-by: SuZhou-Joe <[email protected]> * troubleshoot 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 ba9ac55) Co-authored-by: SuZhou-Joe <[email protected]>
1 parent c46263e commit a78106c

File tree

5 files changed

+21
-2
lines changed

5 files changed

+21
-2
lines changed

cypress/integration/core-opensearch-dashboards/opensearch-dashboards/datasource-management-plugin/1_create_datasource.spec.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,10 @@ if (Cypress.env('DATASOURCE_MANAGEMENT_ENABLED')) {
4343
after(() => {
4444
// Clean up after all test are run
4545
cy.deleteAllDataSources();
46+
// remove the default data source
47+
cy.setAdvancedSetting({
48+
defaultDataSource: '',
49+
});
4650
});
4751

4852
it('should successfully load the page', () => {

cypress/integration/core-opensearch-dashboards/opensearch-dashboards/datasource-management-plugin/2_datasource_table.spec.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,12 @@ if (Cypress.env('DATASOURCE_MANAGEMENT_ENABLED')) {
2424
after(() => {
2525
// Clean up after all test are run
2626
cy.deleteAllDataSources();
27+
// clear cache
28+
cy.clearCache();
29+
// remove the default data source
30+
cy.setAdvancedSetting({
31+
defaultDataSource: '',
32+
});
2733
});
2834

2935
it('should successfully load the page', () => {

cypress/integration/core-opensearch-dashboards/opensearch-dashboards/datasource-management-plugin/3_update_datasource.spec.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ if (Cypress.env('DATASOURCE_MANAGEMENT_ENABLED')) {
5151
after(() => {
5252
// Clean up after all test are run
5353
cy.deleteAllDataSources();
54+
// remove the default data source
55+
cy.setAdvancedSetting({
56+
defaultDataSource: '',
57+
});
5458
});
5559

5660
it('should successfully load the listing page & have 2 records in table', () => {

cypress/integration/core-opensearch-dashboards/opensearch-dashboards/datasource-management-plugin/4_set_default_datasource.spec.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@ if (Cypress.env('DATASOURCE_MANAGEMENT_ENABLED')) {
2626
});
2727
after(() => {
2828
// Clean up after all test are run
29-
cy.deleteAllDataSourcesOnUI();
29+
cy.deleteAllDataSources();
30+
// remove the default data source
31+
cy.setAdvancedSetting({
32+
defaultDataSource: '',
33+
});
3034
});
3135
it('The first data source is the default data source', () => {
3236
cy.visitDataSourcesListingPage();

cypress/utils/dashboards/datasource-management-dashboards-plugin/commands.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,8 @@ Cypress.Commands.add('singleDeleteDataSourceByTitle', (dataSourceTitle) => {
305305
.should('exist') // Ensure the button exists
306306
.should('be.visible') // Ensure the button is visible
307307
.click({ force: true }); // Click the button
308-
cy.wait(1000);
308+
309+
cy.wait(2000);
309310
cy.visitDataSourcesListingPage();
310311
});
311312

0 commit comments

Comments
 (0)