kuceb / cypress-plugin-retries

A Cypress plugin to retry failed tests.
MIT License
237 stars 20 forks source link

Alias from before hook not available after retrying #62

Closed kasperpeulen closed 4 years ago

kasperpeulen commented 4 years ago
describe(`Credit Card 3ds - New AmEx Happy Flow`, () => {
  before(() => {
    cy.setup();
    cy.createDutchPrivateCustomer().as('customer');
  });

  it('Customer finishes order with newly added American Express 3DS card', () => {
    cy.get('@customer').then(({ email, password }) => cy.login(email, password));
    // etc.
  });
});

However, when the test fails, it and retries it says:

cy.get() could not find a registered alias for: @customer.
You have not aliased anything yet.

So for some reason the test alias context is lost with this plugin. Another option would be that we can say that the plugin runs the before hook again for retries.

kasperpeulen commented 4 years ago

Needs to be a beforeEach hook, closing this.