New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve Appium support in Nightwatch #3519
Conversation
Regarding "why browsername=null was needed earlier", I might be able to provide additional context. I introduced some checking logic a while back for NW 1.7: #2882 I suspect this was to allow support for older versions of Appium that I guess Browserstack was using by default at the time? It's been a fair while since I've looked at this though, so that might be the limit of my memory :) |
Thanks @Topperfalkon, your comment was helpful. It helped me realize that But with the current change, users will be able to set |
52ba4ea
to
c76e481
Compare
Everything is done in this PR now according to me. There are just two issues with BrowserStack that are left:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To support Browserstack mobile and web, we can have two classes that extends Browserstack and we can add in a createDriver
of appium a Mixin method to Browserstack Mobile class prototype
Users can use `${__dirname}/relative/path` in their config file.
Commit e000786 contains my approach for solving the BrowserStack related issues and commit 1167538 contains Ravi's approach for solving the problem. I personally like my approach better for its simplicity but if we don't want to have |
It's better to have different classes rather than hiding every functionality under one class. It will help us in the future when adding additional capabilities which are specific to app-automate. Technically we should use selenium driver instance created from the builder for automate sessions in BrowserStack. |
Makes sense! |
I think for browserstack classes we can create a separate folder and rename it automate and AppAutomate respectively |
22689db
to
27ba564
Compare
} | ||
} | ||
|
||
Object.assign(Automate.prototype, AppiumMixin); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can't we use normal inheritance here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could but then browserstack.js
would have to extend to appium.js
because we need a few functionalities from the AppiumServer
class in automate and app-automate and then to make it work, we'd have to write some additional code in appium.js
related to BrowserStack. Commit e000786 does just that.
But then, as I think now, browserstack.js
and appium.js
should be more or less independent and we shouldn't need to write additional code in appium.js
to support browserstack.js
, because otherwise when appium.js
would grow at some later point of time, we'd always have to do something extra to ensure that browserstack still works fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
or both browserstack and appium could extend a base class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check 0706064.
lib/runner/cli/cli.js
Outdated
@@ -469,8 +469,11 @@ class CliRunner { | |||
let promise = Promise.resolve(); | |||
|
|||
if (this.test_settings.selenium && this.test_settings.selenium.start_process) { | |||
const SeleniumServer = require('../../transport/selenium-webdriver/selenium.js'); | |||
this.seleniumService = SeleniumServer.startServer(this.test_settings); | |||
const Server = this.test_settings.selenium.use_appium |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should use a factory here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You mean factory
as variable name or use a TransportFactory
class method to decide whether appium is being used or not?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use a factory to create the server
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please check 54587b1 if it is fine.
d1b387d
to
54587b1
Compare
13eac3a
to
e7fac99
Compare
This PR does the following:
use_appium
property totrue
in theselenium
config of the Nightwatch configuration file when using Appium server. Ex. config:default_path_prefix
property to''
in theselenium
config of your Nightwatch configuration file:appium
package can be used. The above configs work with the local installation ofappium
. To use a global installation ofappium
, setserver_path
property ofselenium
config to 'appium' or any other command you want to start the Appium Server with.browserName: null
to use Nightwatch with the Appium server is now deprecated. You should setuse_appium
property ofselenium
config totrue
to use Nightwatch with Appium Server, as mentioned in the second point above.