Simplify to basic UI element tests (no snapshots)

This commit is contained in:
Sami Khan
2026-02-04 07:44:29 +05:00
parent 164f8fb38c
commit c9ff05f012
8 changed files with 18 additions and 57 deletions
+12 -35
View File
@@ -1,49 +1,26 @@
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 }) => {
test.describe("Chat Interface", () => {
test("should display chat input and send button", async ({ page }) => {
await page.goto("/");
await waitForTopologyLoaded(page);
const chatInput = page.locator('[data-testid="chat-input"]');
await expect(chatInput).toBeVisible({ timeout: 10000 });
// Take screenshot of the chat form area
const chatForm = page.locator("form").filter({ has: chatInput });
await expect(chatForm).toHaveScreenshot("chat-input-empty.png");
});
test("chat input with text", async ({ page }) => {
await page.goto("/");
await waitForTopologyLoaded(page);
const chatInput = page.locator('[data-testid="chat-input"]');
await expect(chatInput).toBeVisible({ timeout: 10000 });
// Type some text
await chatInput.fill("This is a test message");
await page.waitForTimeout(200);
const chatForm = page.locator("form").filter({ has: chatInput });
await expect(chatForm).toHaveScreenshot("chat-input-with-text.png");
});
test("send button states", async ({ page }) => {
await page.goto("/");
await waitForTopologyLoaded(page);
const chatInput = page.locator('[data-testid="chat-input"]');
await expect(chatInput).toBeVisible({ timeout: 10000 });
await expect(chatInput).toBeVisible();
const sendButton = page.locator('[data-testid="send-button"]');
await expect(sendButton).toBeVisible();
});
// Empty state - button should be disabled
await expect(sendButton).toHaveScreenshot("send-button-disabled.png");
test("should allow typing in chat input", async ({ page }) => {
await page.goto("/");
await waitForTopologyLoaded(page);
const chatInput = page.locator('[data-testid="chat-input"]');
await expect(chatInput).toBeVisible();
// With text - button should be enabled
await chatInput.fill("Test message");
await page.waitForTimeout(100);
await expect(sendButton).toHaveScreenshot("send-button-enabled.png");
await expect(chatInput).toHaveValue("Test message");
});
});
Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 842 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 839 B

+6 -22
View File
@@ -1,30 +1,14 @@
import { test, expect } from "@playwright/test";
import { waitForTopologyLoaded } from "../helpers/wait-for-ready";
test.describe("Homepage Visual Snapshots", () => {
test("homepage with topology", async ({ page }) => {
test.describe("Homepage", () => {
test("should load and display key elements", async ({ page }) => {
await page.goto("/");
await waitForTopologyLoaded(page);
// Wait for the page to fully render
await page.waitForTimeout(1000);
await expect(page).toHaveScreenshot("homepage.png", {
fullPage: true,
});
});
test("topology graph", async ({ page }) => {
await page.goto("/");
await waitForTopologyLoaded(page);
await page.waitForTimeout(1000);
const topologyGraph = page
.locator('[data-testid="topology-graph"]')
.first();
await expect(topologyGraph).toBeVisible();
await expect(topologyGraph).toHaveScreenshot("topology-graph.png");
// Verify key UI elements are present
await expect(page.locator('[data-testid="topology-graph"]').first()).toBeVisible();
await expect(page.locator('[data-testid="chat-input"]')).toBeVisible();
await expect(page.locator('[data-testid="send-button"]')).toBeVisible();
});
});
Binary file not shown.

Before

Width:  |  Height:  |  Size: 65 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB