Skip to content

Conversation

@flyskywhy
Copy link
Contributor

Test case with locator ~ now can write once run on Android, iOS and Web with #728 , but if write I.runOnIOS() I.runOnAndroid() or I.runInWeb() in test case, then we also need a reactweb_helper.js required in codecept.conf.js , if this PR is accepted and publish a new version, then the reactweb_helper.js is not needed.

* placeholder for ~ locator only test case write once run on both Appium and WebDriverIO
*/
runOnAndroid(caps, fn) {
return;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary return statement no-useless-return

* placeholder for ~ locator only test case write once run on both Appium and WebDriverIO
*/
runOnIOS(caps, fn) {
return;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary return statement no-useless-return

@DavertMik
Copy link
Contributor

Thanks for PR. I'd ask you to wait for about an hour and resend it. I'm heavily reworking WebDriverIO and Appium helpers right now.

I have some questions:

  • why won't you use Appium helper for web testing then?
  • why runInWeb is empty for WebDriverIO - WebDriverIO expects to be in web mode all the time

@flyskywhy
Copy link
Contributor Author

  1. why won't you use Appium helper for web testing then?

Is that possible? As you can see in my codecept.conf.js , Appium use app: './android/app/build/outputs/apk/app-debug.apk' , but WebDriverIO use url: 'http://localhost:3000' , and server side appium listen 4723, server side webdriver-manager listen 4444

  1. why runInWeb is empty for WebDriverIO - WebDriverIO expects to be in web mode all the time

No, runInWeb is not empty fro WebDriverIO, it return fn() , only runOnIOS and runOnAndroid is empty. That's why below is excuted in init.js with WebDriverIO. And because if (!this.isWeb) return; in runInWeb(fn) of Appium , that's why below is not excuted with Appium.

        I.runInWeb(() => {
            I.amOnPage('/');
        });

@DavertMik
Copy link
Contributor

  1. Please try to pass in url and browser to Appium helper. It should work with websites too.
  2. Sorry, I missed it. So that makes more sense to me. But please try to run Appium for website

@flyskywhy
Copy link
Contributor Author

If my test case is just run on Mobile native and PC browser, OK, and I tried successfully, just change from

    helpers: process.profile === 'android' || process.profile === 'ios' ? {
        Appium: {
            smartWait: 35000,
            app: process.profile === 'android' ? './android/app/build/outputs/apk/app-debug.apk' : './ios/build/Build/Products/Release-iphonesimulator/e2etest.app',
            platform: process.profile === 'android' ? 'Android' : 'iOS',
            desiredCapabilities: {
                platformVersion: process.profile === 'ios' ? '10.3' : undefined,
                deviceName: process.profile === 'ios' ? 'iPhone Simulator' : 'Android Emulator'
            }
        }
    } : {
        WebDriverIO: {
            url: 'http://localhost:3000',
            browser: 'chrome'
        },
        ReactWeb: {
            require: CODECEPT_WORK_PATH + '/helpers/reactweb_helper.js'
        }
    },

to

    helpers: {
        Appium: {
            port: process.profile === 'web' ? '4444' : '4723',
            smartWait: 35000,
            url: 'http://localhost:3000',
            browser: process.profile === 'web' ? 'chrome' : null,
            app: process.profile === 'web' ? null : (process.profile === 'android' ? './android/app/build/outputs/apk/app-debug.apk' : './ios/build/Build/Products/Release-iphonesimulator/e2etest.app'),
            platform: process.profile === 'web' ? null : (process.profile === 'android' ? 'Android' : 'iOS'),
            desiredCapabilities: {
                platformVersion: process.profile === 'ios' ? '10.3' : undefined,
                deviceName: process.profile === 'ios' ? 'iPhone Simulator' : 'Android Emulator'
            }
        }
    },

But if test case alse want to run on Mobile browser and Mobile native and PC browser, that's so complicated and I don't have the aspiration to edit the helpers: {} again...

So I think that the three APIs only in Appium also support in WebDriverIO is elegant, and other APIs only in Appium can just be wraped by the three APIs to be used in WebDriverIO.

@DavertMik
Copy link
Contributor

Ok, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants