chore(e2e-test): fix snapshot pixel ratio + try to reuse cargo build to reduce cpu consumption
This commit is contained in:
@@ -16,29 +16,41 @@ jobs:
|
|||||||
test:
|
test:
|
||||||
timeout-minutes: 60
|
timeout-minutes: 60
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
working-directory: tests/e2e
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Install Rust toolchain
|
- name: Install Rust toolchain
|
||||||
uses: dtolnay/rust-toolchain@stable
|
uses: dtolnay/rust-toolchain@stable
|
||||||
|
|
||||||
- name: Cache Rust build
|
- name: Cache compiled binary
|
||||||
|
id: binary-cache
|
||||||
|
uses: actions/cache@v4
|
||||||
|
with:
|
||||||
|
path: ${{ github.workspace }}/target/debug/oxicloud
|
||||||
|
key: ${{ runner.os }}-oxicloud-binary-${{ hashFiles('src/**', 'Cargo.toml', 'Cargo.lock') }}
|
||||||
|
|
||||||
|
- name: Cache Rust dependencies
|
||||||
|
if: steps.binary-cache.outputs.cache-hit != 'true'
|
||||||
uses: Swatinem/rust-cache@v2
|
uses: Swatinem/rust-cache@v2
|
||||||
|
|
||||||
|
- name: Build server
|
||||||
|
if: steps.binary-cache.outputs.cache-hit != 'true'
|
||||||
|
run: cargo build
|
||||||
|
|
||||||
- uses: actions/setup-node@v4
|
- uses: actions/setup-node@v4
|
||||||
with:
|
with:
|
||||||
node-version: lts/*
|
node-version: lts/*
|
||||||
|
|
||||||
- name: Install Node dependencies
|
- name: Install Node dependencies
|
||||||
|
working-directory: tests/e2e
|
||||||
run: npm ci
|
run: npm ci
|
||||||
|
|
||||||
- name: Install Playwright browsers
|
- name: Install Playwright browsers
|
||||||
|
working-directory: tests/e2e
|
||||||
run: npx playwright install --with-deps
|
run: npx playwright install --with-deps
|
||||||
|
|
||||||
- name: Run Playwright tests (spawns DB via pretest hook)
|
- name: Run Playwright tests (spawns DB via pretest hook)
|
||||||
|
working-directory: tests/e2e
|
||||||
run: npm test
|
run: npm test
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v4
|
- uses: actions/upload-artifact@v4
|
||||||
|
|||||||
@@ -13,6 +13,9 @@ export default defineConfig({
|
|||||||
use: {
|
use: {
|
||||||
baseURL: 'http://localhost:8087',
|
baseURL: 'http://localhost:8087',
|
||||||
trace: 'on-first-retry',
|
trace: 'on-first-retry',
|
||||||
|
},
|
||||||
|
|
||||||
|
expect: {
|
||||||
toHaveScreenshot: { maxDiffPixelRatio: 0.02 },
|
toHaveScreenshot: { maxDiffPixelRatio: 0.02 },
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -28,7 +31,7 @@ export default defineConfig({
|
|||||||
],
|
],
|
||||||
|
|
||||||
webServer: {
|
webServer: {
|
||||||
command: 'cargo run',
|
command: process.env.CI ? `${process.env.GITHUB_WORKSPACE}/target/debug/oxicloud` : 'cargo run',
|
||||||
url: 'http://localhost:8087',
|
url: 'http://localhost:8087',
|
||||||
timeout: 600_000,
|
timeout: 600_000,
|
||||||
reuseExistingServer: false,
|
reuseExistingServer: false,
|
||||||
|
|||||||
Reference in New Issue
Block a user