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(
}) "button[data-role='positive-button']"
.catch(() => {}) );
.then(async () => { const negativeButton = dialog.locator(
const positiveButton = page.locator( "button[data-role='negative-button']"
"button[data-role='positive-button']" );
); if (await positiveButton.isVisible())
const negativeButton = page.locator( await positiveButton.click({ timeout: 2000 });
"button[data-role='negative-button']" else if (await negativeButton.isVisible())
); await negativeButton.click({ timeout: 2000 });
if (await positiveButton.isVisible()) await positiveButton.click(); } catch (e) {
else if (await negativeButton.isVisible()) await negativeButton.click(); // ignore error
}); }
} }