Skip to content

Commit

Permalink
Merge branch 'main' into add-workspace-import-sample-data-cases
Browse files Browse the repository at this point in the history
  • Loading branch information
wanglam authored Jun 12, 2024
2 parents 4893bc1 + 24b5659 commit dadc242
Show file tree
Hide file tree
Showing 7 changed files with 165 additions and 25 deletions.
112 changes: 112 additions & 0 deletions .github/workflows/cypress-workflow-bundle-snapshot-based-ci-groups.yml
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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
8 changes: 0 additions & 8 deletions .github/workflows/cypress-workflow-bundle-snapshot-based.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
19 changes: 19 additions & 0 deletions .github/workflows/mds-release-e2e-workflow.yml
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -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"]')
Expand All @@ -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);
});
Expand All @@ -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);
Expand All @@ -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);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
},
Expand All @@ -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();
},
Expand Down Expand Up @@ -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();
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,11 @@

/// <reference types="cypress" />

import { SERVICE_NAME, setTimeFilter } from '../../../utils/constants';
import {
SERVICE_NAME,
setTimeFilter,
delayTime,
} from '../../../utils/constants';

describe('Testing services table', () => {
beforeEach(() => {
Expand All @@ -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', () => {
Expand Down

0 comments on commit dadc242

Please sign in to comment.