32 lines
927 B
TypeScript
32 lines
927 B
TypeScript
/**
|
|
* DreamiExplore 页面对象
|
|
* 封装 DreamiExplore 相关的操作
|
|
*/
|
|
|
|
import { Page, expect } from '@playwright/test';
|
|
import { BasePage } from './BasePage';
|
|
|
|
export class DreamiExplorePage extends BasePage {
|
|
constructor(page: Page) {
|
|
super(page);
|
|
}
|
|
|
|
/**
|
|
* 进入 DreamiExplore
|
|
*/
|
|
async enterDreamiExplore(): Promise<void> {
|
|
await this.page.getByRole('link').filter({ hasText: 'DreamiExplore Everything' }).click();
|
|
await expect(this.page.getByRole('heading', { name: 'Hello, Admin' })).toBeVisible();
|
|
}
|
|
|
|
/**
|
|
* 测试聊天功能
|
|
*/
|
|
async testChatFunction(message: string = 'hello'): Promise<void> {
|
|
await this.page.getByRole('textbox').click();
|
|
await this.page.getByRole('textbox').fill(message);
|
|
await this.page.getByRole('button', { name: 'send' }).click();
|
|
await expect(this.page.getByRole('button', { name: '复制' })).toBeVisible({ timeout: 10000 });
|
|
}
|
|
}
|