diff --git a/.github/workflows/test-client.yml b/.github/workflows/test-client.yml index 6373bc8801a..37a3db2e357 100644 --- a/.github/workflows/test-client.yml +++ b/.github/workflows/test-client.yml @@ -159,3 +159,49 @@ jobs: - name: Mithril Stake Distribution / download & restore latest shell: bash run: ${{ steps.command.outputs.mithril_client }} ${{ steps.prepare.outputs.debug_level }} mithril-stake-distribution download $MITHRIL_STAKE_DISTRIBUTION_HASH --download-dir /app + + test-mithril-client-wasm: + strategy: + fail-fast: false + matrix: + os: [ ubuntu-22.04 ] + runs-on: ${{ matrix.os }} + steps: + - name: Checkout sources + uses: actions/checkout@v3 + + - name: Download built artifacts + uses: dawidd6/action-download-artifact@v2 + with: + name: mithril-distribution-wasm + path: ./mithril-client-wasm + commit: ${{ steps.prepare.outputs.sha }} + branch: ${{ steps.prepare.outputs.branch }} + workflow: ci.yml + workflow_conclusion: success + + - name: Unpack 'mithril-client-wasm' package + working-directory: mithril-client-wasm + run: tar -xvzf pkg/*.tgz -C pkg/ && mv pkg/package/* pkg/ + + - name: Install dependencies + working-directory: mithril-client-wasm + run: make www-test-install + + - name: Create .env file + working-directory: mithril-client-wasm + run: | + echo "AGGREGATOR_ENDPOINT=${{ inputs.aggregator_endpoint }}" > ./www-test/.env + echo "GENESIS_VERIFICATION_KEY=$(curl -s ${{ inputs.genesis_verification_key }})" >> ./www-test/.env + + - name: Start the server and run Chrome headless + working-directory: mithril-client-wasm + shell: bash + run: | + make www-test-serve & + if /usr/bin/google-chrome --headless --virtual-time-budget=200000 --timeout=200000 --dump-dom http://localhost:8080 | grep -q 'title="FAILED"'; then + echo "Mithril client wasm tests failed." + exit 1 + else + echo "Success." + fi