You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I just tried to use await with promisify library.
I put my code below.
import promisify from 'cypress-promise';
describe('My First Test', () => {
it('Does not do much!', async() => {
const url = "https://rahulshettyacademy.com/seleniumPractise/#/";
cy.visit(url);
cy.get(".search-keyword").type("ca");
cy.wait(2000);
cy.get(".products").find(".product").should("have.length", 4);
cy.get(".products").find(".product").each(async($el, index, list) => {
const element = cy.wrap($el);
const txtElement = await promisify(element.find(".product-name"));
});
})
})
On this line const txtElement = await promisify(element.find(".product-name")); my code gives below error.
`CypressError: cy.each() timed out after waiting 4000ms.
Your callback function returned a promise that never resolved.
The callback function was:
() => {
const ret = fn.call(ctx, el, index, subject); // if the return value is false then return early
if (ret === false) {
endEarly = true;
}
return ret;
}
at <unknown> (https://rahulshettyacademy.com/__cypress/runner/cypress_runner.js:139277:83)
From previous event:
at thenFn (https://rahulshettyacademy.com/__cypress/runner/cypress_runner.js:139276:13)
at yieldItem (https://rahulshettyacademy.com/__cypress/runner/cypress_runner.js:139662:16)
From previous event:
at Context.each (https://rahulshettyacademy.com/__cypress/runner/cypress_runner.js:139667:62)
at wrapped (https://rahulshettyacademy.com/__cypress/runner/cypress_runner.js:157859:19)
From Your Spec Code:
at eval (webpack:///./cypress/integration/examples/Test1.spec.ts:14:41)
at step (https://rahulshettyacademy.com/__cypress/tests?p=cypress\integration\examples\Test1.spec.ts:129:23)
at Object.eval [as next] (https://rahulshettyacademy.com/__cypress/tests?p=cypress\integration\examples\Test1.spec.ts:110:53)
at eval (https://rahulshettyacademy.com/__cypress/tests?p=cypress\integration\examples\Test1.spec.ts:104:71)
at new Promise (<anonymous>)
at ./cypress/integration/examples/Test1.spec.ts.__awaiter (https://rahulshettyacademy.com/__cypress/tests?p=cypress\integration\examples\Test1.spec.ts:100:12)
at Context.eval (webpack:///./cypress/integration/examples/Test1.spec.ts:4:26)`
Cypress Version
11.2.0
cypress-promise version
^1.1.0
Node version
18.12.1
Operating System
Windows 10 Pro - 21H2 - )S Build 19044.2311
The text was updated successfully, but these errors were encountered:
I just tried to use await with promisify library.
I put my code below.
On this line
const txtElement = await promisify(element.find(".product-name"));
my code gives below error.Cypress Version
11.2.0
cypress-promise version
^1.1.0
Node version
18.12.1
Operating System
Windows 10 Pro - 21H2 - )S Build 19044.2311
The text was updated successfully, but these errors were encountered: