Skip to content

Commit 1ac6826

Browse files
committed
test: more test fixes
1 parent 5c15f17 commit 1ac6826

6 files changed

Lines changed: 46 additions & 50 deletions

File tree

.github/workflows/ui-tests.yml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,6 @@ jobs:
2828
target
2929
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
3030

31-
- name: Build Rust application
32-
run: |
33-
cargo build --release
34-
make css
35-
3631
- name: Setup Node.js
3732
uses: actions/setup-node@v4
3833
with:
@@ -42,6 +37,11 @@ jobs:
4237
- name: Install dependencies
4338
run: npm ci
4439

40+
- name: Build Rust application
41+
run: |
42+
cargo build --release
43+
make css
44+
4545
- name: Install Playwright Browsers
4646
run: npx playwright install --with-deps
4747

@@ -95,11 +95,6 @@ jobs:
9595
target
9696
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
9797

98-
- name: Build Rust application
99-
run: |
100-
cargo build --release
101-
make css
102-
10398
- name: Setup Node.js
10499
uses: actions/setup-node@v4
105100
with:
@@ -109,6 +104,11 @@ jobs:
109104
- name: Install dependencies
110105
run: npm ci
111106

107+
- name: Build Rust application
108+
run: |
109+
cargo build --release
110+
make css
111+
112112
- name: Install Playwright Browsers
113113
run: npx playwright install --with-deps ${{ matrix.browser }}
114114

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ release: css
1313
cargo build --release
1414

1515
dev_server: css
16-
cargo run -- server ./seed
16+
cargo run -- server ./seed --port 9080
1717

1818
dev: css-watch
1919
cargo run -- server ./seed

playwright.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ export default defineConfig({
9797

9898
/* Run your local dev server before starting the tests */
9999
webServer: {
100-
command: 'make dev_server',
100+
command: 'npm run build-css && cargo run -- server ./seed --port 9080',
101101
url: 'http://localhost:9080',
102102
reuseExistingServer: !process.env.CI,
103103
timeout: 120 * 1000,

seed/config/pantry.conf

Lines changed: 22 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,28 @@
1-
# Pantry configuration file
2-
31
[fridge]
4-
milk = { expire = "2025-09-20", quantity = "500%ml" }
5-
butter = { expire = "2025-10-01", quantity = "250%g" }
6-
eggs = { expire = "2025-09-18", quantity = "6" }
7-
cheese = { expire = "2025-09-25", quantity = "200%g" }
8-
yogurt = { expire = "2025-09-17", quantity = "150%g" }
9-
lemon = { expire = "2025-09-22", quantity = "2" }
2+
cheese = "200%g"
3+
eggs = "6"
4+
lemon = "2"
5+
milk = "500%ml"
6+
yogurt = "150%g"
107

118
[pantry]
12-
flour = { quantity = "400%g", low = "500%g" }
13-
sugar = { quantity = "1%kg", low = "2%kg" }
14-
"olive oil" = { quantity = "750%ml", low = "250%ml" }
15-
pasta = { quantity = "500%g", low = "200%g" }
16-
rice = { quantity = "1%kg", low = "300%kg" }
17-
salt = { quantity = "500%g", low = "100%g" }
18-
"black pepper" = { quantity = "50%g", low = "20%g" }
19-
garlic = { quantity = "5", low = "10" }
20-
onion = { quantity = "3", low = "5" }
21-
tomato = { expire = "2025-09-19", quantity = "4", low = "2" }
22-
"vegetable oil" = { quantity = "1%L", low = "500%ml" }
23-
"baking powder" = { quantity = "100%g", low = "50%g" }
24-
25-
[freezer]
26-
"chicken breast" = { bought = "2025-09-10", expire = "2025-10-10", quantity = "1%kg" }
27-
"ground beef" = { bought = "2025-09-05", expire = "2025-10-05", quantity = "500%g" }
28-
"frozen peas" = { expire = "2026-03-01", quantity = "300%g" }
29-
"ice cream" = { expire = "2025-12-01", quantity = "1%L" }
9+
"baking powder" = "100%g"
10+
"black pepper" = "50%g"
11+
flour = "400%g"
12+
garlic = "5"
13+
"olive oil" = "750%ml"
14+
onion = "3"
15+
pasta = "500%g"
16+
rice = "1%kg"
17+
salt = "500%g"
18+
sugar = "1%kg"
19+
tomato = "4"
20+
"vegetable oil" = "1%L"
3021

3122
[spices]
32-
oregano = { quantity = "20%g" }
33-
thyme = { quantity = "15%g" }
34-
basil = { quantity = "25%g" }
35-
paprika = { quantity = "30%g" }
36-
cumin = { quantity = "40%g" }
23+
basil = "25%g"
24+
cumin = "40%g"
25+
oregano = "20%g"
26+
paprika = "30%g"
27+
thyme = "15%g"
3728

38-
[depleted]
39-
# Items that are running low or out
40-
"soy sauce" = { quantity = "50%ml", low = "100%ml" }
41-
vinegar = { quantity = "80%ml", low = "200%ml" }
42-
honey = { quantity = "0", low = "1" }
43-
mustard = { quantity = "0", low = "1" }

tests/snapshot_test.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,11 @@ fn test_search_output() {
256256
lines.sort();
257257
let sorted = lines.join("\n");
258258

259-
assert_snapshot!(sorted);
259+
// Use platform-specific snapshots
260+
#[cfg(target_os = "windows")]
261+
assert_snapshot!("search_output_windows", sorted);
262+
#[cfg(not(target_os = "windows"))]
263+
assert_snapshot!("search_output", sorted);
260264
}
261265

262266
#[test]
@@ -297,8 +301,10 @@ fn test_help_output() {
297301
let stdout = String::from_utf8(output.stdout).unwrap();
298302

299303
// Filter version numbers for stable snapshots
304+
// On Windows, the executable name is cook.exe, normalize it to cook
300305
with_settings!({filters => vec![
301306
(r"cookcli \d+\.\d+\.\d+", "cookcli [VERSION]"),
307+
(r"Usage: cook\.exe", "Usage: cook"), // Normalize Windows executable name in usage line
302308
]}, {
303309
assert_snapshot!(stdout);
304310
});
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
source: tests/snapshot_test.rs
3+
expression: sorted
4+
---
5+
"Breakfast\pancakes.cook"

0 commit comments

Comments
 (0)