Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

before hook still reruns on Cypress 8.4.0 #18128

Closed
JohnnyTheBoy opened this issue Sep 16, 2021 · 4 comments
Closed

before hook still reruns on Cypress 8.4.0 #18128

JohnnyTheBoy opened this issue Sep 16, 2021 · 4 comments
Labels
stage: awaiting response Potential fix was proposed; awaiting response stale no activity on this issue for a long period

Comments

@JohnnyTheBoy
Copy link

Current behavior

before hook triggers multiple times inside one describe() block.

Desired behavior

Before hook inside one describe() block should be triggered only once.

Test code to reproduce

describe("Testing", () => {

before(() => {
cy.log("Before hook is called!");
});

beforeEach(() => {
cy.log("Before each hook is called");
});

it("do something", () => { expect(true).to.be.eq(true); });
it("do something", () => { expect(true).to.be.eq(true); });
it("do something", () => { expect(true).to.be.eq(true); });
it("do something", () => { expect(true).to.be.eq(true); });
it("do something", () => { expect(true).to.be.eq(true); });
it("do something", () => { expect(true).to.be.eq(true); });
it("do something", () => { expect(true).to.be.eq(true); });
it("do something", () => { expect(true).to.be.eq(true); });
it("do something", () => { expect(true).to.be.eq(true); });
it("do something", () => { expect(true).to.be.eq(true); });

it("says hi", () => {
cy.visit("www.google.com");
cy.log("Hi!");
});

it("do something", () => { expect(true).to.be.eq(true); });
it("do something", () => { expect(true).to.be.eq(true); });
it("do something", () => { expect(true).to.be.eq(true); });
});

Cypress Version

8.4.0

Other

cypress_before_hook_issue
I'm very surprised that after 8.4 update this thing still doesn't work. This is so simple test and yet nobody tried it before merge/push... sad

@JohnnyTheBoy JohnnyTheBoy changed the title before hook still rerun on Cypress 8.4.0 before hook still reruns on Cypress 8.4.0 Sep 16, 2021
@sainthkh
Copy link
Contributor

sainthkh commented Oct 4, 2021

@flotwig When domain changes, Cypress reloads and it reruns the before(). I don't think it's a right behavior, right?

@sainthkh sainthkh added the stage: awaiting response Potential fix was proposed; awaiting response label Oct 4, 2021
@cypress-app-bot
Copy link
Collaborator

This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided.

@cypress-app-bot cypress-app-bot added the stale no activity on this issue for a long period label May 15, 2023
@cypress-app-bot
Copy link
Collaborator

This issue has been closed due to inactivity.

@cypress-app-bot cypress-app-bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 3, 2023
@jennifer-shehane
Copy link
Member

See #17940

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stage: awaiting response Potential fix was proposed; awaiting response stale no activity on this issue for a long period
Projects
None yet
Development

No branches or pull requests

4 participants