codeceptjs / CodeceptJS

Supercharged End 2 End Testing Framework for NodeJS
http://codecept.io
MIT License
4.11k stars 724 forks source link

Passing ios & android locator values for a single command produces different results than if they were run separately #2551

Open roam-qa-alx opened 4 years ago

roam-qa-alx commented 4 years ago

What are you trying to achieve?

Reduce lines of code & complexity by passing in the android and ios locators for functions. Example below: I.see({ android: this.home_navTab_android, ios: this.home_navTab_ios });

What do you get instead?

Certain commands or selectors fail when using this method. However, I get different results if I use I.see() and pass in single OS locator. i.e Call the OS specific functions individually for each platform.

Using I.see(this.home_navTab_android);

Test output:
expected current context //* to include "#au.com.flexirent.skye:id/navigation_home"

Using: I.see({ android: this.home_navTab_android, ios: this.home_navTab_ios });

Test output:
expected current context //* to include "[object Object]"

Details

* CodeceptJS version: ^2.6.7
* NodeJS Version: v14.3.0
* Operating System: Mac 10.15.5
* puppeteer || webdriverio || protractor || testcafe version (if related)
* Configuration file:

Appium: {
      host: "0.0.0.0",
      port: 4723,
      platform: "Android",
      newCommandTimeout: 10000,
      desiredCapabilities: {
        platformName: 'Android',
        deviceName: 'any',
        udid: 'emulator-5554',
        automationName: 'UiAutomator2',
        appPackage: '',
        appActivity: '',
      },
    },
idxn commented 4 years ago

It's probably the issue with logging. I have check the appium helper and I don't think it's going to have an issue with locator handling. I'll try to reproduce and make a fix if I could.

roam-qa-alx commented 4 years ago

Hi @idxn , thanks for that. Did you try to repro the issue yourself? I agree about the logging as I use the same locator strategy for other elements and they can be found whereas in this case, it's some other reason 🤔