From f683c8b8b9caee20fd9a43db54447e8d81b2abb9 Mon Sep 17 00:00:00 2001 From: Jessie Cai Date: Thu, 10 Oct 2024 12:26:30 -0400 Subject: [PATCH] Fixed tests --- js/test/test-helpers.js | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/js/test/test-helpers.js b/js/test/test-helpers.js index 69e34695..33a0c0ee 100644 --- a/js/test/test-helpers.js +++ b/js/test/test-helpers.js @@ -9,14 +9,13 @@ const testHelpers = new (function () { return el.offsetParent === null; }; - this.isElementFocused = async function (tooltipButtonInputId) { + this.isElementFocused = async function (elId) { + const isElFocused = await page.evaluate((elId) => { + const el = document.querySelector(elId); + return el === document.activeElement; + }, elId); - const isButtonFocused = await page.evaluate((tooltipIconButtonId) => { - const button = document.querySelector(tooltipIconButtonId); - return button === document.activeElement; - }, tooltipButtonInputId); - - return isButtonFocused; + return isElFocused; } this.getDesktopBrowser = async function (isBrowserVisible) {