Skip to content

Commit

Permalink
Adds basic visBuilder test (#320)
Browse files Browse the repository at this point in the history
* Adds basic visBuilder test

Signed-off-by: Ashwin Pc <ashwinpc@amazon.com>

* Adds env variable

Signed-off-by: Ashwin Pc <ashwinpc@amazon.com>

* updates cypress bundle snapshot workflow

Signed-off-by: Ashwin Pc <ashwinpc@amazon.com>

Signed-off-by: Ashwin Pc <ashwinpc@amazon.com>
  • Loading branch information
ashwin-pc authored Oct 8, 2022
1 parent 317f156 commit b71a6d2
Show file tree
Hide file tree
Showing 13 changed files with 690 additions and 100 deletions.
94 changes: 18 additions & 76 deletions .github/workflows/cypress-workflow-bundle-snapshot-based.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,83 +8,25 @@ on:
branches:
- main
- dev-*

jobs:
tests:
name: Run Cypress E2E tests
changes:
runs-on: ubuntu-latest
env:
# prevents extra Cypress installation progress messages
CI: 1
# avoid warnings like "tput: No value for $TERM and no -T specified"
TERM: xterm
outputs:
tests: ${{ steps.filter.outputs.tests }}
steps:
- name: Set up JDK
uses: actions/setup-java@v1
with:
java-version: 14
- name: Checkout monetery-test
uses: actions/checkout@v2
with:
repository: ${{github.repository}}
path: monetery-test
- name: Get package version
working-directory: monetery-test
run: |
echo "VERSION=$(yarn --silent pkg-version)" >> $GITHUB_ENV
- name: Get and run OpenSearch
run: |
wget https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/${{ env.VERSION }}/latest/linux/x64/tar/dist/opensearch/opensearch-${{ env.VERSION }}-linux-x64.tar.gz
tar -xzf opensearch-${{ env.VERSION }}-linux-x64.tar.gz
cd opensearch-${{ env.VERSION }}/
./opensearch-tar-install.sh &
timeout 900 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' -u admin:admin -k https://localhost:9200)" != "200" ]]; do sleep 5; done'
- name: Get OpenSearch-Dashboards
run: |
wget https://ci.opensearch.org/ci/dbc/distribution-build-opensearch-dashboards/${{ env.VERSION }}/latest/linux/x64/tar/dist/opensearch-dashboards/opensearch-dashboards-${{ env.VERSION }}-linux-x64.tar.gz
tar -xzf opensearch-dashboards-${{ env.VERSION }}-linux-x64.tar.gz
- name: Get node and yarn versions
id: versions
run: |
echo "::set-output name=node_version::$(node -p "(require('./opensearch-dashboards-${{ env.VERSION }}-linux-x64/package.json').engines.node).match(/[.0-9]+/)[0]")"
- name: Setup node
uses: actions/setup-node@v1
with:
node-version: ${{ steps.versions.outputs.node_version }}
registry-url: 'https://registry.npmjs.org'
- name: Run OpenSearch-Dashboards server
run: |
cd opensearch-dashboards-${{ env.VERSION }}
bin/opensearch-dashboards serve &
timeout 300 bash -c 'while [[ "$(curl -s -u admin:admin -k localhost:5601/api/status | jq -r '.status.overall.state')" != "green" ]]; do sleep 5; done'
- name: Get Cypress version
id: cypress_version
run: |
echo "::set-output name=cypress_version::$(cat ./monetery-test/package.json | jq '.devDependencies.cypress' | tr -d '"')"
- name: Cache Cypress
id: cache-cypress
uses: actions/cache@v1
- uses: dorny/paths-filter@v2
id: filter
with:
path: ~/.cache/Cypress
key: cypress-cache-v2-${{ runner.os }}-${{ hashFiles('**/package.json') }}
env:
CYPRESS_INSTALL_BINARY: ${{ steps.cypress_version.outputs.cypress_version }}
- run: npx cypress cache list
- run: npx cypress cache path
- name: Cypress tests
uses: cypress-io/github-action@v2
with:
working-directory: monetery-test
command: yarn cypress:run-with-security --browser chromium --spec 'cypress/integration/core-opensearch-dashboards/opensearch-dashboards/*.js'
wait-on: 'http://localhost:5601'
# Screenshots are only captured on failure, will change this once we do visual regression tests
- uses: actions/upload-artifact@v1
if: failure()
with:
name: cypress-screenshots
path: monetery-test/cypress/screenshots
# Test run video was always captured, so this action uses "always()" condition
- uses: actions/upload-artifact@v1
if: always()
with:
name: cypress-videos
path: monetery-test/cypress/videos
filters: |
tests:
- 'cypress/**/core-opensearch-dashboards/**'
tests:
needs: changes
if: ${{ needs.changes.outputs.tests == 'true' }}
uses: ./.github/workflows/release-e2e-workflow-template.yml
with:
test-name: Core Dashboards using Bundle Snapshot
test-command: env CYPRESS_VISBUILDER_ENABLED=true yarn cypress:run-with-security --browser chromium --spec 'cypress/integration/core-opensearch-dashboards/opensearch-dashboards/**/*.js'
osd-serve-args: --wizard.enabled=true
7 changes: 5 additions & 2 deletions .github/workflows/release-e2e-workflow-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
test-command:
required: true
type: string
osd-serve-args:
required: false
type: string
jobs:
tests:
name: Run Cypress E2E tests for ${{ inputs.test-name }}
Expand Down Expand Up @@ -54,7 +57,7 @@ jobs:
- name: Run OpenSearch-Dashboards server
run: |
cd opensearch-dashboards-${{ env.VERSION }}
bin/opensearch-dashboards serve &
bin/opensearch-dashboards serve ${{ inputs.osd-serve-args }} &
timeout 300 bash -c 'while [[ "$(curl -s -u admin:admin -k localhost:5601/api/status | jq -r '.status.overall.state')" != "green" ]]; do sleep 5; done'
- name: Get Cypress version
id: cypress_version
Expand Down Expand Up @@ -93,4 +96,4 @@ jobs:
if: always()
with:
name: cypress-results
path: cypress-test/cypress/results
path: cypress-test/cypress/results
5 changes: 3 additions & 2 deletions cypress.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"username": "admin",
"password": "admin",
"ENDPOINT_WITH_PROXY": false,
"MANAGED_SERVICE_ENDPOINT": false
"MANAGED_SERVICE_ENDPOINT": false,
"VISBUILDER_ENABLED": false
}
}
}
Loading

0 comments on commit b71a6d2

Please sign in to comment.