Skip to content

Commit 5dada39

Browse files
chore(e2e-test): fix snapshot pixel ratio + try to reuse cargo build to reduce cpu consumption
1 parent 379d33a commit 5dada39

2 files changed

Lines changed: 18 additions & 2 deletions

File tree

.github/workflows/playwright.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,22 @@ jobs:
2525
- name: Install Rust toolchain
2626
uses: dtolnay/rust-toolchain@stable
2727

28-
- name: Cache Rust build
28+
- name: Cache compiled binary
29+
id: binary-cache
30+
uses: actions/cache@v4
31+
with:
32+
path: ${{ github.workspace }}/target/debug/oxicloud
33+
key: ${{ runner.os }}-oxicloud-binary-${{ hashFiles('src/**', 'Cargo.toml', 'Cargo.lock') }}
34+
35+
- name: Cache Rust dependencies
36+
if: steps.binary-cache.outputs.cache-hit != 'true'
2937
uses: Swatinem/rust-cache@v2
3038

39+
- name: Build server
40+
if: steps.binary-cache.outputs.cache-hit != 'true'
41+
run: cargo build
42+
working-directory: ${{ github.workspace }}
43+
3144
- uses: actions/setup-node@v4
3245
with:
3346
node-version: lts/*

tests/e2e/playwright.config.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ export default defineConfig({
1313
use: {
1414
baseURL: 'http://localhost:8087',
1515
trace: 'on-first-retry',
16+
},
17+
18+
expect: {
1619
toHaveScreenshot: { maxDiffPixelRatio: 0.02 },
1720
},
1821

@@ -28,7 +31,7 @@ export default defineConfig({
2831
],
2932

3033
webServer: {
31-
command: 'cargo run',
34+
command: process.env.CI ? `${process.env.GITHUB_WORKSPACE}/target/debug/oxicloud` : 'cargo run',
3235
url: 'http://localhost:8087',
3336
timeout: 600_000,
3437
reuseExistingServer: false,

0 commit comments

Comments
 (0)