test: adds playwright test for svelte project #6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: Setup node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: lts/* | |
- 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" | |
export | |
- uses: actions-rs/toolchain@v1 | |
with: | |
toolchain: stable | |
- uses: actions-rs/cargo@v1 | |
with: | |
command: build | |
args: --release --all-features | |
- name: Build dfx | |
run: cargo build --bin dfx | |
- 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: Deploy default dfx project | |
run: | | |
./target/debug/dfx new e2e_project --frontend sveltekit | |
pushd e2e_project | |
./target/debug/dfx start --background --clean | |
./target/debug/dfx canister create e2e_project_frontend --specified-id br5f7-7uaaa-aaaaa-qaaca-cai | |
./target/debug/dfx deploy | |
popd | |
- name: Install dependencies | |
run: npm ci | |
- name: Install Playwright Browsers | |
run: npx playwright install --with-deps | |
- name: Run Playwright tests | |
run: npx playwright test |