Skip to content

Appium: plaform "Android" (upper case) doesn't work for comparation in WebDriver methods #5213

@mirao

Description

@mirao

The fix #5107 doesn't work in the WebDriver methods (e.g. in checkOption()) if the config has set platform: "Android" instead of platform: "android"

    helpers: {
        Appium: {
            appiumV2: true,
            platform: "Android",
            ...
        }
    }

Note that the upper case form is allowed according to the docs https://codecept.io/helpers/Appium/#appium and here:

const supportedPlatform = {
android: 'Android',
iOS: 'iOS',
}

The platformName is normalized in the WebDriver helper's method _startBrowser, but it's used only if you use WebDriver directly, not when using Appium.

if (this.browser.capabilities && this.browser.capabilities.platformName) {
this.browser.capabilities.platformName = this.browser.capabilities.platformName.toLowerCase()
}

So a solution should be normalization of the attribute in Appium. Adding of config.capabilities.platformName = config.capabilities.platformName.toLowerCase() under this condition (as the 2nd line) helps (advised by Copilot)

if (config.capabilities.platformName) {
this.platform = config.capabilities.platformName.toLowerCase()
}

A workaround is using platform: "android" instead of platform: "Android" in your CodeceptJS config

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions