2

I'm trying to automate test cases for a websocket based chat app and the Multiremote function of Codeceptjs with the WebdriverIO helper, called my attention. However, I'm struggling to make it work.

I would like to set my codecept.js config file and test files correctly to switch and act back and forth between one browser and the other one. { "output": "./output", "helpers": { "WebDriverIO": { "url": "localhost", "browser":"chrome", "multiremote": { "MyChrome1": { "desiredCapabilities": { "browserName": "chrome" } }, "MyChrome2": { "desiredCapabilities": { "browserName": "chrome" } } }, "restart": false, "windowSize": "maximize", "timeouts": { "script": 60000, "page load": 10000, "implicit": 5000 } } }, "include": { "I": "./steps/ICustom_steps.js", "loginPage": "./page_objects/login_page/login_page.js", "chatPage": "./page_objects/chat_page/chat_page.js" }, "mocha": {}, "bootstrap": false, "teardown": null, "hooks": [], "tests": "./test_cases/*_test.js", "timeout": 10000, "name": "chat app test" }

I can see the 2 browsers popping up but how can I set the test files correctly to switch interact back and forth between one browser and the other one.

fndg87
  • 331
  • 4
  • 13

1 Answers1

1

I've just figured out that it can be introduced in a helper method that calls the WebDriverIO helper. For instance,

useBrowserAs() {
    let client = this.helpers['WebDriverIO'].browser;
    let browser1 = client.select('browser1');
    ...INSERT YOUR WEBDRIVER IO ACTION HERE FOR BROWSER 1
    let browser2 = client.select('browser2');
    ...INSERT YOUR WEBDRIVER IO ACTION HERE FOR BROWSER 2
}

after that, it can be introduced in the I actor.

fndg87
  • 331
  • 4
  • 13