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

Commit 23478f5

Browse files
authored
chore(deps): update dependencies and related docs (#3998)
1 parent 5856037 commit 23478f5

File tree

4 files changed

+40
-75
lines changed

4 files changed

+40
-75
lines changed

docs/mobile-setup.md

+30-43
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,6 @@ page](https://github.com/angular/webdriver-manager/blob/master/docs/mobile.md)).
2929

3030
* Configure protractor:
3131

32-
additional dependencies:
33-
```shell
34-
npm install --save-dev wd wd-bridge
35-
```
36-
3732
Config File:
3833
```javascript
3934
exports.config = {
@@ -49,17 +44,7 @@ exports.config = {
4944
deviceName: 'Android Emulator',
5045
},
5146

52-
baseUrl: 'http://10.0.2.2:8000',
53-
54-
// configuring wd in onPrepare
55-
// wdBridge helps to bridge wd driver with other selenium clients
56-
// See https://github.com/sebv/wd-bridge/blob/master/README.md
57-
onPrepare: function () {
58-
var wd = require('wd'),
59-
protractor = require('protractor'),
60-
wdBridge = require('wd-bridge')(protractor, wd);
61-
wdBridge.initFromProtractor(exports.config);
62-
}
47+
baseUrl: 'http://10.0.2.2:8000'
6348
};
6449
```
6550
*Note the following:*
@@ -91,11 +76,6 @@ Starting express web server in /workspace/protractor/testapp on port 8000
9176

9277
* Configure protractor:
9378

94-
additional dependencies:
95-
```shell
96-
npm install --save-dev wd wd-bridge
97-
```
98-
9979
iPhone:
10080
```javascript
10181
exports.config = {
@@ -113,17 +93,7 @@ exports.config = {
11393
deviceName: 'iPhone Simulator',
11494
},
11595

116-
baseUrl: 'http://localhost:8000',
117-
118-
// configuring wd in onPrepare
119-
// wdBridge helps to bridge wd driver with other selenium clients
120-
// See https://github.com/sebv/wd-bridge/blob/master/README.md
121-
onPrepare: function () {
122-
var wd = require('wd'),
123-
protractor = require('protractor'),
124-
wdBridge = require('wd-bridge')(protractor, wd);
125-
wdBridge.initFromProtractor(exports.config);
126-
}
96+
baseUrl: 'http://localhost:8000'
12797
};
12898
```
12999

@@ -144,17 +114,7 @@ exports.config = {
144114
deviceName: 'IPad Simulator',
145115
},
146116

147-
baseUrl: 'http://localhost:8000',
148-
149-
// configuring wd in onPrepare
150-
// wdBridge helps to bridge wd driver with other selenium clients
151-
// See https://github.com/sebv/wd-bridge/blob/master/README.md
152-
onPrepare: function () {
153-
var wd = require('wd'),
154-
protractor = require('protractor'),
155-
wdBridge = require('wd-bridge')(protractor, wd);
156-
wdBridge.initFromProtractor(exports.config);
157-
}
117+
baseUrl: 'http://localhost:8000'
158118
};
159119

160120
```
@@ -231,3 +191,30 @@ exports.config = {
231191
*Note the following:*
232192
- browserName is 'android'
233193
- 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
194+
195+
Using `wd` and `wd-bridge`
196+
-------------------------------------
197+
198+
As of version 5.1.0, Protractor uses `webdriver-js-extender` to provide all the
199+
mobile commands you should need (see the API page for details). However, if you
200+
prefer `wd`, you can access it via `wd-bridge`. First, install both `wd` and
201+
`wd-bridge` as `devDependencies`:
202+
203+
```shell
204+
npm install --save-dev wd wd-bridge
205+
```
206+
207+
Then, in your config file:
208+
209+
```javascript
210+
// configuring wd in onPrepare
211+
// wdBridge helps to bridge wd driver with other selenium clients
212+
// See https://github.com/sebv/wd-bridge/blob/master/README.md
213+
onPrepare: function () {
214+
var wd = require('wd'),
215+
protractor = require('protractor'),
216+
wdBridge = require('wd-bridge')(protractor, wd);
217+
wdBridge.initFromProtractor(exports.config);
218+
}
219+
```
220+

lib/frameworks/jasmine.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ exports.run = function(runner, specs) {
6363
var jrunner = new JasmineRunner();
6464
/* global jasmine */
6565

66-
require('jasminewd2').init(webdriver.promise.controlFlow());
66+
require('jasminewd2').init(webdriver.promise.controlFlow(), webdriver);
6767

6868
var jasmineNodeOpts = runner.getConfig().jasmineNodeOpts;
6969

lib/webdriver-js-extender/index.js

+7-29
Original file line numberDiff line numberDiff line change
@@ -35,35 +35,13 @@ goog.provide('webdriver_extensions');
3535
webdriver_extensions.ExtendedWebDriver = function() {};
3636

3737
/**
38-
* Schedules a command to retrieve the network connection type.
38+
* Various appium commands, including the commands implemented by `wd`. The
39+
* names may be different however, and commands which are implemented already by
40+
* `selenium-webdriver` are not re-implemented by `webdriver-js-extender`.
3941
*
40-
* Network connection types are a bitmask with:
41-
* 1 -> airplane mode
42-
* 2 -> wifi
43-
* 4 -> data
42+
* See the [GitHub repo](https://github.com/angular/webdriver-js-extender) for
43+
* details.
4444
*
45-
* @example
46-
* expect(browser.getNetworkConnection()).toBe(6); //Expect wifi and data on
47-
*
48-
* @returns {!webdriver.promise.Promise.<number>} A promise that will be
49-
* resolved with the current network connection type.
50-
*/
51-
webdriver_extensions.ExtendedWebDriver.prototype.getNetworkConnection = function() {};
52-
53-
/**
54-
* Schedules a command to set the network connection type.
55-
*
56-
* Network connection types are a bitmask with:
57-
* 1 -> airplane mode
58-
* 2 -> wifi
59-
* 4 -> data
60-
*
61-
* @example
62-
* browser.setNetworkConnection(1); //Turn on airplane mode
63-
* expect(browser.getNetworkConnection()).toBe(1);
64-
*
65-
* @param {number} type The type to set the network connection to.
66-
* @returns {!webdriver.promise.Promise.<void>} A promise that will be
67-
* resolved when the network connection type is set.
45+
* @returns {!webdriver.promise.Promise.<*>}
6846
*/
69-
webdriver_extensions.ExtendedWebDriver.prototype.setNetworkConnection = function(type) {};
47+
webdriver_extensions.ExtendedWebDriver.prototype.Appium_Commands = function() {};

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,14 @@
1919
"chalk": "^1.1.3",
2020
"glob": "^7.0.3",
2121
"jasmine": "2.4.1",
22-
"jasminewd2": "~0.1.0",
22+
"jasminewd2": "^2.0.0",
2323
"optimist": "~0.6.0",
2424
"q": "1.4.1",
2525
"saucelabs": "~1.3.0",
2626
"selenium-webdriver": "3.0.1",
2727
"source-map-support": "~0.4.0",
2828
"webdriver-manager": "^11.1.1",
29-
"webdriver-js-extender": "^0.2.2"
29+
"webdriver-js-extender": "^1.0.0"
3030
},
3131
"devDependencies": {
3232
"@types/chalk": "^0.4.28",

0 commit comments

Comments
 (0)