mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-16 19:57:52 +01:00
desktop: fix dialog skipping in tests
This commit is contained in:
@@ -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
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user