Skip to content

Feature Request cy.all to work with multiple commands in parallel #8719

Open
@valoricDe

Description

@valoricDe

Summary

Sometimes you want to work with multiple cypress commands but want to wait for all comands to finish before proceeding with another task

Current behavior

currently you have to chain these commands and pass the fetched data from promiselike to promiselike.

cy.fixture('filea.json').then((fileAContents) => {
  cy.fixture('fileb.json').then((fileBContents => {
    ....
    cy.request... with fileAContents, fileBContents, fileCContents ...
  }
}

Desired behavior

like Bluebirds props method or my favorite

import { zipObject } from 'lodash'

export async function makePromiseFromObject(obj: { [key: string]: Promise<any> }) {
  return zipObject(Object.keys(obj), await Promise.all(Object.values(obj)))
}

we could aggregate all comand responses into one object with cy.all

cy.all({
  fileAContents: cy.fixture('filea.json'),
  fileBContents: cy.fixture('fileb.json'),
  ...
).then(props => cy.request( with ...props))

Relates to: #915

Metadata

Metadata

Assignees

No one assigned

    Labels

    pkg/driverThis is due to an issue in the packages/driver directorystage: proposal 💡No work has been done of this issuetype: enhancementRequested enhancement of existing feature

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions