mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-13 12:55:00 +00:00
test(core): chat with collection & tags (#11388)
### TL:DR * AI chat with collection E2E * AI chat with tag E2E > Close BS-3007
This commit is contained in:
@@ -225,7 +225,6 @@ export class ChatPanelUtils {
|
||||
await expect(states.every(state => state === 'finished')).toBe(true);
|
||||
}).toPass({ timeout: 20000 });
|
||||
|
||||
await page.pause();
|
||||
await this.makeChat(page, text);
|
||||
}
|
||||
|
||||
@@ -249,6 +248,39 @@ export class ChatPanelUtils {
|
||||
await this.makeChat(page, text);
|
||||
}
|
||||
|
||||
public static async chatWithTags(page: Page, tags: string[]) {
|
||||
for (const tag of tags) {
|
||||
const withButton = await page.getByTestId('chat-panel-with-button');
|
||||
await withButton.click();
|
||||
const withMenu = await page.getByTestId('ai-add-popover');
|
||||
await withMenu.getByTestId('ai-chat-with-tags').click();
|
||||
await withMenu.getByText(tag).click();
|
||||
await page.getByTestId('chat-panel-chips').getByText(tag);
|
||||
}
|
||||
await this.waitForEmbeddingProgress(page);
|
||||
}
|
||||
|
||||
public static async chatWithCollections(page: Page, collections: string[]) {
|
||||
for (const collection of collections) {
|
||||
const withButton = await page.getByTestId('chat-panel-with-button');
|
||||
await withButton.click();
|
||||
const withMenu = await page.getByTestId('ai-add-popover');
|
||||
await withMenu.getByTestId('ai-chat-with-collections').click();
|
||||
await withMenu.getByText(collection).click();
|
||||
await page.getByTestId('chat-panel-chips').getByText(collection);
|
||||
}
|
||||
await this.waitForEmbeddingProgress(page);
|
||||
}
|
||||
|
||||
public static async waitForEmbeddingProgress(page: Page) {
|
||||
await page.getByTestId('chat-panel-embedding-progress').waitFor({
|
||||
state: 'visible',
|
||||
});
|
||||
await page.getByTestId('chat-panel-embedding-progress').waitFor({
|
||||
state: 'hidden',
|
||||
});
|
||||
}
|
||||
|
||||
public static async enableNetworkSearch(page: Page) {
|
||||
const networkSearch = await page.getByTestId('chat-network-search');
|
||||
if ((await networkSearch.getAttribute('data-active')) === 'false') {
|
||||
|
||||
Reference in New Issue
Block a user