@webex/test-helper-automation 2.36.1 → 2.37.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/dist/index.js CHANGED
@@ -1,11 +1,8 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
4
-
5
4
  var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
6
-
7
5
  var _now = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/date/now"));
8
-
9
6
  /*!
10
7
  * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
11
8
  */
@@ -14,26 +11,20 @@ var _now = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/date/n
14
11
  if (typeof _promise.default === 'undefined') {
15
12
  // eslint-disable-next-line global-require
16
13
  require('es6-promise').polyfill();
17
- } // Reminder: this is intentionally a different instance of chai than
18
- // @webex/test-helper-chai.
19
-
14
+ }
20
15
 
16
+ // Reminder: this is intentionally a different instance of chai than
17
+ // @webex/test-helper-chai.
21
18
  var path = require('path');
22
-
23
- var chai = require('chai'); // Note: this is probably the only place we should use chai-as-promised; it's
19
+ var chai = require('chai');
20
+ // Note: this is probably the only place we should use chai-as-promised; it's
24
21
  // incompatible with IE 11, so can't go into browser tests. Once we move to
25
22
  // wdio, it can be removed from here as well.
26
-
27
-
28
23
  var chaiAsPromised = require('chai-as-promised');
29
-
30
24
  var _require = require('lodash'),
31
- defaults = _require.defaults;
32
-
25
+ defaults = _require.defaults;
33
26
  var requireDir = require('require-dir');
34
-
35
27
  var wd = require('wd');
36
-
37
28
  chai.use(chaiAsPromised);
38
29
  chai.should();
39
30
  chaiAsPromised.transferPromiseness = wd.transferPromiseness;
@@ -49,17 +40,14 @@ module.exports = {
49
40
  if (!pkg) {
50
41
  throw new Error('pkg is required');
51
42
  }
52
-
53
43
  if (!browserDef) {
54
44
  browserDef = {
55
45
  browserName: 'chrome'
56
46
  };
57
47
  }
58
-
59
48
  if (!browserDef) {
60
49
  throw new Error('No browser definition available');
61
50
  }
62
-
63
51
  browserDef = defaults(browserDef, {
64
52
  build: process.env.BUILD_NUMBER || "local-".concat(process.env.USER, "-").concat(pkg.name, "-").concat((0, _now.default)()),
65
53
  name: "".concat(pkg.name, " (automation)"),
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"names":["require","polyfill","path","chai","chaiAsPromised","defaults","requireDir","wd","use","should","transferPromiseness","join","__dirname","module","exports","createBrowser","pkg","browserDef","Error","browserName","build","process","env","BUILD_NUMBER","USER","name","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\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 ? wd.promiseChainRemote('ondemand.saucelabs.com', 80) : wd.promiseChainRemote();\n\n return browser.init(browserDef)\n .setImplicitWaitTimeout(10000)\n .setWindowSize(1600, 1200)\n .then(() => browser);\n },\n\n wd\n};\n"],"mappings":";;;;;;;;AAAA;AACA;AACA;;AAGA;AACA,IAAI,4BAAmB,WAAvB,EAAoC;EAClC;EACAA,OAAO,CAAC,aAAD,CAAP,CAAuBC,QAAvB;AACD,C,CAED;AACA;;;AACA,IAAMC,IAAI,GAAGF,OAAO,CAAC,MAAD,CAApB;;AAEA,IAAMG,IAAI,GAAGH,OAAO,CAAC,MAAD,CAApB,C,CACA;AACA;AACA;;;AACA,IAAMI,cAAc,GAAGJ,OAAO,CAAC,kBAAD,CAA9B;;AACA,eAAmBA,OAAO,CAAC,QAAD,CAA1B;AAAA,IAAOK,QAAP,YAAOA,QAAP;;AACA,IAAMC,UAAU,GAAGN,OAAO,CAAC,aAAD,CAA1B;;AACA,IAAMO,EAAE,GAAGP,OAAO,CAAC,IAAD,CAAlB;;AAEAG,IAAI,CAACK,GAAL,CAASJ,cAAT;AACAD,IAAI,CAACM,MAAL;AACAL,cAAc,CAACM,mBAAf,GAAqCH,EAAE,CAACG,mBAAxC;AAEAJ,UAAU,CAACJ,IAAI,CAACS,IAAL,CAAUC,SAAV,EAAqB,IAArB,CAAD,CAAV;AAEAC,MAAM,CAACC,OAAP,GAAiB;EACf;AACF;AACA;AACA;AACA;AACA;EACEC,aAAa,EAAE,SAASA,aAAT,CAAuBC,GAAvB,EAA4BC,UAA5B,EAAwC;IACrD,IAAI,CAACD,GAAL,EAAU;MACR,MAAM,IAAIE,KAAJ,CAAU,iBAAV,CAAN;IACD;;IAED,IAAI,CAACD,UAAL,EAAiB;MACfA,UAAU,GAAG;QAACE,WAAW,EAAE;MAAd,CAAb;IACD;;IAED,IAAI,CAACF,UAAL,EAAiB;MACf,MAAM,IAAIC,KAAJ,CAAU,iCAAV,CAAN;IACD;;IAEDD,UAAU,GAAGZ,QAAQ,CAACY,UAAD,EAAa;MAChCG,KAAK,EAAEC,OAAO,CAACC,GAAR,CAAYC,YAAZ,oBAAqCF,OAAO,CAACC,GAAR,CAAYE,IAAjD,cAAyDR,GAAG,CAACS,IAA7D,cAAqE,mBAArE,CADyB;MAEhCA,IAAI,YAAKT,GAAG,CAACS,IAAT,kBAF4B;MAGhCC,MAAM,EAAE,MAHwB;MAIhCC,gBAAgB,EAAEN,OAAO,CAACC,GAAR,CAAYM;IAJE,CAAb,CAArB;IAOA,IAAMC,OAAO,GAAGR,OAAO,CAACC,GAAR,CAAYM,oBAAZ,GAAmCrB,EAAE,CAACuB,kBAAH,CAAsB,wBAAtB,EAAgD,EAAhD,CAAnC,GAAyFvB,EAAE,CAACuB,kBAAH,EAAzG;IAEA,OAAOD,OAAO,CAACE,IAAR,CAAad,UAAb,EACJe,sBADI,CACmB,KADnB,EAEJC,aAFI,CAEU,IAFV,EAEgB,IAFhB,EAGJC,IAHI,CAGC;MAAA,OAAML,OAAN;IAAA,CAHD,CAAP;EAID,CAjCc;EAmCftB,EAAE,EAAFA;AAnCe,CAAjB"}
1
+ {"version":3,"names":["require","polyfill","path","chai","chaiAsPromised","defaults","requireDir","wd","use","should","transferPromiseness","join","__dirname","module","exports","createBrowser","pkg","browserDef","Error","browserName","build","process","env","BUILD_NUMBER","USER","name","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,uBAAc,KAAK,WAAW,EAAE;EAClC;EACAA,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,eAAmBA,OAAO,CAAC,QAAQ,CAAC;EAA7BK,QAAQ,YAARA,QAAQ;AACf,IAAMC,UAAU,GAAGN,OAAO,CAAC,aAAa,CAAC;AACzC,IAAMO,EAAE,GAAGP,OAAO,CAAC,IAAI,CAAC;AAExBG,IAAI,CAACK,GAAG,CAACJ,cAAc,CAAC;AACxBD,IAAI,CAACM,MAAM,EAAE;AACbL,cAAc,CAACM,mBAAmB,GAAGH,EAAE,CAACG,mBAAmB;AAE3DJ,UAAU,CAACJ,IAAI,CAACS,IAAI,CAACC,SAAS,EAAE,IAAI,CAAC,CAAC;AAEtCC,MAAM,CAACC,OAAO,GAAG;EACf;AACF;AACA;AACA;AACA;AACA;EACEC,aAAa,EAAE,SAASA,aAAa,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,oBAAaF,OAAO,CAACC,GAAG,CAACE,IAAI,cAAIR,GAAG,CAACS,IAAI,cAAI,mBAAU,CAAE;MACxFA,IAAI,YAAKT,GAAG,CAACS,IAAI,kBAAe;MAChCC,MAAM,EAAE,MAAM;MACdC,gBAAgB,EAAEN,OAAO,CAACC,GAAG,CAACM;IAChC,CAAC,CAAC;IAEF,IAAMC,OAAO,GAAGR,OAAO,CAACC,GAAG,CAACM,oBAAoB,GAC5CrB,EAAE,CAACuB,kBAAkB,CAAC,wBAAwB,EAAE,EAAE,CAAC,GACnDvB,EAAE,CAACuB,kBAAkB,EAAE;IAE3B,OAAOD,OAAO,CACXE,IAAI,CAACd,UAAU,CAAC,CAChBe,sBAAsB,CAAC,KAAK,CAAC,CAC7BC,aAAa,CAAC,IAAI,EAAE,IAAI,CAAC,CACzBC,IAAI,CAAC;MAAA,OAAML,OAAO;IAAA,EAAC;EACxB,CAAC;EAEDtB,EAAE,EAAFA;AACF,CAAC"}
@@ -5,17 +5,15 @@
5
5
  */
6
6
 
7
7
  /* eslint-disable no-invalid-this */
8
- var wd = require('wd');
9
8
 
9
+ var wd = require('wd');
10
10
  wd.addPromiseChainMethod('acceptGrant', function acceptGrant() {
11
11
  var _this = this;
12
-
13
12
  var selector = 'input[value="Accept"]';
14
13
  return this.hasElementByCssSelector(selector).then(function (has) {
15
14
  if (has) {
16
15
  return _this.waitForElementByCssSelector(selector).click();
17
16
  }
18
-
19
17
  return _this;
20
18
  });
21
19
  });
@@ -1 +1 @@
1
- {"version":3,"names":["wd","require","addPromiseChainMethod","acceptGrant","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\n .hasElementByCssSelector(selector)\n .then((has) => {\n if (has) {\n return this\n .waitForElementByCssSelector(selector)\n .click();\n }\n\n return this;\n });\n});\n"],"mappings":";;AAAA;AACA;AACA;;AAEA;AAEA,IAAMA,EAAE,GAAGC,OAAO,CAAC,IAAD,CAAlB;;AAEAD,EAAE,CAACE,qBAAH,CAAyB,aAAzB,EAAwC,SAASC,WAAT,GAAuB;EAAA;;EAC7D,IAAMC,QAAQ,GAAG,uBAAjB;EAEA,OAAO,KACJC,uBADI,CACoBD,QADpB,EAEJE,IAFI,CAEC,UAACC,GAAD,EAAS;IACb,IAAIA,GAAJ,EAAS;MACP,OAAO,KAAI,CACRC,2BADI,CACwBJ,QADxB,EAEJK,KAFI,EAAP;IAGD;;IAED,OAAO,KAAP;EACD,CAVI,CAAP;AAWD,CAdD"}
1
+ {"version":3,"names":["wd","require","addPromiseChainMethod","acceptGrant","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,WAAW,GAAG;EAAA;EAC7D,IAAMC,QAAQ,GAAG,uBAAuB;EAExC,OAAO,IAAI,CAACC,uBAAuB,CAACD,QAAQ,CAAC,CAACE,IAAI,CAAC,UAACC,GAAG,EAAK;IAC1D,IAAIA,GAAG,EAAE;MACP,OAAO,KAAI,CAACC,2BAA2B,CAACJ,QAAQ,CAAC,CAACK,KAAK,EAAE;IAC3D;IAEA,OAAO,KAAI;EACb,CAAC,CAAC;AACJ,CAAC,CAAC"}
package/dist/wd/login.js CHANGED
@@ -5,10 +5,11 @@
5
5
  */
6
6
 
7
7
  /* eslint-disable no-invalid-this */
8
- var _require = require('lodash'),
9
- defaults = _require.defaults;
10
8
 
9
+ var _require = require('lodash'),
10
+ defaults = _require.defaults;
11
11
  var wd = require('wd');
12
+
12
13
  /**
13
14
  * @method login
14
15
  * @memberof wd
@@ -18,29 +19,22 @@ var wd = require('wd');
18
19
  * @param {Object} options
19
20
  * @param {number} options.remainingRetries
20
21
  */
21
-
22
-
23
22
  wd.addPromiseChainMethod('login', function login(user, options) {
24
23
  var _this = this;
25
-
26
24
  options = options || {};
27
25
  defaults(options, {
28
26
  remainingRetries: 3
29
27
  });
30
-
31
28
  if (!user.email) {
32
29
  throw new Error('`user.email` is required');
33
30
  }
34
-
35
31
  if (!user.password) {
36
32
  throw new Error('`user.password` is required');
37
33
  }
38
-
39
34
  return this.hasElementByCssSelector('#IDToken1[readonly]').then(function (emailAlreadyEntered) {
40
35
  if (!emailAlreadyEntered) {
41
36
  return _this.elementById('IDToken1').sendKeys(user.email).elementById('IDButton2').click();
42
37
  }
43
-
44
38
  return _this;
45
39
  }).submitPassword(user, options).acceptGrant();
46
40
  });
@@ -1 +1 @@
1
- {"version":3,"names":["require","defaults","wd","addPromiseChainMethod","login","user","options","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\n .hasElementByCssSelector('#IDToken1[readonly]')\n .then((emailAlreadyEntered) => {\n if (!emailAlreadyEntered) {\n return this\n .elementById('IDToken1')\n .sendKeys(user.email)\n .elementById('IDButton2')\n .click();\n }\n\n return this;\n })\n .submitPassword(user, options)\n .acceptGrant();\n});\n"],"mappings":";;AAAA;AACA;AACA;;AAEA;AAEA,eAAmBA,OAAO,CAAC,QAAD,CAA1B;AAAA,IAAOC,QAAP,YAAOA,QAAP;;AACA,IAAMC,EAAE,GAAGF,OAAO,CAAC,IAAD,CAAlB;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACAE,EAAE,CAACC,qBAAH,CAAyB,OAAzB,EAAkC,SAASC,KAAT,CAAeC,IAAf,EAAqBC,OAArB,EAA8B;EAAA;;EAC9DA,OAAO,GAAGA,OAAO,IAAI,EAArB;EACAL,QAAQ,CAACK,OAAD,EAAU;IAChBC,gBAAgB,EAAE;EADF,CAAV,CAAR;;EAIA,IAAI,CAACF,IAAI,CAACG,KAAV,EAAiB;IACf,MAAM,IAAIC,KAAJ,CAAU,0BAAV,CAAN;EACD;;EAED,IAAI,CAACJ,IAAI,CAACK,QAAV,EAAoB;IAClB,MAAM,IAAID,KAAJ,CAAU,6BAAV,CAAN;EACD;;EAED,OAAO,KACJE,uBADI,CACoB,qBADpB,EAEJC,IAFI,CAEC,UAACC,mBAAD,EAAyB;IAC7B,IAAI,CAACA,mBAAL,EAA0B;MACxB,OAAO,KAAI,CACRC,WADI,CACQ,UADR,EAEJC,QAFI,CAEKV,IAAI,CAACG,KAFV,EAGJM,WAHI,CAGQ,WAHR,EAIJE,KAJI,EAAP;IAKD;;IAED,OAAO,KAAP;EACD,CAZI,EAaJC,cAbI,CAaWZ,IAbX,EAaiBC,OAbjB,EAcJY,WAdI,EAAP;AAeD,CA7BD"}
1
+ {"version":3,"names":["require","defaults","wd","addPromiseChainMethod","login","user","options","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,eAAmBA,OAAO,CAAC,QAAQ,CAAC;EAA7BC,QAAQ,YAARA,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,KAAK,CAACC,IAAI,EAAEC,OAAO,EAAE;EAAA;EAC9DA,OAAO,GAAGA,OAAO,IAAI,CAAC,CAAC;EACvBL,QAAQ,CAACK,OAAO,EAAE;IAChBC,gBAAgB,EAAE;EACpB,CAAC,CAAC;EAEF,IAAI,CAACF,IAAI,CAACG,KAAK,EAAE;IACf,MAAM,IAAIC,KAAK,CAAC,0BAA0B,CAAC;EAC7C;EAEA,IAAI,CAACJ,IAAI,CAACK,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,OAAO,KAAI,CAACC,WAAW,CAAC,UAAU,CAAC,CAACC,QAAQ,CAACV,IAAI,CAACG,KAAK,CAAC,CAACM,WAAW,CAAC,WAAW,CAAC,CAACE,KAAK,EAAE;IAC3F;IAEA,OAAO,KAAI;EACb,CAAC,CAAC,CACDC,cAAc,CAACZ,IAAI,EAAEC,OAAO,CAAC,CAC7BY,WAAW,EAAE;AAClB,CAAC,CAAC"}
@@ -5,12 +5,10 @@
5
5
  */
6
6
 
7
7
  /* eslint max-nested-callbacks: [0] */
8
-
9
8
  /* eslint no-console: [0] */
10
-
11
9
  /* eslint-disable no-invalid-this */
12
- var wd = require('wd');
13
10
 
11
+ var wd = require('wd');
14
12
  wd.addPromiseChainMethod('printLogs', function printLogs() {
15
13
  return this.log('browser').then(function (logs) {
16
14
  logs.forEach(function (log) {
@@ -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\n .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 }\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,IAAD,CAAlB;;AAEAD,EAAE,CAACE,qBAAH,CAAyB,WAAzB,EAAsC,SAASC,SAAT,GAAqB;EACzD,OAAO,KACJC,GADI,CACA,SADA,EAEJC,IAFI,CAEC,UAACC,IAAD,EAAU;IACdA,IAAI,CAACC,OAAL,CAAa,UAACH,GAAD,EAAS;MACpB,IAAI;QACFA,GAAG,CAACI,OAAJ,GAAcC,IAAI,CAACC,KAAL,CAAWN,GAAG,CAACI,OAAf,CAAd;QACA,IAAMG,MAAM,GAAGC,OAAO,CAACR,GAAG,CAACI,OAAJ,CAAYA,OAAZ,CAAoBK,KAArB,CAAP,IAAsCD,OAAO,CAACR,GAA7D;QAEAQ,OAAO,CAACD,MAAD,CAAP,CAAgB,aAAhB,EAA+BP,GAAG,CAACI,OAAJ,CAAYA,OAAZ,CAAoBM,IAAnD;MACD,CALD,CAMA,OAAOC,GAAP,EAAY;QACVH,OAAO,CAACR,GAAR,CAAY,cAAZ,EAA4BA,GAAG,CAACI,OAAhC;MACD;IACF,CAVD;EAWD,CAdI,EAeJQ,KAfI,CAeE,UAACC,MAAD,EAAY;IACjBL,OAAO,CAACM,IAAR,CAAa,8BAAb,EAA6CD,MAA7C;EACD,CAjBI,CAAP;AAkBD,CAnBD"}
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,SAAS,GAAG;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,25 +1,22 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime-corejs2/helpers/interopRequireDefault");
4
-
5
4
  var _promise = _interopRequireDefault(require("@babel/runtime-corejs2/core-js/promise"));
6
-
7
5
  /*!
8
6
  * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
9
7
  */
10
8
 
11
9
  /* eslint-disable no-invalid-this */
12
-
13
10
  /* eslint-disable max-nested-callbacks */
11
+
14
12
  var wd = require('wd');
13
+
15
14
  /**
16
15
  * Returns a promise that resolves after 'timeout' milliseconds
17
16
  * @param {number} timeout
18
17
  * @private
19
18
  * @returns {Promise}
20
19
  */
21
-
22
-
23
20
  function delay(timeout) {
24
21
  return new _promise.default(function (resolve) {
25
22
  setTimeout(resolve, timeout);
@@ -33,15 +30,11 @@ function delay(timeout) {
33
30
  * @param {Object} options
34
31
  * @param {Object} options.remainingRetries
35
32
  */
36
-
37
-
38
33
  wd.addPromiseChainMethod('submitPassword', function submitPassword(user, options) {
39
34
  var _this = this;
40
-
41
35
  if (!user.password) {
42
36
  throw new Error('`user.password` is required');
43
37
  }
44
-
45
38
  options = options || {
46
39
  remainingRetries: 3
47
40
  };
@@ -53,10 +46,8 @@ wd.addPromiseChainMethod('submitPassword', function submitPassword(user, options
53
46
  _this.submitPassword(user, options);
54
47
  });
55
48
  }
56
-
57
49
  throw new Error('Failed to login after several attempts');
58
50
  }
59
-
60
51
  return null;
61
52
  });
62
53
  });
@@ -1 +1 @@
1
- {"version":3,"names":["wd","require","delay","timeout","resolve","setTimeout","addPromiseChainMethod","submitPassword","user","options","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\n .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)\n .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,IAAD,CAAlB;AAEA;AACA;AACA;AACA;AACA;AACA;;;AACA,SAASC,KAAT,CAAeC,OAAf,EAAwB;EACtB,OAAO,qBAAY,UAACC,OAAD,EAAa;IAC9BC,UAAU,CAACD,OAAD,EAAUD,OAAV,CAAV;EACD,CAFM,CAAP;AAGD;AACD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;;AACAH,EAAE,CAACM,qBAAH,CAAyB,gBAAzB,EAA2C,SAASC,cAAT,CAAwBC,IAAxB,EAA8BC,OAA9B,EAAuC;EAAA;;EAChF,IAAI,CAACD,IAAI,CAACE,QAAV,EAAoB;IAClB,MAAM,IAAIC,KAAJ,CAAU,6BAAV,CAAN;EACD;;EAEDF,OAAO,GAAGA,OAAO,IAAI;IACnBG,gBAAgB,EAAE;EADC,CAArB;EAIA,OAAO,KACJC,WADI,CACQ,UADR,EAEJC,QAFI,CAEKN,IAAI,CAACE,QAFV,EAGJG,WAHI,CAGQ,SAHR,EAIJE,KAJI,GAKJC,qBALI,CAKkB,eALlB,EAMJC,IANI,CAMC,UAACC,SAAD,EAAe;IACnB,IAAIA,SAAJ,EAAe;MACb,IAAIT,OAAO,CAACG,gBAAR,GAA2B,CAA/B,EAAkC;QAChCH,OAAO,CAACG,gBAAR,IAA4B,CAA5B;QAEA,OAAOV,KAAK,CAAC,IAAD,CAAL,CACJe,IADI,CACC,YAAM;UACV,KAAI,CAACV,cAAL,CAAoBC,IAApB,EAA0BC,OAA1B;QACD,CAHI,CAAP;MAID;;MACD,MAAM,IAAIE,KAAJ,CAAU,wCAAV,CAAN;IACD;;IAED,OAAO,IAAP;EACD,CApBI,CAAP;AAqBD,CA9BD"}
1
+ {"version":3,"names":["wd","require","delay","timeout","resolve","setTimeout","addPromiseChainMethod","submitPassword","user","options","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,KAAK,CAACC,OAAO,EAAE;EACtB,OAAO,qBAAY,UAACC,OAAO,EAAK;IAC9BC,UAAU,CAACD,OAAO,EAAED,OAAO,CAAC;EAC9B,CAAC,CAAC;AACJ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACAH,EAAE,CAACM,qBAAqB,CAAC,gBAAgB,EAAE,SAASC,cAAc,CAACC,IAAI,EAAEC,OAAO,EAAE;EAAA;EAChF,IAAI,CAACD,IAAI,CAACE,QAAQ,EAAE;IAClB,MAAM,IAAIC,KAAK,CAAC,6BAA6B,CAAC;EAChD;EAEAF,OAAO,GAAGA,OAAO,IAAI;IACnBG,gBAAgB,EAAE;EACpB,CAAC;EAED,OAAO,IAAI,CAACC,WAAW,CAAC,UAAU,CAAC,CAChCC,QAAQ,CAACN,IAAI,CAACE,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,IAAIT,OAAO,CAACG,gBAAgB,GAAG,CAAC,EAAE;QAChCH,OAAO,CAACG,gBAAgB,IAAI,CAAC;QAE7B,OAAOV,KAAK,CAAC,IAAI,CAAC,CAACe,IAAI,CAAC,YAAM;UAC5B,KAAI,CAACV,cAAc,CAACC,IAAI,EAAEC,OAAO,CAAC;QACpC,CAAC,CAAC;MACJ;MACA,MAAM,IAAIE,KAAK,CAAC,wCAAwC,CAAC;IAC3D;IAEA,OAAO,IAAI;EACb,CAAC,CAAC;AACN,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webex/test-helper-automation",
3
- "version": "2.36.1",
3
+ "version": "2.37.1",
4
4
  "description": "",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
package/src/index.js CHANGED
@@ -2,7 +2,6 @@
2
2
  * Copyright (c) 2015-2020 Cisco Systems, Inc. See LICENSE file.
3
3
  */
4
4
 
5
-
6
5
  /* istanbul ignore next */
7
6
  if (typeof Promise === 'undefined') {
8
7
  // eslint-disable-next-line global-require
@@ -52,16 +51,19 @@ module.exports = {
52
51
  build: process.env.BUILD_NUMBER || `local-${process.env.USER}-${pkg.name}-${Date.now()}`,
53
52
  name: `${pkg.name} (automation)`,
54
53
  public: 'team',
55
- tunnelIdentifier: process.env.SC_TUNNEL_IDENTIFIER
54
+ tunnelIdentifier: process.env.SC_TUNNEL_IDENTIFIER,
56
55
  });
57
56
 
58
- const browser = process.env.SC_TUNNEL_IDENTIFIER ? wd.promiseChainRemote('ondemand.saucelabs.com', 80) : wd.promiseChainRemote();
57
+ const browser = process.env.SC_TUNNEL_IDENTIFIER
58
+ ? wd.promiseChainRemote('ondemand.saucelabs.com', 80)
59
+ : wd.promiseChainRemote();
59
60
 
60
- return browser.init(browserDef)
61
+ return browser
62
+ .init(browserDef)
61
63
  .setImplicitWaitTimeout(10000)
62
64
  .setWindowSize(1600, 1200)
63
65
  .then(() => browser);
64
66
  },
65
67
 
66
- wd
68
+ wd,
67
69
  };
@@ -9,15 +9,11 @@ const wd = require('wd');
9
9
  wd.addPromiseChainMethod('acceptGrant', function acceptGrant() {
10
10
  const selector = 'input[value="Accept"]';
11
11
 
12
- return this
13
- .hasElementByCssSelector(selector)
14
- .then((has) => {
15
- if (has) {
16
- return this
17
- .waitForElementByCssSelector(selector)
18
- .click();
19
- }
12
+ return this.hasElementByCssSelector(selector).then((has) => {
13
+ if (has) {
14
+ return this.waitForElementByCssSelector(selector).click();
15
+ }
20
16
 
21
- return this;
22
- });
17
+ return this;
18
+ });
23
19
  });
package/src/wd/login.js CHANGED
@@ -19,7 +19,7 @@ const wd = require('wd');
19
19
  wd.addPromiseChainMethod('login', function login(user, options) {
20
20
  options = options || {};
21
21
  defaults(options, {
22
- remainingRetries: 3
22
+ remainingRetries: 3,
23
23
  });
24
24
 
25
25
  if (!user.email) {
@@ -30,15 +30,10 @@ wd.addPromiseChainMethod('login', function login(user, options) {
30
30
  throw new Error('`user.password` is required');
31
31
  }
32
32
 
33
- return this
34
- .hasElementByCssSelector('#IDToken1[readonly]')
33
+ return this.hasElementByCssSelector('#IDToken1[readonly]')
35
34
  .then((emailAlreadyEntered) => {
36
35
  if (!emailAlreadyEntered) {
37
- return this
38
- .elementById('IDToken1')
39
- .sendKeys(user.email)
40
- .elementById('IDButton2')
41
- .click();
36
+ return this.elementById('IDToken1').sendKeys(user.email).elementById('IDButton2').click();
42
37
  }
43
38
 
44
39
  return this;
@@ -9,8 +9,7 @@
9
9
  const wd = require('wd');
10
10
 
11
11
  wd.addPromiseChainMethod('printLogs', function printLogs() {
12
- return this
13
- .log('browser')
12
+ return this.log('browser')
14
13
  .then((logs) => {
15
14
  logs.forEach((log) => {
16
15
  try {
@@ -18,8 +17,7 @@ wd.addPromiseChainMethod('printLogs', function printLogs() {
18
17
  const method = console[log.message.message.level] || console.log;
19
18
 
20
19
  console[method]('broser log:', log.message.message.text);
21
- }
22
- catch (err) {
20
+ } catch (err) {
23
21
  console.log('browser log:', log.message);
24
22
  }
25
23
  });
@@ -32,11 +32,10 @@ wd.addPromiseChainMethod('submitPassword', function submitPassword(user, options
32
32
  }
33
33
 
34
34
  options = options || {
35
- remainingRetries: 3
35
+ remainingRetries: 3,
36
36
  };
37
37
 
38
- return this
39
- .elementById('IDToken2')
38
+ return this.elementById('IDToken2')
40
39
  .sendKeys(user.password)
41
40
  .elementById('Button1')
42
41
  .click()
@@ -46,10 +45,9 @@ wd.addPromiseChainMethod('submitPassword', function submitPassword(user, options
46
45
  if (options.remainingRetries > 0) {
47
46
  options.remainingRetries -= 1;
48
47
 
49
- return delay(1000)
50
- .then(() => {
51
- this.submitPassword(user, options);
52
- });
48
+ return delay(1000).then(() => {
49
+ this.submitPassword(user, options);
50
+ });
53
51
  }
54
52
  throw new Error('Failed to login after several attempts');
55
53
  }