Skip to content

Microapps UI prod smoke tests #476

Microapps UI prod smoke tests

Microapps UI prod smoke tests #476

name: Microapps UI prod smoke tests
on:
workflow_dispatch:
schedule:
- cron: "5 10 * * *"
jobs:
setup-report:
name: setup testmo report
runs-on: ubuntu-latest
outputs:
testmo-run-id: ${{ steps.setTestRun.outputs.testmo-run-id }}
steps:
- name: Install testmo
run: yarn global add @testmo/testmo-cli
- name: Add extra params
run: |
testmo automation:resources:add-field --name git --type string \
--value ${GITHUB_SHA:0:7} --resources resources.json
RUN_URL="$GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$GITHUB_RUN_ID"
testmo automation:resources:add-link --name build \
--url $RUN_URL --resources resources.json
- name: Create test run
run: |
testmo automation:run:create \
--instance https://mangata-finance.testmo.net \
--project-id 2 \
--name "FE e2e prod smoke test run" \
--resources resources.json \
--source "fe-prod-e2e-job" > testmo-run-id.txt
ID=$(cat testmo-run-id.txt)
echo "testmo-run-id=$ID" >> $GITHUB_OUTPUT
echo "ID=$ID" >> $GITHUB_ENV
env:
TESTMO_URL: ${{ secrets.TESTMO_URL }}
TESTMO_TOKEN: ${{ secrets.TESTMO_TOKEN }}
id: setTestRun
e2e-tm:
name: Run UI tests
needs: [setup-report]
strategy:
fail-fast: false
matrix:
command: ["first"]
runs-on: ubuntu-latest
env:
API_URL: "wss://kusama-rpc.mangata.online"
UI_URL: https://app.mangata.finance/
TEST_SUDO_NAME: ${{ secrets.DEV_SUDO_NAME }}
MNEMONIC_POLK: ${{ secrets.MNEMONIC_PROD_POLK }}
TEST_SCRIPT: "test-ui"
NODE_ENV: test
SELENIUM_REMOTE_URL: http://localhost:4444/wd/hub
steps:
- name: Start Selenoid Server
uses: Xotabu4/selenoid-github-action@v2
with:
selenoid-start-arguments: |
--args "-timeout 300s" --browsers 'chrome:110.0;chrome:112.0;chrome:114.0'
- uses: actions/checkout@v3
with:
ref: ci/mangata-tests-fe-branch
- uses: actions/setup-node@v3
with:
node-version: 18
cache: yarn
- name: Install testmo
run: yarn global add @testmo/testmo-cli
- name: Install dependencies with Yarn
run: yarn
- name: Tsc code quality check
run: yarn tsc-lint
- name: ESLint code quality check
run: yarn eslint
- name: installed packages
run: yarn list
- name: is selenoid started?
run: curl http://localhost:4444/status
- name: Run tests
run: yarn test-microapps-prod-${{ matrix.command }}
- name: Test Report
uses: dorny/test-reporter@v1
if: success() || failure() # run this step even if previous step failed
with:
name: JEST UI Tests ${{ matrix.command }} # Name of the check run which will be created
path: reports/*.xml # Path to test results
reporter: jest-junit # Format of test results
- name: Install testmo
run: yarn global add @testmo/testmo-cli
- name: Submit results to the testmo-run
if: always()
run: |
testmo automation:run:submit-thread \
--instance https://mangata-finance.testmo.net \
--run-id ${{needs.setup-report.outputs.testmo-run-id}} \
--results reports/*.xml
env:
TESTMO_URL: ${{ secrets.TESTMO_URL }}
TESTMO_TOKEN: ${{ secrets.TESTMO_TOKEN }}
continue-on-error: true
- name: Sleep for 5 seconds
run: sleep 10s #close buffers of videos.
- name: Copy video files to reports folder
if: success() || failure()
run: "cp ~/.aerokube/selenoid/* -r reports/artifacts/"
- name: Create reports zip
uses: vimtor/action-zip@v1
if: success() || failure()
with:
files: reports/
dest: reports.zip
- name: Archive report files
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: ReportData ${{ matrix.command }}
path: reports.zip
- name: Archive report files
uses: actions/upload-artifact@v4
if: success() || failure()
with:
name: TestReport ${{ matrix.command }}
path: reports/html-report/report.html
test-complete:
needs: [setup-report, e2e-tm]
if: always()
runs-on: ubuntu-latest
steps:
- name: Install testmo
run: yarn global add @testmo/testmo-cli
- name: Complete test run
run: |
npx testmo automation:run:complete \
--instance https://mangata-finance.testmo.net \
--run-id ${{needs.setup-report.outputs.testmo-run-id}} \
env:
TESTMO_URL: ${{ secrets.TESTMO_URL }}
TESTMO_TOKEN: ${{ secrets.TESTMO_TOKEN }}
continue-on-error: true
slack-notify-ok:
needs: [e2e-tm, setup-report]
if: success()
runs-on: ubuntu-latest
steps:
- name: Slack Notification - OK
if: success()
uses: bryannice/[email protected]
env:
SLACK_INCOMING_WEBHOOK: ${{ secrets.STG_SLACK_WEBHOOK }}
SLACK_TITLE: "PROD Microapps smoke UI tests - results - OK"
SLACK_COLOR: "#00ff11"
SLACK_MESSAGE: "Test succeed in [ ${{ env.TEST_SCRIPT }} ]
testmo report: https://mangata-finance.testmo.net/automation/runs/view/${{needs.setup-report.outputs.testmo-run-id}}"
GITHUB_REF: "https://mangata-finance.github.io/mangata-e2e/${{ github.run_number }}"
slack-notify-nook:
needs: [e2e-tm]
if: failure()
runs-on: ubuntu-latest
steps:
- name: Slack Notification - Error
uses: bryannice/[email protected]
env:
SLACK_INCOMING_WEBHOOK: ${{ secrets.STG_SLACK_WEBHOOK }}
SLACK_TITLE: "PROD Microapps smoke UI tests - results - NOOK"
SLACK_COLOR: "#ff0011"
SLACK_MESSAGE: "Test failures [ ${{ env.TEST_SCRIPT }} ]
testmo report: https://mangata-finance.testmo.net/automation/runs/view/${{needs.setup-report.outputs.testmo-run-id}}"
GITHUB_REF: "https://mangata-finance.github.io/mangata-e2e/${{ github.run_number }}"