From c4f7e1caf40be024e06abfd3dfca83ce2f848b86 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Mon, 2 Oct 2023 22:15:25 +0000 Subject: [PATCH] [CI] Cypress test run spec input (#5142) Originally: https://github.com/opensearch-project/OpenSearch-Dashboards/pull/5134 I believed it to be a good idea to ensure that triggering the CI should always run a batch of tests. But I realized that some tests can be added and just be bad tests until updated. Or if we want to verify a flaky test in the CI. So instead of only making it additional tests, the spec input will complete replace the default tests (unless you append to the default). Empty will run the default spec still. This will append on to the PR comment with the spec that was run. So at least maintainers can see it passed for a set of tests but it did not run the ones we usually run. Also adding some formatting for empty values for the PR comment. Issue related: https://github.com/opensearch-project/OpenSearch-Dashboards/issues/4019 Signed-off-by: Kawika Avilla (cherry picked from commit 6154e2d3c1cd96e64bfcae7ec14cffcf54c6805b) Signed-off-by: github-actions[bot] --- .github/workflows/cypress_workflow.yml | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cypress_workflow.yml b/.github/workflows/cypress_workflow.yml index 92a92b19c1ce..d78999a7965f 100644 --- a/.github/workflows/cypress_workflow.yml +++ b/.github/workflows/cypress_workflow.yml @@ -22,20 +22,20 @@ on: required: false type: number specs: - description: 'Additional tests to run' + description: 'Tests to run (default: core)' + default: 'cypress/integration/core-opensearch-dashboards/opensearch-dashboards/**/*.js,' required: false type: string env: SOURCE_REPO: ${{ github.repository }} - SOURCE_BRANCH: ${{ github.base_ref }} + SOURCE_BRANCH: "${{ github.base_ref }}" TEST_REPO: ${{ inputs.test_repo != '' && inputs.test_repo || 'opensearch-project/opensearch-dashboards-functional-test' }} TEST_BRANCH: "${{ inputs.test_branch != '' && inputs.test_branch || github.base_ref }}" FTR_PATH: 'ftr' START_CMD: 'node ../scripts/opensearch_dashboards --dev --no-base-path --no-watch' OPENSEARCH_SNAPSHOT_CMD: 'node ../scripts/opensearch snapshot' - SPEC: 'cypress/integration/core-opensearch-dashboards/opensearch-dashboards/**/*.js,' - ADDITIONAL_SPEC: ${{ inputs.specs != '' && inputs.specs || '' }} + SPEC: ${{ inputs.specs != '' && inputs.specs || 'cypress/integration/core-opensearch-dashboards/opensearch-dashboards/**/*.js,' }} CYPRESS_BROWSER: 'chromium' CYPRESS_VISBUILDER_ENABLED: true CYPRESS_DATASOURCE_MANAGEMENT_ENABLED: false @@ -129,7 +129,7 @@ jobs: working-directory: ${{ env.FTR_PATH }} start: ${{ env.OPENSEARCH_SNAPSHOT_CMD }}, ${{ env.START_CMD }} wait-on: 'http://localhost:9200, http://localhost:5601' - command: yarn cypress:run-without-security --browser ${{ env.CYPRESS_BROWSER }} --spec ${{ env.SPEC }}${{ env.ADDITIONAL_SPEC }} + command: yarn cypress:run-without-security --browser ${{ env.CYPRESS_BROWSER }} --spec ${{ env.SPEC }} # Screenshots are only captured on failure, will change this once we do visual regression tests - uses: actions/upload-artifact@v3 @@ -180,10 +180,13 @@ jobs: #### Inputs: Source repo: `${{ env.SOURCE_REPO }}` - Source branch: `${{ env.SOURCE_BRANCH }}` + Source branch: ``${{ env.SOURCE_BRANCH }}`` Test repo: `${{ env.TEST_REPO }}` Test branch: ``${{ env.TEST_BRANCH }}`` + Test spec: + `${{ env.SPEC }}` + #### Link to results: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} edit-mode: replace