element now?
diff --git a/tests/frontend/specs/timeslider.js b/tests/frontend/specs/timeslider.js
index bea7932df..10f94b3cb 100644
--- a/tests/frontend/specs/timeslider.js
+++ b/tests/frontend/specs/timeslider.js
@@ -1,3 +1,5 @@
+'use strict';
+
// deactivated, we need a nice way to get the timeslider, this is ugly
xdescribe('timeslider button takes you to the timeslider of a pad', function () {
beforeEach(function (cb) {
@@ -12,7 +14,6 @@ xdescribe('timeslider button takes you to the timeslider of a pad', function ()
// get the first text element inside the editable space
const $firstTextElement = inner$('div span').first();
const originalValue = $firstTextElement.text(); // get the original value
- const newValue = `Testing${originalValue}`;
$firstTextElement.sendkeys('Testing'); // send line 1 to the pad
const modifiedValue = $firstTextElement.text(); // get the modified value
diff --git a/tests/frontend/specs/timeslider_labels.js b/tests/frontend/specs/timeslider_labels.js
index c7a4aca5a..dd418d976 100644
--- a/tests/frontend/specs/timeslider_labels.js
+++ b/tests/frontend/specs/timeslider_labels.js
@@ -1,3 +1,5 @@
+'use strict';
+
describe('timeslider', function () {
// create a new pad before each test run
beforeEach(function (cb) {
@@ -7,7 +9,7 @@ describe('timeslider', function () {
/**
* @todo test authorsList
*/
- it("Shows a date and time in the timeslider and make sure it doesn't include NaN", async function () {
+ it("Shows a date/time in the timeslider and make sure it doesn't include NaN", async function () {
// make some changes to produce 3 revisions
const revs = 3;
diff --git a/tests/frontend/specs/timeslider_numeric_padID.js b/tests/frontend/specs/timeslider_numeric_padID.js
index 53eb4a29c..4d05f95b3 100644
--- a/tests/frontend/specs/timeslider_numeric_padID.js
+++ b/tests/frontend/specs/timeslider_numeric_padID.js
@@ -1,3 +1,5 @@
+'use strict';
+
describe('timeslider', function () {
const padId = 735773577357 + (Math.round(Math.random() * 1000));
diff --git a/tests/frontend/specs/timeslider_revisions.js b/tests/frontend/specs/timeslider_revisions.js
index fbfbb3615..2f5cc170a 100644
--- a/tests/frontend/specs/timeslider_revisions.js
+++ b/tests/frontend/specs/timeslider_revisions.js
@@ -1,3 +1,5 @@
+'use strict';
+
describe('timeslider', function () {
// create a new pad before each test run
beforeEach(function (cb) {
@@ -23,7 +25,8 @@ describe('timeslider', function () {
setTimeout(() => {
// go to timeslider
- $('#iframe-container iframe').attr('src', `${$('#iframe-container iframe').attr('src')}/timeslider`);
+ $('#iframe-container iframe').attr('src',
+ `${$('#iframe-container iframe').attr('src')}/timeslider`);
setTimeout(() => {
const timeslider$ = $('#iframe-container iframe')[0].contentWindow.$;
@@ -66,7 +69,6 @@ describe('timeslider', function () {
// Disabled as jquery trigger no longer works properly
xit('changes the url when clicking on the timeslider', function (done) {
const inner$ = helper.padInner$;
- const chrome$ = helper.padChrome$;
// make some changes to produce 7 revisions
const timePerRev = 1000;
@@ -81,13 +83,13 @@ describe('timeslider', function () {
setTimeout(() => {
// go to timeslider
- $('#iframe-container iframe').attr('src', `${$('#iframe-container iframe').attr('src')}/timeslider`);
+ $('#iframe-container iframe').attr('src',
+ `${$('#iframe-container iframe').attr('src')}/timeslider`);
setTimeout(() => {
const timeslider$ = $('#iframe-container iframe')[0].contentWindow.$;
const $sliderBar = timeslider$('#ui-slider-bar');
- const latestContents = timeslider$('#innerdocbody').text();
const oldUrl = $('#iframe-container iframe')[0].contentWindow.location.hash;
// Click somewhere on the timeslider
@@ -96,20 +98,23 @@ describe('timeslider', function () {
e.clientY = e.pageY = 60;
$sliderBar.trigger(e);
- helper.waitFor(() => $('#iframe-container iframe')[0].contentWindow.location.hash != oldUrl, 6000).always(() => {
- expect($('#iframe-container iframe')[0].contentWindow.location.hash).not.to.eql(oldUrl);
- done();
- });
+ helper.waitFor(
+ () => $('#iframe-container iframe')[0].contentWindow.location.hash !== oldUrl, 6000)
+ .always(() => {
+ expect(
+ $('#iframe-container iframe')[0].contentWindow.location.hash
+ ).not.to.eql(oldUrl);
+ done();
+ });
}, 6000);
}, revs * timePerRev);
});
it('jumps to a revision given in the url', function (done) {
const inner$ = helper.padInner$;
- const chrome$ = helper.padChrome$;
this.timeout(40000);
// wait for the text to be loaded
- helper.waitFor(() => inner$('body').text().length != 0, 10000).always(() => {
+ helper.waitFor(() => inner$('body').text().length !== 0, 10000).always(() => {
const newLines = inner$('body div').length;
const oldLength = inner$('body').text().length + newLines / 2;
expect(oldLength).to.not.eql(0);
@@ -120,22 +125,25 @@ describe('timeslider', function () {
helper.waitFor(() => {
// newLines takes the new lines into account which are strippen when using
// inner$('body').text(), one is used for one line in ACE.
- const lenOkay = inner$('body').text().length + newLines / 2 != oldLength;
+ const lenOkay = inner$('body').text().length + newLines / 2 !== oldLength;
// this waits for the color to be added to our , which means that the revision
// was accepted by the server.
- const colorOkay = inner$('span').first().attr('class').indexOf('author-') == 0;
+ const colorOkay = inner$('span').first().attr('class').indexOf('author-') === 0;
return lenOkay && colorOkay;
}, 10000).always(() => {
// go to timeslider with a specific revision set
- $('#iframe-container iframe').attr('src', `${$('#iframe-container iframe').attr('src')}/timeslider#0`);
+ $('#iframe-container iframe').attr('src',
+ `${$('#iframe-container iframe').attr('src')}/timeslider#0`);
// wait for the timeslider to be loaded
helper.waitFor(() => {
try {
timeslider$ = $('#iframe-container iframe')[0].contentWindow.$;
- } catch (e) {}
+ } catch (e) {
+ // Empty catch block <3
+ }
if (timeslider$) {
- return timeslider$('#innerdocbody').text().length == oldLength;
+ return timeslider$('#innerdocbody').text().length === oldLength;
}
}, 10000).always(() => {
expect(timeslider$('#innerdocbody').text().length).to.eql(oldLength);
@@ -147,24 +155,26 @@ describe('timeslider', function () {
it('checks the export url', function (done) {
const inner$ = helper.padInner$;
- const chrome$ = helper.padChrome$;
this.timeout(11000);
inner$('div').first().sendkeys('a');
setTimeout(() => {
// go to timeslider
- $('#iframe-container iframe').attr('src', `${$('#iframe-container iframe').attr('src')}/timeslider#0`);
+ $('#iframe-container iframe').attr('src',
+ `${$('#iframe-container iframe').attr('src')}/timeslider#0`);
let timeslider$;
let exportLink;
helper.waitFor(() => {
try {
timeslider$ = $('#iframe-container iframe')[0].contentWindow.$;
- } catch (e) {}
+ } catch (e) {
+ // Empty catch block <3
+ }
if (!timeslider$) return false;
exportLink = timeslider$('#exportplaina').attr('href');
if (!exportLink) return false;
- return exportLink.substr(exportLink.length - 12) == '0/export/txt';
+ return exportLink.substr(exportLink.length - 12) === '0/export/txt';
}, 6000).always(() => {
expect(exportLink.substr(exportLink.length - 12)).to.eql('0/export/txt');
done();
diff --git a/tests/frontend/specs/undo.js b/tests/frontend/specs/undo.js
index 0c94f2230..0daa282fc 100644
--- a/tests/frontend/specs/undo.js
+++ b/tests/frontend/specs/undo.js
@@ -1,3 +1,5 @@
+'use strict';
+
describe('undo button', function () {
beforeEach(function (cb) {
helper.newPad(cb); // creates a new pad
@@ -30,7 +32,6 @@ describe('undo button', function () {
it('undo some typing using a keypress', function (done) {
const inner$ = helper.padInner$;
- const chrome$ = helper.padChrome$;
// get the first text element inside the editable space
const $firstTextElement = inner$('div span').first();
@@ -40,7 +41,7 @@ describe('undo button', function () {
const modifiedValue = $firstTextElement.text(); // get the modified value
expect(modifiedValue).not.to.be(originalValue); // expect the value to change
- const e = inner$.Event(helper.evtType);
+ const e = new inner$.Event(helper.evtType);
e.ctrlKey = true; // Control key
e.which = 90; // z
inner$('#innerdocbody').trigger(e);
diff --git a/tests/frontend/specs/unordered_list.js b/tests/frontend/specs/unordered_list.js
index 4cbdabfac..22d1a6fe2 100644
--- a/tests/frontend/specs/unordered_list.js
+++ b/tests/frontend/specs/unordered_list.js
@@ -1,3 +1,5 @@
+'use strict';
+
describe('assign unordered list', function () {
// create a new pad before each test run
beforeEach(function (cb) {
@@ -130,7 +132,8 @@ describe('Pressing Tab in an UL increases and decreases indentation', function (
});
});
-describe('Pressing indent/outdent button in an UL increases and decreases indentation and bullet / ol formatting', function () {
+describe('Pressing indent/outdent button in an UL increases and decreases indentation ' +
+ 'and bullet / ol formatting', function () {
// create a new pad before each test run
beforeEach(function (cb) {
helper.newPad(cb);
diff --git a/tests/frontend/specs/xxauto_reconnect.js b/tests/frontend/specs/xxauto_reconnect.js
index 574616ce5..d92936563 100644
--- a/tests/frontend/specs/xxauto_reconnect.js
+++ b/tests/frontend/specs/xxauto_reconnect.js
@@ -1,3 +1,5 @@
+'use strict';
+
describe('Automatic pad reload on Force Reconnect message', function () {
let padId, $originalPadFrame;
diff --git a/tests/frontend/travis/remote_runner.js b/tests/frontend/travis/remote_runner.js
index 70c850ca8..ba0e7be0c 100644
--- a/tests/frontend/travis/remote_runner.js
+++ b/tests/frontend/travis/remote_runner.js
@@ -1,17 +1,19 @@
-var srcFolder = '../../../src/node_modules/';
-var wd = require(`${srcFolder}wd`);
-var async = require(`${srcFolder}async`);
+'use strict';
-var config = {
+const wd = require('ep_etherpad-lite/node_modules/wd');
+const async = require('ep_etherpad-lite/node_modules/async');
+
+const config = {
host: 'ondemand.saucelabs.com',
port: 80,
username: process.env.SAUCE_USER,
accessKey: process.env.SAUCE_ACCESS_KEY,
};
-var allTestsPassed = true;
+let allTestsPassed = true;
// overwrite the default exit code
-// in case not all worker can be run (due to saucelabs limits), `queue.drain` below will not be called
+// in case not all worker can be run (due to saucelabs limits),
+// `queue.drain` below will not be called
// and the script would silently exit with error code 0
process.exitCode = 2;
process.on('exit', (code) => {
@@ -20,13 +22,18 @@ process.on('exit', (code) => {
}
});
-var sauceTestWorker = async.queue((testSettings, callback) => {
- const browser = wd.promiseChainRemote(config.host, config.port, config.username, config.accessKey);
- const name = `${process.env.GIT_HASH} - ${testSettings.browserName} ${testSettings.version}, ${testSettings.platform}`;
+const sauceTestWorker = async.queue((testSettings, callback) => {
+ const browser = wd.promiseChainRemote(
+ config.host, config.port, config.username, config.accessKey);
+ const name =
+ `${process.env.GIT_HASH} - ${testSettings.browserName} ` +
+ `${testSettings.version}, ${testSettings.platform}`;
testSettings.name = name;
testSettings.public = true;
testSettings.build = process.env.GIT_HASH;
- testSettings.extendedDebugging = true; // console.json can be downloaded via saucelabs, don't know how to print them into output of the tests
+ // console.json can be downloaded via saucelabs,
+ // don't know how to print them into output of the tests
+ testSettings.extendedDebugging = true;
testSettings.tunnelIdentifier = process.env.TRAVIS_JOB_NUMBER;
browser.init(testSettings).get('http://localhost:9001/tests/frontend/', () => {
@@ -34,7 +41,7 @@ var sauceTestWorker = async.queue((testSettings, callback) => {
console.log(`Remote sauce test '${name}' started! ${url}`);
// tear down the test excecution
- const stopSauce = function (success, timesup) {
+ const stopSauce = (success, timesup) => {
clearInterval(getStatusInterval);
clearTimeout(timeout);
@@ -43,12 +50,15 @@ var sauceTestWorker = async.queue((testSettings, callback) => {
allTestsPassed = false;
}
- // if stopSauce is called via timeout (in contrast to via getStatusInterval) than the log of up to the last
+ // if stopSauce is called via timeout
+ // (in contrast to via getStatusInterval) than the log of up to the last
// five seconds may not be available here. It's an error anyway, so don't care about it.
printLog(logIndex);
if (timesup) {
- console.log(`[${testSettings.browserName} ${testSettings.platform}${testSettings.version === '' ? '' : (` ${testSettings.version}`)}] \x1B[31mFAILED\x1B[39m allowed test duration exceeded`);
+ console.log(`[${testSettings.browserName} ${testSettings.platform}` +
+ `${testSettings.version === '' ? '' : (` ${testSettings.version}`)}]` +
+ ' \x1B[31mFAILED\x1B[39m allowed test duration exceeded');
}
console.log(`Remote sauce test '${name}' finished! ${url}`);
@@ -58,17 +68,19 @@ var sauceTestWorker = async.queue((testSettings, callback) => {
/**
* timeout if a test hangs or the job exceeds 14.5 minutes
- * It's necessary because if travis kills the saucelabs session due to inactivity, we don't get any output
- * @todo this should be configured in testSettings, see https://wiki.saucelabs.com/display/DOCS/Test+Configuration+Options#TestConfigurationOptions-Timeouts
+ * It's necessary because if travis kills the saucelabs session due to inactivity,
+ * we don't get any output
+ * @todo this should be configured in testSettings, see
+ * https://wiki.saucelabs.com/display/DOCS/Test+Configuration+Options#TestConfigurationOptions-Timeouts
*/
- var timeout = setTimeout(() => {
+ const timeout = setTimeout(() => {
stopSauce(false, true);
}, 870000); // travis timeout is 15 minutes, set this to a slightly lower value
let knownConsoleText = '';
// how many characters of the log have been sent to travis
let logIndex = 0;
- var getStatusInterval = setInterval(() => {
+ const getStatusInterval = setInterval(() => {
browser.eval("$('#console').text()", (err, consoleText) => {
if (!consoleText || err) {
return;
@@ -76,9 +88,10 @@ var sauceTestWorker = async.queue((testSettings, callback) => {
knownConsoleText = consoleText;
if (knownConsoleText.indexOf('FINISHED') > 0) {
- const match = knownConsoleText.match(/FINISHED.*([0-9]+) tests passed, ([0-9]+) tests failed/);
+ const match = knownConsoleText.match(
+ /FINISHED.*([0-9]+) tests passed, ([0-9]+) tests failed/);
// finished without failures
- if (match[2] && match[2] == '0') {
+ if (match[2] && match[2] === '0') {
stopSauce(true);
// finished but some tests did not return or some tests failed
@@ -99,13 +112,17 @@ var sauceTestWorker = async.queue((testSettings, callback) => {
*
* @param {number} index offset from where to start
*/
- function printLog(index) {
- let testResult = knownConsoleText.substring(index).replace(/\[red\]/g, '\x1B[31m').replace(/\[yellow\]/g, '\x1B[33m')
+ const printLog = (index) => {
+ let testResult = knownConsoleText.substring(index)
+ .replace(/\[red\]/g, '\x1B[31m').replace(/\[yellow\]/g, '\x1B[33m')
.replace(/\[green\]/g, '\x1B[32m').replace(/\[clear\]/g, '\x1B[39m');
- testResult = testResult.split('\\n').map((line) => `[${testSettings.browserName} ${testSettings.platform}${testSettings.version === '' ? '' : (` ${testSettings.version}`)}] ${line}`).join('\n');
+ testResult = testResult.split('\\n').map((line) => `[${testSettings.browserName} ` +
+ `${testSettings.platform}` +
+ `${testSettings.version === '' ? '' : (` ${testSettings.version}`)}]` +
+ `${line}`).join('\n');
console.log(testResult);
- }
+ };
});
}, 6); // run 6 tests in parrallel
diff --git a/tests/ratelimit/send_changesets.js b/tests/ratelimit/send_changesets.js
index b0d994c8c..92af23e18 100644
--- a/tests/ratelimit/send_changesets.js
+++ b/tests/ratelimit/send_changesets.js
@@ -1,8 +1,12 @@
+'use strict';
+
+let etherpad;
try {
- var etherpad = require('../../src/node_modules/etherpad-cli-client');
+ etherpad = require('ep_etherpad-lite/node_modules/etherpad-cli-client');
// ugly
} catch {
- var etherpad = require('etherpad-cli-client');
+ /* eslint-disable-next-line node/no-missing-require */
+ etherpad = require('etherpad-cli-client'); // uses global
}
const pad = etherpad.connect(process.argv[2]);
pad.on('connected', () => {
@@ -18,7 +22,7 @@ pad.on('connected', () => {
});
// in case of disconnect exit code 1
pad.on('message', (message) => {
- if (message.disconnect == 'rateLimited') {
+ if (message.disconnect === 'rateLimited') {
process.exit(1);
}
});