desktop: fix dialog skipping in tests

This commit is contained in:
Abdullah Atta
2025-07-19 09:43:39 +05:00
parent 4948a8d7de
commit ab4092c088

View File

@@ -228,19 +228,19 @@ test("downgrade to stable on switching to stable release track", async (t) => {
}); });
async function skipDialog(page: Page) { async function skipDialog(page: Page) {
await page try {
.waitForSelector(".ReactModal__Content", { const dialog = page.locator(".ReactModal__Content");
timeout: 1000 const positiveButton = dialog.locator(
})
.catch(() => {})
.then(async () => {
const positiveButton = page.locator(
"button[data-role='positive-button']" "button[data-role='positive-button']"
); );
const negativeButton = page.locator( const negativeButton = dialog.locator(
"button[data-role='negative-button']" "button[data-role='negative-button']"
); );
if (await positiveButton.isVisible()) await positiveButton.click(); if (await positiveButton.isVisible())
else if (await negativeButton.isVisible()) await negativeButton.click(); await positiveButton.click({ timeout: 2000 });
}); else if (await negativeButton.isVisible())
await negativeButton.click({ timeout: 2000 });
} catch (e) {
// ignore error
}
} }