Skip to content

Add test orchestrator script to trigger remote workflow runner outside functional test repo for cypress tests #1334

Add test orchestrator script to trigger remote workflow runner outside functional test repo for cypress tests

Add test orchestrator script to trigger remote workflow runner outside functional test repo for cypress tests #1334

name: Snapshot based E2E Cypress tests workflow
on:
pull_request:
branches:
- main
- dev-*
push:
branches:
- main
- dev-*
jobs:
tests:
name: Run Cypress E2E tests
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
# make Node run in ipv4 first so that cypress can detect 5601 port in CI environment
NODE_OPTIONS: '--max-old-space-size=6144 --dns-result-order=ipv4first'
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
# TODO: Qualifier not supported yet for OSD snapshot
# - name: Get package version
# working-directory: monetery-test
# run: |
# echo "VERSION=$(yarn --silent pkg-version)" >> $GITHUB_ENV
- 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/builds/opensearch/dist/opensearch-min-${{ env.VERSION }}-linux-x64.tar.gz
tar -xzf opensearch-min-${{ env.VERSION }}-linux-x64.tar.gz
cd opensearch-${{ env.VERSION }}/
bin/opensearch &
timeout 300 bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' 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/builds/opensearch-dashboards/dist/opensearch-dashboards-min-${{ env.VERSION }}-linux-x64.tar.gz
tar -xzf opensearch-dashboards-min-${{ env.VERSION }}-linux-x64.tar.gz
- name: Run OpenSearch-Dashboards server
run: |
cd opensearch-dashboards-${{ env.VERSION }}-linux-x64
bin/opensearch-dashboards serve &
timeout 300 bash -c 'while [[ "$(curl -s localhost:5601/api/status | jq -r '.status.overall.state')" != "green" ]]; do sleep 5; done'
- name: Get Cypress version
id: cypress_version
run: |
cypress_version_temp=$(cat ./monetery-test/package.json | jq -r '.devDependencies.cypress')
echo "cypress_version=$cypress_version_temp" >> $GITHUB_ENV
- name: Cache Cypress
id: cache-cypress
uses: actions/cache@v1
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-without-security --browser chromium --spec 'cypress/integration/core-opensearch-dashboards/vanilla-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
# Test reports was always captured, so this action uses "always()" condition
- uses: actions/upload-artifact@v1
if: always()
with:
name: cypress-results
path: monetery-test/cypress/results