_isNativeContext is not detected correctly if there are several browsers (web+appium)
kluverua opened this issue · 4 comments
Environment:
- Node.js version: 20.12.2
- NPM version: 10.3.0
- Browser name and version: Chrome 126 + Appium
- Platform name and version: Windows 10
- WebdriverIO version: 8.32.3
@wdio/visual-service
version: 5.1.0
Config of WebdriverIO
capabilities: {
webBrowser: {
capabilities: {
browserName: 'chrome',
browserVersion: 'stable'
}
},
appiumBrowser: {
hostname: '127.0.0.1',
port: 4723,
capabilities: {
'appium:avd': avd,
'appium:platformName': 'Android',
'appium:browserName': '',
'appium:automationName': 'uiautomator2',
}
}
}
Config of @wdio/visual-service
[
"visual",
{
formatImageName: '{tag}-{logName}',
logLevel: 'debug',
}
]
Describe the bug
Service can't determine if context is native if WDIO uses MultiRemote (web + appium).
I guess the problem in this function determineNativeContext (https://github.com/webdriverio/visual-testing/blob/main/packages/visual-service/src/utils.ts)
export function determineNativeContext(
driver: WebdriverIO.Browser | WebdriverIO.MultiRemoteBrowser
): boolean {
if (driver.isMobile) {
return !!(driver.requestedCapabilities // <-- driver.requestedCapabilities is undefined
To Reproduce
Steps to reproduce the behavior:
- Setup wdio for multi remote (see example above)
await browser.checkScreen("examplePaged", {});
Expected behavior
variable this._isNativeContext
should be true for appium driver
Log
[0-0] 2024-07-05T18:10:40.601Z INFO webdriver: COMMAND executeScript(<fn>, <object>)
[0-0] 2024-07-05T18:10:40.601Z INFO webdriver: [POST] http://127.0.0.1:4723/session/a07bed4f-83d4-49c1-a03b-76e03fa89d4c/execute/sync
[0-0] 2024-07-05T18:10:40.601Z INFO webdriver: DATA { script: 'waitForFonts(...) [472 bytes]', args: [] }
[0-0] 2024-07-05T18:10:40.610Z WARN webdriver: Request failed with status 405 due to Method is not implemented
[0-0] 2024-07-05T18:10:40.610Z INFO webdriver: Retrying 1/1
[0-0] 2024-07-05T18:10:40.610Z INFO webdriver: [POST] http://127.0.0.1:4723/session/a07bed4f-83d4-49c1-a03b-76e03fa89d4c/execute/sync
[0-0] 2024-07-05T18:10:40.610Z INFO webdriver: DATA { script: 'waitForFonts(...) [472 bytes]', args: [] }
[0-0] 2024-07-05T18:10:40.618Z ERROR webdriver: Request failed with status 405 due to unknown method: Method is not implemented
[0-0] 2024-07-05T18:10:40.618Z INFO webdriver: COMMAND executeScript(<fn>, <object>)
[0-0] 2024-07-05T18:10:40.619Z INFO webdriver: [POST] http://127.0.0.1:4723/session/a07bed4f-83d4-49c1-a03b-76e03fa89d4c/execute/sync
[0-0] 2024-07-05T18:10:40.619Z INFO webdriver: DATA { script: 'hideScrollBars(...) [186 bytes]', args: [ true ] }
[0-0] 2024-07-05T18:10:40.626Z WARN webdriver: Request failed with status 405 due to Method is not implemented
[0-0] 2024-07-05T18:10:40.626Z INFO webdriver: Retrying 1/1
[0-0] 2024-07-05T18:10:40.626Z INFO webdriver: [POST] http://127.0.0.1:4723/session/a07bed4f-83d4-49c1-a03b-76e03fa89d4c/execute/sync
[0-0] 2024-07-05T18:10:40.626Z INFO webdriver: DATA { script: 'hideScrollBars(...) [186 bytes]', args: [ true ] }
[0-0] 2024-07-05T18:10:40.633Z ERROR webdriver: Request failed with status 405 due to unknown method: Method is not implemented
[0-0] Error in "Approvals should be displayed blank screen if there is no visa. BT-31786, RND-T13341"
unknown method: Method is not implemented
waitForFonts hideScrollBars should not be called for native application
Thanks, this is a bug and needs to be fixed, and help would be appreciated
I'm working on a fix, hope to have it out in 48-72 hours
Will be fixed in #423
Please retry with the latest version which has just been released, see https://github.com/webdriverio/visual-testing/releases/tag/%40wdio%2Fvisual-service%405.1.1