fix: resolve ONNX CUDA fallback, Docker e2e infrastructure, and all test failures

- Add safe_onnx_session() to gpu.py with graceful CUDA EP → CPU fallback
- Replace bare ort.InferenceSession() calls across colorize, restore, inpaint, remove_bg
- Add libcublas-12-6 to production Dockerfile for ONNX Runtime CUDA EP
- Add skipIfFeatureNotInstalled guards to remove-bg, blur-faces, smart-crop, ocr, noise-removal e2e specs
- Add AI tool install prompt detection in tools-all.spec.ts
- Add smart-crop to PYTHON_SIDECAR_TOOLS so frontend shows install prompt correctly
- Create Dockerfile.test.dockerignore to include tests/ in test image builds
- Add libheif-examples and exiftool to Dockerfile.test for HEIC and metadata tests
- Regenerate visual regression baselines for Docker/Linux and skip on non-Docker platforms
This commit is contained in:
ashim-hq
2026-04-20 20:53:54 +08:00
parent f67a03bb36
commit 37277e5c09
23 changed files with 203 additions and 94 deletions
+18 -9
View File
@@ -15,8 +15,17 @@ async function uploadFile(page: import("@playwright/test").Page, filePath: strin
}
test.describe("Smart Crop tool", () => {
test("page loads with correct UI controls", async ({ loggedInPage: page }) => {
async function skipIfFeatureNotInstalled(page: import("@playwright/test").Page) {
await page.goto("/smart-crop");
try {
await page.getByTestId("smart-crop-submit").waitFor({ state: "visible", timeout: 15_000 });
} catch {
test.skip(true, "face-detection feature bundle not installed");
}
}
test("page loads with correct UI controls", async ({ loggedInPage: page }) => {
await skipIfFeatureNotInstalled(page);
// Mode tabs
await expect(page.getByRole("button", { name: "Subject Focus" })).toBeVisible();
@@ -28,20 +37,20 @@ test.describe("Smart Crop tool", () => {
});
test("submit button disabled without file", async ({ loggedInPage: page }) => {
await page.goto("/smart-crop");
await skipIfFeatureNotInstalled(page);
await expect(page.getByTestId("smart-crop-submit")).toBeDisabled();
});
test("submit button enables after file upload", async ({ loggedInPage: page }) => {
await page.goto("/smart-crop");
await skipIfFeatureNotInstalled(page);
await uploadFile(page, fixturePath("test-200x150.png"));
await expect(page.getByTestId("smart-crop-submit")).toBeEnabled();
});
test("subject mode shows strategy and padding controls", async ({ loggedInPage: page }) => {
await page.goto("/smart-crop");
await skipIfFeatureNotInstalled(page);
// Subject Focus is default
await expect(page.getByText("Detection Strategy")).toBeVisible();
@@ -53,7 +62,7 @@ test.describe("Smart Crop tool", () => {
});
test("face mode shows framing and sensitivity controls", async ({ loggedInPage: page }) => {
await page.goto("/smart-crop");
await skipIfFeatureNotInstalled(page);
await page.getByRole("button", { name: "Face Focus" }).click();
@@ -63,7 +72,7 @@ test.describe("Smart Crop tool", () => {
});
test("trim mode shows tolerance controls", async ({ loggedInPage: page }) => {
await page.goto("/smart-crop");
await skipIfFeatureNotInstalled(page);
await page.getByRole("button", { name: "Auto Trim" }).click();
@@ -72,7 +81,7 @@ test.describe("Smart Crop tool", () => {
});
test("aspect ratio presets update dimensions", async ({ loggedInPage: page }) => {
await page.goto("/smart-crop");
await skipIfFeatureNotInstalled(page);
// Click 16:9 preset
await page.getByRole("button", { name: "16:9" }).click();
@@ -91,7 +100,7 @@ test.describe("Smart Crop tool", () => {
});
test("JPG - subject focus crops and shows result", async ({ loggedInPage: page }) => {
await page.goto("/smart-crop");
await skipIfFeatureNotInstalled(page);
await uploadFile(page, fixturePath("test-100x100.jpg"));
// Use default subject mode with attention strategy
@@ -107,7 +116,7 @@ test.describe("Smart Crop tool", () => {
});
test("HEIC input processes without error", async ({ loggedInPage: page }) => {
await page.goto("/smart-crop");
await skipIfFeatureNotInstalled(page);
await uploadFile(page, fixturePath("test-200x150.heic"));
await page.getByTestId("smart-crop-submit").click();