Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am working with a custom command in cypress that pauses the test and opens a window.prompt() that asks the user for some input and adds it to the mochawesome report with the addcontext command. However, I want to create my own custom dialog that has a textbox and two buttons - pass/fail (basically a combination of window.prompt() and window.confirm()). Is there some way I can create my own html element and display it in cypress?

question from:https://stackoverflow.com/questions/66066106/how-to-create-custom-dialog-in-cypress

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
137 views
Welcome To Ask or Share your Answers For Others

1 Answer

Solved. I injected html into the dom through Cypress.$(body).append(... and then accessed the elements through jquery. I used waitUntil and cy.focused as well as the regular jquery button focus events to pause execution of the test and resume after the pause or fail buttons were pressed.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...