From 79499b677f48f054f854f8ab9f19d9b945a72437 Mon Sep 17 00:00:00 2001 From: jwzimmer Date: Mon, 23 Oct 2017 20:15:37 -0400 Subject: [PATCH 1/3] Updated selenium & chromedriver versions, which fixed test failures in test_footer_links. Also fixed the clickFooterLinks function so it only checks links in the footer, to remove false positives (e.g. test finds 'Tips' in navbar and passes). --- test/integration/package.json | 4 +-- .../smoke-testing/test_footer_links.js | 31 +++++++++---------- 2 files changed, 16 insertions(+), 19 deletions(-) diff --git a/test/integration/package.json b/test/integration/package.json index db2942f14..fa26009a5 100644 --- a/test/integration/package.json +++ b/test/integration/package.json @@ -1,6 +1,6 @@ { "testDependencies": { - "selenium-webdriver": "2.44.0", - "chromedriver": "2.27.0" + "selenium-webdriver": "2.45.0", + "chromedriver": "2.33.0" } } diff --git a/test/integration/smoke-testing/test_footer_links.js b/test/integration/smoke-testing/test_footer_links.js index 57349d152..1fcb50d56 100644 --- a/test/integration/smoke-testing/test_footer_links.js +++ b/test/integration/smoke-testing/test_footer_links.js @@ -11,13 +11,14 @@ var seleniumWebdriver = require('selenium-webdriver'); // Selenium's promise driver will be deprecated, so we should not rely on it seleniumWebdriver.SELENIUM_PROMISE_MANAGER=0; -//chrome driver -var driver = new seleniumWebdriver.Builder().withCapabilities(seleniumWebdriver.Capabilities.chrome()).build(); +const { + driver +} = require('../../helpers/selenium-helpers.js'); var rootUrl = process.env.ROOT_URL || 'https://scratch.ly'; //timeout for each test; timeout for suite set at command line level -var options = { timeout: 20000 }; +var options = { timeout: 30000 }; //number of tests in the plan tap.plan(25); @@ -33,20 +34,16 @@ tap.beforeEach(function () { }); // Function clicks the link and returns the url of the resulting page -function clickFooterLinks ( linkText ) { - // Not sure if I need this first wait - maybe it solved intermittent initial failure problem? - return driver.wait(seleniumWebdriver.until.elementLocated(seleniumWebdriver.By.id('view'))) - .then( function () { - return driver.wait(seleniumWebdriver.until.elementLocated(seleniumWebdriver.By - .id('footer'))) - .then( function () { - return driver.findElement(seleniumWebdriver.By.linkText(linkText)); }) - .then( function (element) { - return element.click(); }) - .then(function () { - return driver.getCurrentUrl(); - }); - }); + +function clickFooterLinks (linkText) { + return driver.wait(seleniumWebdriver.until.elementLocated(seleniumWebdriver.By.id('footer'))) + .then( function (element) { + return element.findElement(seleniumWebdriver.By.linkText(linkText)); }) + .then( function (element) { + return element.click(); }) + .then(function () { + return driver.getCurrentUrl(); + }); } // ==== ABOUT SCRATCH column ==== From 44bb646ab2d7798ba7cf8c34ea8f648e6b965593 Mon Sep 17 00:00:00 2001 From: jwzimmer Date: Tue, 24 Oct 2017 11:38:07 -0400 Subject: [PATCH 2/3] removed redundant require statements --- .../smoke-testing/test_footer_links.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/test/integration/smoke-testing/test_footer_links.js b/test/integration/smoke-testing/test_footer_links.js index 1fcb50d56..330b2d548 100644 --- a/test/integration/smoke-testing/test_footer_links.js +++ b/test/integration/smoke-testing/test_footer_links.js @@ -4,17 +4,16 @@ * Test cases: https://github.com/LLK/scratch-www/wiki/Most-Important-Workflows */ -require('chromedriver'); var tap = require('tap'); -var seleniumWebdriver = require('selenium-webdriver'); - -// Selenium's promise driver will be deprecated, so we should not rely on it -seleniumWebdriver.SELENIUM_PROMISE_MANAGER=0; const { - driver + driver, + webdriver } = require('../../helpers/selenium-helpers.js'); +// Selenium's promise driver will be deprecated, so we should not rely on it +webdriver.SELENIUM_PROMISE_MANAGER=0; + var rootUrl = process.env.ROOT_URL || 'https://scratch.ly'; //timeout for each test; timeout for suite set at command line level @@ -36,9 +35,9 @@ tap.beforeEach(function () { // Function clicks the link and returns the url of the resulting page function clickFooterLinks (linkText) { - return driver.wait(seleniumWebdriver.until.elementLocated(seleniumWebdriver.By.id('footer'))) + return driver.wait(webdriver.until.elementLocated(webdriver.By.id('footer'))) .then( function (element) { - return element.findElement(seleniumWebdriver.By.linkText(linkText)); }) + return element.findElement(webdriver.By.linkText(linkText)); }) .then( function (element) { return element.click(); }) .then(function () { From 8b61ce72e1455377ce31377b8d51d426b11ba8d9 Mon Sep 17 00:00:00 2001 From: Ray Schamp Date: Wed, 15 Nov 2017 13:33:30 -0500 Subject: [PATCH 3/3] Scratch itch --- test/integration/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/integration/package.json b/test/integration/package.json index fa26009a5..06fc0f859 100644 --- a/test/integration/package.json +++ b/test/integration/package.json @@ -1,5 +1,5 @@ { - "testDependencies": { + "devDependencies": { "selenium-webdriver": "2.45.0", "chromedriver": "2.33.0" }