/**
 * Check if component is visible in E2E test. This way
 * elements with display none property, are detected.
 *
 * @param {Object} page - Page instance of newE2EPage()
 * @param {string} targetQuery - Query to target triggered element. E.g. "telia-text-input input"
 */
const isVisible = async (page, targetQuery) => {
  const element = await page.$(targetQuery);
  if (!element)
    return false;
  return !!(await element.boundingBox());
};
export default isVisible;
