From ecdeec52449e4fb9fbd0c20dc95c1869bc1fea2b Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Tue, 1 Oct 2024 06:11:30 -0700 Subject: [PATCH 1/4] Add query and filter syncing up (#1576) (#1581) Follow up PR of opensearch-project/OpenSearch-Dashboards#8168 to add test to make sure queries and filters are persisted across refresh, and switching between new and legacy tables. Signed-off-by: Qingyang(Abby) Hu (cherry picked from commit fb85e41994f560eb9bb42c1c96c6c1ed03105df9) Co-authored-by: Qingyang(Abby) Hu --- .../apps/data_explorer/discover.spec.js | 26 +++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/data_explorer/discover.spec.js b/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/data_explorer/discover.spec.js index 9fccc0265..a8b0a349f 100644 --- a/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/data_explorer/discover.spec.js +++ b/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/data_explorer/discover.spec.js @@ -63,6 +63,32 @@ describe('discover app', { scrollBehavior: false }, () => { after(() => {}); + describe('filters and queries', () => { + after(() => { + cy.get('[data-test-subj~="filter-key-extension.raw"]').click(); + cy.getElementByTestId(`deleteFilter`).click(); + cy.switchDiscoverTable('legacy'); + }); + it('should persist across refresh', function () { + // Set up query and filter + cy.setTopNavQuery('response:200'); + cy.submitFilterFromDropDown('extension.raw', 'is one of', 'jpg'); + cy.reload(); + cy.getElementByTestId(`queryInput`).should('have.text', 'response:200'); + cy.get('[data-test-subj~="filter-key-extension.raw"]').should( + 'be.visible' + ); + }); + + it('should persist across switching table', function () { + cy.switchDiscoverTable('new'); + cy.getElementByTestId(`queryInput`).should('have.text', 'response:200'); + cy.get('[data-test-subj~="filter-key-extension.raw"]').should( + 'be.visible' + ); + }); + }); + describe('save search', () => { const saveSearch1 = 'Save Search # 1'; const saveSearch2 = 'Modified Save Search # 1'; From ef9bc81a85eb7e39dc80d06001dd3f564ea7584a Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Wed, 16 Oct 2024 16:46:33 -0400 Subject: [PATCH 2/4] skip new home UI test if disabled (#1587) (#1588) Signed-off-by: Junqiu Lei (cherry picked from commit 72e960aa09fce06c44584401483ccda65d3db791) Co-authored-by: Junqiu Lei --- .../7_enable_new_home_ui.spec.js | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/cypress/integration/plugins/custom-import-map-dashboards/7_enable_new_home_ui.spec.js b/cypress/integration/plugins/custom-import-map-dashboards/7_enable_new_home_ui.spec.js index ec1d1d5ff..75015bbdd 100644 --- a/cypress/integration/plugins/custom-import-map-dashboards/7_enable_new_home_ui.spec.js +++ b/cypress/integration/plugins/custom-import-map-dashboards/7_enable_new_home_ui.spec.js @@ -9,19 +9,22 @@ import { CURRENT_TENANT } from '../../../utils/commands'; const miscUtils = new MiscUtils(cy); -describe('Add flights dataset saved object', () => { - before(() => { +describe('Add flights dataset saved object', function () { + before(function () { CURRENT_TENANT.newTenant = 'global'; cy.deleteAllIndices(); miscUtils.addSampleData(); cy.wait(10000); - // Enable the new home UI + // Enable the new home UI if possible cy.visit(`${BASE_PATH}/app/settings`); cy.get( '[data-test-subj="advancedSetting-editField-home:useNewHomePage"]' ).then(($switch) => { - if ($switch.attr('aria-checked') === 'false') { + if ($switch.attr('disabled') === 'disabled') { + cy.log('Switch is disabled and cannot be changed.'); + this.skip(); // Skip all tests in this suite + } else if ($switch.attr('aria-checked') === 'false') { cy.wrap($switch).click(); cy.get('[data-test-subj="advancedSetting-saveButton"]').click(); cy.get('button.euiButton--primary.euiButton--small', { @@ -35,12 +38,14 @@ describe('Add flights dataset saved object', () => { after(() => { miscUtils.removeSampleData(); - // Disable the new home UI + // Disable the new home UI if possible cy.visit(`${BASE_PATH}/app/settings`); cy.get( '[data-test-subj="advancedSetting-editField-home:useNewHomePage"]' ).then(($switch) => { - if ($switch.attr('aria-checked') === 'true') { + if ($switch.attr('disabled') === 'disabled') { + cy.log('Switch is disabled and cannot be changed.'); + } else if ($switch.attr('aria-checked') === 'true') { cy.wrap($switch).click(); cy.get('[data-test-subj="advancedSetting-saveButton"]').click(); cy.get('button.euiButton--primary.euiButton--small', { From 879e0d3c2d6272d5a4e055d11882908f839bdca2 Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Fri, 18 Oct 2024 11:42:02 -0700 Subject: [PATCH 3/4] Increment version to 2.18.0 (#1577) Signed-off-by: opensearch-ci-bot Co-authored-by: opensearch-ci-bot --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 2a61ff896..024e3877c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "opensearch-dashboards-functional-test", - "version": "2.17.0", + "version": "2.18.0", "description": "Maintains functional tests for OpenSearch Dashboards and Dashboards plugins", "main": "index.js", "scripts": { From 970b0f42822da4e0a25cde3ea3f878d6508a6c8d Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Fri, 18 Oct 2024 11:45:32 -0700 Subject: [PATCH 4/4] Security analytics cypress test fixes. (#1590) (#1592) * Added short wait to help reduce flakiness. Signed-off-by: AWSHurneyt * Gave rule unique ID. Signed-off-by: AWSHurneyt --------- Signed-off-by: AWSHurneyt (cherry picked from commit b5b2cb8238b6e7ae5999e37fcca2ab7d346a6e15) Co-authored-by: AWSHurneyt --- .../rule/create_dns_rule_with_type_selection.json | 2 +- .../plugins/security-analytics-dashboards-plugin/commands.js | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/cypress/fixtures/plugins/security-analytics-dashboards-plugin/integration_tests/rule/create_dns_rule_with_type_selection.json b/cypress/fixtures/plugins/security-analytics-dashboards-plugin/integration_tests/rule/create_dns_rule_with_type_selection.json index e447a30d5..f332a4868 100644 --- a/cypress/fixtures/plugins/security-analytics-dashboards-plugin/integration_tests/rule/create_dns_rule_with_type_selection.json +++ b/cypress/fixtures/plugins/security-analytics-dashboards-plugin/integration_tests/rule/create_dns_rule_with_type_selection.json @@ -1,5 +1,5 @@ { - "id": "25b9c01c-350d-4b95-bed1-836d04a4f325", + "id": "25b9c01c-350d-4b95-bed1-836d04a4f324", "category": "dns", "title": "Cypress DNS Type Rule", "description": "Detects DNS type as QWE", diff --git a/cypress/utils/plugins/security-analytics-dashboards-plugin/commands.js b/cypress/utils/plugins/security-analytics-dashboards-plugin/commands.js index 708b1e8bc..3bf1e0cf0 100644 --- a/cypress/utils/plugins/security-analytics-dashboards-plugin/commands.js +++ b/cypress/utils/plugins/security-analytics-dashboards-plugin/commands.js @@ -198,6 +198,9 @@ Cypress.Commands.add( Cypress.log({ message: `Select combobox items: ${items.join(' | ')}` }); items.map((item) => { cy.wrap(subject).type(item); + + // Short wait to reduce flakiness + cy.wait(3000); cy.get(`[title="${item}"]`).click({ force: true }); }); }