@webex/test-helper-automation 2.59.2 → 2.59.3-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +6 -6
- package/README.md +31 -31
- package/babel.config.js +3 -3
- package/dist/index.js +7 -7
- package/dist/index.js.map +1 -1
- package/dist/wd/accept-grant.js +2 -2
- package/dist/wd/accept-grant.js.map +1 -1
- package/dist/wd/login.js +10 -10
- package/dist/wd/login.js.map +1 -1
- package/dist/wd/print-logs.js +2 -2
- package/dist/wd/print-logs.js.map +1 -1
- package/dist/wd/submit-password.js +14 -14
- package/dist/wd/submit-password.js.map +1 -1
- package/jest.config.js +3 -3
- package/package.json +12 -11
- package/process +1 -1
- package/src/index.js +69 -69
- package/src/wd/accept-grant.js +19 -19
- package/src/wd/login.js +43 -43
- package/src/wd/print-logs.js +28 -28
- package/src/wd/submit-password.js +57 -57
package/.eslintrc.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
const config = {
|
|
2
|
-
root: true,
|
|
3
|
-
extends: ['@webex/eslint-config-legacy'],
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
module.exports = config;
|
|
1
|
+
const config = {
|
|
2
|
+
root: true,
|
|
3
|
+
extends: ['@webex/eslint-config-legacy'],
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
module.exports = config;
|
package/README.md
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
# @webex/test-helper-automation
|
|
2
|
-
|
|
3
|
-
[](https://github.com/RichardLitt/standard-readme)
|
|
4
|
-
|
|
5
|
-
>
|
|
6
|
-
|
|
7
|
-
- [Install](#install)
|
|
8
|
-
- [Usage](#usage)
|
|
9
|
-
- [Contribute](#contribute)
|
|
10
|
-
- [Maintainers](#maintainers)
|
|
11
|
-
- [License](#license)
|
|
12
|
-
|
|
13
|
-
## Install
|
|
14
|
-
|
|
15
|
-
```bash
|
|
16
|
-
npm install --save @webex/test-helper-automation
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
## Usage
|
|
20
|
-
|
|
21
|
-
## Maintainers
|
|
22
|
-
|
|
23
|
-
This package is maintained by [Cisco Webex for Developers](https://developer.webex.com/).
|
|
24
|
-
|
|
25
|
-
## Contribute
|
|
26
|
-
|
|
27
|
-
Pull requests welcome. Please see [CONTRIBUTING.md](https://github.com/webex/webex-js-sdk/blob/master/CONTRIBUTING.md) for more details.
|
|
28
|
-
|
|
29
|
-
## License
|
|
30
|
-
|
|
31
|
-
© 2016-2020 Cisco and/or its affiliates. All Rights Reserved.
|
|
1
|
+
# @webex/test-helper-automation
|
|
2
|
+
|
|
3
|
+
[](https://github.com/RichardLitt/standard-readme)
|
|
4
|
+
|
|
5
|
+
>
|
|
6
|
+
|
|
7
|
+
- [Install](#install)
|
|
8
|
+
- [Usage](#usage)
|
|
9
|
+
- [Contribute](#contribute)
|
|
10
|
+
- [Maintainers](#maintainers)
|
|
11
|
+
- [License](#license)
|
|
12
|
+
|
|
13
|
+
## Install
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install --save @webex/test-helper-automation
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Usage
|
|
20
|
+
|
|
21
|
+
## Maintainers
|
|
22
|
+
|
|
23
|
+
This package is maintained by [Cisco Webex for Developers](https://developer.webex.com/).
|
|
24
|
+
|
|
25
|
+
## Contribute
|
|
26
|
+
|
|
27
|
+
Pull requests welcome. Please see [CONTRIBUTING.md](https://github.com/webex/webex-js-sdk/blob/master/CONTRIBUTING.md) for more details.
|
|
28
|
+
|
|
29
|
+
## License
|
|
30
|
+
|
|
31
|
+
© 2016-2020 Cisco and/or its affiliates. All Rights Reserved.
|
package/babel.config.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const babelConfigLegacy = require('@webex/babel-config-legacy');
|
|
2
|
-
|
|
3
|
-
module.exports = babelConfigLegacy;
|
|
1
|
+
const babelConfigLegacy = require('@webex/babel-config-legacy');
|
|
2
|
+
|
|
3
|
+
module.exports = babelConfigLegacy;
|
package/dist/index.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
|
4
4
|
var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
|
|
5
5
|
var _now = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/date/now"));
|
|
6
|
-
/*!
|
|
7
|
-
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
6
|
+
/*!
|
|
7
|
+
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
10
|
/* istanbul ignore next */
|
|
@@ -30,11 +30,11 @@ chai.should();
|
|
|
30
30
|
chaiAsPromised.transferPromiseness = wd.transferPromiseness;
|
|
31
31
|
requireDir(path.join(__dirname, 'wd'));
|
|
32
32
|
module.exports = {
|
|
33
|
-
/**
|
|
34
|
-
* Resolves with a wd browser instance
|
|
35
|
-
* @param {Object} pkg package.json as JavaScript Object
|
|
36
|
-
* @param {Object} browserDef wd-compatible browser definition
|
|
37
|
-
* @returns {Promise}
|
|
33
|
+
/**
|
|
34
|
+
* Resolves with a wd browser instance
|
|
35
|
+
* @param {Object} pkg package.json as JavaScript Object
|
|
36
|
+
* @param {Object} browserDef wd-compatible browser definition
|
|
37
|
+
* @returns {Promise}
|
|
38
38
|
*/
|
|
39
39
|
createBrowser: function createBrowser(pkg, browserDef) {
|
|
40
40
|
if (!pkg) {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_promise","default","require","polyfill","path","chai","chaiAsPromised","_require","defaults","requireDir","wd","use","should","transferPromiseness","join","__dirname","module","exports","createBrowser","pkg","browserDef","Error","browserName","build","process","env","BUILD_NUMBER","concat","USER","name","_now","public","tunnelIdentifier","SC_TUNNEL_IDENTIFIER","browser","promiseChainRemote","init","setImplicitWaitTimeout","setWindowSize","then"],"sources":["index.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\n/* istanbul ignore next */\nif (typeof Promise === 'undefined') {\n // eslint-disable-next-line global-require\n require('es6-promise').polyfill();\n}\n\n// Reminder: this is intentionally a different instance of chai than\n// @webex/test-helper-chai.\nconst path = require('path');\n\nconst chai = require('chai');\n// Note: this is probably the only place we should use chai-as-promised; it's\n// incompatible with IE 11, so can't go into browser tests. Once we move to\n// wdio, it can be removed from here as well.\nconst chaiAsPromised = require('chai-as-promised');\nconst {defaults} = require('lodash');\nconst requireDir = require('require-dir');\nconst wd = require('wd');\n\nchai.use(chaiAsPromised);\nchai.should();\nchaiAsPromised.transferPromiseness = wd.transferPromiseness;\n\nrequireDir(path.join(__dirname, 'wd'));\n\nmodule.exports = {\n /**\n * Resolves with a wd browser instance\n * @param {Object} pkg package.json as JavaScript Object\n * @param {Object} browserDef wd-compatible browser definition\n * @returns {Promise}\n */\n createBrowser: function createBrowser(pkg, browserDef) {\n if (!pkg) {\n throw new Error('pkg is required');\n }\n\n if (!browserDef) {\n browserDef = {browserName: 'chrome'};\n }\n\n if (!browserDef) {\n throw new Error('No browser definition available');\n }\n\n browserDef = defaults(browserDef, {\n build: process.env.BUILD_NUMBER || `local-${process.env.USER}-${pkg.name}-${Date.now()}`,\n name: `${pkg.name} (automation)`,\n public: 'team',\n tunnelIdentifier: process.env.SC_TUNNEL_IDENTIFIER,\n });\n\n const browser = process.env.SC_TUNNEL_IDENTIFIER\n ? wd.promiseChainRemote('ondemand.saucelabs.com', 80)\n : wd.promiseChainRemote();\n\n return browser\n .init(browserDef)\n .setImplicitWaitTimeout(10000)\n .setWindowSize(1600, 1200)\n .then(() => browser);\n },\n\n wd,\n};\n"],"mappings":";;;;;AAAA;AACA;AACA;;AAEA;AACA,IAAI,OAAAA,QAAA,CAAAC,OAAc,KAAK,WAAW,EAAE;EAClC;EACAC,OAAO,CAAC,aAAa,CAAC,CAACC,QAAQ,EAAE;AACnC;;AAEA;AACA;AACA,IAAMC,IAAI,GAAGF,OAAO,CAAC,MAAM,CAAC;AAE5B,IAAMG,IAAI,GAAGH,OAAO,CAAC,MAAM,CAAC;AAC5B;AACA;AACA;AACA,IAAMI,cAAc,GAAGJ,OAAO,CAAC,kBAAkB,CAAC;AAClD,IAAAK,QAAA,GAAmBL,OAAO,CAAC,QAAQ,CAAC;EAA7BM,QAAQ,GAAAD,QAAA,CAARC,QAAQ;AACf,IAAMC,UAAU,GAAGP,OAAO,CAAC,aAAa,CAAC;AACzC,IAAMQ,EAAE,GAAGR,OAAO,CAAC,IAAI,CAAC;AAExBG,IAAI,CAACM,GAAG,CAACL,cAAc,CAAC;AACxBD,IAAI,CAACO,MAAM,EAAE;AACbN,cAAc,CAACO,mBAAmB,GAAGH,EAAE,CAACG,mBAAmB;AAE3DJ,UAAU,CAACL,IAAI,CAACU,IAAI,CAACC,SAAS,EAAE,IAAI,CAAC,CAAC;AAEtCC,MAAM,CAACC,OAAO,GAAG;EACf;AACF;AACA;AACA;AACA;AACA;EACEC,aAAa,EAAE,SAASA,aAAaA,CAACC,GAAG,EAAEC,UAAU,EAAE;IACrD,IAAI,CAACD,GAAG,EAAE;MACR,MAAM,IAAIE,KAAK,CAAC,iBAAiB,CAAC;IACpC;IAEA,IAAI,CAACD,UAAU,EAAE;MACfA,UAAU,GAAG;QAACE,WAAW,EAAE;MAAQ,CAAC;IACtC;IAEA,IAAI,CAACF,UAAU,EAAE;MACf,MAAM,IAAIC,KAAK,CAAC,iCAAiC,CAAC;IACpD;IAEAD,UAAU,GAAGZ,QAAQ,CAACY,UAAU,EAAE;MAChCG,KAAK,EAAEC,OAAO,CAACC,GAAG,CAACC,YAAY,aAAAC,MAAA,CAAaH,OAAO,CAACC,GAAG,CAACG,IAAI,OAAAD,MAAA,CAAIR,GAAG,CAACU,IAAI,OAAAF,MAAA,CAAI,IAAAG,IAAA,CAAA7B,OAAA,GAAU,CAAE;MACxF4B,IAAI,KAAAF,MAAA,CAAKR,GAAG,CAACU,IAAI,kBAAe;MAChCE,MAAM,EAAE,MAAM;MACdC,gBAAgB,EAAER,OAAO,CAACC,GAAG,CAACQ;IAChC,CAAC,CAAC;IAEF,IAAMC,OAAO,GAAGV,OAAO,CAACC,GAAG,CAACQ,oBAAoB,GAC5CvB,EAAE,CAACyB,kBAAkB,CAAC,wBAAwB,EAAE,EAAE,CAAC,GACnDzB,EAAE,CAACyB,kBAAkB,EAAE;IAE3B,OAAOD,OAAO,CACXE,IAAI,CAAChB,UAAU,CAAC,CAChBiB,sBAAsB,CAAC,KAAK,CAAC,CAC7BC,aAAa,CAAC,IAAI,EAAE,IAAI,CAAC,CACzBC,IAAI,CAAC;MAAA,OAAML,OAAO;IAAA,EAAC;EACxB,CAAC;EAEDxB,EAAE,EAAFA;AACF,CAAC"}
|
|
1
|
+
{"version":3,"names":["_promise","default","require","polyfill","path","chai","chaiAsPromised","_require","defaults","requireDir","wd","use","should","transferPromiseness","join","__dirname","module","exports","createBrowser","pkg","browserDef","Error","browserName","build","process","env","BUILD_NUMBER","concat","USER","name","_now","public","tunnelIdentifier","SC_TUNNEL_IDENTIFIER","browser","promiseChainRemote","init","setImplicitWaitTimeout","setWindowSize","then"],"sources":["index.js"],"sourcesContent":["/*!\r\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\r\n */\r\n\r\n/* istanbul ignore next */\r\nif (typeof Promise === 'undefined') {\r\n // eslint-disable-next-line global-require\r\n require('es6-promise').polyfill();\r\n}\r\n\r\n// Reminder: this is intentionally a different instance of chai than\r\n// @webex/test-helper-chai.\r\nconst path = require('path');\r\n\r\nconst chai = require('chai');\r\n// Note: this is probably the only place we should use chai-as-promised; it's\r\n// incompatible with IE 11, so can't go into browser tests. Once we move to\r\n// wdio, it can be removed from here as well.\r\nconst chaiAsPromised = require('chai-as-promised');\r\nconst {defaults} = require('lodash');\r\nconst requireDir = require('require-dir');\r\nconst wd = require('wd');\r\n\r\nchai.use(chaiAsPromised);\r\nchai.should();\r\nchaiAsPromised.transferPromiseness = wd.transferPromiseness;\r\n\r\nrequireDir(path.join(__dirname, 'wd'));\r\n\r\nmodule.exports = {\r\n /**\r\n * Resolves with a wd browser instance\r\n * @param {Object} pkg package.json as JavaScript Object\r\n * @param {Object} browserDef wd-compatible browser definition\r\n * @returns {Promise}\r\n */\r\n createBrowser: function createBrowser(pkg, browserDef) {\r\n if (!pkg) {\r\n throw new Error('pkg is required');\r\n }\r\n\r\n if (!browserDef) {\r\n browserDef = {browserName: 'chrome'};\r\n }\r\n\r\n if (!browserDef) {\r\n throw new Error('No browser definition available');\r\n }\r\n\r\n browserDef = defaults(browserDef, {\r\n build: process.env.BUILD_NUMBER || `local-${process.env.USER}-${pkg.name}-${Date.now()}`,\r\n name: `${pkg.name} (automation)`,\r\n public: 'team',\r\n tunnelIdentifier: process.env.SC_TUNNEL_IDENTIFIER,\r\n });\r\n\r\n const browser = process.env.SC_TUNNEL_IDENTIFIER\r\n ? wd.promiseChainRemote('ondemand.saucelabs.com', 80)\r\n : wd.promiseChainRemote();\r\n\r\n return browser\r\n .init(browserDef)\r\n .setImplicitWaitTimeout(10000)\r\n .setWindowSize(1600, 1200)\r\n .then(() => browser);\r\n },\r\n\r\n wd,\r\n};\r\n"],"mappings":";;;;;AAAA;AACA;AACA;;AAEA;AACA,IAAI,OAAAA,QAAA,CAAAC,OAAc,KAAK,WAAW,EAAE;EAClC;EACAC,OAAO,CAAC,aAAa,CAAC,CAACC,QAAQ,EAAE;AACnC;;AAEA;AACA;AACA,IAAMC,IAAI,GAAGF,OAAO,CAAC,MAAM,CAAC;AAE5B,IAAMG,IAAI,GAAGH,OAAO,CAAC,MAAM,CAAC;AAC5B;AACA;AACA;AACA,IAAMI,cAAc,GAAGJ,OAAO,CAAC,kBAAkB,CAAC;AAClD,IAAAK,QAAA,GAAmBL,OAAO,CAAC,QAAQ,CAAC;EAA7BM,QAAQ,GAAAD,QAAA,CAARC,QAAQ;AACf,IAAMC,UAAU,GAAGP,OAAO,CAAC,aAAa,CAAC;AACzC,IAAMQ,EAAE,GAAGR,OAAO,CAAC,IAAI,CAAC;AAExBG,IAAI,CAACM,GAAG,CAACL,cAAc,CAAC;AACxBD,IAAI,CAACO,MAAM,EAAE;AACbN,cAAc,CAACO,mBAAmB,GAAGH,EAAE,CAACG,mBAAmB;AAE3DJ,UAAU,CAACL,IAAI,CAACU,IAAI,CAACC,SAAS,EAAE,IAAI,CAAC,CAAC;AAEtCC,MAAM,CAACC,OAAO,GAAG;EACf;AACF;AACA;AACA;AACA;AACA;EACEC,aAAa,EAAE,SAASA,aAAaA,CAACC,GAAG,EAAEC,UAAU,EAAE;IACrD,IAAI,CAACD,GAAG,EAAE;MACR,MAAM,IAAIE,KAAK,CAAC,iBAAiB,CAAC;IACpC;IAEA,IAAI,CAACD,UAAU,EAAE;MACfA,UAAU,GAAG;QAACE,WAAW,EAAE;MAAQ,CAAC;IACtC;IAEA,IAAI,CAACF,UAAU,EAAE;MACf,MAAM,IAAIC,KAAK,CAAC,iCAAiC,CAAC;IACpD;IAEAD,UAAU,GAAGZ,QAAQ,CAACY,UAAU,EAAE;MAChCG,KAAK,EAAEC,OAAO,CAACC,GAAG,CAACC,YAAY,aAAAC,MAAA,CAAaH,OAAO,CAACC,GAAG,CAACG,IAAI,OAAAD,MAAA,CAAIR,GAAG,CAACU,IAAI,OAAAF,MAAA,CAAI,IAAAG,IAAA,CAAA7B,OAAA,GAAU,CAAE;MACxF4B,IAAI,KAAAF,MAAA,CAAKR,GAAG,CAACU,IAAI,kBAAe;MAChCE,MAAM,EAAE,MAAM;MACdC,gBAAgB,EAAER,OAAO,CAACC,GAAG,CAACQ;IAChC,CAAC,CAAC;IAEF,IAAMC,OAAO,GAAGV,OAAO,CAACC,GAAG,CAACQ,oBAAoB,GAC5CvB,EAAE,CAACyB,kBAAkB,CAAC,wBAAwB,EAAE,EAAE,CAAC,GACnDzB,EAAE,CAACyB,kBAAkB,EAAE;IAE3B,OAAOD,OAAO,CACXE,IAAI,CAAChB,UAAU,CAAC,CAChBiB,sBAAsB,CAAC,KAAK,CAAC,CAC7BC,aAAa,CAAC,IAAI,EAAE,IAAI,CAAC,CACzBC,IAAI,CAAC;MAAA,OAAML,OAAO;IAAA,EAAC;EACxB,CAAC;EAEDxB,EAAE,EAAFA;AACF,CAAC"}
|
package/dist/wd/accept-grant.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["wd","require","addPromiseChainMethod","acceptGrant","_this","selector","hasElementByCssSelector","then","has","waitForElementByCssSelector","click"],"sources":["accept-grant.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\n/* eslint-disable no-invalid-this */\n\nconst wd = require('wd');\n\nwd.addPromiseChainMethod('acceptGrant', function acceptGrant() {\n const selector = 'input[value=\"Accept\"]';\n\n return this.hasElementByCssSelector(selector).then((has) => {\n if (has) {\n return this.waitForElementByCssSelector(selector).click();\n }\n\n return this;\n });\n});\n"],"mappings":";;AAAA;AACA;AACA;;AAEA;;AAEA,IAAMA,EAAE,GAAGC,OAAO,CAAC,IAAI,CAAC;AAExBD,EAAE,CAACE,qBAAqB,CAAC,aAAa,EAAE,SAASC,WAAWA,CAAA,EAAG;EAAA,IAAAC,KAAA;EAC7D,IAAMC,QAAQ,GAAG,uBAAuB;EAExC,OAAO,IAAI,CAACC,uBAAuB,CAACD,QAAQ,CAAC,CAACE,IAAI,CAAC,UAACC,GAAG,EAAK;IAC1D,IAAIA,GAAG,EAAE;MACP,OAAOJ,KAAI,CAACK,2BAA2B,CAACJ,QAAQ,CAAC,CAACK,KAAK,EAAE;IAC3D;IAEA,OAAON,KAAI;EACb,CAAC,CAAC;AACJ,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"names":["wd","require","addPromiseChainMethod","acceptGrant","_this","selector","hasElementByCssSelector","then","has","waitForElementByCssSelector","click"],"sources":["accept-grant.js"],"sourcesContent":["/*!\r\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\r\n */\r\n\r\n/* eslint-disable no-invalid-this */\r\n\r\nconst wd = require('wd');\r\n\r\nwd.addPromiseChainMethod('acceptGrant', function acceptGrant() {\r\n const selector = 'input[value=\"Accept\"]';\r\n\r\n return this.hasElementByCssSelector(selector).then((has) => {\r\n if (has) {\r\n return this.waitForElementByCssSelector(selector).click();\r\n }\r\n\r\n return this;\r\n });\r\n});\r\n"],"mappings":";;AAAA;AACA;AACA;;AAEA;;AAEA,IAAMA,EAAE,GAAGC,OAAO,CAAC,IAAI,CAAC;AAExBD,EAAE,CAACE,qBAAqB,CAAC,aAAa,EAAE,SAASC,WAAWA,CAAA,EAAG;EAAA,IAAAC,KAAA;EAC7D,IAAMC,QAAQ,GAAG,uBAAuB;EAExC,OAAO,IAAI,CAACC,uBAAuB,CAACD,QAAQ,CAAC,CAACE,IAAI,CAAC,UAACC,GAAG,EAAK;IAC1D,IAAIA,GAAG,EAAE;MACP,OAAOJ,KAAI,CAACK,2BAA2B,CAACJ,QAAQ,CAAC,CAACK,KAAK,EAAE;IAC3D;IAEA,OAAON,KAAI;EACb,CAAC,CAAC;AACJ,CAAC,CAAC"}
|
package/dist/wd/login.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
/*!
|
|
4
|
-
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
+
/*!
|
|
4
|
+
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
7
|
/* eslint-disable no-invalid-this */
|
|
@@ -10,14 +10,14 @@ var _require = require('lodash'),
|
|
|
10
10
|
defaults = _require.defaults;
|
|
11
11
|
var wd = require('wd');
|
|
12
12
|
|
|
13
|
-
/**
|
|
14
|
-
* @method login
|
|
15
|
-
* @memberof wd
|
|
16
|
-
* @param {Object} user
|
|
17
|
-
* @param {stirng} user.email
|
|
18
|
-
* @param {stirng} user.password
|
|
19
|
-
* @param {Object} options
|
|
20
|
-
* @param {number} options.remainingRetries
|
|
13
|
+
/**
|
|
14
|
+
* @method login
|
|
15
|
+
* @memberof wd
|
|
16
|
+
* @param {Object} user
|
|
17
|
+
* @param {stirng} user.email
|
|
18
|
+
* @param {stirng} user.password
|
|
19
|
+
* @param {Object} options
|
|
20
|
+
* @param {number} options.remainingRetries
|
|
21
21
|
*/
|
|
22
22
|
wd.addPromiseChainMethod('login', function login(user, options) {
|
|
23
23
|
var _this = this;
|
package/dist/wd/login.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_require","require","defaults","wd","addPromiseChainMethod","login","user","options","_this","remainingRetries","email","Error","password","hasElementByCssSelector","then","emailAlreadyEntered","elementById","sendKeys","click","submitPassword","acceptGrant"],"sources":["login.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\n/* eslint-disable no-invalid-this */\n\nconst {defaults} = require('lodash');\nconst wd = require('wd');\n\n/**\n * @method login\n * @memberof wd\n * @param {Object} user\n * @param {stirng} user.email\n * @param {stirng} user.password\n * @param {Object} options\n * @param {number} options.remainingRetries\n */\nwd.addPromiseChainMethod('login', function login(user, options) {\n options = options || {};\n defaults(options, {\n remainingRetries: 3,\n });\n\n if (!user.email) {\n throw new Error('`user.email` is required');\n }\n\n if (!user.password) {\n throw new Error('`user.password` is required');\n }\n\n return this.hasElementByCssSelector('#IDToken1[readonly]')\n .then((emailAlreadyEntered) => {\n if (!emailAlreadyEntered) {\n return this.elementById('IDToken1').sendKeys(user.email).elementById('IDButton2').click();\n }\n\n return this;\n })\n .submitPassword(user, options)\n .acceptGrant();\n});\n"],"mappings":";;AAAA;AACA;AACA;;AAEA;;AAEA,IAAAA,QAAA,GAAmBC,OAAO,CAAC,QAAQ,CAAC;EAA7BC,QAAQ,GAAAF,QAAA,CAARE,QAAQ;AACf,IAAMC,EAAE,GAAGF,OAAO,CAAC,IAAI,CAAC;;AAExB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACAE,EAAE,CAACC,qBAAqB,CAAC,OAAO,EAAE,SAASC,KAAKA,CAACC,IAAI,EAAEC,OAAO,EAAE;EAAA,IAAAC,KAAA;EAC9DD,OAAO,GAAGA,OAAO,IAAI,CAAC,CAAC;EACvBL,QAAQ,CAACK,OAAO,EAAE;IAChBE,gBAAgB,EAAE;EACpB,CAAC,CAAC;EAEF,IAAI,CAACH,IAAI,CAACI,KAAK,EAAE;IACf,MAAM,IAAIC,KAAK,CAAC,0BAA0B,CAAC;EAC7C;EAEA,IAAI,CAACL,IAAI,CAACM,QAAQ,EAAE;IAClB,MAAM,IAAID,KAAK,CAAC,6BAA6B,CAAC;EAChD;EAEA,OAAO,IAAI,CAACE,uBAAuB,CAAC,qBAAqB,CAAC,CACvDC,IAAI,CAAC,UAACC,mBAAmB,EAAK;IAC7B,IAAI,CAACA,mBAAmB,EAAE;MACxB,OAAOP,KAAI,CAACQ,WAAW,CAAC,UAAU,CAAC,CAACC,QAAQ,CAACX,IAAI,CAACI,KAAK,CAAC,CAACM,WAAW,CAAC,WAAW,CAAC,CAACE,KAAK,EAAE;IAC3F;IAEA,OAAOV,KAAI;EACb,CAAC,CAAC,CACDW,cAAc,CAACb,IAAI,EAAEC,OAAO,CAAC,CAC7Ba,WAAW,EAAE;AAClB,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"names":["_require","require","defaults","wd","addPromiseChainMethod","login","user","options","_this","remainingRetries","email","Error","password","hasElementByCssSelector","then","emailAlreadyEntered","elementById","sendKeys","click","submitPassword","acceptGrant"],"sources":["login.js"],"sourcesContent":["/*!\r\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\r\n */\r\n\r\n/* eslint-disable no-invalid-this */\r\n\r\nconst {defaults} = require('lodash');\r\nconst wd = require('wd');\r\n\r\n/**\r\n * @method login\r\n * @memberof wd\r\n * @param {Object} user\r\n * @param {stirng} user.email\r\n * @param {stirng} user.password\r\n * @param {Object} options\r\n * @param {number} options.remainingRetries\r\n */\r\nwd.addPromiseChainMethod('login', function login(user, options) {\r\n options = options || {};\r\n defaults(options, {\r\n remainingRetries: 3,\r\n });\r\n\r\n if (!user.email) {\r\n throw new Error('`user.email` is required');\r\n }\r\n\r\n if (!user.password) {\r\n throw new Error('`user.password` is required');\r\n }\r\n\r\n return this.hasElementByCssSelector('#IDToken1[readonly]')\r\n .then((emailAlreadyEntered) => {\r\n if (!emailAlreadyEntered) {\r\n return this.elementById('IDToken1').sendKeys(user.email).elementById('IDButton2').click();\r\n }\r\n\r\n return this;\r\n })\r\n .submitPassword(user, options)\r\n .acceptGrant();\r\n});\r\n"],"mappings":";;AAAA;AACA;AACA;;AAEA;;AAEA,IAAAA,QAAA,GAAmBC,OAAO,CAAC,QAAQ,CAAC;EAA7BC,QAAQ,GAAAF,QAAA,CAARE,QAAQ;AACf,IAAMC,EAAE,GAAGF,OAAO,CAAC,IAAI,CAAC;;AAExB;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACAE,EAAE,CAACC,qBAAqB,CAAC,OAAO,EAAE,SAASC,KAAKA,CAACC,IAAI,EAAEC,OAAO,EAAE;EAAA,IAAAC,KAAA;EAC9DD,OAAO,GAAGA,OAAO,IAAI,CAAC,CAAC;EACvBL,QAAQ,CAACK,OAAO,EAAE;IAChBE,gBAAgB,EAAE;EACpB,CAAC,CAAC;EAEF,IAAI,CAACH,IAAI,CAACI,KAAK,EAAE;IACf,MAAM,IAAIC,KAAK,CAAC,0BAA0B,CAAC;EAC7C;EAEA,IAAI,CAACL,IAAI,CAACM,QAAQ,EAAE;IAClB,MAAM,IAAID,KAAK,CAAC,6BAA6B,CAAC;EAChD;EAEA,OAAO,IAAI,CAACE,uBAAuB,CAAC,qBAAqB,CAAC,CACvDC,IAAI,CAAC,UAACC,mBAAmB,EAAK;IAC7B,IAAI,CAACA,mBAAmB,EAAE;MACxB,OAAOP,KAAI,CAACQ,WAAW,CAAC,UAAU,CAAC,CAACC,QAAQ,CAACX,IAAI,CAACI,KAAK,CAAC,CAACM,WAAW,CAAC,WAAW,CAAC,CAACE,KAAK,EAAE;IAC3F;IAEA,OAAOV,KAAI;EACb,CAAC,CAAC,CACDW,cAAc,CAACb,IAAI,EAAEC,OAAO,CAAC,CAC7Ba,WAAW,EAAE;AAClB,CAAC,CAAC"}
|
package/dist/wd/print-logs.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["wd","require","addPromiseChainMethod","printLogs","log","then","logs","forEach","message","JSON","parse","method","console","level","text","err","catch","reason","warn"],"sources":["print-logs.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\n/* eslint max-nested-callbacks: [0] */\n/* eslint no-console: [0] */\n/* eslint-disable no-invalid-this */\n\nconst wd = require('wd');\n\nwd.addPromiseChainMethod('printLogs', function printLogs() {\n return this.log('browser')\n .then((logs) => {\n logs.forEach((log) => {\n try {\n log.message = JSON.parse(log.message);\n const method = console[log.message.message.level] || console.log;\n\n console[method]('broser log:', log.message.message.text);\n } catch (err) {\n console.log('browser log:', log.message);\n }\n });\n })\n .catch((reason) => {\n console.warn('failed to fetch browser logs', reason);\n });\n});\n"],"mappings":";;AAAA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,IAAMA,EAAE,GAAGC,OAAO,CAAC,IAAI,CAAC;AAExBD,EAAE,CAACE,qBAAqB,CAAC,WAAW,EAAE,SAASC,SAASA,CAAA,EAAG;EACzD,OAAO,IAAI,CAACC,GAAG,CAAC,SAAS,CAAC,CACvBC,IAAI,CAAC,UAACC,IAAI,EAAK;IACdA,IAAI,CAACC,OAAO,CAAC,UAACH,GAAG,EAAK;MACpB,IAAI;QACFA,GAAG,CAACI,OAAO,GAAGC,IAAI,CAACC,KAAK,CAACN,GAAG,CAACI,OAAO,CAAC;QACrC,IAAMG,MAAM,GAAGC,OAAO,CAACR,GAAG,CAACI,OAAO,CAACA,OAAO,CAACK,KAAK,CAAC,IAAID,OAAO,CAACR,GAAG;QAEhEQ,OAAO,CAACD,MAAM,CAAC,CAAC,aAAa,EAAEP,GAAG,CAACI,OAAO,CAACA,OAAO,CAACM,IAAI,CAAC;MAC1D,CAAC,CAAC,OAAOC,GAAG,EAAE;QACZH,OAAO,CAACR,GAAG,CAAC,cAAc,EAAEA,GAAG,CAACI,OAAO,CAAC;MAC1C;IACF,CAAC,CAAC;EACJ,CAAC,CAAC,CACDQ,KAAK,CAAC,UAACC,MAAM,EAAK;IACjBL,OAAO,CAACM,IAAI,CAAC,8BAA8B,EAAED,MAAM,CAAC;EACtD,CAAC,CAAC;AACN,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"names":["wd","require","addPromiseChainMethod","printLogs","log","then","logs","forEach","message","JSON","parse","method","console","level","text","err","catch","reason","warn"],"sources":["print-logs.js"],"sourcesContent":["/*!\r\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\r\n */\r\n\r\n/* eslint max-nested-callbacks: [0] */\r\n/* eslint no-console: [0] */\r\n/* eslint-disable no-invalid-this */\r\n\r\nconst wd = require('wd');\r\n\r\nwd.addPromiseChainMethod('printLogs', function printLogs() {\r\n return this.log('browser')\r\n .then((logs) => {\r\n logs.forEach((log) => {\r\n try {\r\n log.message = JSON.parse(log.message);\r\n const method = console[log.message.message.level] || console.log;\r\n\r\n console[method]('broser log:', log.message.message.text);\r\n } catch (err) {\r\n console.log('browser log:', log.message);\r\n }\r\n });\r\n })\r\n .catch((reason) => {\r\n console.warn('failed to fetch browser logs', reason);\r\n });\r\n});\r\n"],"mappings":";;AAAA;AACA;AACA;;AAEA;AACA;AACA;;AAEA,IAAMA,EAAE,GAAGC,OAAO,CAAC,IAAI,CAAC;AAExBD,EAAE,CAACE,qBAAqB,CAAC,WAAW,EAAE,SAASC,SAASA,CAAA,EAAG;EACzD,OAAO,IAAI,CAACC,GAAG,CAAC,SAAS,CAAC,CACvBC,IAAI,CAAC,UAACC,IAAI,EAAK;IACdA,IAAI,CAACC,OAAO,CAAC,UAACH,GAAG,EAAK;MACpB,IAAI;QACFA,GAAG,CAACI,OAAO,GAAGC,IAAI,CAACC,KAAK,CAACN,GAAG,CAACI,OAAO,CAAC;QACrC,IAAMG,MAAM,GAAGC,OAAO,CAACR,GAAG,CAACI,OAAO,CAACA,OAAO,CAACK,KAAK,CAAC,IAAID,OAAO,CAACR,GAAG;QAEhEQ,OAAO,CAACD,MAAM,CAAC,CAAC,aAAa,EAAEP,GAAG,CAACI,OAAO,CAACA,OAAO,CAACM,IAAI,CAAC;MAC1D,CAAC,CAAC,OAAOC,GAAG,EAAE;QACZH,OAAO,CAACR,GAAG,CAAC,cAAc,EAAEA,GAAG,CAACI,OAAO,CAAC;MAC1C;IACF,CAAC,CAAC;EACJ,CAAC,CAAC,CACDQ,KAAK,CAAC,UAACC,MAAM,EAAK;IACjBL,OAAO,CAACM,IAAI,CAAC,8BAA8B,EAAED,MAAM,CAAC;EACtD,CAAC,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
|
|
4
4
|
var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
|
|
5
|
-
/*!
|
|
6
|
-
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
5
|
+
/*!
|
|
6
|
+
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
9
|
/* eslint-disable no-invalid-this */
|
|
@@ -11,24 +11,24 @@ var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/pr
|
|
|
11
11
|
|
|
12
12
|
var wd = require('wd');
|
|
13
13
|
|
|
14
|
-
/**
|
|
15
|
-
* Returns a promise that resolves after 'timeout' milliseconds
|
|
16
|
-
* @param {number} timeout
|
|
17
|
-
* @private
|
|
18
|
-
* @returns {Promise}
|
|
14
|
+
/**
|
|
15
|
+
* Returns a promise that resolves after 'timeout' milliseconds
|
|
16
|
+
* @param {number} timeout
|
|
17
|
+
* @private
|
|
18
|
+
* @returns {Promise}
|
|
19
19
|
*/
|
|
20
20
|
function delay(timeout) {
|
|
21
21
|
return new _promise.default(function (resolve) {
|
|
22
22
|
setTimeout(resolve, timeout);
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
|
-
/**
|
|
26
|
-
* @method submitPassword
|
|
27
|
-
* @memberof wd
|
|
28
|
-
* @param {Object} user
|
|
29
|
-
* @param {string} user.password
|
|
30
|
-
* @param {Object} options
|
|
31
|
-
* @param {Object} options.remainingRetries
|
|
25
|
+
/**
|
|
26
|
+
* @method submitPassword
|
|
27
|
+
* @memberof wd
|
|
28
|
+
* @param {Object} user
|
|
29
|
+
* @param {string} user.password
|
|
30
|
+
* @param {Object} options
|
|
31
|
+
* @param {Object} options.remainingRetries
|
|
32
32
|
*/
|
|
33
33
|
wd.addPromiseChainMethod('submitPassword', function submitPassword(user, options) {
|
|
34
34
|
var _this = this;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["wd","require","delay","timeout","_promise","default","resolve","setTimeout","addPromiseChainMethod","submitPassword","user","options","_this","password","Error","remainingRetries","elementById","sendKeys","click","hasElementByClassName","then","isPresent"],"sources":["submit-password.js"],"sourcesContent":["/*!\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\n */\n\n/* eslint-disable no-invalid-this */\n/* eslint-disable max-nested-callbacks */\n\nconst wd = require('wd');\n\n/**\n * Returns a promise that resolves after 'timeout' milliseconds\n * @param {number} timeout\n * @private\n * @returns {Promise}\n */\nfunction delay(timeout) {\n return new Promise((resolve) => {\n setTimeout(resolve, timeout);\n });\n}\n/**\n * @method submitPassword\n * @memberof wd\n * @param {Object} user\n * @param {string} user.password\n * @param {Object} options\n * @param {Object} options.remainingRetries\n */\nwd.addPromiseChainMethod('submitPassword', function submitPassword(user, options) {\n if (!user.password) {\n throw new Error('`user.password` is required');\n }\n\n options = options || {\n remainingRetries: 3,\n };\n\n return this.elementById('IDToken2')\n .sendKeys(user.password)\n .elementById('Button1')\n .click()\n .hasElementByClassName('generic-error')\n .then((isPresent) => {\n if (isPresent) {\n if (options.remainingRetries > 0) {\n options.remainingRetries -= 1;\n\n return delay(1000).then(() => {\n this.submitPassword(user, options);\n });\n }\n throw new Error('Failed to login after several attempts');\n }\n\n return null;\n });\n});\n"],"mappings":";;;;AAAA;AACA;AACA;;AAEA;AACA;;AAEA,IAAMA,EAAE,GAAGC,OAAO,CAAC,IAAI,CAAC;;AAExB;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,KAAKA,CAACC,OAAO,EAAE;EACtB,OAAO,IAAAC,QAAA,CAAAC,OAAA,CAAY,UAACC,OAAO,EAAK;IAC9BC,UAAU,CAACD,OAAO,EAAEH,OAAO,CAAC;EAC9B,CAAC,CAAC;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACAH,EAAE,CAACQ,qBAAqB,CAAC,gBAAgB,EAAE,SAASC,cAAcA,CAACC,IAAI,EAAEC,OAAO,EAAE;EAAA,IAAAC,KAAA;EAChF,IAAI,CAACF,IAAI,CAACG,QAAQ,EAAE;IAClB,MAAM,IAAIC,KAAK,CAAC,6BAA6B,CAAC;EAChD;EAEAH,OAAO,GAAGA,OAAO,IAAI;IACnBI,gBAAgB,EAAE;EACpB,CAAC;EAED,OAAO,IAAI,CAACC,WAAW,CAAC,UAAU,CAAC,CAChCC,QAAQ,CAACP,IAAI,CAACG,QAAQ,CAAC,CACvBG,WAAW,CAAC,SAAS,CAAC,CACtBE,KAAK,EAAE,CACPC,qBAAqB,CAAC,eAAe,CAAC,CACtCC,IAAI,CAAC,UAACC,SAAS,EAAK;IACnB,IAAIA,SAAS,EAAE;MACb,IAAIV,OAAO,CAACI,gBAAgB,GAAG,CAAC,EAAE;QAChCJ,OAAO,CAACI,gBAAgB,IAAI,CAAC;QAE7B,OAAOb,KAAK,CAAC,IAAI,CAAC,CAACkB,IAAI,CAAC,YAAM;UAC5BR,KAAI,CAACH,cAAc,CAACC,IAAI,EAAEC,OAAO,CAAC;QACpC,CAAC,CAAC;MACJ;MACA,MAAM,IAAIG,KAAK,CAAC,wCAAwC,CAAC;IAC3D;IAEA,OAAO,IAAI;EACb,CAAC,CAAC;AACN,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"names":["wd","require","delay","timeout","_promise","default","resolve","setTimeout","addPromiseChainMethod","submitPassword","user","options","_this","password","Error","remainingRetries","elementById","sendKeys","click","hasElementByClassName","then","isPresent"],"sources":["submit-password.js"],"sourcesContent":["/*!\r\n * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.\r\n */\r\n\r\n/* eslint-disable no-invalid-this */\r\n/* eslint-disable max-nested-callbacks */\r\n\r\nconst wd = require('wd');\r\n\r\n/**\r\n * Returns a promise that resolves after 'timeout' milliseconds\r\n * @param {number} timeout\r\n * @private\r\n * @returns {Promise}\r\n */\r\nfunction delay(timeout) {\r\n return new Promise((resolve) => {\r\n setTimeout(resolve, timeout);\r\n });\r\n}\r\n/**\r\n * @method submitPassword\r\n * @memberof wd\r\n * @param {Object} user\r\n * @param {string} user.password\r\n * @param {Object} options\r\n * @param {Object} options.remainingRetries\r\n */\r\nwd.addPromiseChainMethod('submitPassword', function submitPassword(user, options) {\r\n if (!user.password) {\r\n throw new Error('`user.password` is required');\r\n }\r\n\r\n options = options || {\r\n remainingRetries: 3,\r\n };\r\n\r\n return this.elementById('IDToken2')\r\n .sendKeys(user.password)\r\n .elementById('Button1')\r\n .click()\r\n .hasElementByClassName('generic-error')\r\n .then((isPresent) => {\r\n if (isPresent) {\r\n if (options.remainingRetries > 0) {\r\n options.remainingRetries -= 1;\r\n\r\n return delay(1000).then(() => {\r\n this.submitPassword(user, options);\r\n });\r\n }\r\n throw new Error('Failed to login after several attempts');\r\n }\r\n\r\n return null;\r\n });\r\n});\r\n"],"mappings":";;;;AAAA;AACA;AACA;;AAEA;AACA;;AAEA,IAAMA,EAAE,GAAGC,OAAO,CAAC,IAAI,CAAC;;AAExB;AACA;AACA;AACA;AACA;AACA;AACA,SAASC,KAAKA,CAACC,OAAO,EAAE;EACtB,OAAO,IAAAC,QAAA,CAAAC,OAAA,CAAY,UAACC,OAAO,EAAK;IAC9BC,UAAU,CAACD,OAAO,EAAEH,OAAO,CAAC;EAC9B,CAAC,CAAC;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACAH,EAAE,CAACQ,qBAAqB,CAAC,gBAAgB,EAAE,SAASC,cAAcA,CAACC,IAAI,EAAEC,OAAO,EAAE;EAAA,IAAAC,KAAA;EAChF,IAAI,CAACF,IAAI,CAACG,QAAQ,EAAE;IAClB,MAAM,IAAIC,KAAK,CAAC,6BAA6B,CAAC;EAChD;EAEAH,OAAO,GAAGA,OAAO,IAAI;IACnBI,gBAAgB,EAAE;EACpB,CAAC;EAED,OAAO,IAAI,CAACC,WAAW,CAAC,UAAU,CAAC,CAChCC,QAAQ,CAACP,IAAI,CAACG,QAAQ,CAAC,CACvBG,WAAW,CAAC,SAAS,CAAC,CACtBE,KAAK,EAAE,CACPC,qBAAqB,CAAC,eAAe,CAAC,CACtCC,IAAI,CAAC,UAACC,SAAS,EAAK;IACnB,IAAIA,SAAS,EAAE;MACb,IAAIV,OAAO,CAACI,gBAAgB,GAAG,CAAC,EAAE;QAChCJ,OAAO,CAACI,gBAAgB,IAAI,CAAC;QAE7B,OAAOb,KAAK,CAAC,IAAI,CAAC,CAACkB,IAAI,CAAC,YAAM;UAC5BR,KAAI,CAACH,cAAc,CAACC,IAAI,EAAEC,OAAO,CAAC;QACpC,CAAC,CAAC;MACJ;MACA,MAAM,IAAIG,KAAK,CAAC,wCAAwC,CAAC;IAC3D;IAEA,OAAO,IAAI;EACb,CAAC,CAAC;AACN,CAAC,CAAC"}
|
package/jest.config.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
const config = require('@webex/jest-config-legacy');
|
|
2
|
-
|
|
3
|
-
module.exports = config;
|
|
1
|
+
const config = require('@webex/jest-config-legacy');
|
|
2
|
+
|
|
3
|
+
module.exports = config;
|
package/package.json
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@webex/test-helper-automation",
|
|
3
|
-
"version": "2.59.2",
|
|
4
3
|
"description": "",
|
|
5
4
|
"license": "MIT",
|
|
6
5
|
"main": "dist/index.js",
|
|
@@ -14,14 +13,14 @@
|
|
|
14
13
|
},
|
|
15
14
|
"devDependencies": {
|
|
16
15
|
"@babel/core": "^7.17.10",
|
|
17
|
-
"@webex/babel-config-legacy": "
|
|
18
|
-
"@webex/eslint-config-legacy": "
|
|
19
|
-
"@webex/jest-config-legacy": "
|
|
20
|
-
"@webex/legacy-tools": "
|
|
21
|
-
"@webex/test-helper-chai": "2.59.
|
|
22
|
-
"@webex/test-helper-mocha": "2.59.
|
|
23
|
-
"@webex/test-helper-mock-webex": "2.59.
|
|
24
|
-
"@webex/test-helper-test-users": "2.59.
|
|
16
|
+
"@webex/babel-config-legacy": "^0.0.0",
|
|
17
|
+
"@webex/eslint-config-legacy": "^0.0.0",
|
|
18
|
+
"@webex/jest-config-legacy": "^0.0.0",
|
|
19
|
+
"@webex/legacy-tools": "^0.0.0",
|
|
20
|
+
"@webex/test-helper-chai": "^2.59.3-next.1",
|
|
21
|
+
"@webex/test-helper-mocha": "^2.59.3-next.1",
|
|
22
|
+
"@webex/test-helper-mock-webex": "^2.59.3-next.1",
|
|
23
|
+
"@webex/test-helper-test-users": "^2.59.3-next.1",
|
|
25
24
|
"chai": "^4.3.4",
|
|
26
25
|
"chai-as-promised": "^7.1.1",
|
|
27
26
|
"eslint": "^8.24.0",
|
|
@@ -36,10 +35,12 @@
|
|
|
36
35
|
"scripts": {
|
|
37
36
|
"build": "yarn build:src",
|
|
38
37
|
"build:src": "webex-legacy-tools build -dest \"./dist\" -src \"./src\" -js -ts -maps",
|
|
38
|
+
"deploy:npm": "yarn npm publish",
|
|
39
39
|
"test": "yarn test:style && yarn test:unit && yarn test:integration && yarn test:browser",
|
|
40
40
|
"test:browser": "webex-legacy-tools test --integration --unit --runner karma",
|
|
41
41
|
"test:integration": "webex-legacy-tools test --integration --runner mocha",
|
|
42
42
|
"test:style": "eslint ./src/**/*.*",
|
|
43
43
|
"test:unit": "webex-legacy-tools test --unit --runner jest"
|
|
44
|
-
}
|
|
45
|
-
|
|
44
|
+
},
|
|
45
|
+
"version": "2.59.3-next.1"
|
|
46
|
+
}
|
package/process
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
module.exports = {browser: true};
|
|
1
|
+
module.exports = {browser: true};
|
package/src/index.js
CHANGED
|
@@ -1,69 +1,69 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
/* istanbul ignore next */
|
|
6
|
-
if (typeof Promise === 'undefined') {
|
|
7
|
-
// eslint-disable-next-line global-require
|
|
8
|
-
require('es6-promise').polyfill();
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
// Reminder: this is intentionally a different instance of chai than
|
|
12
|
-
// @webex/test-helper-chai.
|
|
13
|
-
const path = require('path');
|
|
14
|
-
|
|
15
|
-
const chai = require('chai');
|
|
16
|
-
// Note: this is probably the only place we should use chai-as-promised; it's
|
|
17
|
-
// incompatible with IE 11, so can't go into browser tests. Once we move to
|
|
18
|
-
// wdio, it can be removed from here as well.
|
|
19
|
-
const chaiAsPromised = require('chai-as-promised');
|
|
20
|
-
const {defaults} = require('lodash');
|
|
21
|
-
const requireDir = require('require-dir');
|
|
22
|
-
const wd = require('wd');
|
|
23
|
-
|
|
24
|
-
chai.use(chaiAsPromised);
|
|
25
|
-
chai.should();
|
|
26
|
-
chaiAsPromised.transferPromiseness = wd.transferPromiseness;
|
|
27
|
-
|
|
28
|
-
requireDir(path.join(__dirname, 'wd'));
|
|
29
|
-
|
|
30
|
-
module.exports = {
|
|
31
|
-
/**
|
|
32
|
-
* Resolves with a wd browser instance
|
|
33
|
-
* @param {Object} pkg package.json as JavaScript Object
|
|
34
|
-
* @param {Object} browserDef wd-compatible browser definition
|
|
35
|
-
* @returns {Promise}
|
|
36
|
-
*/
|
|
37
|
-
createBrowser: function createBrowser(pkg, browserDef) {
|
|
38
|
-
if (!pkg) {
|
|
39
|
-
throw new Error('pkg is required');
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
if (!browserDef) {
|
|
43
|
-
browserDef = {browserName: 'chrome'};
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
if (!browserDef) {
|
|
47
|
-
throw new Error('No browser definition available');
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
browserDef = defaults(browserDef, {
|
|
51
|
-
build: process.env.BUILD_NUMBER || `local-${process.env.USER}-${pkg.name}-${Date.now()}`,
|
|
52
|
-
name: `${pkg.name} (automation)`,
|
|
53
|
-
public: 'team',
|
|
54
|
-
tunnelIdentifier: process.env.SC_TUNNEL_IDENTIFIER,
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
const browser = process.env.SC_TUNNEL_IDENTIFIER
|
|
58
|
-
? wd.promiseChainRemote('ondemand.saucelabs.com', 80)
|
|
59
|
-
: wd.promiseChainRemote();
|
|
60
|
-
|
|
61
|
-
return browser
|
|
62
|
-
.init(browserDef)
|
|
63
|
-
.setImplicitWaitTimeout(10000)
|
|
64
|
-
.setWindowSize(1600, 1200)
|
|
65
|
-
.then(() => browser);
|
|
66
|
-
},
|
|
67
|
-
|
|
68
|
-
wd,
|
|
69
|
-
};
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/* istanbul ignore next */
|
|
6
|
+
if (typeof Promise === 'undefined') {
|
|
7
|
+
// eslint-disable-next-line global-require
|
|
8
|
+
require('es6-promise').polyfill();
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
// Reminder: this is intentionally a different instance of chai than
|
|
12
|
+
// @webex/test-helper-chai.
|
|
13
|
+
const path = require('path');
|
|
14
|
+
|
|
15
|
+
const chai = require('chai');
|
|
16
|
+
// Note: this is probably the only place we should use chai-as-promised; it's
|
|
17
|
+
// incompatible with IE 11, so can't go into browser tests. Once we move to
|
|
18
|
+
// wdio, it can be removed from here as well.
|
|
19
|
+
const chaiAsPromised = require('chai-as-promised');
|
|
20
|
+
const {defaults} = require('lodash');
|
|
21
|
+
const requireDir = require('require-dir');
|
|
22
|
+
const wd = require('wd');
|
|
23
|
+
|
|
24
|
+
chai.use(chaiAsPromised);
|
|
25
|
+
chai.should();
|
|
26
|
+
chaiAsPromised.transferPromiseness = wd.transferPromiseness;
|
|
27
|
+
|
|
28
|
+
requireDir(path.join(__dirname, 'wd'));
|
|
29
|
+
|
|
30
|
+
module.exports = {
|
|
31
|
+
/**
|
|
32
|
+
* Resolves with a wd browser instance
|
|
33
|
+
* @param {Object} pkg package.json as JavaScript Object
|
|
34
|
+
* @param {Object} browserDef wd-compatible browser definition
|
|
35
|
+
* @returns {Promise}
|
|
36
|
+
*/
|
|
37
|
+
createBrowser: function createBrowser(pkg, browserDef) {
|
|
38
|
+
if (!pkg) {
|
|
39
|
+
throw new Error('pkg is required');
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if (!browserDef) {
|
|
43
|
+
browserDef = {browserName: 'chrome'};
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if (!browserDef) {
|
|
47
|
+
throw new Error('No browser definition available');
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
browserDef = defaults(browserDef, {
|
|
51
|
+
build: process.env.BUILD_NUMBER || `local-${process.env.USER}-${pkg.name}-${Date.now()}`,
|
|
52
|
+
name: `${pkg.name} (automation)`,
|
|
53
|
+
public: 'team',
|
|
54
|
+
tunnelIdentifier: process.env.SC_TUNNEL_IDENTIFIER,
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
const browser = process.env.SC_TUNNEL_IDENTIFIER
|
|
58
|
+
? wd.promiseChainRemote('ondemand.saucelabs.com', 80)
|
|
59
|
+
: wd.promiseChainRemote();
|
|
60
|
+
|
|
61
|
+
return browser
|
|
62
|
+
.init(browserDef)
|
|
63
|
+
.setImplicitWaitTimeout(10000)
|
|
64
|
+
.setWindowSize(1600, 1200)
|
|
65
|
+
.then(() => browser);
|
|
66
|
+
},
|
|
67
|
+
|
|
68
|
+
wd,
|
|
69
|
+
};
|
package/src/wd/accept-grant.js
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
/* eslint-disable no-invalid-this */
|
|
6
|
-
|
|
7
|
-
const wd = require('wd');
|
|
8
|
-
|
|
9
|
-
wd.addPromiseChainMethod('acceptGrant', function acceptGrant() {
|
|
10
|
-
const selector = 'input[value="Accept"]';
|
|
11
|
-
|
|
12
|
-
return this.hasElementByCssSelector(selector).then((has) => {
|
|
13
|
-
if (has) {
|
|
14
|
-
return this.waitForElementByCssSelector(selector).click();
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
return this;
|
|
18
|
-
});
|
|
19
|
-
});
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/* eslint-disable no-invalid-this */
|
|
6
|
+
|
|
7
|
+
const wd = require('wd');
|
|
8
|
+
|
|
9
|
+
wd.addPromiseChainMethod('acceptGrant', function acceptGrant() {
|
|
10
|
+
const selector = 'input[value="Accept"]';
|
|
11
|
+
|
|
12
|
+
return this.hasElementByCssSelector(selector).then((has) => {
|
|
13
|
+
if (has) {
|
|
14
|
+
return this.waitForElementByCssSelector(selector).click();
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return this;
|
|
18
|
+
});
|
|
19
|
+
});
|
package/src/wd/login.js
CHANGED
|
@@ -1,43 +1,43 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
/* eslint-disable no-invalid-this */
|
|
6
|
-
|
|
7
|
-
const {defaults} = require('lodash');
|
|
8
|
-
const wd = require('wd');
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* @method login
|
|
12
|
-
* @memberof wd
|
|
13
|
-
* @param {Object} user
|
|
14
|
-
* @param {stirng} user.email
|
|
15
|
-
* @param {stirng} user.password
|
|
16
|
-
* @param {Object} options
|
|
17
|
-
* @param {number} options.remainingRetries
|
|
18
|
-
*/
|
|
19
|
-
wd.addPromiseChainMethod('login', function login(user, options) {
|
|
20
|
-
options = options || {};
|
|
21
|
-
defaults(options, {
|
|
22
|
-
remainingRetries: 3,
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
if (!user.email) {
|
|
26
|
-
throw new Error('`user.email` is required');
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
if (!user.password) {
|
|
30
|
-
throw new Error('`user.password` is required');
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
return this.hasElementByCssSelector('#IDToken1[readonly]')
|
|
34
|
-
.then((emailAlreadyEntered) => {
|
|
35
|
-
if (!emailAlreadyEntered) {
|
|
36
|
-
return this.elementById('IDToken1').sendKeys(user.email).elementById('IDButton2').click();
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return this;
|
|
40
|
-
})
|
|
41
|
-
.submitPassword(user, options)
|
|
42
|
-
.acceptGrant();
|
|
43
|
-
});
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/* eslint-disable no-invalid-this */
|
|
6
|
+
|
|
7
|
+
const {defaults} = require('lodash');
|
|
8
|
+
const wd = require('wd');
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @method login
|
|
12
|
+
* @memberof wd
|
|
13
|
+
* @param {Object} user
|
|
14
|
+
* @param {stirng} user.email
|
|
15
|
+
* @param {stirng} user.password
|
|
16
|
+
* @param {Object} options
|
|
17
|
+
* @param {number} options.remainingRetries
|
|
18
|
+
*/
|
|
19
|
+
wd.addPromiseChainMethod('login', function login(user, options) {
|
|
20
|
+
options = options || {};
|
|
21
|
+
defaults(options, {
|
|
22
|
+
remainingRetries: 3,
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
if (!user.email) {
|
|
26
|
+
throw new Error('`user.email` is required');
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
if (!user.password) {
|
|
30
|
+
throw new Error('`user.password` is required');
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return this.hasElementByCssSelector('#IDToken1[readonly]')
|
|
34
|
+
.then((emailAlreadyEntered) => {
|
|
35
|
+
if (!emailAlreadyEntered) {
|
|
36
|
+
return this.elementById('IDToken1').sendKeys(user.email).elementById('IDButton2').click();
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return this;
|
|
40
|
+
})
|
|
41
|
+
.submitPassword(user, options)
|
|
42
|
+
.acceptGrant();
|
|
43
|
+
});
|
package/src/wd/print-logs.js
CHANGED
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
/* eslint max-nested-callbacks: [0] */
|
|
6
|
-
/* eslint no-console: [0] */
|
|
7
|
-
/* eslint-disable no-invalid-this */
|
|
8
|
-
|
|
9
|
-
const wd = require('wd');
|
|
10
|
-
|
|
11
|
-
wd.addPromiseChainMethod('printLogs', function printLogs() {
|
|
12
|
-
return this.log('browser')
|
|
13
|
-
.then((logs) => {
|
|
14
|
-
logs.forEach((log) => {
|
|
15
|
-
try {
|
|
16
|
-
log.message = JSON.parse(log.message);
|
|
17
|
-
const method = console[log.message.message.level] || console.log;
|
|
18
|
-
|
|
19
|
-
console[method]('broser log:', log.message.message.text);
|
|
20
|
-
} catch (err) {
|
|
21
|
-
console.log('browser log:', log.message);
|
|
22
|
-
}
|
|
23
|
-
});
|
|
24
|
-
})
|
|
25
|
-
.catch((reason) => {
|
|
26
|
-
console.warn('failed to fetch browser logs', reason);
|
|
27
|
-
});
|
|
28
|
-
});
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/* eslint max-nested-callbacks: [0] */
|
|
6
|
+
/* eslint no-console: [0] */
|
|
7
|
+
/* eslint-disable no-invalid-this */
|
|
8
|
+
|
|
9
|
+
const wd = require('wd');
|
|
10
|
+
|
|
11
|
+
wd.addPromiseChainMethod('printLogs', function printLogs() {
|
|
12
|
+
return this.log('browser')
|
|
13
|
+
.then((logs) => {
|
|
14
|
+
logs.forEach((log) => {
|
|
15
|
+
try {
|
|
16
|
+
log.message = JSON.parse(log.message);
|
|
17
|
+
const method = console[log.message.message.level] || console.log;
|
|
18
|
+
|
|
19
|
+
console[method]('broser log:', log.message.message.text);
|
|
20
|
+
} catch (err) {
|
|
21
|
+
console.log('browser log:', log.message);
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
})
|
|
25
|
+
.catch((reason) => {
|
|
26
|
+
console.warn('failed to fetch browser logs', reason);
|
|
27
|
+
});
|
|
28
|
+
});
|
|
@@ -1,57 +1,57 @@
|
|
|
1
|
-
/*!
|
|
2
|
-
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
-
*/
|
|
4
|
-
|
|
5
|
-
/* eslint-disable no-invalid-this */
|
|
6
|
-
/* eslint-disable max-nested-callbacks */
|
|
7
|
-
|
|
8
|
-
const wd = require('wd');
|
|
9
|
-
|
|
10
|
-
/**
|
|
11
|
-
* Returns a promise that resolves after 'timeout' milliseconds
|
|
12
|
-
* @param {number} timeout
|
|
13
|
-
* @private
|
|
14
|
-
* @returns {Promise}
|
|
15
|
-
*/
|
|
16
|
-
function delay(timeout) {
|
|
17
|
-
return new Promise((resolve) => {
|
|
18
|
-
setTimeout(resolve, timeout);
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* @method submitPassword
|
|
23
|
-
* @memberof wd
|
|
24
|
-
* @param {Object} user
|
|
25
|
-
* @param {string} user.password
|
|
26
|
-
* @param {Object} options
|
|
27
|
-
* @param {Object} options.remainingRetries
|
|
28
|
-
*/
|
|
29
|
-
wd.addPromiseChainMethod('submitPassword', function submitPassword(user, options) {
|
|
30
|
-
if (!user.password) {
|
|
31
|
-
throw new Error('`user.password` is required');
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
options = options || {
|
|
35
|
-
remainingRetries: 3,
|
|
36
|
-
};
|
|
37
|
-
|
|
38
|
-
return this.elementById('IDToken2')
|
|
39
|
-
.sendKeys(user.password)
|
|
40
|
-
.elementById('Button1')
|
|
41
|
-
.click()
|
|
42
|
-
.hasElementByClassName('generic-error')
|
|
43
|
-
.then((isPresent) => {
|
|
44
|
-
if (isPresent) {
|
|
45
|
-
if (options.remainingRetries > 0) {
|
|
46
|
-
options.remainingRetries -= 1;
|
|
47
|
-
|
|
48
|
-
return delay(1000).then(() => {
|
|
49
|
-
this.submitPassword(user, options);
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
throw new Error('Failed to login after several attempts');
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
return null;
|
|
56
|
-
});
|
|
57
|
-
});
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
/* eslint-disable no-invalid-this */
|
|
6
|
+
/* eslint-disable max-nested-callbacks */
|
|
7
|
+
|
|
8
|
+
const wd = require('wd');
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Returns a promise that resolves after 'timeout' milliseconds
|
|
12
|
+
* @param {number} timeout
|
|
13
|
+
* @private
|
|
14
|
+
* @returns {Promise}
|
|
15
|
+
*/
|
|
16
|
+
function delay(timeout) {
|
|
17
|
+
return new Promise((resolve) => {
|
|
18
|
+
setTimeout(resolve, timeout);
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* @method submitPassword
|
|
23
|
+
* @memberof wd
|
|
24
|
+
* @param {Object} user
|
|
25
|
+
* @param {string} user.password
|
|
26
|
+
* @param {Object} options
|
|
27
|
+
* @param {Object} options.remainingRetries
|
|
28
|
+
*/
|
|
29
|
+
wd.addPromiseChainMethod('submitPassword', function submitPassword(user, options) {
|
|
30
|
+
if (!user.password) {
|
|
31
|
+
throw new Error('`user.password` is required');
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
options = options || {
|
|
35
|
+
remainingRetries: 3,
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
return this.elementById('IDToken2')
|
|
39
|
+
.sendKeys(user.password)
|
|
40
|
+
.elementById('Button1')
|
|
41
|
+
.click()
|
|
42
|
+
.hasElementByClassName('generic-error')
|
|
43
|
+
.then((isPresent) => {
|
|
44
|
+
if (isPresent) {
|
|
45
|
+
if (options.remainingRetries > 0) {
|
|
46
|
+
options.remainingRetries -= 1;
|
|
47
|
+
|
|
48
|
+
return delay(1000).then(() => {
|
|
49
|
+
this.submitPassword(user, options);
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
throw new Error('Failed to login after several attempts');
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return null;
|
|
56
|
+
});
|
|
57
|
+
});
|