Skip to content

POC: Support multi-remote take 2 - #2172

Draft
dprevost-LMI wants to merge 55 commits into
webdriverio:mainfrom
dprevost-LMI:support-multiremote-take-2
Draft

POC: Support multi-remote take 2#2172
dprevost-LMI wants to merge 55 commits into
webdriverio:mainfrom
dprevost-LMI:support-multiremote-take-2

Conversation

@dprevost-LMI

@dprevost-LMI dprevost-LMI commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Multi-Remote Support

Support multi-remote for Browser and element matchers.
Fixes #106

Browser Matchers

await expect(multiRemoteBrowser).toHaveTitle('WebdriverJS Testpage')
await expect(multiRemoteBrowser).toHaveTitle({
    chrome: expect.stringContaining('WebdriverJS'),
    firefox: expect.stringContaining('WebdriverJS')
})
await expect(multiRemoteBrowser.select('firefox')).toHaveTitle({
    firefox: expect.stringContaining('WebdriverJS')
})

Element(s) Matchers

toBe Matchers

await expect(multiRemoteBrowser.$('h1')).toBeDisplayed()
await expect(multiRemoteBrowser.$$('h1')).toBeDisplayed()

// Allow a subset of browsers
await expect(multiRemoteBrowser.$('h1').select('firefox')).toBeDisplayed()
await expect(multiRemoteBrowser.select('firefox').$$('h1')).toBeDisplayed() 
// Note: One day we could have select API directly on MultiRemoteElement[]

toHave Matchers

// Single element
await expect(multiRemoteBrowser.$('h1')).toHaveText('WebdriverJS Testpage')
await expect(h1).toHaveText({
     'firefox': 'WebdriverJS Testpage',
     'chrome': 'WebdriverJS Testpage'
  })

// Multiple elements
await expect(multiRemoteBrowser.$$('h1')).toHaveText(['Testpage', 'Test CSS Attributes'])
await expect(h1).toHaveText({
    'firefox': ['WebdriverJS Testpage', 'Test CSS Attributes'],
    'chrome': ['WebdriverJS Testpage', 'Test CSS Attributes']
})
await expect(h1.select('firefox')).toHaveText({
    'firefox': ['WebdriverJS Testpage', 'Test CSS Attributes']
})

Error messages

toBe multi-remote single element

Expect multi-remote<chrome, firefox>.$(`h1`) to be displayed

- Expected  - 1
+ Received  + 1

  Object {
    "chrome": "displayed",
-   "firefox": "displayed",
+   "firefox": "not displayed",
  }

toHave multi-remote single elements

Expect multi-remote<chrome, firefox>.$(`h1`) to have text

- Expected  - 1
+ Received  + 1

  Object {
    "chrome": "WebdriverJS Testpage",
-   "firefox": "ebdriverJS Testpage",
+   "firefox": "WebdriverJS Testpage",
  }

toHave multi-remote multiple elements

Expect multi-remote<chrome, firefox>.$$(`h1`) to have text

- Expected  - 2
+ Received  + 2

  Object {
    "chrome": Array [
-     "WebdriverJS Testpage",
-     "Test CSS Attributes",
+     "",
+     "Open Source and Open Governed",
    ],
    "firefox": Array [
      "WebdriverJS Testpage",
      "Test CSS Attributes",
    ],
  }

@dprevost-LMI
dprevost-LMI marked this pull request as ready for review August 4, 2026 10:23
@dprevost-LMI
dprevost-LMI marked this pull request as draft August 4, 2026 10:23
Comment thread src/matchers/browser/toHaveTitle.ts Outdated
Comment thread src/matchers/browser/toHaveTitle.ts Outdated
Comment thread package.json Outdated
Comment thread playgrounds/multi-remote-mocha/test/specs/wdio-matchers.test.ts Outdated
Comment thread package.json
@dprevost-LMI
dprevost-LMI force-pushed the support-multiremote-take-2 branch from cecd879 to 7ec8819 Compare August 6, 2026 00:59
@dprevost-LMI
dprevost-LMI force-pushed the support-multiremote-take-2 branch from 7ec8819 to b48142d Compare August 18, 2026 19:23
@dprevost-LMI
dprevost-LMI marked this pull request as ready for review August 21, 2026 02:41
@dprevost-LMI
dprevost-LMI marked this pull request as draft August 21, 2026 02:41
@webdriverio webdriverio deleted a comment from greptile-apps Bot Aug 21, 2026
Comment thread src/matchers/browser/toHaveTitle.ts Outdated
@dprevost-LMI dprevost-LMI reopened this Aug 25, 2026
@dprevost-LMI
dprevost-LMI force-pushed the support-multiremote-take-2 branch from f6c73cd to 91b3356 Compare August 25, 2026 11:37
@dprevost-LMI dprevost-LMI changed the title POC: Support multiremote take 2 POC: Support multi-remote take 2 Aug 26, 2026
@dprevost-LMI
dprevost-LMI force-pushed the support-multiremote-take-2 branch from 978dd57 to 3c3cb10 Compare August 27, 2026 17:17
@dprevost-LMI
dprevost-LMI force-pushed the support-multiremote-take-2 branch from aee7746 to 2455c57 Compare August 29, 2026 23:52
Comment thread src/util/elementsUtil.ts Outdated
@dprevost-LMI
dprevost-LMI force-pushed the support-multiremote-take-2 branch from 808d8ab to 4fa1b72 Compare August 30, 2026 01:21
@dprevost-LMI
dprevost-LMI marked this pull request as ready for review August 31, 2026 14:17
@dprevost-LMI
dprevost-LMI marked this pull request as draft August 31, 2026 14:17
@dprevost-LMI

dprevost-LMI commented Aug 31, 2026

Copy link
Copy Markdown
Contributor Author

@greptileai, analyze this PR, all the files and the changes, in depth and report any inconsistencies, bugs, or leftover TODOs and incomplete tasks. Ensure you communicate your findings!

@webdriverio webdriverio deleted a comment from greptile-apps Bot Aug 31, 2026
@greptile-apps

greptile-apps Bot commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

The PR adds multiremote support across browser and element matchers while preserving per-instance comparison and diagnostics.

  • Adds shared multiremote browser-command and element-resolution utilities.
  • Supports scalar, asymmetric, and browser-keyed expectations.
  • Extends public declarations, mocks, unit tests, and multiremote playground coverage.
  • Updates WebdriverIO peer requirements for the multiremote selection APIs.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains; the previously reported title-value handling, excess-expectation validation, clean-install dependencies, exclusive test, and lint-pipeline issues are fixed in the current code.

Important Files Changed

Filename Overview
src/util/executeBrowserCommand.ts Centralizes single-browser and multiremote command execution, expected-value mapping, instance validation, and result aggregation.
src/matchers/browser/toHaveTitle.ts Delegates title checks through the shared browser-command path while retaining regular-expression and asymmetric matcher support.
src/util/executeCommand.ts Extends command comparison and aggregation to multiremote element shapes and per-instance results.
src/util/elementsUtil.ts Adds recognition and normalization of multiremote single-element and collection values.
types/expect-webdriverio.d.ts Expands the public matcher declarations for multiremote browser and element targets.
package.json Restores lint validation, uses registry dependencies, and raises WebdriverIO peer requirements for the required multiremote APIs.
playgrounds/multi-remote-mocha/test/specs/wdio-matchers.test.ts Adds end-to-end multiremote browser and element matcher scenarios without leaving an exclusive test enabled.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart LR
    Test[Test assertion] --> Target{Received target}
    Target -->|Browser| BrowserCommand[Execute browser command]
    Target -->|Element or collection| ElementCommand[Resolve and execute element command]
    BrowserCommand --> Multi{Multiremote?}
    Multi -->|No| Single[Compare one browser value]
    Multi -->|Yes| Instances[Read and compare each selected instance]
    ElementCommand --> Resolve[Resolve single or multiremote elements]
    Resolve --> Compare[Compare element results]
    Single --> Result[Assertion result]
    Instances --> Result
    Compare --> Result
    Result --> Diagnostic[Target-aware failure diagnostic]
Loading

Reviews (6): Last reviewed commit: "Fix instabilities" | Re-trigger Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support for Multiremote

1 participant