test: fix tests to not use chromedriver npm wrapper

This commit is contained in:
Christopher Willis-Ford 2024-02-26 14:25:00 -08:00
parent 84409fb569
commit 9e5ead4cc5
10 changed files with 3 additions and 25 deletions

View file

@ -4,7 +4,9 @@
* See this directory's package.json
* TAP
* In the scratch-www repo's package.json
* A Chrome-compatible browser (Chrome, Chromium, etc.)
* [Chromedriver](https://sites.google.com/a/chromium.org/chromedriver/)
* Note: Chromedriver may come bundled with your browser, so you may not need to install it separately
# Running the tests

View file

@ -1,6 +1,5 @@
const webdriver = require('selenium-webdriver');
const bindAll = require('lodash.bindall');
require('chromedriver');
const headless = process.env.SMOKE_HEADLESS || false;
const remote = process.env.SMOKE_REMOTE || false;

View file

@ -3,7 +3,6 @@
*
* Test cases: https://github.com/LLK/scratch-www/wiki/Testing-Scratch-www#All_Test_Cases_Teacher_Join_Flow
*/
require('chromedriver');
const seleniumWebdriver = require('selenium-webdriver');
const tap = require('tap');

View file

@ -3,7 +3,6 @@
*
* Test cases: https://github.com/LLK/scratch-www/wiki/Testing-Scratch-www#All_Test_Cases_Teacher_Join_Flow
*/
require('chromedriver');
const seleniumWebdriver = require('selenium-webdriver');
const tap = require('tap');

View file

@ -3,7 +3,6 @@
*
* Test cases: https://github.com/LLK/scratch-www/wiki/Testing-Scratch-www#All_Test_Cases_Teacher_Join_Flow
*/
require('chromedriver');
const seleniumWebdriver = require('selenium-webdriver');
const tap = require('tap');

View file

@ -3,7 +3,6 @@
*
* Test cases: https://github.com/LLK/scratch-www/wiki/Testing-Scratch-www#All_Test_Cases_Teacher_Join_Flow
*/
require('chromedriver');
const seleniumWebdriver = require('selenium-webdriver');
const tap = require('tap');

View file

@ -3,7 +3,6 @@
*
* Test cases: https://github.com/LLK/scratch-www/wiki/Testing-Scratch-www#All_Test_Cases_Teacher_Join_Flow
*/
require('chromedriver');
const seleniumWebdriver = require('selenium-webdriver');
const tap = require('tap');

View file

@ -4,7 +4,6 @@
* Test cases: https://github.com/LLK/scratch-www/wiki/Testing-Scratch-www#All_Test_Cases_Teacher_Join_Flow
*/
require('chromedriver');
const seleniumWebdriver = require('selenium-webdriver');
const tap = require('tap');

View file

@ -3,7 +3,6 @@
*
* Test cases: https://github.com/LLK/scratch-www/wiki/Testing-Scratch-www#All_Test_Cases_Teacher_Join_Flow
*/
require('chromedriver');
const seleniumWebdriver = require('selenium-webdriver');
const tap = require('tap');

View file

@ -3,8 +3,6 @@ jest.setTimeout(30000); // eslint-disable-line no-undef
const webdriver = require('selenium-webdriver');
const {PageLoadStrategy} = require('selenium-webdriver/lib/capabilities');
const bindAll = require('lodash.bindall');
require('chromedriver');
const chromedriverVersion = require('chromedriver').version;
const headless = process.env.SMOKE_HEADLESS || false;
const remote = process.env.SMOKE_REMOTE || false;
@ -194,18 +192,6 @@ class SeleniumHelper {
return driver;
}
/**
* @returns {string} The version of chromedriver being used.
*/
getChromeVersionNumber () {
const versionFinder = /\d+\.\d+/;
const versionArray = versionFinder.exec(chromedriverVersion);
if (versionArray === null) {
throw new Error('couldn\'t find version of chromedriver');
}
return versionArray[0];
}
/**
* Build a new webdriver instance using Sauce Labs.
* You should probably use `buildDriver` instead.
@ -215,13 +201,11 @@ class SeleniumHelper {
* @returns {webdriver.ThenableWebDriver} The new webdriver instance.
*/
getSauceDriver (username, accessKey, name) {
const chromeVersion = this.getChromeVersionNumber();
// Driver configs can be generated with the Sauce Platform Configurator
// https://wiki.saucelabs.com/display/DOCS/Platform+Configurator
const driverConfig = {
browserName: 'chrome',
platform: 'macOS 10.15',
version: chromeVersion
platform: 'macOS 10.15'
};
const driver = new webdriver.Builder()
.withCapabilities({