Skip to content

test: adds playwright test for svelte project #3

test: adds playwright test for svelte project

test: adds playwright test for svelte project #3

name: Playwright Svelte Tests
on:
push:
branches:
- master
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
# When getting Rust dependencies, retry on network error:
CARGO_NET_RETRY: 10
# Use the local .curlrc
CURL_HOME: .
jobs:
build_dfx:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup environment variables
run: |
echo "RUSTFLAGS=--remap-path-prefix=${GITHUB_WORKSPACE}=/builds/dfinity" >> $GITHUB_ENV
test:
runs-on: ubuntu-latest
needs: [build_dfx]
strategy:
fail-fast: false
env:
E2E_TEST: tests-${{ matrix.test }}.bash
steps:
- uses: actions/checkout@v4
- name: Download dfx binary
uses: actions/download-artifact@v4
with:
name: dfx-ubuntu-latest-rs-${{ hashFiles('rust-toolchain.toml') }}
path: /usr/local/bin
- name: Setup dfx binary
run: chmod +x /usr/local/bin/dfx
- name: Provision Linux
run: bash scripts/workflows/provision-linux.sh || bash scripts/workflows/provision-linux.sh
- name: Prepare environment
run: |
echo "archive=$(pwd)/e2e/archive" >> "$GITHUB_ENV"
echo "assets=$(pwd)/e2e/assets" >> "$GITHUB_ENV"
echo "utils=$(pwd)/e2e/utils" >> "$GITHUB_ENV"
if [ "${{ matrix.backend == 'pocketic' || '' }}" ]; then
echo "USE_POCKETIC=1" >> "$GITHUB_ENV"
fi
export
- name: Download bats-support as a git submodule
run: git submodule update --init --recursive
- name: Cache mops files
uses: actions/cache@v4
with:
path: |
e2e/assets/playground_backend/.mops
key: playground-backend-mops-${{ hashFiles('e2e/assets/playground_backend/mops.toml') }}
- name: Run e2e test
run: timeout 2400 bats "e2e/$E2E_TEST"
ui_test:
runs-on: ubuntu-latest
needs: [ build_dfx]
strategy:
fail-fast: false
steps:
- name: Checking out repo
uses: actions/checkout@v4
- name: Setting up Python
uses: actions/setup-python@v5
with:
python-version: "3.9"
- name: Installing playwright
run: |
pip install playwright==1.40.0
playwright install
playwright install-deps
- name: Download dfx binary
uses: actions/download-artifact@v4
with:
name: dfx-ubuntu-latest-rs-${{ hashFiles('rust-toolchain.toml') }}
path: /usr/local/bin
- name: Setup dfx binary
run: chmod +x /usr/local/bin/dfx
- name: Deploy default dfx project
run: |
dfx new e2e_project
pushd e2e_project
dfx start --background --clean
dfx deploy
popd
- name: Setup node
uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install dependencies
run: npm ci
- name: Install Playwright Browsers
run: npx playwright install --with-deps
- name: Run Playwright tests
run: npx playwright test