playwright-fluent
Version:
Fluent API around playwright
22 lines (21 loc) • 847 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.waitForDialog = void 0;
const wait_until_1 = require("../../../utils/wait-until/wait-until");
async function waitForDialog(dialog, page, options = wait_until_1.defaultWaitUntilOptions) {
if (!page) {
throw new Error(`Cannot wait for a dialog to open because no browser has been launched`);
}
const waitOptions = {
...wait_until_1.defaultWaitUntilOptions,
...options,
};
await (0, wait_until_1.waitUntil)(async () => {
const currentDialog = dialog();
if (!currentDialog) {
return false;
}
return true;
}, `No dialog has been opened. Maybe you forgot to call the '.withDialogs()' on the playwright-fluent instance.`, waitOptions);
}
exports.waitForDialog = waitForDialog;
;