Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for Multiremote #106

Open
christian-bromann opened this issue Jun 29, 2020 · 6 comments
Open

Support for Multiremote #106

christian-bromann opened this issue Jun 29, 2020 · 6 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@christian-bromann
Copy link
Member

Allow users to use this assertion library with multiremote. Using the isMultiremote flag of the browser object should help to determine the current mode and allows to then iterate over the multiremote instances to do separate assertions.

@DerekCL

This comment has been minimized.

@DerekCL
Copy link

DerekCL commented Feb 3, 2021

@christian-bromann Is there a workaround you would recommend for right now? Currently I have a solution that works with chai that looks like this

`
const expectChai = require('chai').expect;

export const messageDevices = (
selector: $Params = '#form-devices h1',
): Promise => {
return $(selector);
};

const test = async () => {
const messageDevicesElement = await messageDevices();
// @ts-ignore
const browser: boolean[] = messageDevicesElement.isDisplayed();
browser.forEach((result) => {
expectChai(result).to.equal(true);
});
},`

The problem I have with this approach is that $() returns a type of Promise<WebdriverIO.Element>;
When we get the result in messageDevices() since this is using Multiremote we get an array of browsers on messageDevicesElement.isDisplayed(); but I have to use // @ts-ignore because it expects a boolean and not an array of booleans.

@evilC
Copy link

evilC commented May 14, 2021

@christian-bromann is there any movement on this?
If not, what's the blocker? Is it something you don't know how to solve, or is it just a case of bandwidth?
I'm pretty certain that it's beyond my abilities to fix, but I may be able to persuade my employer to throw some man hours at this

@christian-bromann
Copy link
Member Author

but I may be able to persuade my employer to throw some man hours at this

That would be idea, see the help wanted label 😉

@amandaflagg
Copy link

amandaflagg commented Jul 8, 2021

@evilC @DerekCL i have been able to work around this with my current setup i have been building out, which involves defining each browser separately for tests. for example at the top of a test file, i have the following in order to use multiremote with two different instances of chrome (both defined in wdio.conf.js):
declare const mobileChromeBrowser: WebdriverIO.MultiRemoteBrowser['mobileChromeBrowser'];
declare const chromeBrowser: WebdriverIO.MultiRemoteBrowser['chromeBrowser'];

then within the test, you can use expect based upon each browser individually. like, expect(chromeBrowser).toHaveUrl('www')

@christian-bromann
Copy link
Member Author

@amandaflagg it would be however also nice to be able to make assertion for one command on both browsers, e.g.:

expect(browser).toHaveTitle(["titleA", "titleB"])

Maybe we can even allow a fancier syntax like:

expect(browser).toHaveTitle({
    mobileChromeBrowser: "titleA",
    chromeBrowser: "titleB"
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants