Skip to content

Commit

Permalink
[CI] Cypress test run spec input (#5142)
Browse files Browse the repository at this point in the history
Originally:
#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:
#4019

Signed-off-by: Kawika Avilla <[email protected]>
  • Loading branch information
kavilla authored Sep 29, 2023
1 parent 34a8594 commit 6154e2d
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions .github/workflows/cypress_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

0 comments on commit 6154e2d

Please sign in to comment.