From 90477c51858061a39e214c81b433bf43e118c1b4 Mon Sep 17 00:00:00 2001 From: mayramelisa Date: Thu, 26 Sep 2024 21:36:17 -0400 Subject: [PATCH] funtion --- pages/naturalLanguage.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/pages/naturalLanguage.js b/pages/naturalLanguage.js index 640858a..c17fe30 100644 --- a/pages/naturalLanguage.js +++ b/pages/naturalLanguage.js @@ -162,4 +162,19 @@ export class NaturalLanguage { cy.get('textarea[class="m-0 border-0 form-control"]').should('be.visible').type(processName, {delay:50}); cy.get('button[class="px-4 btn btn-primary text-uppercase"]').should('be.visible').click(); } + + waitUntilElementIsVisibleIframe(type, selectorXPath, maxAttempts = 15, attempts = 0) { + if (attempts > maxAttempts) { + throw new Error("Timed out waiting for report to be generated"); + } + if (type === 'selector') { + cy.wait(4000); + cy.iframe('[id="alternative_a"]') + .then($body => { + if ($body.find(selectorXPath).length <= 0) { + this.waitUntilElementIsVisibleIframe(type, selectorXPath, maxAttempts, attempts + 1); + } + }) + } + } }