fix(editor): improve tests stability (#14971)
#### PR Dependency Tree * **PR #14971** 👈 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 * **Tests** * Improved shape selection reliability in edge case testing scenarios * Enhanced rich text editor focusing logic with better synchronization for inline editor state validation <!-- review_stack_entry_start --> [](https://app.coderabbit.ai/change-stack/toeverything/AFFiNE/pull/14971) <!-- review_stack_entry_end --> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
@@ -552,6 +552,27 @@ export async function focusRichText(
|
||||
await expect(locator).toBeVisible();
|
||||
// need to set `force` to true when clicking on `affine-selected-blocks`
|
||||
await locator.click({ force: true, position: options?.clickPosition });
|
||||
await expect
|
||||
.poll(() =>
|
||||
page.evaluate(
|
||||
([i, currentEditorIndex]) => {
|
||||
const editorHost =
|
||||
document.querySelectorAll('editor-host')[currentEditorIndex];
|
||||
const richText =
|
||||
editorHost?.querySelectorAll<RichText>('rich-text')[i];
|
||||
const inlineEditor = richText?.inlineEditor;
|
||||
if (!inlineEditor) {
|
||||
return false;
|
||||
}
|
||||
if (inlineEditor.getInlineRange() === null) {
|
||||
inlineEditor.focusIndex(0);
|
||||
}
|
||||
return inlineEditor.getInlineRange() !== null;
|
||||
},
|
||||
[i, currentEditorIndex]
|
||||
)
|
||||
)
|
||||
.toBe(true);
|
||||
}
|
||||
|
||||
export async function focusRichTextEnd(page: Page, i = 0) {
|
||||
|
||||
Reference in New Issue
Block a user