文件
chen 301194963b
一些检查失败了
automerge / automerge (push) Has been cancelled
react-native-android-build-apk / AssembleRelease (push) Has been cancelled
Build macOS M1 / Main (push) Has been cancelled
Joplin Continuous Integration / Main (macos-15-intel) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-11-vs2026-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-2025) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04-arm) (push) Has been cancelled
Joplin UI tests / Main (ubuntu-22.04) (push) Has been cancelled
Joplin UI tests / Main (windows-2025) (push) Has been cancelled
Joplin UI tests / Mobile (push) Has been cancelled
Close stale issues / ProcessStaleIssues (push) Has been cancelled
feat: Initial clean release of CHM
2026-11-04 11:29:39 +08:00

41 行
1.5 KiB
TypeScript

import { ElectronApplication, Locator, Page } from '@playwright/test';
import setSettingValue from '../util/setSettingValue';
import MainScreen from './MainScreen';
import { expect } from '../util/test';
export default class ChatPanel {
public readonly container: Locator;
public readonly textInput: Locator;
public constructor(private page_: Page, private mainScreen_: MainScreen) {
this.container = page_.getByRole('region', { name: 'AI Chat' });
this.textInput = page_.getByRole('textbox', { name: 'Chat message' });
}
public async configure(electronApp: ElectronApplication) {
await setSettingValue(electronApp, this.page_, 'ai.enabled', true);
await setSettingValue(electronApp, this.page_, 'ai.allowRemote', true);
await setSettingValue(electronApp, this.page_, 'ai.chat.providerType', 'test-provider');
}
public async open(electronApp: ElectronApplication) {
await this.mainScreen_.goToAnything.runCommand(electronApp, 'toggleAiChat');
await this.container.waitFor();
}
public async close(electronApp: ElectronApplication) {
await this.container.waitFor();
await this.mainScreen_.goToAnything.runCommand(electronApp, 'toggleAiChat');
await expect(this.container).not.toBeVisible();
}
public async sendMessage(message: string) {
await this.textInput.fill(message);
await this.textInput.press('Enter');
}
public async waitForMessageCount(count: number) {
await expect(this.container.locator('.chat-message.turn')).toHaveCount(count);
}
}