UNPKG

e2ed

Version:

E2E testing framework over Playwright

22 lines (21 loc) 657 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.isSelectorEntirelyInViewport = void 0; const test_1 = require("@playwright/test"); /** * Returns `true`, if the selector is entirely in the viewport * (all selector points are in the viewport), and `false` otherwise. */ const isSelectorEntirelyInViewport = async (selector) => { try { await (0, test_1.expect)(selector.getPlaywrightLocator()).toBeInViewport({ ratio: 1, timeout: 1, }); return true; } catch { return false; } }; exports.isSelectorEntirelyInViewport = isSelectorEntirelyInViewport;