From de98e0b232509d5f40c135d540a70e415272ff85 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Wed, 3 May 2017 15:35:00 +0200 Subject: node_modules --- .../selenium-webdriver/example/async_await_test.js | 68 +++++++++++++ .../selenium-webdriver/example/firefox_channels.js | 73 ++++++++++++++ .../selenium-webdriver/lib/atoms/getAttribute.js | 12 +++ .../selenium-webdriver/lib/atoms/is-displayed.js | 107 +++++++++++++++++++++ .../selenium-webdriver/lib/test/promise.js | 79 +++++++++++++++ node_modules/selenium-webdriver/test/rect_test.js | 60 ++++++++++++ 6 files changed, 399 insertions(+) create mode 100644 node_modules/selenium-webdriver/example/async_await_test.js create mode 100644 node_modules/selenium-webdriver/example/firefox_channels.js create mode 100644 node_modules/selenium-webdriver/lib/atoms/getAttribute.js create mode 100644 node_modules/selenium-webdriver/lib/atoms/is-displayed.js create mode 100644 node_modules/selenium-webdriver/lib/test/promise.js create mode 100644 node_modules/selenium-webdriver/test/rect_test.js (limited to 'node_modules/selenium-webdriver') diff --git a/node_modules/selenium-webdriver/example/async_await_test.js b/node_modules/selenium-webdriver/example/async_await_test.js new file mode 100644 index 000000000..dd625db34 --- /dev/null +++ b/node_modules/selenium-webdriver/example/async_await_test.js @@ -0,0 +1,68 @@ +// Licensed to the Software Freedom Conservancy (SFC) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The SFC licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +/** + * @fileoverview Example Mocha tests using async/await. + * + * Usage: + * + * mocha -t 20000 --harmony_async_await \ + * selenium-webdriver/example/async_await_test.js + * + * You can change which browser is started with the SELENIUM_BROWSER environment + * variable: + * + * SELENIUM_BROWSER=chrome \ + * mocha -t 20000 --harmony_async_await \ + * selenium-webdriver/example/async_await_test.js + */ + +'use strict'; + +const assert = require('assert'); +const {Builder, By, promise, until} = require('..'); + +// async/await do not work well when the promise manager is enabled. +// See https://github.com/SeleniumHQ/selenium/issues/3037 +// +// 3037 does not impact these specific examples, but it is still recommended +// that you disable the promise manager when using async/await. +promise.USE_PROMISE_MANAGER = false; + +describe('Google Search', function() { + let driver; + + beforeEach(async function() { + driver = await new Builder().forBrowser('firefox').build(); + }); + + afterEach(async function() { + await driver.quit(); + }); + + it('example', async function() { + await driver.get('https://www.google.com/ncr'); + + await driver.findElement(By.name('q')).sendKeys('webdriver'); + await driver.findElement(By.name('btnG')).click(); + + await driver.wait(until.titleIs('webdriver - Google Search'), 1000); + + let url = await driver.getCurrentUrl(); + assert.equal(url, 'https://www.google.com/#q=webdriver'); + }); +}); diff --git a/node_modules/selenium-webdriver/example/firefox_channels.js b/node_modules/selenium-webdriver/example/firefox_channels.js new file mode 100644 index 000000000..b0a30f545 --- /dev/null +++ b/node_modules/selenium-webdriver/example/firefox_channels.js @@ -0,0 +1,73 @@ +// Licensed to the Software Freedom Conservancy (SFC) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The SFC licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +/** + * @fileoverview This is an example of working with the different Firefox + * release channels. Before running this example, you will need to have + * installed Firefox's release, nightly, and developer editions: + * + * - https://www.mozilla.org/en-US/firefox/channel/desktop/#aurora + * - https://www.mozilla.org/en-US/firefox/channel/desktop/#nightly + */ + + +'use strict'; + +const {Builder, By, promise, until} = require('..'); +const {Channel, Options} = require('../firefox'); + +let i = 0; +function resposition(driver) { + return driver.manage().window().setSize(600, 400) + .then(_ => driver.manage().window().setPosition(300 * (i++), 0)); +} + +function doSearch(driver) { + // Start on the base about page. + return driver.get('about:') + // Reposition so users can see the three windows. + .then(_ => resposition(driver)) + // Pause so users can see the magic. + .then(_ => promise.delayed(750)) + // Now do the rest. + .then(_ => driver.get('http://www.google.com/ncr')) + .then(_ => driver.findElement(By.name('q')).sendKeys('webdriver')) + .then(_ => driver.findElement(By.name('btnG')).click()) + .then(_ => driver.wait(until.titleIs('webdriver - Google Search'), 1000)) + .then(_ => driver.quit()); +} + +function createDriver(channel) { + let options = new Options().setBinary(channel); + return new Builder().forBrowser('firefox').setFirefoxOptions(options).build(); +} + +// NOTE: disabling the promise manager so searches all run concurrently. +// For more on the promise manager and its pending deprecation, see +// https://github.com/SeleniumHQ/selenium/issues/2969 +promise.USE_PROMISE_MANAGER = false; + +Promise.all([ + doSearch(createDriver(Channel.RELEASE)), + doSearch(createDriver(Channel.AURORA)), // Developer Edition. + doSearch(createDriver(Channel.NIGHTLY)), +]).then(_ => { + console.log('Success!'); +}, err => { + console.error('An error occured! ' + err); + setTimeout(() => {throw err}, 0); +}); diff --git a/node_modules/selenium-webdriver/lib/atoms/getAttribute.js b/node_modules/selenium-webdriver/lib/atoms/getAttribute.js new file mode 100644 index 000000000..b7d006bbe --- /dev/null +++ b/node_modules/selenium-webdriver/lib/atoms/getAttribute.js @@ -0,0 +1,12 @@ +// GENERATED CODE - DO NOT EDIT +module.exports = function(){return function(){var aa="function"==typeof Object.defineProperties?Object.defineProperty:function(a,c,b){if(b.get||b.set)throw new TypeError("ES3 does not support getters and setters.");a!=Array.prototype&&a!=Object.prototype&&(a[c]=b.value)},ba="undefined"!=typeof window&&window===this?this:"undefined"!=typeof global?global:this; +function e(a,c){if(c){for(var b=ba,d=a.split("."),f=0;fa||1342177279>>=1)b+=b;return d}});e("Math.sign",function(a){return a?a:function(a){a=Number(a);return!a||isNaN(a)?a:0d||b.indexOf("Error",d)!=d)b+="Error";this.name=b;b=Error(this.message);b.name=this.name;this.stack=b.stack||""} +(function(){var a=Error;function c(){}c.prototype=a.prototype;m.b=a.prototype;m.prototype=new c;m.prototype.constructor=m;m.a=function(b,c,f){for(var h=Array(arguments.length-2),k=2;kc?1:0};var w;a:{var x=g.navigator;if(x){var y=x.userAgent;if(y){w=y;break a}}w=""}function z(a){return-1!=w.indexOf(a)};function ca(a,c){for(var b=a.length,d=l(a)?a.split(""):a,f=0;fparseFloat(a))?String(c):a}(),J={},K=g.document,L=K&&E?H()||("CSS1Compat"==K.compatMode?parseInt(I,10):5):void 0;!G&&!E||E&&9<=Number(L)||G&&(J["1.9.1"]||(J["1.9.1"]=0<=r(I,"1.9.1")));E&&(J["9"]||(J["9"]=0<=r(I,"9")));var fa=z("Firefox"),ga=A()||z("iPod"),ha=z("iPad"),M=z("Android")&&!(C()||z("Firefox")||B()||z("Silk")),ia=C(),N=z("Safari")&&!(C()||z("Coast")||B()||z("Edge")||z("Silk")||z("Android"))&&!(A()||z("iPad")||z("iPod"));var ma={SCRIPT:1,STYLE:1,HEAD:1,IFRAME:1,OBJECT:1},na={IMG:" ",BR:"\n"};function oa(a,c,b){if(!(a.nodeName in ma))if(3==a.nodeType)b?c.push(String(a.nodeValue).replace(/(\r\n|\r|\n)/g,"")):c.push(a.nodeValue);else if(a.nodeName in na)c.push(na[a.nodeName]);else for(a=a.firstChild;a;)oa(a,c,b),a=a.nextSibling};function O(a){return(a=a.exec(w))?a[1]:""}var pa=function(){if(fa)return O(/Firefox\/([0-9.]+)/);if(E||F||D)return I;if(ia)return O(/Chrome\/([0-9.]+)/);if(N&&!(A()||z("iPad")||z("iPod")))return O(/Version\/([0-9.]+)/);if(ga||ha){var a=/Version\/(\S+).*Mobile\/(\S+)/.exec(w);if(a)return a[1]+"."+a[2]}else if(M)return(a=O(/Android\s+([0-9.]+)/))?a:O(/Version\/([0-9.]+)/);return""}();var qa;function P(a){ra?qa(a):M?r(sa,a):r(pa,a)}var ra=function(){if(!G)return!1;var a=g.Components;if(!a)return!1;try{if(!a.classes)return!1}catch(f){return!1}var c=a.classes,a=a.interfaces,b=c["@mozilla.org/xpcom/version-comparator;1"].getService(a.nsIVersionComparator),d=c["@mozilla.org/xre/app-info;1"].getService(a.nsIXULAppInfo).version;qa=function(a){b.compare(d,""+a)};return!0}(),Q;if(M){var ta=/Android\s+([0-9\.]+)/.exec(w);Q=ta?ta[1]:"0"}else Q="0"; +var sa=Q,ua=E&&!(8<=Number(L)),va=E&&!(9<=Number(L));M&&P(2.3);M&&P(4);N&&P(6);function R(a,c){c=c.toLowerCase();if("style"==c)return wa(a.style.cssText);if(ua&&"value"==c&&T(a,"INPUT"))return a.value;if(va&&!0===a[c])return String(a.getAttribute(c));var b=a.getAttributeNode(c);return b&&b.specified?b.value:null}var xa=/[;]+(?=(?:(?:[^"]*"){2})*[^"]*$)(?=(?:(?:[^']*'){2})*[^']*$)(?=(?:[^()]*\([^()]*\))*[^()]*$)/; +function wa(a){var c=[];ca(a.split(xa),function(a){var d=a.indexOf(":");0