diff --git a/.changeset/upset-areas-wear.md b/.changeset/upset-areas-wear.md new file mode 100644 index 00000000..40f6e8c8 --- /dev/null +++ b/.changeset/upset-areas-wear.md @@ -0,0 +1,5 @@ +--- +"@wdio/visual-service": patch +--- + +fix: [983](#983 ) in multiremote, commands are now executed on the requested instances diff --git a/packages/visual-service/src/service.ts b/packages/visual-service/src/service.ts index 77a75c7a..2759794e 100644 --- a/packages/visual-service/src/service.ts +++ b/packages/visual-service/src/service.ts @@ -140,6 +140,15 @@ export default class WdioImageComparisonService extends BaseClass { const browser = this.#browser as WebdriverIO.MultiRemoteBrowser const browserNames = Object.keys(capabilities) + /** + * Add all the commands to the global browser object that will execute + * on each browser in the Multi Remote + * Start with the page commands + */ + for (const [commandName, command] of Object.entries(pageCommands)) { + this.#addMultiremoteCommand(browser, browserNames, commandName as keyof CommandMap, command) + } + /** * Add all the commands to each browser in the Multi Remote */ @@ -154,15 +163,6 @@ export default class WdioImageComparisonService extends BaseClass { await this.#addCommandsToBrowser(browserInstance) } - /** - * Add all the commands to the global browser object that will execute - * on each browser in the Multi Remote - * Start with the page commands - */ - for (const [commandName, command] of Object.entries(pageCommands)) { - this.#addMultiremoteCommand(browser, browserNames, commandName as keyof CommandMap, command) - } - /** * Add all the element commands to the global browser object that will execute * on each browser in the Multi Remote