Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Commit

Permalink
chore(deps): update dependencies and related docs (#3998)
Browse files Browse the repository at this point in the history
  • Loading branch information
sjelin committed Jan 24, 2017
1 parent 5856037 commit 23478f5
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 75 deletions.
73 changes: 30 additions & 43 deletions docs/mobile-setup.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,6 @@ page](https://github.com/angular/webdriver-manager/blob/master/docs/mobile.md)).

* Configure protractor:

additional dependencies:
```shell
npm install --save-dev wd wd-bridge
```

Config File:
```javascript
exports.config = {
Expand All @@ -49,17 +44,7 @@ exports.config = {
deviceName: 'Android Emulator',
},

baseUrl: 'http://10.0.2.2:8000',

// configuring wd in onPrepare
// wdBridge helps to bridge wd driver with other selenium clients
// See https://github.com/sebv/wd-bridge/blob/master/README.md
onPrepare: function () {
var wd = require('wd'),
protractor = require('protractor'),
wdBridge = require('wd-bridge')(protractor, wd);
wdBridge.initFromProtractor(exports.config);
}
baseUrl: 'http://10.0.2.2:8000'
};
```
*Note the following:*
Expand Down Expand Up @@ -91,11 +76,6 @@ Starting express web server in /workspace/protractor/testapp on port 8000

* Configure protractor:

additional dependencies:
```shell
npm install --save-dev wd wd-bridge
```

iPhone:
```javascript
exports.config = {
Expand All @@ -113,17 +93,7 @@ exports.config = {
deviceName: 'iPhone Simulator',
},

baseUrl: 'http://localhost:8000',

// configuring wd in onPrepare
// wdBridge helps to bridge wd driver with other selenium clients
// See https://github.com/sebv/wd-bridge/blob/master/README.md
onPrepare: function () {
var wd = require('wd'),
protractor = require('protractor'),
wdBridge = require('wd-bridge')(protractor, wd);
wdBridge.initFromProtractor(exports.config);
}
baseUrl: 'http://localhost:8000'
};
```

Expand All @@ -144,17 +114,7 @@ exports.config = {
deviceName: 'IPad Simulator',
},

baseUrl: 'http://localhost:8000',

// configuring wd in onPrepare
// wdBridge helps to bridge wd driver with other selenium clients
// See https://github.com/sebv/wd-bridge/blob/master/README.md
onPrepare: function () {
var wd = require('wd'),
protractor = require('protractor'),
wdBridge = require('wd-bridge')(protractor, wd);
wdBridge.initFromProtractor(exports.config);
}
baseUrl: 'http://localhost:8000'
};

```
Expand Down Expand Up @@ -231,3 +191,30 @@ exports.config = {
*Note the following:*
- browserName is 'android'
- baseUrl is 10.0.2.2 instead of localhost because it is used to access the localhost of the host machine in the android emulator

Using `wd` and `wd-bridge`
-------------------------------------

As of version 5.1.0, Protractor uses `webdriver-js-extender` to provide all the
mobile commands you should need (see the API page for details). However, if you
prefer `wd`, you can access it via `wd-bridge`. First, install both `wd` and
`wd-bridge` as `devDependencies`:

```shell
npm install --save-dev wd wd-bridge
```

Then, in your config file:

```javascript
// configuring wd in onPrepare
// wdBridge helps to bridge wd driver with other selenium clients
// See https://github.com/sebv/wd-bridge/blob/master/README.md
onPrepare: function () {
var wd = require('wd'),
protractor = require('protractor'),
wdBridge = require('wd-bridge')(protractor, wd);
wdBridge.initFromProtractor(exports.config);
}
```

2 changes: 1 addition & 1 deletion lib/frameworks/jasmine.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ exports.run = function(runner, specs) {
var jrunner = new JasmineRunner();
/* global jasmine */

require('jasminewd2').init(webdriver.promise.controlFlow());
require('jasminewd2').init(webdriver.promise.controlFlow(), webdriver);

var jasmineNodeOpts = runner.getConfig().jasmineNodeOpts;

Expand Down
36 changes: 7 additions & 29 deletions lib/webdriver-js-extender/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,35 +35,13 @@ goog.provide('webdriver_extensions');
webdriver_extensions.ExtendedWebDriver = function() {};

/**
* Schedules a command to retrieve the network connection type.
* Various appium commands, including the commands implemented by `wd`. The
* names may be different however, and commands which are implemented already by
* `selenium-webdriver` are not re-implemented by `webdriver-js-extender`.
*
* Network connection types are a bitmask with:
* 1 -> airplane mode
* 2 -> wifi
* 4 -> data
* See the [GitHub repo](https://github.com/angular/webdriver-js-extender) for
* details.
*
* @example
* expect(browser.getNetworkConnection()).toBe(6); //Expect wifi and data on
*
* @returns {!webdriver.promise.Promise.<number>} A promise that will be
* resolved with the current network connection type.
*/
webdriver_extensions.ExtendedWebDriver.prototype.getNetworkConnection = function() {};

/**
* Schedules a command to set the network connection type.
*
* Network connection types are a bitmask with:
* 1 -> airplane mode
* 2 -> wifi
* 4 -> data
*
* @example
* browser.setNetworkConnection(1); //Turn on airplane mode
* expect(browser.getNetworkConnection()).toBe(1);
*
* @param {number} type The type to set the network connection to.
* @returns {!webdriver.promise.Promise.<void>} A promise that will be
* resolved when the network connection type is set.
* @returns {!webdriver.promise.Promise.<*>}
*/
webdriver_extensions.ExtendedWebDriver.prototype.setNetworkConnection = function(type) {};
webdriver_extensions.ExtendedWebDriver.prototype.Appium_Commands = function() {};
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@
"chalk": "^1.1.3",
"glob": "^7.0.3",
"jasmine": "2.4.1",
"jasminewd2": "~0.1.0",
"jasminewd2": "^2.0.0",
"optimist": "~0.6.0",
"q": "1.4.1",
"saucelabs": "~1.3.0",
"selenium-webdriver": "3.0.1",
"source-map-support": "~0.4.0",
"webdriver-manager": "^11.1.1",
"webdriver-js-extender": "^0.2.2"
"webdriver-js-extender": "^1.0.0"
},
"devDependencies": {
"@types/chalk": "^0.4.28",
Expand Down

0 comments on commit 23478f5

Please sign in to comment.