mirror of
https://github.com/vrtmrz/obsidian-livesync.git
synced 2026-10-28 12:03:20 +00:00
Harden real-runtime workflow validation
This commit is contained in:
1 parent
3a23b7a6b0
commit
9a28d46287
8 files changed
+72
-42
No files matched your search
@@ -179,14 +179,17 @@ async function openOnboardingFromSettings(): Promise<void> {
|
||||
async function dismissVisibleNotices(): Promise<void> {
|
||||
await withObsidianPage(obsidianRemoteDebuggingPort(), async (page) => {
|
||||
const notices = page.locator(".notice:visible");
|
||||
let noticeIndex = 0;
|
||||
while ((await notices.count()) > 0) {
|
||||
const noticeCount = await page.locator(".notice").count();
|
||||
await notices.first().click({ position: { x: 8, y: 8 }, timeout: uiTimeoutMs });
|
||||
await page.waitForFunction(
|
||||
(previousCount) => document.querySelectorAll(".notice").length < previousCount,
|
||||
noticeCount,
|
||||
{ timeout: uiTimeoutMs }
|
||||
);
|
||||
const marker = `livesync-e2e-notice-${noticeIndex++}`;
|
||||
await notices
|
||||
.first()
|
||||
.evaluate((element, value) => element.setAttribute("data-livesync-e2e-notice", value), marker);
|
||||
const markedNotice = page.locator(`[data-livesync-e2e-notice="${marker}"]`);
|
||||
await markedNotice.click({ position: { x: 8, y: 8 }, timeout: uiTimeoutMs });
|
||||
// Follow the notice which was clicked. Another concurrently added
|
||||
// notice must not make a total-count wait look permanently stuck.
|
||||
await markedNotice.waitFor({ state: "hidden", timeout: uiTimeoutMs });
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user