Skip to content

Run test manually

Run test manually #285

name: Run test manually
on: [workflow_dispatch]
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
jobs:
initialize-cloud:
runs-on: ubuntu-22.04
outputs:
POOL_NAME: ${{ steps.pool_variables.outputs.POOL_NAME }}
POOL_INSTANCE: ${{ steps.pool_variables.outputs.POOL_INSTANCE }}
BASE_URL: ${{ steps.cloud_variables.outputs.BASE_URL }}
API_URL: ${{ steps.cloud_variables.outputs.API_URL }}
BACKUP_ID: ${{ steps.cloud_variables.outputs.BACKUP_ID }}
BACKUP_VER: ${{ steps.cloud_variables.outputs.BACKUP_VER }}
BACKUP_NAME: ${{ steps.cloud_variables.outputs.BACKUP_NAME }}
ACCOUNTS: ${{ steps.accounts.outputs.ACCOUNTS }}
steps:
- uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version-file: ".nvmrc"
- name: Cache node modules
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-qa-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-qa-${{ env.cache-name }}-
${{ runner.os }}-qa-
${{ runner.os }}-
- name: Install deps
run: npm ci
- name: Set variables mode
id: set_variables_mode
shell: bash
run: |
if [[ "$GITHUB_REF" == "refs/heads/main" ]]; then
echo "MODE=main" >> $GITHUB_OUTPUT
else
echo "MODE=release" >> $GITHUB_OUTPUT
fi
- name: Generate variables
id: cloud_variables
uses: ./.github/actions/prepare-tests-variables
with:
CLI_TOKEN: ${{ secrets.STAGING_TOKEN }}
MODE: ${{ steps.set_variables_mode.outputs.MODE }}
- name: Prepare instances
id: pool_variables
uses: ./.github/actions/prepare-instance
with:
STRATEGY: reload
CLI_TOKEN: ${{ secrets.STAGING_TOKEN }}
BASE_URL: ${{ steps.cloud_variables.outputs.BASE_URL }}
API_URL: ${{ steps.cloud_variables.outputs.API_URL }}
POOL_NAME: ${{ steps.cloud_variables.outputs.POOL_NAME }}
POOL_INSTANCE: ${{ steps.cloud_variables.outputs.POOL_INSTANCE }}
BACKUP_ID: ${{ steps.cloud_variables.outputs.BACKUP_ID }}
- name: Prepare accounts
id: accounts
uses: ./.github/actions/prepare-accounts
with:
BASE_URL: ${{ steps.cloud_variables.outputs.BASE_URL }}
API_URL: ${{ steps.cloud_variables.outputs.API_URL }}
E2E_USER_NAME: ${{ secrets.E2E_USER_NAME }}
E2E_USER_PASSWORD: ${{ secrets.E2E_USER_PASSWORD }}
E2E_ENCODE_PASS: ${{ secrets.E2E_ENCODE_PASS }}
E2E_PERMISSIONS_USERS_PASSWORD: ${{ secrets.E2E_PERMISSIONS_USERS_PASSWORD }}
create-run-on-testmo:
runs-on: ubuntu-22.04
needs: initialize-cloud
outputs:
testmo-run-id: ${{ steps.init-testmo.outputs.testmo-run-id }}
steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/testmo/testmo-init
with:
testmoUrl: ${{ secrets.TESTMO_URL }}
testmoToken: ${{ secrets.TESTMO_TOKEN }}
testmoRunName: "Playwright run ${{github.ref_name}}"
id: init-testmo
run-tests:
runs-on: ubuntu-22.04
needs: ["initialize-cloud", "create-run-on-testmo"]
strategy:
fail-fast: false
matrix:
shard: [1/2, 2/2]
steps:
- uses: actions/checkout@v4
- name: Run playwright tests
uses: ./.github/actions/run-pw-tests
with:
SHARD: ${{ matrix.shard }}
BASE_URL: ${{ needs.initialize-cloud.outputs.BASE_URL }}
API_URL: ${{ needs.initialize-cloud.outputs.API_URL }}
E2E_USER_NAME: ${{ secrets.E2E_USER_NAME }}
E2E_USER_PASSWORD: ${{ secrets.E2E_USER_PASSWORD }}
E2E_PERMISSIONS_USERS_PASSWORD: ${{ secrets.E2E_PERMISSIONS_USERS_PASSWORD }}
ACCOUNTS: ${{ needs.initialize-cloud.outputs.ACCOUNTS }}
MAILPITURL: ${{ secrets.MAILPITURL }}
PW_WORKERS: ${{ vars.PW_WORKERS }}
PW_RETRIES: ${{ vars.PW_RETRIES }}
URL_TO_RUN: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
- name: submit-results-to-testmo
if: always()
uses: ./.github/actions/testmo/testmo-threads-submit-playwright
with:
testmoUrl: ${{ secrets.TESTMO_URL }}
testmoToken: ${{ secrets.TESTMO_TOKEN }}
testmoRunId: ${{ needs.create-run-on-testmo.outputs.testmo-run-id }}
tests-complete:
if: '!cancelled()'
needs: ["initialize-cloud", "run-tests", "create-run-on-testmo"]
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Merge playwright reports
uses: ./.github/actions/merge-pw-reports
- name: complete testmo report
uses: ./.github/actions/testmo/testmo-finish
with:
testmoUrl: ${{ secrets.TESTMO_URL }}
testmoToken: ${{ secrets.TESTMO_TOKEN }}
testmoRunId: ${{ needs.create-run-on-testmo.outputs.testmo-run-id }}
- name: send message on slack
working-directory: ".github"
env:
run_id: ${{ needs.create-run-on-testmo.outputs.testmo-run-id }}
url_to_action: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
testmo_token: ${{ secrets.TESTMO_TOKEN }}
environment: ${{ needs.initialize-cloud.outputs.BASE_URL }}
slack_webhook_url: ${{ secrets.SLACK_QA_STATUSES_WEBHOOK_URL }}
ref_name: ${{github.ref_name}}
run: |
node workflows/postTestsResults.js \
--run_id "$run_id" \
--testmo_token "$testmo_token" \
--slack_webhook_url "$slack_webhook_url" \
--environment "$environment" \
--url_to_action "$url_to_action" \
--ref_name "$ref_name"