Await-ing Cypress Chains
### Current behavior: `await`-ing cypress chains yields undefined ### Desired behavior: `await`-ing cypress chains yields the value of the chain (since the chain is a promise-like, it should work with await out of the box) ### Additional Info (images, stack traces, etc) I understand the recommended way to use cypress is closures, however, when dealing with multiple variables, we run into callback hell's lil' brother **closure hell**. The ability to use `await` on Cypress chains could be beneficial in many ways: - avoiding nesting closures many levels deep, thus preventing unreadable code - making it easy for programmers familiar with traditional async patterns to start using Cypress Example code using closures ````js describe('Filter textbox', () => { beforeEach(() => { cy.get(test("suplovaniTable")).as("suplovaniTable"); cy.get(test("filterTextbox")).as("filterTextbox"); }); it('changes data on filter text change', () => { cy.get("@suplovaniTable").then((el) => { return el[0].innerHTML; }).then((innerHTML) => { return sha256(innerHTML); }).then((hash) => { cy.get("[data-test=suplovaniTable] > tbody > :nth-child(1) > :nth-child(2)") .then((tds) => { const text = tds[0].innerText; cy.get("@filterTextbox").type(text); cy.get("@suplovaniTable") .then(el => el[0].innerHTML)
Posted by vacekj on Mar 5, 2018, 12:34 PM
Tags
Related issues
- struct's lifetime requirements can be bypassed via covariant field assignment
- Proposal to Reorganize the Moderation Team and Review Moderation Policies
- Progressive FPS degradation appears to be related to dota2.com — blocking the domain prevents the performance loss
- proposal: container/...: generic collection types
- Better Custom Endpoint BYOK
- A concrete policy for backward compatibility until Godot 5.0
Raise real-world problems, find people facing the same issue, and discuss solutions.4,000 issues0 comments
github (Other)
struct's lifetime requirements can be bypassed via covariant field assignment
Proposal to Reorganize the Moderation Team and Review Moderation Policies
Progressive FPS degradation appears to be related to dota2.com — blocking the domain prevents the performance loss
proposal: container/...: generic collection types
Better Custom Endpoint BYOK
A concrete policy for backward compatibility until Godot 5.0
New MTP models not supported
Tracking: 429 / Capacity Issues
Await-ing Cypress Chains
### Current behavior: `await`-ing cypress chains yields undefined ### Desired behavior: `await`-ing cypress chains yields the value of the chain (since the chain is a promise-like, it should work with await out of the box) ### Additional Info (images, stack traces, etc) I understand the recommended way to use cypress is closures, however, when dealing with multiple variables, we run into callback hell's lil' brother **closure hell**. The ability to use `await` on Cypress chains could be beneficial in many ways: - avoiding nesting closures many levels deep, thus preventing unreadable code - making it easy for programmers familiar with traditional async patterns to start using Cypress Example code using closures ````js describe('Filter textbox', () => { beforeEach(() => { cy.get(test("suplovaniTable")).as("suplovaniTable"); cy.get(test("filterTextbox")).as("filterTextbox"); }); it('changes data on filter text change', () => { cy.get("@suplovaniTable").then((el) => { return el[0].innerHTML; }).then((innerHTML) => { return sha256(innerHTML); }).then((hash) => { cy.get("[data-test=suplovaniTable] > tbody > :nth-child(1) > :nth-child(2)") .then((tds) => { const text = tds[0].innerText; cy.get("@filterTextbox").type(text); cy.get("@suplovaniTable") .then(el => el[0].innerHTML)
Comments (0)
No comments yet. Start the discussion.