Skip to content

Commit

Permalink
Fix demo to use latest details
Browse files Browse the repository at this point in the history
  • Loading branch information
AutomatedTester committed Mar 15, 2024
1 parent dcf4910 commit 021b8bc
Show file tree
Hide file tree
Showing 3 changed files with 2,005 additions and 262 deletions.
83 changes: 5 additions & 78 deletions demo/nightwatch.conf.js
Original file line number Diff line number Diff line change
@@ -1,26 +1,11 @@
'use strict';

const fs = require('fs');
const path = require('path');
const rimraf = require('rimraf');
const seleniumStandAlone = require('selenium-standalone');

const DEVELOPMENT = process.env.NODE_ENV === 'development';

const REPORTS_PATH = path.join(__dirname, 'reports', 'e2e');
const SCREENSHOT_PATH = path.join(__dirname, 'reports', 'screenshots');
const BINPATH = path.join(process.cwd(), 'node_modules', 'nightwatch', 'bin');

const SELENIUM_VERSION = '3.5.2'; // https://selenium-release.storage.googleapis.com/index.html
const SELENIUM_PATH = path.join(BINPATH, 'selenium-server', SELENIUM_VERSION + '-' + 'server.jar');
const CHROME_DRIVER_VERSION = '2.31'; // https://chromedriver.storage.googleapis.com/index.html
const CHROME_PATH = path.join(BINPATH, 'chromedriver', CHROME_DRIVER_VERSION + '-' + process.arch + '-' + 'chromedriver');
const IE_DRIVER_VERSION = SELENIUM_VERSION; // https://selenium-release.storage.googleapis.com/index.html
const GECKO_DRIVER_VERSION = '0.18.0'; // https://github.com/mozilla/geckodriver/releases
const GECKO_PATH = path.join(BINPATH, 'geckodriver', GECKO_DRIVER_VERSION + '-' + process.arch + '-' + 'geckodriver');
const GHOST_DRIVER_VERSION = '2.1.0'; // https://github.com/detro/ghostdriver/releases
const GHOST_PATH = '2.1.0';
const PHANTOMJS_PATH = path.join(__dirname, 'node_modules', 'phantomjs-prebuilt', 'bin', 'phantomjs');

function defaultScreenshotPath(nightwatchClient, basePath, fileName) {
return path.join(
Expand All @@ -38,22 +23,15 @@ module.exports = {
'demo/tests'
],
'custom_assertions_path': [
path.join(process.cwd(), 'assertions')
path.join(process.cwd(), 'nightwatch', 'assertions')
],
'custom_commands_path': [
path.join(process.cwd(), 'commands')
path.join(process.cwd(), 'nightwatch', 'commands')
],
'output_folder': REPORTS_PATH,
'selenium': {
'webdriver': {
'start_process': true,
'server_path': SELENIUM_PATH,
'host': '127.0.0.1',
'port': 4444,
'cli_args': {
'webdriver.chrome.driver': CHROME_PATH,
'webdriver.gecko.driver': GECKO_PATH,
'webdriver.ghost.driver': GHOST_PATH
}
'server_path': ''
},
'test_settings': {
'default': {
Expand Down Expand Up @@ -81,25 +59,12 @@ module.exports = {
'waitForConditionTimeout': 5000
},
'desiredCapabilities': {
'platform': 'LINUX',
'version': 'latest',
'browserName': 'phantomjs'
}
},
'phantomjs': {
'desiredCapabilities': {
'browserName': 'phantomjs',
'javascriptEnabled': true,
'acceptSslCerts': true,
'phantomjs.binary.path': PHANTOMJS_PATH,
'phantomjs.cli.args': []
'browserName': 'chrome'
}
},
'chrome': {
'desiredCapabilities': {
'browserName': 'chrome',
'javascriptEnabled': true,
'acceptSslCerts': true,
'chromeOptions': {
'args': ['--start-fullscreen']
}
Expand All @@ -108,45 +73,7 @@ module.exports = {
'firefox': {
'desiredCapabilities': {
'browserName': 'firefox',
'javascriptEnabled': true,
'acceptSslCerts': true,
'marionette': true
}
}
}
};

fs.stat(SELENIUM_PATH, function(err, stat) {
if (err || !stat || stat.size < 1) {
rimraf(path.join(BINPATH, 'chromedriver'), function(rmerr) {
if (rmerr) {throw new Error(rmerr)};
seleniumStandAlone.install({
basePath: BINPATH,
version: SELENIUM_VERSION,
baseURL: 'https://selenium-release.storage.googleapis.com',
drivers: {
chrome: {
version: CHROME_DRIVER_VERSION,
arch: process.arch,
baseURL: 'https://chromedriver.storage.googleapis.com'
},
ie: {
version: IE_DRIVER_VERSION,
arch: process.arch,
baseURL: 'https://selenium-release.storage.googleapis.com'
},
firefox: {
version: GECKO_DRIVER_VERSION,
arch: process.arch,
baseURL: 'https://github.com/mozilla/geckodriver/releases/download'
}
},
logger: function(message) {},
progressCb: function(totalLength, progressLength, chunkLength) {}
}, function(error, child) {
if (error) {throw new Error(error)};
console.log(' \x1b[32m✔\x1b[0m Drivers downloaded to:', BINPATH);
});
});
}
});
Loading

0 comments on commit 021b8bc

Please sign in to comment.