feat: 收口 Rust Web 3000 主链
This commit is contained in:
@@ -15,7 +15,7 @@ const {
|
||||
} = require("./tree-shell-smoke-helpers");
|
||||
|
||||
async function waitForPageTitleInput(page) {
|
||||
const input = page.getByLabel("页面标题");
|
||||
const input = page.locator('[data-page-title-input="true"][data-pane-role="primary"]').first();
|
||||
await input.waitFor({ state: "visible", timeout: UI_TIMEOUT_MS });
|
||||
return input;
|
||||
}
|
||||
@@ -27,7 +27,12 @@ async function waitForTitleSave(page, documentId, expectedTitle) {
|
||||
return false;
|
||||
}
|
||||
const payload = response.request().postDataJSON();
|
||||
return payload?.documentId === documentId && payload?.title === expectedTitle && response.ok();
|
||||
return (
|
||||
payload?.documentId === documentId &&
|
||||
payload?.title === expectedTitle &&
|
||||
payload?.commandName === "page.head.updateTitle" &&
|
||||
response.ok()
|
||||
);
|
||||
},
|
||||
{ timeout: UI_TIMEOUT_MS },
|
||||
);
|
||||
@@ -56,7 +61,9 @@ async function waitForBreadcrumbTitle(page, title) {
|
||||
async function waitForSidebarRowTitle(page, documentId, title) {
|
||||
await page.waitForFunction(
|
||||
({ docId, expectedTitle }) => {
|
||||
const row = document.querySelector(`aside a[href="/documents/${docId}"]`);
|
||||
const row = document.querySelector(
|
||||
`[data-node-id="${docId}"] .tree-link-title, [data-testid="page-tree-row"][data-node-id="${docId}"], .wolai-page-row[data-node-id="${docId}"] > .wolai-row-title`,
|
||||
);
|
||||
return (row?.textContent ?? "").includes(expectedTitle);
|
||||
},
|
||||
{ docId: documentId, expectedTitle: title },
|
||||
@@ -66,12 +73,10 @@ async function waitForSidebarRowTitle(page, documentId, title) {
|
||||
|
||||
async function waitForPageTreeTitle(page, documentId, title) {
|
||||
await openSectionView(page);
|
||||
const shellHost = page.getByTestId("sidebar-page-tree-shell");
|
||||
await shellHost.waitFor({ state: "visible", timeout: UI_TIMEOUT_MS });
|
||||
await page.waitForFunction(
|
||||
({ nodeId, expectedTitle }) => {
|
||||
const row = document.querySelector(
|
||||
`[data-testid="page-tree-row"][data-node-id="${nodeId}"]`,
|
||||
`#sidebar-tree-root .tree-row[data-shell-mode="page"][data-node-id="${nodeId}"] .tree-link-title, [data-testid="page-tree-row"][data-node-id="${nodeId}"], .wolai-page-row[data-node-id="${nodeId}"] > .wolai-row-title`,
|
||||
);
|
||||
return (row?.textContent ?? "").includes(expectedTitle);
|
||||
},
|
||||
@@ -82,12 +87,10 @@ async function waitForPageTreeTitle(page, documentId, title) {
|
||||
|
||||
async function waitForFileTreeTitle(page, documentId, title) {
|
||||
await openFilesystemView(page);
|
||||
const shellHost = page.getByTestId("sidebar-file-tree-shell");
|
||||
await shellHost.waitFor({ state: "visible", timeout: UI_TIMEOUT_MS });
|
||||
await page.waitForFunction(
|
||||
({ docId, expectedTitle }) => {
|
||||
const row = document.querySelector(
|
||||
`[data-testid="filetree-doc-row"][data-doc-id="${docId}"]`,
|
||||
`#sidebar-file-tree-root .tree-row[data-shell-mode="filetree"][data-doc-id="${docId}"] .tree-link-title, #sidebar-file-tree-root .tree-row[data-shell-mode="filetree"][data-document-id="${docId}"] .tree-link-title, [data-testid="filetree-doc-row"][data-doc-id="${docId}"]`,
|
||||
);
|
||||
return (row?.textContent ?? "").includes(expectedTitle);
|
||||
},
|
||||
@@ -97,7 +100,7 @@ async function waitForFileTreeTitle(page, documentId, title) {
|
||||
}
|
||||
|
||||
async function readVisibleTitle(page) {
|
||||
const titleInput = page.getByLabel("页面标题");
|
||||
const titleInput = page.locator('[data-page-title-input="true"][data-pane-role="primary"]').first();
|
||||
if (await titleInput.isVisible().catch(() => false)) {
|
||||
return (await titleInput.inputValue()).trim();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user