From 05784d3e592941fea8f935373721cc3bcf56177e Mon Sep 17 00:00:00 2001 From: Shenoy Pratik Date: Tue, 11 Jun 2024 12:28:16 -0700 Subject: [PATCH 1/3] update cypress for trace analytics 2.15 (#1376) Signed-off-by: Shenoy Pratik --- .../1_trace_analytics_dashboard.spec.js | 6 +++--- .../2_trace_analytics_services.spec.js | 14 +++++++++++++- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/cypress/integration/plugins/observability-dashboards/1_trace_analytics_dashboard.spec.js b/cypress/integration/plugins/observability-dashboards/1_trace_analytics_dashboard.spec.js index 33c685ef4..6c1162393 100644 --- a/cypress/integration/plugins/observability-dashboards/1_trace_analytics_dashboard.spec.js +++ b/cypress/integration/plugins/observability-dashboards/1_trace_analytics_dashboard.spec.js @@ -9,7 +9,7 @@ import { delayTime, setTimeFilter } from '../../../utils/constants'; describe('Testing dashboard table empty state', () => { beforeEach(() => { - cy.visit('app/observability-traces#/', { + cy.visit('app/observability-traces#/traces', { onBeforeLoad: (win) => { win.sessionStorage.clear(); }, @@ -23,7 +23,7 @@ describe('Testing dashboard table empty state', () => { describe('Testing dashboard table', () => { beforeEach(() => { - cy.visit('app/observability-traces#/', { + cy.visit('app/observability-traces#/traces', { onBeforeLoad: (win) => { win.sessionStorage.clear(); }, @@ -91,7 +91,7 @@ describe('Testing dashboard table', () => { describe('Testing plots', () => { beforeEach(() => { - cy.visit('app/observability-traces#/', { + cy.visit('app/observability-traces#/traces', { onBeforeLoad: (win) => { win.sessionStorage.clear(); }, diff --git a/cypress/integration/plugins/observability-dashboards/2_trace_analytics_services.spec.js b/cypress/integration/plugins/observability-dashboards/2_trace_analytics_services.spec.js index f0264294b..7ad693834 100644 --- a/cypress/integration/plugins/observability-dashboards/2_trace_analytics_services.spec.js +++ b/cypress/integration/plugins/observability-dashboards/2_trace_analytics_services.spec.js @@ -5,7 +5,11 @@ /// -import { SERVICE_NAME, setTimeFilter } from '../../../utils/constants'; +import { + SERVICE_NAME, + setTimeFilter, + delayTime, +} from '../../../utils/constants'; describe('Testing services table', () => { beforeEach(() => { @@ -25,6 +29,14 @@ describe('Testing services table', () => { cy.get('.euiButton__text').contains('Refresh').click(); cy.contains(' (1)').should('exist'); }); + + it('Opens service flyout', () => { + cy.get('button[data-test-subj^="service-flyout-action-btn"]') + .first() + .click(); + cy.wait(delayTime); + cy.get('span').contains('Overview').should('exist'); + }); }); describe('Testing service view empty state', () => { From c8cbf04d96e1437ec8d8eeadc19859b2714b51c0 Mon Sep 17 00:00:00 2001 From: Suchit Sahoo <38322563+LDrago27@users.noreply.github.com> Date: Tue, 11 Jun 2024 17:14:37 -0700 Subject: [PATCH 2/3] Fix Flaky Discover Table Tests (#1377) Signed-off-by: Suchit Sahoo --- .../apps/data_explorer/discover_table.spec.js | 29 +++++++++++-------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/data_explorer/discover_table.spec.js b/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/data_explorer/discover_table.spec.js index e21421b7f..1cd55d18b 100644 --- a/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/data_explorer/discover_table.spec.js +++ b/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/apps/data_explorer/discover_table.spec.js @@ -408,22 +408,27 @@ describe('discover_table', () => { describe('AutoSize table', () => { describe('Legacy Table', () => { it('check table Auto Size with change in time range', function () { - cy.get('[aria-label="Next"]') + cy.get('[data-test-subj="docTableExpandToggleColumn"]') .its('length') .then((noEntries) => { cy.setTopNavDate( 'Sep 22, 2015 @ 14:00:00.000', - 'Sep 22, 2015 @ 18:00:00.000' + 'Sep 22, 2015 @ 14:05:00.000' ); - cy.waitForLoader(); - cy.get('[aria-label="Next"]') + cy.verifyHitCount('2'); // Intentional Wait + cy.get('[data-test-subj="docTableExpandToggleColumn"]') .its('length') .should('be.lessThan', noEntries); }); }); it('check table Auto Size with filter', function () { - cy.get('[aria-label="Next"]') + cy.setTopNavDate( + 'Sep 22, 2015 @ 14:00:00.000', + 'Sep 22, 2015 @ 18:00:00.000' + ); + cy.waitForLoader(); // Intentional Wait + cy.get('[aria-label="Toggle row details"]') .its('length') .then((noEntries) => { cy.get('[data-test-subj="field-extension-showDetails"]') @@ -432,8 +437,8 @@ describe('discover_table', () => { cy.get('[data-test-subj="plus-extension-gif"]') .click() .then(() => { - cy.wait(2000); - cy.get('[aria-label="Next"]') + cy.verifyHitCount('1'); // Intentional Wait + cy.get('[aria-label="Toggle row details"]') .its('length') .should('be.lessThan', noEntries); }); @@ -459,9 +464,9 @@ describe('discover_table', () => { .then((noEntries) => { cy.setTopNavDate( 'Sep 22, 2015 @ 14:00:00.000', - 'Sep 22, 2015 @ 18:00:00.000' + 'Sep 22, 2015 @ 14:30:00.000' ); - cy.waitForLoader(); + cy.verifyHitCount('7'); cy.get('[aria-label="Inspect document details"]') .its('length') .should('be.lessThan', noEntries); @@ -475,11 +480,11 @@ describe('discover_table', () => { cy.get('[data-test-subj="field-extension-showDetails"]') .trigger('click') .then(() => { - cy.get('[data-test-subj="plus-extension-gif"]') + cy.get('[data-test-subj="plus-extension-css"]') .trigger('click') .then(() => { - cy.switchDiscoverTable('new'); - cy.get('[aria-label="Inspect document details"]') + cy.verifyHitCount('4'); + cy.get('[aria-label="Toggle row details"]') .its('length') .should('be.lessThan', noEntries); }); From 24b565922988d83316b6e5e2667fa7a099bb1200 Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Wed, 12 Jun 2024 11:26:35 +0800 Subject: [PATCH 3/3] [Backport main] [Infra] Add CI groups for OSD core test cases to avoid flaky test (#1368) * [Infra] Add CI groups for OSD core test cases to avoid flaky test (#1352) * feat: add ci-groups Signed-off-by: SuZhou-Joe * feat: add ci-groups Signed-off-by: SuZhou-Joe * feat: add ci-groups Signed-off-by: SuZhou-Joe * feat: run all Signed-off-by: SuZhou-Joe * feat: add ci-groups Signed-off-by: SuZhou-Joe * feat: add ci-groups Signed-off-by: SuZhou-Joe * feat: add ci-groups Signed-off-by: SuZhou-Joe * feat: add ci-groups Signed-off-by: SuZhou-Joe * feat: add ci-groups Signed-off-by: SuZhou-Joe * feat: add ci-groups Signed-off-by: SuZhou-Joe * feat: add ci-groups Signed-off-by: SuZhou-Joe * feat: add ci-groups Signed-off-by: SuZhou-Joe * feat: add ci-groups Signed-off-by: SuZhou-Joe * feat: add ci-groups Signed-off-by: SuZhou-Joe * feat: add ci-groups Signed-off-by: SuZhou-Joe * feat: add ci-groups Signed-off-by: SuZhou-Joe * feat: add ci-groups Signed-off-by: SuZhou-Joe * feat: add ci-groups Signed-off-by: SuZhou-Joe * feat: add ci-groups Signed-off-by: SuZhou-Joe * feat: revert the deletion of windows flow Signed-off-by: SuZhou-Joe * fix: integration test failure Signed-off-by: SuZhou-Joe * fix: integration test failure Signed-off-by: SuZhou-Joe --------- Signed-off-by: SuZhou-Joe Co-authored-by: Yulong Ruan (cherry picked from commit bd5e0fbe4f84a733d883adcec73cbedb9d08b1f7) * feat: merge Signed-off-by: SuZhou-Joe --------- Signed-off-by: SuZhou-Joe Co-authored-by: SuZhou-Joe --- ...rkflow-bundle-snapshot-based-ci-groups.yml | 112 ++++++++++++++++++ ...workflow-bundle-snapshot-based-windows.yml | 2 +- ...cypress-workflow-bundle-snapshot-based.yml | 8 -- .../workflows/mds-release-e2e-workflow.yml | 19 +++ 4 files changed, 132 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/cypress-workflow-bundle-snapshot-based-ci-groups.yml create mode 100644 .github/workflows/mds-release-e2e-workflow.yml diff --git a/.github/workflows/cypress-workflow-bundle-snapshot-based-ci-groups.yml b/.github/workflows/cypress-workflow-bundle-snapshot-based-ci-groups.yml new file mode 100644 index 000000000..a1852050b --- /dev/null +++ b/.github/workflows/cypress-workflow-bundle-snapshot-based-ci-groups.yml @@ -0,0 +1,112 @@ +name: Cypress test for core Dashboards +on: + pull_request: + branches: ['**'] + paths: + - '.github/workflows/cypress-workflow-bundle-snapshot-based-ci-groups.yml' + - 'cypress/**/core-opensearch-dashboards/**' + - 'cypress/utils/dashboards/**' + push: + branches: ['**'] + paths: + - '.github/workflows/cypress-workflow-bundle-snapshot-based-ci-groups.yml' + - 'cypress/**/core-opensearch-dashboards/**' + - 'cypress/utils/dashboards/**' + +env: + CI_GROUPS: "1,2,3,4,5,6,7,8,9" + +jobs: + get_spec: + runs-on: 'ubuntu-latest' + outputs: + MATRIX_INCLUDES: ${{ steps.get_spec.outputs.MATRIX_INCLUDES }} + steps: + - name: Checkout Branch + uses: actions/checkout@v3 + - name: Checkout cypress-test + uses: actions/checkout@v2 + with: + repository: ${{github.repository}} + path: spec-detect + - id: get_spec + name: Get specs array + run: | + cd spec-detect + result="[" + ## split CI_Groups into array + IFS="," read -a groups <<< "${{ env.CI_GROUPS }}" + for group in "${groups[@]}"; do + item="{\"ciGroup\": \"${group}\", \"specs\": " + IFS="," read -a SPEC_ARRAY <<< "$(npm run -s osd:ciGroup${group})" + FORMATTED_SPEC="\"" + for i in "${SPEC_ARRAY[@]}"; do + FORMATTED_SPEC+="cypress/integration/core-opensearch-dashboards/opensearch-dashboards/${i}," + done + FORMATTED_SPEC+="\" }" + if [[ "${result}" != "[" ]]; + then + result+="," + fi + item+="${FORMATTED_SPEC}" + result+="${item}" + done + + result+=']'; + + echo ${result} + echo "MATRIX_INCLUDES=${result}" >> "$GITHUB_OUTPUT" + + tests-with-security: + needs: ["get_spec"] + strategy: + fail-fast: false + matrix: + include: ${{ fromJSON(needs.get_spec.outputs.MATRIX_INCLUDES) }} + name: (security)osd:ciGroup${{ matrix.ciGroup }} + uses: ./.github/workflows/release-e2e-workflow-template.yml + with: + test-name: "osd:ciGroup${{ matrix.ciGroup }}" + test-command: env CYPRESS_NO_COMMAND_LOG=1 CYPRESS_ML_COMMONS_DASHBOARDS_ENABLED=true CYPRESS_VISBUILDER_ENABLED=true CYPRESS_DATASOURCE_MANAGEMENT_ENABLED=true yarn cypress:run-with-security --browser chromium --spec '${{ matrix.specs }}' + osd-serve-args: --data_source.enabled=true --data_source.ssl.verificationMode=none --vis_builder.enabled=true --ml_commons_dashboards.enabled=true + + tests-without-security: + needs: ["get_spec"] + strategy: + fail-fast: false + matrix: + include: ${{ fromJSON(needs.get_spec.outputs.MATRIX_INCLUDES) }} + name: (non-security)osd:ciGroup${{ matrix.ciGroup }} + uses: ./.github/workflows/release-e2e-workflow-template.yml + with: + test-name: "osd:ciGroup${{ matrix.ciGroup }}" + test-command: env CYPRESS_NO_COMMAND_LOG=1 CYPRESS_ML_COMMONS_DASHBOARDS_ENABLED=true CYPRESS_VISBUILDER_ENABLED=true CYPRESS_DATASOURCE_MANAGEMENT_ENABLED=true yarn cypress:run-without-security --browser chromium --spec '${{ matrix.specs }}' + osd-serve-args: --data_source.enabled=true --data_source.ssl.verificationMode=none --vis_builder.enabled=true --ml_commons_dashboards.enabled=true + security-enabled: false + + # Hold on windows test cases + # https://github.com/opensearch-project/opensearch-dashboards-functional-test/actions/runs/9377445544/job/25819022121?pr=1352 + # tests-with-security-windows: + # needs: ["get_spec"] + # strategy: + # fail-fast: false + # matrix: + # include: ${{ fromJSON(needs.get_spec.outputs.MATRIX_INCLUDES) }} + # name: (security)osd:ciGroup${{ matrix.ciGroup }} + # uses: ./.github/workflows/release-e2e-workflow-template-windows.yml + # with: + # test-name: "osd:ciGroup${{ matrix.ciGroup }}" + # test-command: env CYPRESS_NO_COMMAND_LOG=1 CYPRESS_VISBUILDER_ENABLED=true CYPRESS_DATASOURCE_MANAGEMENT_ENABLED=true yarn cypress:run-with-security --browser chrome --spec '${{ matrix.specs }}' + + # tests-without-security-windows: + # needs: ["get_spec"] + # strategy: + # fail-fast: false + # matrix: + # include: ${{ fromJSON(needs.get_spec.outputs.MATRIX_INCLUDES) }} + # name: (non-security)osd:ciGroup${{ matrix.ciGroup }} + # uses: ./.github/workflows/release-e2e-workflow-template-windows.yml + # with: + # test-name: "osd:ciGroup${{ matrix.ciGroup }}" + # test-command: env CYPRESS_NO_COMMAND_LOG=1 CYPRESS_VISBUILDER_ENABLED=true CYPRESS_DATASOURCE_MANAGEMENT_ENABLED=true yarn cypress:run-without-security --browser chrome --spec '${{ matrix.specs }}' + # security-enabled: false \ No newline at end of file diff --git a/.github/workflows/cypress-workflow-bundle-snapshot-based-windows.yml b/.github/workflows/cypress-workflow-bundle-snapshot-based-windows.yml index 27a2115cb..4a5410a67 100644 --- a/.github/workflows/cypress-workflow-bundle-snapshot-based-windows.yml +++ b/.github/workflows/cypress-workflow-bundle-snapshot-based-windows.yml @@ -27,4 +27,4 @@ jobs: test-command: env CYPRESS_NO_COMMAND_LOG=1 CYPRESS_VISBUILDER_ENABLED=true CYPRESS_DATASOURCE_MANAGEMENT_ENABLED=true yarn cypress:run-without-security --browser chrome --spec 'cypress/integration/core-opensearch-dashboards/opensearch-dashboards/**/*.js' # not useful now as the windows e2e template currently do not allow serving parameters #osd-serve-args: --data_source.enabled=true --vis_builder.enabled=true - security-enabled: false + security-enabled: false \ No newline at end of file diff --git a/.github/workflows/cypress-workflow-bundle-snapshot-based.yml b/.github/workflows/cypress-workflow-bundle-snapshot-based.yml index 8f1ddbb4d..425c945d3 100644 --- a/.github/workflows/cypress-workflow-bundle-snapshot-based.yml +++ b/.github/workflows/cypress-workflow-bundle-snapshot-based.yml @@ -26,11 +26,3 @@ jobs: test-command: env CYPRESS_NO_COMMAND_LOG=1 CYPRESS_ML_COMMONS_DASHBOARDS_ENABLED=true CYPRESS_VISBUILDER_ENABLED=true CYPRESS_UIMETRIC_ENABLED=true CYPRESS_DATASOURCE_MANAGEMENT_ENABLED=true yarn cypress:run-without-security --browser chromium --spec 'cypress/integration/core-opensearch-dashboards/opensearch-dashboards/**/*.js' osd-serve-args: --data_source.enabled=true --data_source.ssl.verificationMode=none --vis_builder.enabled=true --ml_commons_dashboards.enabled=true --usageCollection.uiMetric.enabled=true security-enabled: false - - tests-with-multiple-data-source-and-disabled-local-cluster: - uses: ./.github/workflows/release-e2e-workflow-template.yml - with: - test-name: Core Dashboards using Bundle Snapshot - test-command: env CYPRESS_DISABLE_LOCAL_CLUSTER=true CYPRESS_DATASOURCE_MANAGEMENT_ENABLED=true yarn cypress:run-with-security --browser chromium --spec 'cypress/integration/core-opensearch-dashboards/opensearch-dashboards/**/mds*.js' - osd-serve-args: --data_source.enabled=true --data_source.ssl.verificationMode=none --data_source.hideLocalCluster=true - security-enabled: true diff --git a/.github/workflows/mds-release-e2e-workflow.yml b/.github/workflows/mds-release-e2e-workflow.yml new file mode 100644 index 000000000..cb01bff7a --- /dev/null +++ b/.github/workflows/mds-release-e2e-workflow.yml @@ -0,0 +1,19 @@ +name: E2E Cypress tests workflow for MDS +on: + pull_request: + branches: ['**'] + paths: + - 'cypress/integration/core-opensearch-dashboards/opensearch-dashboards/**/mds*.js' + push: + branches: ['**'] + paths: + - 'cypress/integration/core-opensearch-dashboards/opensearch-dashboards/**/mds*.js' + +jobs: + tests-with-multiple-data-source-and-disabled-local-cluster: + uses: ./.github/workflows/release-e2e-workflow-template.yml + with: + test-name: MDS enabled and local cluster disabled + test-command: env CYPRESS_DISABLE_LOCAL_CLUSTER=true CYPRESS_DATASOURCE_MANAGEMENT_ENABLED=true yarn cypress:run-with-security --browser chromium --spec 'cypress/integration/core-opensearch-dashboards/opensearch-dashboards/**/mds*.js' + osd-serve-args: --data_source.enabled=true --data_source.ssl.verificationMode=none --data_source.hideLocalCluster=true + security-enabled: true