remove mock tests

This commit is contained in:
Sami Khan
2026-02-04 01:23:12 +05:00
parent 075c5c545e
commit 8f1ca88e5d
12 changed files with 15 additions and 324 deletions
-172
View File
@@ -1,172 +0,0 @@
{
"emptyState": {
"instances": {},
"runners": {},
"downloads": {},
"tasks": {},
"lastSeen": {},
"topology": {
"nodes": {},
"edges": []
},
"lastEventAppliedIdx": -1,
"nodeIdentities": {},
"nodeMemory": {},
"nodeSystem": {},
"nodeNetwork": {},
"nodeThunderbolt": {},
"nodeThunderboltBridge": {},
"thunderboltBridgeCycles": []
},
"singleNodeState": {
"instances": {},
"runners": {},
"downloads": {},
"tasks": {},
"lastSeen": {
"node-abc123": "2024-01-15T10:30:00Z"
},
"topology": {
"nodes": {
"node-abc123": {
"peerId": "node-abc123",
"friendlyName": "MacBook Pro",
"systemInfo": {
"modelId": "MacBook Pro",
"memory": 34359738368
},
"macmonInfo": {
"memory": {
"ramTotal": 34359738368,
"ramUsage": 17179869184
}
}
}
},
"edges": []
},
"lastEventAppliedIdx": 5,
"nodeIdentities": {
"node-abc123": {
"peerId": "node-abc123",
"friendlyName": "MacBook Pro"
}
},
"nodeMemory": {
"node-abc123": {
"ramTotal": 34359738368,
"ramUsage": 17179869184
}
},
"nodeSystem": {},
"nodeNetwork": {},
"nodeThunderbolt": {},
"nodeThunderboltBridge": {},
"thunderboltBridgeCycles": []
},
"multiNodeState": {
"instances": {},
"runners": {},
"downloads": {},
"tasks": {},
"lastSeen": {
"node-abc123": "2024-01-15T10:30:00Z",
"node-def456": "2024-01-15T10:30:00Z",
"node-ghi789": "2024-01-15T10:30:00Z"
},
"topology": {
"nodes": {
"node-abc123": {
"peerId": "node-abc123",
"friendlyName": "MacBook Pro 1",
"systemInfo": {
"modelId": "MacBook Pro",
"memory": 34359738368
},
"macmonInfo": {
"memory": {
"ramTotal": 34359738368,
"ramUsage": 17179869184
}
}
},
"node-def456": {
"peerId": "node-def456",
"friendlyName": "Mac Studio",
"systemInfo": {
"modelId": "Mac Studio",
"memory": 68719476736
},
"macmonInfo": {
"memory": {
"ramTotal": 68719476736,
"ramUsage": 21474836480
}
}
},
"node-ghi789": {
"peerId": "node-ghi789",
"friendlyName": "Mac Mini",
"systemInfo": {
"modelId": "Mac Mini",
"memory": 17179869184
},
"macmonInfo": {
"memory": {
"ramTotal": 17179869184,
"ramUsage": 8589934592
}
}
}
},
"edges": [
{
"source": "node-abc123",
"target": "node-def456"
},
{
"source": "node-def456",
"target": "node-ghi789"
},
{
"source": "node-ghi789",
"target": "node-abc123"
}
]
},
"lastEventAppliedIdx": 10,
"nodeIdentities": {
"node-abc123": {
"peerId": "node-abc123",
"friendlyName": "MacBook Pro 1"
},
"node-def456": {
"peerId": "node-def456",
"friendlyName": "Mac Studio"
},
"node-ghi789": {
"peerId": "node-ghi789",
"friendlyName": "Mac Mini"
}
},
"nodeMemory": {
"node-abc123": {
"ramTotal": 34359738368,
"ramUsage": 17179869184
},
"node-def456": {
"ramTotal": 68719476736,
"ramUsage": 21474836480
},
"node-ghi789": {
"ramTotal": 17179869184,
"ramUsage": 8589934592
}
},
"nodeSystem": {},
"nodeNetwork": {},
"nodeThunderbolt": {},
"nodeThunderboltBridge": {},
"thunderboltBridgeCycles": []
}
}
+7 -82
View File
@@ -1,20 +1,13 @@
import { test, expect } from "@playwright/test";
import { waitForTopologyLoaded } from "../helpers/wait-for-ready";
test.describe("Chat Interface Visual Snapshots", () => {
test("chat input area", async ({ page }) => {
await page.goto("/");
await page.waitForLoadState("networkidle");
await waitForTopologyLoaded(page);
const chatInput = page.locator('[data-testid="chat-input"]');
const isVisible = await chatInput
.isVisible({ timeout: 10000 })
.catch(() => false);
if (!isVisible) {
// No chat interface available (no running instance)
test.skip();
return;
}
await expect(chatInput).toBeVisible({ timeout: 10000 });
// Take screenshot of the chat form area
const chatForm = page.locator("form").filter({ has: chatInput });
@@ -23,17 +16,10 @@ test.describe("Chat Interface Visual Snapshots", () => {
test("chat input with text", async ({ page }) => {
await page.goto("/");
await page.waitForLoadState("networkidle");
await waitForTopologyLoaded(page);
const chatInput = page.locator('[data-testid="chat-input"]');
const isVisible = await chatInput
.isVisible({ timeout: 10000 })
.catch(() => false);
if (!isVisible) {
test.skip();
return;
}
await expect(chatInput).toBeVisible({ timeout: 10000 });
// Type some text
await chatInput.fill("This is a test message");
@@ -43,73 +29,12 @@ test.describe("Chat Interface Visual Snapshots", () => {
await expect(chatForm).toHaveScreenshot("chat-input-with-text.png");
});
test("empty chat messages area", async ({ page }) => {
await page.goto("/");
await page.waitForLoadState("networkidle");
const chatInput = page.locator('[data-testid="chat-input"]');
const isVisible = await chatInput
.isVisible({ timeout: 10000 })
.catch(() => false);
if (!isVisible) {
test.skip();
return;
}
// Look for the "AWAITING INPUT" text that appears in empty chat
const emptyState = page.locator("text=AWAITING INPUT");
const hasEmptyState = await emptyState.isVisible().catch(() => false);
if (hasEmptyState) {
await expect(page).toHaveScreenshot("chat-empty-state.png", {
fullPage: true,
});
}
});
test("chat with user message", async ({ page }) => {
await page.goto("/");
await page.waitForLoadState("networkidle");
const chatInput = page.locator('[data-testid="chat-input"]');
const isVisible = await chatInput
.isVisible({ timeout: 10000 })
.catch(() => false);
if (!isVisible) {
test.skip();
return;
}
// Send a message
await chatInput.fill("Hello, world!");
await page.locator('[data-testid="send-button"]').click();
// Wait for user message to appear
await expect(page.locator('[data-testid="user-message"]')).toBeVisible({
timeout: 5000,
});
// Take screenshot of the chat area with the user message
await expect(page).toHaveScreenshot("chat-with-user-message.png", {
fullPage: true,
});
});
test("send button states", async ({ page }) => {
await page.goto("/");
await page.waitForLoadState("networkidle");
await waitForTopologyLoaded(page);
const chatInput = page.locator('[data-testid="chat-input"]');
const isVisible = await chatInput
.isVisible({ timeout: 10000 })
.catch(() => false);
if (!isVisible) {
test.skip();
return;
}
await expect(chatInput).toBeVisible({ timeout: 10000 });
const sendButton = page.locator('[data-testid="send-button"]');
Binary file not shown.

Before

Width:  |  Height:  |  Size: 67 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 819 B

After

Width:  |  Height:  |  Size: 842 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 833 B

After

Width:  |  Height:  |  Size: 839 B

+8 -70
View File
@@ -1,83 +1,23 @@
import { test, expect } from "@playwright/test";
import { createRequire } from "module";
const require = createRequire(import.meta.url);
const mockStates = require("../fixtures/mock-state.json");
import { waitForTopologyLoaded } from "../helpers/wait-for-ready";
test.describe("Homepage Visual Snapshots", () => {
test("empty state - no nodes", async ({ page }) => {
// Mock the state API to return empty state
await page.route("**/state", (route) => {
route.fulfill({
status: 200,
contentType: "application/json",
body: JSON.stringify(mockStates.emptyState),
});
});
test("homepage with topology", async ({ page }) => {
await page.goto("/");
await page.waitForLoadState("networkidle");
await waitForTopologyLoaded(page);
// Wait for the page to stabilize
await page.waitForTimeout(500);
await expect(page).toHaveScreenshot("homepage-empty-state.png", {
fullPage: true,
});
});
test("single node connected", async ({ page }) => {
// Mock the state API to return single node state
await page.route("**/state", (route) => {
route.fulfill({
status: 200,
contentType: "application/json",
body: JSON.stringify(mockStates.singleNodeState),
});
});
await page.goto("/");
await page.waitForLoadState("networkidle");
// Wait for the topology to render
// Wait for the page to fully render
await page.waitForTimeout(1000);
await expect(page).toHaveScreenshot("homepage-single-node.png", {
await expect(page).toHaveScreenshot("homepage.png", {
fullPage: true,
});
});
test("multiple nodes in topology", async ({ page }) => {
// Mock the state API to return multi-node state
await page.route("**/state", (route) => {
route.fulfill({
status: 200,
contentType: "application/json",
body: JSON.stringify(mockStates.multiNodeState),
});
});
test("topology graph", async ({ page }) => {
await page.goto("/");
await page.waitForLoadState("networkidle");
await waitForTopologyLoaded(page);
// Wait for the topology to render
await page.waitForTimeout(1000);
await expect(page).toHaveScreenshot("homepage-multi-node.png", {
fullPage: true,
});
});
test("topology graph element", async ({ page }) => {
await page.route("**/state", (route) => {
route.fulfill({
status: 200,
contentType: "application/json",
body: JSON.stringify(mockStates.singleNodeState),
});
});
await page.goto("/");
await page.waitForLoadState("networkidle");
await page.waitForTimeout(1000);
const topologyGraph = page
@@ -85,8 +25,6 @@ test.describe("Homepage Visual Snapshots", () => {
.first();
await expect(topologyGraph).toBeVisible();
await expect(topologyGraph).toHaveScreenshot(
"topology-graph-single-node.png",
);
await expect(topologyGraph).toHaveScreenshot("topology-graph.png");
});
});
Binary file not shown.

After

Width:  |  Height:  |  Size: 90 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB