-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Description
Have you read the Contributing Guidelines on issues?
- I have read the Contributing Guidelines on issues.
WebdriverIO Version
9.14.0
Node.js Version
20.8.0
Mode
WDIO Testrunner
Which capabilities are you using?
capabilities: [
{
"bstack:options": {
osVersion: '15.0',
deviceName: 'Samsung Galaxy S25',
realMobile: 'true',
appiumVersion: '2.4.1',
projectName: "ProjectName",
buildName: "BuildName + " + new Date().toISOString(),
sessionName: "SessionName",
seleniumVersion: "4.20.0",
debug: "true",
networkLogs: "true",
consoleLogs: "verbose",
},
browserName: 'chrome',
} as Capabilities.BrowserStackCapabilities,
],What happened?
console.log('before the test of the test: ', browser.isAndroid); // -> Returns false
(browser.isAndroid ? it.skip : it)('A test that should not run on Android devices', async function () {
console.log('inside of the test: ', browser.isAndroid); // -> Returns true
});
if browsername is set to chrome, isAndroid will return false in the first console log (the one outside of the test). If you remove browserName as a capability, the test will still run and the browser will default to chrome. If you set browserName to something completely irrelevant, e.g "Galaxy", the console log outside of the test will return true.
What is your expected behavior?
In my oppinion, browserName should always return true if the deviced used for executing the test is Android. The console log inside of the test appears to be working as expected, but a user should expect the same behaviour if isAndroid is used outside of a test (e.g as a condition to skip a test).
I don't know if a user should be able to set browserName to anything other than the two valid browsers available at Browserstack (samsung & chrome) but that is in my oppinion a different topic. No matter what value browserName is set to, isAndroid should always return true is the tests are executed on an Android device. It should not matter if I try access it from inside of a test or outside of a test.
How to reproduce the bug.
Use the snippet provided and add it to a spec-file:
console.log('before the test of the test: ', browser.isAndroid); // -> Returns false
(browser.isAndroid ? it.skip : it)('A test that should not run on Android devices', async function () {
console.log('inside of the test: ', browser.isAndroid); // -> Returns true
});
use the following capabilities when running your test using Browserstack:
capabilities: [
{
"bstack:options": {
osVersion: '15.0',
deviceName: 'Samsung Galaxy S25',
realMobile: 'true',
appiumVersion: '2.4.1',
projectName: "ProjectName",
buildName: "BuildName + " + new Date().toISOString(),
sessionName: "SessionName",
seleniumVersion: "4.20.0",
debug: "true",
networkLogs: "true",
consoleLogs: "verbose",
},
browserName: 'chrome',
} as Capabilities.BrowserStackCapabilities,
],
Adjust the browserName value to "galaxy" instead of chrome and observe how the first console logs outputs true instead of false which in my oppinion is the expected behaviour. browserName when using an Android device should not determine whether isAndroid returns true or false
Relevant log output
-Code of Conduct
- I agree to follow this project's Code of Conduct
Is there an existing issue for this?
- I have searched the existing issues