fix(test): e2e stability (#14749)

#### PR Dependency Tree


* **PR #14749** 👈

This tree was auto-generated by
[Charcoal](https://github.com/danerwilliams/charcoal)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Bug Fixes**
* Improved link preview reliability by updating request identification
to better match modern browsers.
* **Tests**
* Made end-to-end and integration tests deterministic and more robust,
improving AI chat, image generation, attachment handling, settings
visibility, and editor flows.
* **Chores**
* Updated underlying tooling versions to enhance stability and
compatibility.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
DarkSky
2026-03-29 23:26:15 +08:00
committed by GitHub
parent 9ca520a81f
commit 91ad783973
12 changed files with 136 additions and 114 deletions
@@ -6,6 +6,9 @@ const WORKSPACE_EMBEDDING_SWITCH_TEST_ID = 'workspace-embedding-setting-switch';
export class SettingsPanelUtils {
public static async openSettingsPanel(page: Page) {
if (await page.getByTestId('workspace-setting:embedding').isHidden()) {
await page
.getByTestId('slider-bar-workspace-setting-button')
.waitFor({ state: 'visible' });
await page.getByTestId('slider-bar-workspace-setting-button').click();
await page.getByTestId('workspace-setting:embedding').click();
await page.getByTestId('workspace-embedding-setting-header').waitFor({
@@ -18,7 +21,7 @@ export class SettingsPanelUtils {
if (
await page.getByTestId('workspace-embedding-setting-wrapper').isVisible()
) {
await page.getByTestId('modal-close-button').click();
await page.keyboard.press('Escape');
await page.getByTestId('workspace-embedding-setting-wrapper').waitFor({
state: 'hidden',
});
@@ -161,13 +164,22 @@ export class SettingsPanelUtils {
const searcher = await page.getByTestId('doc-selector-layout');
const searchInput = await page.getByTestId('doc-selector-search-input');
await searchInput.waitFor({ state: 'visible' });
await searchInput.focus();
await page.keyboard.insertText(doc);
const pageListItem = searcher.getByTestId('doc-list-item');
await expect(pageListItem).toHaveCount(1);
const pageListItemTitle = pageListItem.getByTestId('doc-list-item-title');
await expect(pageListItemTitle).toHaveText(doc);
const pageListItem = searcher
.getByTestId('doc-list-item')
.filter({
has: page
.getByTestId('doc-list-item-title')
.getByText(doc, { exact: true }),
})
.first();
await expect(pageListItem).toBeVisible();
await expect(pageListItem.getByTestId('doc-list-item-title')).toHaveText(
doc
);
await pageListItem.click();
await searcher.getByTestId('doc-selector-confirm-button').click();
@@ -200,7 +212,7 @@ export class SettingsPanelUtils {
await searchInput.focus();
await page.keyboard.insertText(doc);
const pageListItem = searcher.getByTestId('page-list-item');
const pageListItem = searcher.getByTestId('doc-list-item');
await expect(pageListItem).toHaveCount(1);
await pageListItem.getByTestId('affine-checkbox').uncheck();