mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 12:55:00 +00:00
@@ -201,7 +201,7 @@ export class ChatPanelUtils {
|
||||
public static async chatWithDoc(page: Page, docName: string) {
|
||||
const withButton = page.getByTestId('chat-panel-with-button');
|
||||
await withButton.hover();
|
||||
await withButton.click();
|
||||
await withButton.click({ delay: 200 });
|
||||
const withMenu = page.getByTestId('ai-add-popover');
|
||||
await withMenu.waitFor({ state: 'visible' });
|
||||
await withMenu.getByText(docName).click();
|
||||
@@ -221,7 +221,7 @@ export class ChatPanelUtils {
|
||||
const fileChooserPromise = page.waitForEvent('filechooser');
|
||||
const withButton = page.getByTestId('chat-panel-with-button');
|
||||
await withButton.hover();
|
||||
await withButton.click();
|
||||
await withButton.click({ delay: 200 });
|
||||
const withMenu = page.getByTestId('ai-add-popover');
|
||||
await withMenu.waitFor({ state: 'visible' });
|
||||
await withMenu.getByTestId('ai-chat-with-files').click();
|
||||
@@ -282,7 +282,7 @@ export class ChatPanelUtils {
|
||||
for (const tag of tags) {
|
||||
const withButton = page.getByTestId('chat-panel-with-button');
|
||||
await withButton.hover();
|
||||
await withButton.click();
|
||||
await withButton.click({ delay: 200 });
|
||||
const withMenu = page.getByTestId('ai-add-popover');
|
||||
await withMenu.waitFor({ state: 'visible' });
|
||||
await withMenu.getByTestId('ai-chat-with-tags').click();
|
||||
@@ -299,7 +299,7 @@ export class ChatPanelUtils {
|
||||
for (const collection of collections) {
|
||||
const withButton = page.getByTestId('chat-panel-with-button');
|
||||
await withButton.hover();
|
||||
await withButton.click();
|
||||
await withButton.click({ delay: 200 });
|
||||
const withMenu = page.getByTestId('ai-add-popover');
|
||||
await withMenu.waitFor({ state: 'visible' });
|
||||
await withMenu.getByTestId('ai-chat-with-collections').click();
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import { skipOnboarding } from '@affine-test/kit/playwright';
|
||||
import { createRandomAIUser } from '@affine-test/kit/utils/cloud';
|
||||
import {
|
||||
createRandomAIUser,
|
||||
switchDefaultChatModel,
|
||||
} from '@affine-test/kit/utils/cloud';
|
||||
import { openHomePage, setCoreUrl } from '@affine-test/kit/utils/load-page';
|
||||
import {
|
||||
clickNewPageButton,
|
||||
@@ -58,7 +61,12 @@ export class TestUtils {
|
||||
await waitForEditorLoad(page);
|
||||
}
|
||||
|
||||
public async setupTestEnvironment(page: Page) {
|
||||
public async setupTestEnvironment(
|
||||
page: Page,
|
||||
defaultModel = 'gemini-2.5-flash'
|
||||
) {
|
||||
await switchDefaultChatModel(defaultModel);
|
||||
|
||||
await skipOnboarding(page.context());
|
||||
await openHomePage(page);
|
||||
await this.createNewPage(page);
|
||||
|
||||
Reference in New Issue
Block a user