chore: bump playwright (#13947)

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

* **Chores**
* Updated Playwright test tooling to 1.58.2 across the repository and
test packages.

* **Tests**
* Improved end-to-end robustness: replaced fragile timing/coordinate
logic with element-based interactions, added polling/retry checks for
flaky asserts and async state, and simplified input/rename flows to
reduce test flakiness.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
DarkSky
2026-02-27 22:56:43 +08:00
committed by GitHub
parent c90f173821
commit a4e2242b8d
16 changed files with 170 additions and 119 deletions
@@ -820,10 +820,10 @@ export async function updateExistedBrushElementSize(
page: Page,
nthSizeButton: 1 | 2 | 3 | 4 | 5 | 6
) {
// get the nth brush size button
const btn = page.locator(
`edgeless-line-width-panel .point-button:nth-child(${nthSizeButton})`
);
// pick from the visible panel to avoid strict-mode collisions from hidden/duplicate toolbars
const btn = page
.locator('edgeless-line-width-panel:visible .point-button')
.nth(nthSizeButton - 1);
await btn.click();
}
+55 -23
View File
@@ -1015,31 +1015,63 @@ export async function getIndexCoordinate(
[richTextIndex, vIndex]: [number, number],
coordOffSet: { x: number; y: number } = { x: 0, y: 0 }
) {
const coord = await page.evaluate(
({ richTextIndex, vIndex, coordOffSet, currentEditorIndex }) => {
const editorHost =
document.querySelectorAll('editor-host')[currentEditorIndex];
const richText = editorHost.querySelectorAll('rich-text')[
richTextIndex
] as any;
const domRange = richText.inlineEditor.toDomRange({
index: vIndex,
length: 0,
});
const pointBound = domRange.getBoundingClientRect();
return {
x: pointBound.left + coordOffSet.x,
y: pointBound.top + pointBound.height / 2 + coordOffSet.y,
};
},
{
richTextIndex,
vIndex,
coordOffSet,
currentEditorIndex,
for (let attempt = 0; attempt < 20; attempt++) {
const coord = await page.evaluate(
({ richTextIndex, vIndex, coordOffSet, currentEditorIndex }) => {
const editorHost =
document.querySelectorAll('editor-host')[currentEditorIndex];
const richTexts = Array.from(
editorHost?.querySelectorAll('rich-text') ?? []
);
if (!richTexts.length) {
return null;
}
const richText = richTexts[
Math.min(richTextIndex, richTexts.length - 1)
] as any;
const inlineEditor = richText?.inlineEditor;
if (!inlineEditor) {
return null;
}
const clampedIndex = Math.max(
0,
Math.min(vIndex, inlineEditor.yTextLength ?? vIndex)
);
const domRange = inlineEditor.toDomRange({
index: clampedIndex,
length: 0,
});
if (!domRange) {
return null;
}
const pointBound = domRange.getBoundingClientRect();
if (
!Number.isFinite(pointBound.left) ||
!Number.isFinite(pointBound.top)
) {
return null;
}
return {
x: pointBound.left + coordOffSet.x,
y: pointBound.top + pointBound.height / 2 + coordOffSet.y,
};
},
{
richTextIndex,
vIndex,
coordOffSet,
currentEditorIndex,
}
);
if (coord) {
return coord;
}
await page.waitForTimeout(50);
}
throw new Error(
`Failed to get index coordinate: richTextIndex=${richTextIndex}, vIndex=${vIndex}`
);
return coord;
}
export function inlineEditorInnerTextToString(innerText: string): string {