From 55801486323a1fd62e82eb51062c5bc92acbcdc8 Mon Sep 17 00:00:00 2001 From: Peter Snyder Date: Mon, 23 Oct 2017 01:45:27 -0500 Subject: [PATCH] make all login tests skip (instead of fail) if there are no social networking credentials included in the repo --- README.md | 2 +- test/functional/logins.js | 22 +++++++++++++++++++--- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 40411d6..c3a6356 100644 --- a/README.md +++ b/README.md @@ -87,7 +87,7 @@ Testing and Development --- There is a [Mocha](https://mochajs.org/) and [Selenium](http://docs.seleniumhq.org/) based test suite in place now. To run it you'll need to provide the test suite -with some GitHub and YouTube credentials (to make check for previous regressions +with some social networking credentials (to make check for previous regressions related to cookies and logging into sites). To run the tests, give the following a try: diff --git a/test/functional/logins.js b/test/functional/logins.js index d16cd41..95f5b67 100644 --- a/test/functional/logins.js +++ b/test/functional/logins.js @@ -18,6 +18,11 @@ describe("Logging into popular sites", function () { describe("GitHub", function () { + if (!testParams.github.username) { + console.log(" * No Github account information in test.config.js, skipping these tests."); + return; + } + const formValues = [ ["login", testParams.github.username], ["password", testParams.github.password] @@ -93,6 +98,12 @@ describe("Logging into popular sites", function () { }); describe("Facebook", function () { + + if (!testParams.facebook.username) { + console.log(" * No Facebook account information in test.config.js, skipping these tests."); + return; + } + this.timeout = function () { return 20000; }; @@ -136,8 +147,13 @@ describe("Logging into popular sites", function () { describe("YouTube", function () { + if (!testParams.google.username) { + console.log(" * No Google/YouTube account information in test.config.js, skipping these tests."); + return; + } + this.timeout = function () { - return 20000; + return 30000; }; it("Log in", function (done) { @@ -159,7 +175,7 @@ describe("Logging into popular sites", function () { .then(function () { return driverReference.wait(until.elementLocated( by.name("identifier") - ), 3000); + ), 5000); }) .then(identifierElm => driverReference.wait(until.elementIsVisible(identifierElm))) .then(identifierElm => identifierElm.sendKeys(testParams.google.username, keys.ENTER)) @@ -167,7 +183,7 @@ describe("Logging into popular sites", function () { .then(function () { return driverReference.wait(until.elementLocated( by.name("password") - ), 3000); + ), 5000); }) .then(passwordElm => driverReference.wait(until.elementIsVisible(passwordElm))) .then(passwordElm => passwordElm.sendKeys(testParams.google.password, keys.ENTER))