Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ jobs:
- uses: browser-actions/setup-firefox@latest
- run: cargo test --workspace


fmt:
if: github.event.pull_request.draft == false
name: Rustfmt
Expand Down
67 changes: 67 additions & 0 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Playwright Tests

on:
push:
branches:
- main
paths:
- /**
- preview/**/*.rs
- preview/**/Cargo.toml
- primitives/**/*.rs
- primitives/**/Cargo.toml
- .github/**
- Cargo.toml

pull_request:
types: [opened, synchronize, reopened, ready_for_review]
branches:
- main
paths:
- /**
- preview/**/*.rs
- preview/**/Cargo.toml
- primitives/**/*.rs
- primitives/**/Cargo.toml
- .github/**
- Cargo.toml

concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
test:
if: github.event.pull_request.draft == false
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
# Do our best to cache the toolchain and node install steps
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install Rust
uses: dtolnay/[email protected]
with:
targets: x86_64-unknown-linux-gnu,wasm32-unknown-unknown
- uses: Swatinem/rust-cache@v2
with:
cache-all-crates: "true"
cache-on-failure: "true"
- name: Clear base path
run: rm -f preview/Dioxus.toml
- name: Install dx
run: cargo install [email protected]
- name: Install dependencies
run: cd ./playwright && npm ci
- name: Install Playwright Browsers
run: cd ./playwright && npx playwright install --with-deps
- name: Run Playwright tests
run: cd ./playwright && npx playwright test
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-report
path: playwright-report/
retention-days: 30
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
target

**/.claude/settings.local.json
node_modules

# Playwright
/test-results/
/playwright/playwright-report/
/playwright/test-results/
/blob-report/
/playwright/.cache/
216 changes: 216 additions & 0 deletions playwright/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions playwright/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"devDependencies": {
"@axe-core/playwright": "^4.10.2",
"@playwright/test": "^1.53.0",
"axe-playwright": "^2.1.0",
"playwright": "^1.53.0"
}
}
76 changes: 76 additions & 0 deletions playwright/playwright.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
import { defineConfig, devices } from "@playwright/test";
const path = require("path");

/**
* Read environment variables from file.
* https://github.com/motdotla/dotenv
*/
// import dotenv from 'dotenv';
// import path from 'path';
// dotenv.config({ path: path.resolve(__dirname, '.env') });

/**
* See https://playwright.dev/docs/test-configuration.
*/
export default defineConfig({
testDir: ".",
/* Run tests in files in parallel */
fullyParallel: true,
/* Fail the build on CI if you accidentally left test.only in the source code. */
forbidOnly: !!process.env.CI,
/* Retry on CI only */
retries: process.env.CI ? 2 : 0,
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 1 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: "html",
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
// baseURL: 'http://localhost:3000',

/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: "on-first-retry",
},

// Each test is given 20 minutes.
timeout: 20 * 60 * 1000,

/* Configure projects for major browsers */
projects: [
{
name: "chromium",
use: { ...devices["Desktop Chrome"] },
},

{
name: "firefox",
use: { ...devices["Desktop Firefox"] },
},

{
name: "webkit",
use: { ...devices["Desktop Safari"] },
},

/* Test against mobile viewports. */
{
name: "Mobile Chrome",
use: { ...devices["Pixel 5"] },
},
{
name: "Mobile Safari",
use: { ...devices["iPhone 12"] },
},
],

/* Run your local dev server before starting the tests */
webServer: {
cwd: path.join(process.cwd(), "../preview"),
command: "dx serve --platform web",
port: 8080,
timeout: 50 * 60 * 1000,
reuseExistingServer: !process.env.CI,
stdout: "pipe",
},
});
Loading
Loading