cy.pause() now pauses test while running cypress run --headed --no-exit (2024)

Table of Contents
Before After

Cypress gives us the ability to stop the test at a spot viacy.pause() command.We can use this to stop the test before any action or assertion that is causingour tests to fail.But this command only works when we run Cypress in GUI mode and, it isignored when we run the tests in headless mode.

Before

Before version 8.6.0cy.pause() was ignored if we runour tests via cypress run --headed --no-exit command.

describe("example", () => { it("should not pause the test", () => { cy.visit("www.google.co.in"); cy.pause(); cy.contains("India"); cy.get('input[value="Google Search"'); });});

Now, if we run the above test via the cypress run --headed --no-exit command,then we notice from the image below that our test has not paused.

cy.pause() now pauses test while running cypress run --headed --no-exit (3)

After

From Cypress 8.6.0 cy.pause() works the same with cypress open and cypress runcommand when --headed and --no-exit flags are passed to cypress run.

describe("example", () => { it("should pause the test", () => { cy.visit("www.google.co.in"); cy.pause(); cy.contains("India"); cy.get('input[value="Google Search"'); });});

cy.pause() now pauses test while running cypress run --headed --no-exit (4)

Now when we run the above test via cypress run --headed --no-exit commandthen we notice from the image that our test has paused.

To know more about this, check out thePR.

cy.pause() now pauses test while running  cypress run --headed --no-exit (2024)
Top Articles
Latest Posts
Article information

Author: Kelle Weber

Last Updated:

Views: 6256

Rating: 4.2 / 5 (53 voted)

Reviews: 92% of readers found this page helpful

Author information

Name: Kelle Weber

Birthday: 2000-08-05

Address: 6796 Juan Square, Markfort, MN 58988

Phone: +8215934114615

Job: Hospitality Director

Hobby: tabletop games, Foreign language learning, Leather crafting, Horseback riding, Swimming, Knapping, Handball

Introduction: My name is Kelle Weber, I am a magnificent, enchanting, fair, joyous, light, determined, joyous person who loves writing and wants to share my knowledge and understanding with you.