Auto-refuel on dispatch; remove manual refueling UI/API/action (ISS-082, v0.42.0)
CI / build + unit + e2e (pull_request) Successful in 17m25s
CI / build + unit + e2e (pull_request) Successful in 17m25s
This commit is contained in:
@@ -93,6 +93,14 @@ async function createPackage(page: Page, fromIcao: string, toIcao: string): Prom
|
||||
return (await created.json()) as PackageState;
|
||||
}
|
||||
|
||||
// Test hook (FLIGHT_TEST_HOOKS=1): top the starter's tank back to full — replaces the removed /refuel
|
||||
// endpoint (ISS-082). Reads maxFuel from the snapshot so no catalog mirror is needed.
|
||||
async function setFuelFull(page: Page, planeId: string): Promise<void> {
|
||||
const s = await getState(page);
|
||||
const p = s.planes.find((x) => x.id === planeId)!;
|
||||
expect((await page.request.post('/api/test/set-fuel', { data: { planeId, fuel: p.maxFuel } })).status()).toBe(200);
|
||||
}
|
||||
|
||||
// Load a package onto plane-starter and fly it from → to via the API, then poll at
|
||||
// scale 1000 until the plane lands at `to`. Same pattern as e2e/actions.spec.ts.
|
||||
async function loadAndFly(page: Page, fromIcao: string, toIcao: string): Promise<PackageState> {
|
||||
@@ -198,10 +206,8 @@ test('plane markers move while flying and the plane popup shows status + route',
|
||||
await loadAndFly(page, starterLoc, HUB);
|
||||
}
|
||||
|
||||
// Full tank before departure — the EDDF↔LEMD round trip burns ~4970 L of the 6300 L tank,
|
||||
// so a partially drained plane left by an earlier spec could not make it home.
|
||||
const refuel = await page.request.post('/api/planes/plane-starter/refuel');
|
||||
expect(refuel.status()).toBe(200);
|
||||
// Full tank before departure — deterministic baseline (ISS-082 hook; dispatch would auto-refuel anyway).
|
||||
await setFuelFull(page, 'plane-starter');
|
||||
|
||||
// 1) Load the hook-created package — a GROUNDED plane draws no route line yet.
|
||||
const pkg = await createPackage(page, HUB, DEST);
|
||||
|
||||
Reference in New Issue
Block a user