From c21b8cc942e8ac13285510ca6a841f91b41e89cf Mon Sep 17 00:00:00 2001 From: Raju Udava <86527202+dstala@users.noreply.github.com> Date: Thu, 9 Feb 2023 00:14:42 +0530 Subject: [PATCH] test: eslint fix Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> --- .../pages/Dashboard/common/Cell/index.ts | 38 ++++++++++++++----- 1 file changed, 29 insertions(+), 9 deletions(-) diff --git a/tests/playwright/pages/Dashboard/common/Cell/index.ts b/tests/playwright/pages/Dashboard/common/Cell/index.ts index 708768ae6f..afcd25b4a7 100644 --- a/tests/playwright/pages/Dashboard/common/Cell/index.ts +++ b/tests/playwright/pages/Dashboard/common/Cell/index.ts @@ -96,15 +96,35 @@ export class CellPageObject extends BasePage { async verify({ index, columnHeader, value }: CellProps & { value: string | string[] }) { const _verify = async text => { - await expect - .poll(async () => { - const innerTexts = await this.get({ - index, - columnHeader, - }).allInnerTexts(); - return typeof innerTexts === 'string' ? [innerTexts] : innerTexts; - }) - .toContain(text); + // await expect + // .poll(async () => { + // const innerTexts = await this.get({ + // index, + // columnHeader, + // }).allInnerTexts(); + // return typeof innerTexts === 'string' ? [innerTexts] : innerTexts; + // }) + // .toContain(text); + + // retrieve text from cell + // loop for 5 seconds + // if text is found, return + // if text is not found, throw error + let count = 0; + while (count < 5) { + const innerTexts = await this.get({ + index, + columnHeader, + }).allInnerTexts(); + const cellText = typeof innerTexts === 'string' ? [innerTexts] : innerTexts; + + if (cellText.includes(text) || cellText[0].includes(text)) { + return; + } + await this.rootPage.waitForTimeout(1000); + count++; + if (count === 5) throw new Error(`Cell text ${text} not found`); + } }; if (Array.isArray(value)) {