mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
feat: enhance noise removal tool tests and update Docker configurations for GPU support
This commit is contained in:
@@ -180,7 +180,7 @@ export function NoiseRemovalControls({
|
|||||||
|
|
||||||
{/* Quality slider (lossy formats only) */}
|
{/* Quality slider (lossy formats only) */}
|
||||||
{LOSSY_FORMATS.has(outputFormat) && (
|
{LOSSY_FORMATS.has(outputFormat) && (
|
||||||
<div>
|
<div data-testid="quality-slider">
|
||||||
<div className="flex justify-between items-center">
|
<div className="flex justify-between items-center">
|
||||||
<p className="text-sm font-medium text-muted-foreground">Quality</p>
|
<p className="text-sm font-medium text-muted-foreground">Quality</p>
|
||||||
<span className="text-sm font-mono tabular-nums font-medium">{quality}</span>
|
<span className="text-sm font-mono tabular-nums font-medium">{quality}</span>
|
||||||
|
|||||||
@@ -0,0 +1,47 @@
|
|||||||
|
name: ashim
|
||||||
|
|
||||||
|
# NVIDIA GPU version
|
||||||
|
# Usage: docker compose -f docker-compose-gpu.yml up -d
|
||||||
|
# Requires: NVIDIA GPU + nvidia-container-toolkit (Linux/Windows WSL2 only)
|
||||||
|
|
||||||
|
services:
|
||||||
|
ashim:
|
||||||
|
build:
|
||||||
|
context: ..
|
||||||
|
dockerfile: docker/Dockerfile
|
||||||
|
image: ashim:latest
|
||||||
|
container_name: ashim
|
||||||
|
ports:
|
||||||
|
- "1349:1349"
|
||||||
|
volumes:
|
||||||
|
- ashim-data:/data
|
||||||
|
- ashim-workspace:/tmp/workspace
|
||||||
|
environment:
|
||||||
|
- AUTH_ENABLED=true
|
||||||
|
- DEFAULT_USERNAME=admin
|
||||||
|
- DEFAULT_PASSWORD=admin
|
||||||
|
- SKIP_MUST_CHANGE_PASSWORD=${SKIP_MUST_CHANGE_PASSWORD:-false}
|
||||||
|
- RATE_LIMIT_PER_MIN=${RATE_LIMIT_PER_MIN:-100}
|
||||||
|
restart: unless-stopped
|
||||||
|
healthcheck:
|
||||||
|
test: ["CMD", "curl", "-f", "http://localhost:1349/api/v1/health"]
|
||||||
|
interval: 30s
|
||||||
|
timeout: 5s
|
||||||
|
start_period: 60s
|
||||||
|
retries: 3
|
||||||
|
logging:
|
||||||
|
driver: json-file
|
||||||
|
options:
|
||||||
|
max-size: "10m"
|
||||||
|
max-file: "3"
|
||||||
|
deploy:
|
||||||
|
resources:
|
||||||
|
reservations:
|
||||||
|
devices:
|
||||||
|
- driver: nvidia
|
||||||
|
count: all
|
||||||
|
capabilities: [gpu]
|
||||||
|
|
||||||
|
volumes:
|
||||||
|
ashim-data:
|
||||||
|
ashim-workspace:
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
services:
|
|
||||||
ashim:
|
|
||||||
deploy:
|
|
||||||
resources:
|
|
||||||
reservations:
|
|
||||||
devices:
|
|
||||||
- driver: nvidia
|
|
||||||
count: all
|
|
||||||
capabilities: [gpu]
|
|
||||||
@@ -2,8 +2,8 @@ name: ashim
|
|||||||
|
|
||||||
# Usage:
|
# Usage:
|
||||||
# CPU: docker compose up -d
|
# CPU: docker compose up -d
|
||||||
# GPU: docker compose -f docker-compose.yml -f docker-compose.gpu.yml up -d
|
# GPU: docker compose -f docker-compose-gpu.yml up -d
|
||||||
# (requires NVIDIA GPU + nvidia-container-toolkit; not supported on macOS)
|
# (requires NVIDIA GPU + nvidia-container-toolkit; Linux/Windows WSL2 only)
|
||||||
|
|
||||||
services:
|
services:
|
||||||
ashim:
|
ashim:
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ const authFile = path.join(__dirname, "test-results", ".auth", "user.json");
|
|||||||
|
|
||||||
// Point raw-fetch tests (api.spec, security.spec, people.spec, rbac.spec) at
|
// Point raw-fetch tests (api.spec, security.spec, people.spec, rbac.spec) at
|
||||||
// the Docker container instead of the dev-server default (port 13490).
|
// the Docker container instead of the dev-server default (port 13490).
|
||||||
|
// Start the container with: RATE_LIMIT_PER_MIN=50000 SKIP_MUST_CHANGE_PASSWORD=true docker compose -f docker/docker-compose.yml up -d
|
||||||
process.env.API_URL ??= "http://localhost:1349";
|
process.env.API_URL ??= "http://localhost:1349";
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
|
|||||||
@@ -196,8 +196,10 @@ test.describe("Automate Page", () => {
|
|||||||
await expect(page.getByPlaceholder("Pipeline name")).not.toBeVisible({
|
await expect(page.getByPlaceholder("Pipeline name")).not.toBeVisible({
|
||||||
timeout: 5_000,
|
timeout: 5_000,
|
||||||
});
|
});
|
||||||
// The saved pipelines section should be visible
|
// The saved pipeline should appear by name
|
||||||
await expect(page.getByText("SAVED PIPELINES")).toBeVisible();
|
await expect(page.getByText(uniqueName).first()).toBeVisible({
|
||||||
|
timeout: 5_000,
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
// --- Pipeline Execution ---
|
// --- Pipeline Execution ---
|
||||||
|
|||||||
@@ -25,8 +25,17 @@ async function removeNoiseAndWait(page: import("@playwright/test").Page) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
test.describe("Noise Removal tool", () => {
|
test.describe("Noise Removal tool", () => {
|
||||||
test("page loads with correct UI sections", async ({ loggedInPage: page }) => {
|
async function skipIfFeatureNotInstalled(page: import("@playwright/test").Page) {
|
||||||
await page.goto("/noise-removal");
|
await page.goto("/noise-removal");
|
||||||
|
const submit = page.getByTestId("noise-removal-submit");
|
||||||
|
const visible = await submit.isVisible({ timeout: 5_000 }).catch(() => false);
|
||||||
|
if (!visible) {
|
||||||
|
test.skip(true, "upscale-enhance feature bundle not installed");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
test("page loads with correct UI sections", async ({ loggedInPage: page }) => {
|
||||||
|
await skipIfFeatureNotInstalled(page);
|
||||||
|
|
||||||
// Tier buttons
|
// Tier buttons
|
||||||
await expect(page.getByRole("button", { name: "Quick" })).toBeVisible();
|
await expect(page.getByRole("button", { name: "Quick" })).toBeVisible();
|
||||||
@@ -50,26 +59,27 @@ test.describe("Noise Removal tool", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
test("submit button enables after file upload", async ({ loggedInPage: page }) => {
|
test("submit button enables after file upload", async ({ loggedInPage: page }) => {
|
||||||
await page.goto("/noise-removal");
|
await skipIfFeatureNotInstalled(page);
|
||||||
await expect(page.getByTestId("noise-removal-submit")).toBeDisabled();
|
|
||||||
await uploadFile(page, fixturePath("test-200x150.png"));
|
await uploadFile(page, fixturePath("test-200x150.png"));
|
||||||
await expect(page.getByTestId("noise-removal-submit")).toBeEnabled();
|
await expect(page.getByTestId("noise-removal-submit")).toBeEnabled();
|
||||||
});
|
});
|
||||||
|
|
||||||
test("quality slider shows when JPEG or WEBP is selected", async ({ loggedInPage: page }) => {
|
test("quality slider shows when JPEG or WEBP is selected", async ({ loggedInPage: page }) => {
|
||||||
await page.goto("/noise-removal");
|
await skipIfFeatureNotInstalled(page);
|
||||||
|
|
||||||
|
const qualitySlider = page.getByTestId("quality-slider");
|
||||||
|
|
||||||
// Quality slider hidden for original/PNG
|
// Quality slider hidden for original/PNG
|
||||||
await expect(page.getByText("Quality")).not.toBeVisible();
|
await expect(qualitySlider).not.toBeVisible();
|
||||||
|
|
||||||
await page.getByRole("button", { name: "JPEG" }).click();
|
await page.getByRole("button", { name: "JPEG" }).click();
|
||||||
await expect(page.getByText("Quality")).toBeVisible();
|
await expect(qualitySlider).toBeVisible();
|
||||||
|
|
||||||
await page.getByRole("button", { name: "WEBP" }).click();
|
await page.getByRole("button", { name: "WEBP" }).click();
|
||||||
await expect(page.getByText("Quality")).toBeVisible();
|
await expect(qualitySlider).toBeVisible();
|
||||||
|
|
||||||
await page.getByRole("button", { name: "PNG" }).click();
|
await page.getByRole("button", { name: "PNG" }).click();
|
||||||
await expect(page.getByText("Quality")).not.toBeVisible();
|
await expect(qualitySlider).not.toBeVisible();
|
||||||
});
|
});
|
||||||
|
|
||||||
test("GIF + AI tier warning appears and disappears correctly", async ({ loggedInPage: page }) => {
|
test("GIF + AI tier warning appears and disappears correctly", async ({ loggedInPage: page }) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user