https://cypress.io logo
Right that was my impression. If possible I'd like...
# best-practices
p
Right that was my impression. If possible I'd like to avoid nesting
.then()
calls just in order to get the aliasing all inside a given closure. That said, now that I think of it, because cypress already handles the async nature of commands, I might not need
Promise.all()
to wait for the previous values because I would expect that a
.then()
on a given command will already have awaited the previous command's resolution. So I can probably do:
Copy code
it('my test', function () {
  cy.myCustomApiCommand('user1').as('user1Id');
  cy.myCustomApiCommand('user2').as('user2Id')
  // I bet this waits for the 1st command to finish too
  .then(() => {
    const myNewFixture = {
      user1: this.user1Id,
      user2: this.user2Id
    };
  });
});