Closed
Description
Current behavior:
Cypress.Commands.overwrite('then', function(originalCommand, subject, fn, options = {}) {
return originalCommand.call(this, subject, options, fn);
});
specify('aliases work', function () {
cy.wrap(1).as('myAlias');
cy.wrap(2).then(function(subj) {
expect(this.myAlias).to.eq(1); // undefined
});
});
Desired behavior:
The test succeeds.
Steps to reproduce: (app code and test code)
https://github.com/x-yuri/issues/tree/cypress-overwrite
More info
Cypress.Commands.overwrite()
is used by cypress-commands
package. Is there a possibly better way to change then()
command?
Versions
Cypress 3.4.0, Arch Linux, Electron 61