"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createWaitForChildrenCount = void 0;
/**
 * Waits until an element has exactly the expected number of child elements.
 */
const createWaitForChildrenCount = (browser) => {
    return async function waitForChildrenCount(selector, count, opts) {
        await browser.waitUntil(async () => (await this.$$(selector)).length === count, {
            timeout: opts?.timeout ?? 5000,
            timeoutMsg: `Expected ${selector} inside ${this.selector} to have ${count} children, but got ${(await this.$$(selector)).length}`,
        });
    };
};
exports.createWaitForChildrenCount = createWaitForChildrenCount;
