-
-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathsidebar.spec.ts
More file actions
30 lines (25 loc) · 1.17 KB
/
sidebar.spec.ts
File metadata and controls
30 lines (25 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
import { test, expect } from '@playwright/test';
test.describe('Sidebar and Chat History', () => {
test.beforeEach(async ({ page }) => {
await page.goto('/');
await page.waitForSelector('[data-testid="chat-input"]');
});
test('should open the history panel', async ({ page }) => {
await page.click('[data-testid="history-button"]');
const historyPanel = page.locator('[data-testid="history-panel"]');
await expect(historyPanel).toBeVisible();
});
test('should clear the chat history', async ({ page }) => {
// First, send a message to create a history item
await page.fill('[data-testid="chat-input"]', 'Create history');
await page.click('[data-testid="chat-submit"]');
await page.waitForSelector('[data-testid^="history-item-"]');
// Now, open the history panel and clear the history
await page.click('[data-testid="history-button"]');
await page.click('[data-testid="clear-history-button"]');
await page.click('[data-testid="clear-history-confirm"]');
// Verify that the history is empty
const historyItem = page.locator('[data-testid^="history-item-"]');
await expect(historyItem).not.toBeVisible();
});
});