From 4aca960b403993dd2541650bf5b59f0504b23ce5 Mon Sep 17 00:00:00 2001 From: Muhammed Mustafa Date: Thu, 23 Nov 2023 11:20:40 +0000 Subject: [PATCH] fix: Fixed issue with long text expand btn always hidden causing issue in test --- tests/playwright/tests/utils/general.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/tests/playwright/tests/utils/general.ts b/tests/playwright/tests/utils/general.ts index 566af8bf07..e54a33ffc0 100644 --- a/tests/playwright/tests/utils/general.ts +++ b/tests/playwright/tests/utils/general.ts @@ -1,16 +1,21 @@ // Selector objects include the text of any icons in the textContent property. + +import { Locator } from '@playwright/test'; + // This function removes the text of any icons from the textContent property. -async function getTextExcludeIconText(selector) { +async function getTextExcludeIconText(selector: Locator) { // Get the text of the selector let text = await selector.textContent(); // List of icons - const icons = await selector.locator('.material-symbols'); + const icons = selector.locator('.material-symbols'); const iconCount = await icons.count(); // Remove the text of each icon from the text for (let i = 0; i < iconCount; i++) { - await icons.nth(i).waitFor(); + await icons.nth(i).waitFor({ + state: 'attached', + }); const iconText = await icons.nth(i).textContent(); text = text.replace(iconText, ''); }