diff --git a/visual-js/.changeset/old-mails-sin.md b/visual-js/.changeset/old-mails-sin.md new file mode 100644 index 00000000..e27c1a33 --- /dev/null +++ b/visual-js/.changeset/old-mails-sin.md @@ -0,0 +1,5 @@ +--- +"@saucelabs/cypress-visual-plugin": patch +--- + +fix ignore regions for multiple elements diff --git a/visual-js/visual-cypress/src/commands.ts b/visual-js/visual-cypress/src/commands.ts index da2c3f31..4288dd52 100644 --- a/visual-js/visual-cypress/src/commands.ts +++ b/visual-js/visual-cypress/src/commands.ts @@ -92,19 +92,13 @@ function chainableWaitForAll( ): Cypress.Chainable { const result: S[] = []; - if (list.length < 1) return cy.wrap([]); - - let curChainable = list[0]; - for (let idx = 1; idx < list.length; idx++) { - curChainable = curChainable.then((resolved) => { - result.push(resolved); - return list[idx]; + list.forEach((item) => { + item.then((el) => { + result.push(el); }); - } - return curChainable.then((item) => { - result.push(item); - return result; }); + + return cy.wrap(result); } const sauceVisualCheckCommand = (