diff --git a/.github/workflows/workspace-release-e2e-workflow.yml b/.github/workflows/workspace-release-e2e-workflow.yml new file mode 100644 index 000000000..5f6d60520 --- /dev/null +++ b/.github/workflows/workspace-release-e2e-workflow.yml @@ -0,0 +1,34 @@ +name: Workspace Release tests workflow in Bundled OpenSearch Dashboards +on: + pull_request: + branches: ['**'] + +jobs: + changes: + runs-on: ubuntu-latest + outputs: + tests: ${{ steps.filter.outputs.tests }} + steps: + - uses: dorny/paths-filter@v2 + id: filter + with: + filters: | + tests: + - 'cypress/**/workspace-plugin/**' + tests-with-security: + needs: changes + if: ${{ needs.changes.outputs.tests == 'true' }} + uses: ./.github/workflows/release-e2e-workflow-template.yml + with: + test-name: dashboards workspace + test-command: env CYPRESS_WORKSPACE_ENABLED=true yarn cypress:run-with-security --browser chromium --spec 'cypress/integration/core-opensearch-dashboards/opensearch-dashboards/workspace-plugin/*' + osd-serve-args: --workspace.enabled=true --savedObjects.permission.enabled=true + tests-without-security: + needs: changes + if: ${{ needs.changes.outputs.tests == 'true' }} + uses: ./.github/workflows/release-e2e-workflow-template.yml + with: + test-name: dashboards workspace + test-command: env CYPRESS_WORKSPACE_ENABLED=true yarn cypress:run-without-security --browser chromium --spec 'cypress/integration/core-opensearch-dashboards/opensearch-dashboards/workspace-plugin/*' + osd-serve-args: --workspace.enabled=true --savedObjects.permission.enabled=false + security-enabled: false \ No newline at end of file diff --git a/cypress.json b/cypress.json index 2b6abb7db..b6ecf4119 100644 --- a/cypress.json +++ b/cypress.json @@ -21,6 +21,7 @@ "DATASOURCE_MANAGEMENT_ENABLED": false, "ML_COMMONS_DASHBOARDS_ENABLED": true, "WAIT_FOR_LOADER_BUFFER_MS": 0, - "DASHBOARDS_ASSISTANT_ENABLED": false + "DASHBOARDS_ASSISTANT_ENABLED": false, + "WORKSPACE_ENABLED": false } } diff --git a/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/workspace-plugin/workspace_create.spec.js b/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/workspace-plugin/workspace_create.spec.js new file mode 100644 index 000000000..2b095adfa --- /dev/null +++ b/cypress/integration/core-opensearch-dashboards/opensearch-dashboards/workspace-plugin/workspace_create.spec.js @@ -0,0 +1,32 @@ +/* + * Copyright OpenSearch Contributors + * SPDX-License-Identifier: Apache-2.0 + */ + +import { BASE_PATH } from '../../../../utils/constants'; + +if (Cypress.env('WORKSPACE_ENABLED')) { + describe('Workspace CRUD APIs', () => { + describe('Create a workspace', () => { + it('should successfully create a worksapce', () => { + const body = { + attributes: { + name: 'test_workspace', + description: 'test_workspace_description', + }, + }; + cy.request({ + method: 'POST', + url: `${BASE_PATH}/api/workspaces`, + headers: { + 'osd-xsrf': true, + }, + body: body, + }).as('createWorkspace'); + cy.get('@createWorkspace').should((res) => { + expect(res.body.success).to.eql(true); + }); + }); + }); + }); +}