Skip to content

gavvvr/wdio-electron-service-818

Repository files navigation

wdio-electron-service bug

switchFrame doesn't accept not-awaited element

Based on switchFrame() WDIO docs, the following should work:

await browser.switchFrame($('iframe'))

It's also proven by e2e test in main WDIO repository:

it('should reset the frame when the page is reloaded', async () => {
    await browser.url('https://the-internet.herokuapp.com/iframe')
    await expect($('#tinymce')).not.toBePresent()
    await browser.switchFrame($('iframe'))
    await expect($('#tinymce')).toBePresent()
    await browser.refresh()
    await expect($('#tinymce')).not.toBePresent()
    await browser.switchFrame($('iframe'))
    await expect($('#tinymce')).toBePresent()
})

However await browser.switchFrame($('iframe')) construct won't work with wdio-electron-service unless $('iframe') is awaited.

This repo demonstrates the problem.

Steps to reproduce

  1. npm i to resolve dependencies
  2. npm run package to build an electron app displaying iframe from https://the-internet.herokuapp.com/iframe
  3. npm run wdio to execute e2e test. It will fail if switchFrame() argument is not awaited