low hanging lint and some hard coded timeouts

This commit is contained in:
John McLear 2021-01-27 04:53:28 +00:00
parent 809670dbea
commit edf1dabe65
36 changed files with 273 additions and 150 deletions

View file

@ -3216,10 +3216,10 @@ function HTML(runner, options) {
runner.on(EVENT_TEST_PASS, function(test) { runner.on(EVENT_TEST_PASS, function(test) {
var url = self.testURL(test); var url = self.testURL(test);
var markup = var markup =
'<li class="test pass %e"><h2>%e<span class="duration">%ems</span> ' + '<li class="test pass %e"><h2>%e</h2><span class="duration">%ems</span> ' +
'<a href="%s" class="replay">' + '<a href="%s" class="replay">' +
playIcon + playIcon +
'</a></h2></li>'; '</a></li>';
var el = fragment(markup, test.speed, test.title, test.duration, url); var el = fragment(markup, test.speed, test.title, test.duration, url);
self.addCodeToggle(el, test.body); self.addCodeToggle(el, test.body);
appendToStack(el); appendToStack(el);
@ -13792,18 +13792,18 @@ function mkdirP (p, opts, f, made) {
else if (!opts || typeof opts !== 'object') { else if (!opts || typeof opts !== 'object') {
opts = { mode: opts }; opts = { mode: opts };
} }
var mode = opts.mode; var mode = opts.mode;
var xfs = opts.fs || fs; var xfs = opts.fs || fs;
if (mode === undefined) { if (mode === undefined) {
mode = _0777 mode = _0777
} }
if (!made) made = null; if (!made) made = null;
var cb = f || function () {}; var cb = f || function () {};
p = path.resolve(p); p = path.resolve(p);
xfs.mkdir(p, mode, function (er) { xfs.mkdir(p, mode, function (er) {
if (!er) { if (!er) {
made = made || p; made = made || p;
@ -13837,10 +13837,10 @@ mkdirP.sync = function sync (p, opts, made) {
if (!opts || typeof opts !== 'object') { if (!opts || typeof opts !== 'object') {
opts = { mode: opts }; opts = { mode: opts };
} }
var mode = opts.mode; var mode = opts.mode;
var xfs = opts.fs || fs; var xfs = opts.fs || fs;
if (mode === undefined) { if (mode === undefined) {
mode = _0777 mode = _0777
} }

View file

@ -69,7 +69,7 @@ $(() => {
}, 60000 * 3); }, 60000 * 3);
const medium = test.slow() / 2; const medium = test.slow() / 2;
test.speed = test.duration > test.slow() test.speed = test.duratoin > test.slow()
? 'slow' ? 'slow'
: test.duration > medium : test.duration > medium
? 'medium' ? 'medium'

View file

@ -1,3 +1,5 @@
'use strict';
describe('All the alphabet works n stuff', function () { describe('All the alphabet works n stuff', function () {
const expectedString = 'abcdefghijklmnopqrstuvwxyz'; const expectedString = 'abcdefghijklmnopqrstuvwxyz';
@ -10,7 +12,6 @@ describe('All the alphabet works n stuff', function () {
it('when you enter any char it appears right', function (done) { it('when you enter any char it appears right', function (done) {
this.timeout(100); this.timeout(100);
const inner$ = helper.padInner$; const inner$ = helper.padInner$;
const chrome$ = helper.padChrome$;
// get the first text element out of the inner iframe // get the first text element out of the inner iframe
const firstTextElement = inner$('div').first(); const firstTextElement = inner$('div').first();

View file

@ -1,3 +1,5 @@
'use strict';
describe('author of pad edition', function () { describe('author of pad edition', function () {
const REGULAR_LINE = 0; const REGULAR_LINE = 0;
const LINE_WITH_ORDERED_LIST = 1; const LINE_WITH_ORDERED_LIST = 1;
@ -56,14 +58,17 @@ describe('author of pad edition', function () {
// author 2 makes some changes on the pad // author 2 makes some changes on the pad
it('marks only the new content as changes of the second user on a regular line', function (done) { it('marks only the new content as changes of the second user on a regular line', function (done) {
this.timeout(100);
changeLineAndCheckOnlyThatChangeIsFromThisAuthor(REGULAR_LINE, 'x', done); changeLineAndCheckOnlyThatChangeIsFromThisAuthor(REGULAR_LINE, 'x', done);
}); });
it('marks only the new content as changes of the second user on a line with ordered list', function (done) { it('marks only the new content as changes of the second user on a line with ordered list', function (done) {
this.timeout(100);
changeLineAndCheckOnlyThatChangeIsFromThisAuthor(LINE_WITH_ORDERED_LIST, 'y', done); changeLineAndCheckOnlyThatChangeIsFromThisAuthor(LINE_WITH_ORDERED_LIST, 'y', done);
}); });
it('marks only the new content as changes of the second user on a line with unordered list', function (done) { it('marks only the new content as changes of the second user on a line with unordered list', function (done) {
this.timeout(100);
changeLineAndCheckOnlyThatChangeIsFromThisAuthor(LINE_WITH_UNORDERED_LIST, 'z', done); changeLineAndCheckOnlyThatChangeIsFromThisAuthor(LINE_WITH_UNORDERED_LIST, 'z', done);
}); });

View file

@ -1,3 +1,5 @@
'use strict';
describe('bold button', function () { describe('bold button', function () {
// create a new pad before each test run // create a new pad before each test run
beforeEach(function (cb) { beforeEach(function (cb) {
@ -6,6 +8,7 @@ describe('bold button', function () {
}); });
it('makes text bold on click', function (done) { it('makes text bold on click', function (done) {
this.timeout(50);
const inner$ = helper.padInner$; const inner$ = helper.padInner$;
const chrome$ = helper.padChrome$; const chrome$ = helper.padChrome$;
@ -19,7 +22,8 @@ describe('bold button', function () {
const $boldButton = chrome$('.buttonicon-bold'); const $boldButton = chrome$('.buttonicon-bold');
$boldButton.click(); $boldButton.click();
// ace creates a new dom element when you press a button, so just get the first text element again // ace creates a new dom element when you press a button
// so just get the first text element again
const $newFirstTextElement = inner$('div').first(); const $newFirstTextElement = inner$('div').first();
// is there a <b> element now? // is there a <b> element now?
@ -35,8 +39,8 @@ describe('bold button', function () {
}); });
it('makes text bold on keypress', function (done) { it('makes text bold on keypress', function (done) {
this.timeout(50);
const inner$ = helper.padInner$; const inner$ = helper.padInner$;
const chrome$ = helper.padChrome$;
// get the first text element out of the inner iframe // get the first text element out of the inner iframe
const $firstTextElement = inner$('div').first(); const $firstTextElement = inner$('div').first();
@ -49,7 +53,8 @@ describe('bold button', function () {
e.which = 66; // b e.which = 66; // b
inner$('#innerdocbody').trigger(e); inner$('#innerdocbody').trigger(e);
// ace creates a new dom element when you press a button, so just get the first text element again // ace creates a new dom element when you press a button
// so just get the first text element again
const $newFirstTextElement = inner$('div').first(); const $newFirstTextElement = inner$('div').first();
// is there a <b> element now? // is there a <b> element now?

View file

@ -1,3 +1,5 @@
'use strict';
describe('change user color', function () { describe('change user color', function () {
// create a new pad before each test run // create a new pad before each test run
beforeEach(function (cb) { beforeEach(function (cb) {
@ -5,8 +7,8 @@ describe('change user color', function () {
this.timeout(60000); this.timeout(60000);
}); });
it('Color picker matches original color and remembers the user color after a refresh', function (done) { it('Color picker remembers the user color after a refresh', function (done) {
this.timeout(60000); this.timeout(5000);
const chrome$ = helper.padChrome$; const chrome$ = helper.padChrome$;
// click on the settings button to make settings visible // click on the settings button to make settings visible
@ -60,7 +62,7 @@ describe('change user color', function () {
}); });
it('Own user color is shown when you enter a chat', function (done) { it('Own user color is shown when you enter a chat', function (done) {
const inner$ = helper.padInner$; this.timeout(200);
const chrome$ = helper.padChrome$; const chrome$ = helper.padChrome$;
const $colorOption = helper.padChrome$('#options-colorscheck'); const $colorOption = helper.padChrome$('#options-colorscheck');
@ -90,13 +92,16 @@ describe('change user color', function () {
$chatButton.click(); $chatButton.click();
const $chatInput = chrome$('#chatinput'); const $chatInput = chrome$('#chatinput');
$chatInput.sendkeys('O hi'); // simulate a keypress of typing user $chatInput.sendkeys('O hi'); // simulate a keypress of typing user
$chatInput.sendkeys('{enter}'); // simulate a keypress of enter actually does evt.which = 10 not 13 // simulate a keypress of enter actually does evt.which = 10 not 13
$chatInput.sendkeys('{enter}');
// check if chat shows up // check if chat shows up
helper.waitFor(() => chrome$('#chattext').children('p').length !== 0 // wait until the chat message shows up // wait until the chat message shows up
helper.waitFor(() => chrome$('#chattext').children('p').length !== 0
).done(() => { ).done(() => {
const $firstChatMessage = chrome$('#chattext').children('p'); const $firstChatMessage = chrome$('#chattext').children('p');
expect($firstChatMessage.css('background-color')).to.be(testColorRGB); // expect the first chat message to be of the user's color // expect the first chat message to be of the user's color
expect($firstChatMessage.css('background-color')).to.be(testColorRGB);
done(); done();
}); });
}); });

View file

@ -1,3 +1,5 @@
'use strict';
describe('change username value', function () { describe('change username value', function () {
// create a new pad before each test run // create a new pad before each test run
beforeEach(function (cb) { beforeEach(function (cb) {
@ -5,6 +7,7 @@ describe('change username value', function () {
}); });
it('Remembers the user name after a refresh', async function () { it('Remembers the user name after a refresh', async function () {
this.timeout(100);
helper.toggleUserList(); helper.toggleUserList();
helper.setUserName('😃'); helper.setUserName('😃');
@ -19,6 +22,7 @@ describe('change username value', function () {
}); });
it('Own user name is shown when you enter a chat', async function () { it('Own user name is shown when you enter a chat', async function () {
this.timeout(100);
helper.toggleUserList(); helper.toggleUserList();
helper.setUserName('😃'); helper.setUserName('😃');

View file

@ -1,10 +1,13 @@
'use strict';
describe('Chat messages and UI', function () { describe('Chat messages and UI', function () {
// create a new pad before each test run // create a new pad before each test run
beforeEach(function (cb) { beforeEach(function (cb) {
helper.newPad(cb); helper.newPad(cb);
}); });
it('opens chat, sends a message, makes sure it exists on the page and hides chat', async function () { it('opens chat, sends a message, makes sure it exists and hides chat', async function () {
this.timeout(100);
const chatValue = 'JohnMcLear'; const chatValue = 'JohnMcLear';
await helper.showChat(); await helper.showChat();
@ -27,11 +30,13 @@ describe('Chat messages and UI', function () {
}); });
it("makes sure that an empty message can't be sent", async function () { it("makes sure that an empty message can't be sent", async function () {
this.timeout(100);
const chatValue = 'mluto'; const chatValue = 'mluto';
await helper.showChat(); await helper.showChat();
await helper.sendChatMessage(`{enter}${chatValue}{enter}`); // simulate a keypress of typing enter, mluto and enter (to send 'mluto') // simulate a keypress of typing enter, mluto and enter (to send 'mluto')
await helper.sendChatMessage(`{enter}${chatValue}{enter}`);
const chat = helper.chatTextParagraphs(); const chat = helper.chatTextParagraphs();
@ -45,6 +50,7 @@ describe('Chat messages and UI', function () {
}); });
it('makes chat stick to right side of the screen via settings, remove sticky via settings, close it', async function () { it('makes chat stick to right side of the screen via settings, remove sticky via settings, close it', async function () {
this.timeout(200);
await helper.showSettings(); await helper.showSettings();
await helper.enableStickyChatviaSettings(); await helper.enableStickyChatviaSettings();
@ -61,6 +67,7 @@ describe('Chat messages and UI', function () {
}); });
it('makes chat stick to right side of the screen via icon on the top right, remove sticky via icon, close it', async function () { it('makes chat stick to right side of the screen via icon on the top right, remove sticky via icon, close it', async function () {
this.timeout(200);
await helper.showChat(); await helper.showChat();
await helper.enableStickyChatviaIcon(); await helper.enableStickyChatviaIcon();
@ -76,10 +83,8 @@ describe('Chat messages and UI', function () {
expect(helper.isChatboxShown()).to.be(false); expect(helper.isChatboxShown()).to.be(false);
}); });
xit('Checks showChat=false URL Parameter hides chat then when removed it shows chat', function (done) { xit('Checks showChat=false URL Parameter shows/hides chat', function (done) {
this.timeout(60000); this.timeout(60000);
const inner$ = helper.padInner$;
const chrome$ = helper.padChrome$;
setTimeout(() => { // give it a second to save the username on the server side setTimeout(() => { // give it a second to save the username on the server side
helper.newPad({ // get a new pad, but don't clear the cookies helper.newPad({ // get a new pad, but don't clear the cookies

View file

@ -1,13 +1,15 @@
'use strict';
describe('chat-load-messages', function () { describe('chat-load-messages', function () {
let padName; let padName;
it('creates a pad', function (done) { it('creates a pad', function (done) {
this.timeout(3000);
padName = helper.newPad(done); padName = helper.newPad(done);
this.timeout(60000);
}); });
it('adds a lot of messages', function (done) { it('adds a lot of messages', function (done) {
const inner$ = helper.padInner$; this.timeout(5000);
const chrome$ = helper.padChrome$; const chrome$ = helper.padChrome$;
const chatButton = chrome$('#chaticon'); const chatButton = chrome$('#chaticon');
chatButton.click(); chatButton.click();
@ -19,18 +21,19 @@ describe('chat-load-messages', function () {
const messages = 140; const messages = 140;
for (let i = 1; i <= messages; i++) { for (let i = 1; i <= messages; i++) {
let num = `${i}`; let num = `${i}`;
if (num.length == 1) num = `00${num}`; if (num.length === 1) num = `00${num}`;
if (num.length == 2) num = `0${num}`; if (num.length === 2) num = `0${num}`;
chatInput.sendkeys(`msg${num}`); chatInput.sendkeys(`msg${num}`);
chatInput.sendkeys('{enter}'); chatInput.sendkeys('{enter}');
} }
helper.waitFor(() => chatText.children('p').length == messages, 60000).always(() => { helper.waitFor(() => chatText.children('p').length === messages, 60000).always(() => {
expect(chatText.children('p').length).to.be(messages); expect(chatText.children('p').length).to.be(messages);
helper.newPad(done, padName); helper.newPad(done, padName);
}); });
}); });
it('checks initial message count', function (done) { it('checks initial message count', function (done) {
this.timeout(100);
let chatText; let chatText;
const expectedCount = 101; const expectedCount = 101;
const chrome$ = helper.padChrome$; const chrome$ = helper.padChrome$;
@ -38,7 +41,7 @@ describe('chat-load-messages', function () {
const chatButton = chrome$('#chaticon'); const chatButton = chrome$('#chaticon');
chatButton.click(); chatButton.click();
chatText = chrome$('#chattext'); chatText = chrome$('#chattext');
return chatText.children('p').length == expectedCount; return chatText.children('p').length === expectedCount;
}).always(() => { }).always(() => {
expect(chatText.children('p').length).to.be(expectedCount); expect(chatText.children('p').length).to.be(expectedCount);
done(); done();
@ -46,6 +49,7 @@ describe('chat-load-messages', function () {
}); });
it('loads more messages', function (done) { it('loads more messages', function (done) {
this.timeout(1500);
const expectedCount = 122; const expectedCount = 122;
const chrome$ = helper.padChrome$; const chrome$ = helper.padChrome$;
const chatButton = chrome$('#chaticon'); const chatButton = chrome$('#chaticon');
@ -54,24 +58,24 @@ describe('chat-load-messages', function () {
const loadMsgBtn = chrome$('#chatloadmessagesbutton'); const loadMsgBtn = chrome$('#chatloadmessagesbutton');
loadMsgBtn.click(); loadMsgBtn.click();
helper.waitFor(() => chatText.children('p').length == expectedCount).always(() => { helper.waitFor(() => chatText.children('p').length === expectedCount).always(() => {
expect(chatText.children('p').length).to.be(expectedCount); expect(chatText.children('p').length).to.be(expectedCount);
done(); done();
}); });
}); });
it('checks for button vanishing', function (done) { it('checks for button vanishing', function (done) {
this.timeout(2000);
const expectedDisplay = 'none'; const expectedDisplay = 'none';
const chrome$ = helper.padChrome$; const chrome$ = helper.padChrome$;
const chatButton = chrome$('#chaticon'); const chatButton = chrome$('#chaticon');
chatButton.click(); chatButton.click();
const chatText = chrome$('#chattext');
const loadMsgBtn = chrome$('#chatloadmessagesbutton'); const loadMsgBtn = chrome$('#chatloadmessagesbutton');
const loadMsgBall = chrome$('#chatloadmessagesball'); const loadMsgBall = chrome$('#chatloadmessagesball');
loadMsgBtn.click(); loadMsgBtn.click();
helper.waitFor(() => loadMsgBtn.css('display') == expectedDisplay && helper.waitFor(() => loadMsgBtn.css('display') === expectedDisplay &&
loadMsgBall.css('display') == expectedDisplay).always(() => { loadMsgBall.css('display') === expectedDisplay).always(() => {
expect(loadMsgBtn.css('display')).to.be(expectedDisplay); expect(loadMsgBtn.css('display')).to.be(expectedDisplay);
expect(loadMsgBall.css('display')).to.be(expectedDisplay); expect(loadMsgBall.css('display')).to.be(expectedDisplay);
done(); done();

View file

@ -1,3 +1,5 @@
'use strict';
describe('clear authorship colors button', function () { describe('clear authorship colors button', function () {
// create a new pad before each test run // create a new pad before each test run
beforeEach(function (cb) { beforeEach(function (cb) {
@ -6,6 +8,7 @@ describe('clear authorship colors button', function () {
}); });
it('makes text clear authorship colors', function (done) { it('makes text clear authorship colors', function (done) {
this.timeout(1500);
const inner$ = helper.padInner$; const inner$ = helper.padInner$;
const chrome$ = helper.padChrome$; const chrome$ = helper.padChrome$;
@ -17,9 +20,6 @@ describe('clear authorship colors button', function () {
// get the first text element out of the inner iframe // get the first text element out of the inner iframe
const $firstTextElement = inner$('div').first(); const $firstTextElement = inner$('div').first();
// Get the original text
const originalText = inner$('div').first().text();
// Set some new text // Set some new text
const sentText = 'Hello'; const sentText = 'Hello';
@ -28,7 +28,9 @@ describe('clear authorship colors button', function () {
$firstTextElement.sendkeys(sentText); $firstTextElement.sendkeys(sentText);
$firstTextElement.sendkeys('{rightarrow}'); $firstTextElement.sendkeys('{rightarrow}');
helper.waitFor(() => inner$('div span').first().attr('class').indexOf('author') !== -1 // wait until we have the full value available // wait until we have the full value available
helper.waitFor(
() => inner$('div span').first().attr('class').indexOf('author') !== -1
).done(() => { ).done(() => {
// IE hates you if you don't give focus to the inner frame bevore you do a clearAuthorship // IE hates you if you don't give focus to the inner frame bevore you do a clearAuthorship
inner$('div').first().focus(); inner$('div').first().focus();
@ -37,16 +39,13 @@ describe('clear authorship colors button', function () {
const $clearauthorshipcolorsButton = chrome$('.buttonicon-clearauthorship'); const $clearauthorshipcolorsButton = chrome$('.buttonicon-clearauthorship');
$clearauthorshipcolorsButton.click(); $clearauthorshipcolorsButton.click();
// does the first divs span include an author class?
var hasAuthorClass = inner$('div span').first().attr('class').indexOf('author') !== -1;
// expect(hasAuthorClass).to.be(false);
// does the first div include an author class? // does the first div include an author class?
var hasAuthorClass = inner$('div').first().attr('class').indexOf('author') !== -1; const hasAuthorClass = inner$('div').first().attr('class').indexOf('author') !== -1;
expect(hasAuthorClass).to.be(false); expect(hasAuthorClass).to.be(false);
helper.waitFor(() => { helper.waitFor(() => {
const disconnectVisible = chrome$('div.disconnected').attr('class').indexOf('visible') === -1; const disconnectVisible =
chrome$('div.disconnected').attr('class').indexOf('visible') === -1;
return (disconnectVisible === true); return (disconnectVisible === true);
}); });
@ -58,6 +57,7 @@ describe('clear authorship colors button', function () {
}); });
it("makes text clear authorship colors and checks it can't be undone", function (done) { it("makes text clear authorship colors and checks it can't be undone", function (done) {
this.timeout(1500);
const inner$ = helper.padInner$; const inner$ = helper.padInner$;
const chrome$ = helper.padChrome$; const chrome$ = helper.padChrome$;
@ -69,9 +69,6 @@ describe('clear authorship colors button', function () {
// get the first text element out of the inner iframe // get the first text element out of the inner iframe
const $firstTextElement = inner$('div').first(); const $firstTextElement = inner$('div').first();
// Get the original text
const originalText = inner$('div').first().text();
// Set some new text // Set some new text
const sentText = 'Hello'; const sentText = 'Hello';
@ -80,7 +77,9 @@ describe('clear authorship colors button', function () {
$firstTextElement.sendkeys(sentText); $firstTextElement.sendkeys(sentText);
$firstTextElement.sendkeys('{rightarrow}'); $firstTextElement.sendkeys('{rightarrow}');
helper.waitFor(() => inner$('div span').first().attr('class').indexOf('author') !== -1 // wait until we have the full value available // wait until we have the full value available
helper.waitFor(
() => inner$('div span').first().attr('class').indexOf('author') !== -1
).done(() => { ).done(() => {
// IE hates you if you don't give focus to the inner frame bevore you do a clearAuthorship // IE hates you if you don't give focus to the inner frame bevore you do a clearAuthorship
inner$('div').first().focus(); inner$('div').first().focus();
@ -89,12 +88,8 @@ describe('clear authorship colors button', function () {
const $clearauthorshipcolorsButton = chrome$('.buttonicon-clearauthorship'); const $clearauthorshipcolorsButton = chrome$('.buttonicon-clearauthorship');
$clearauthorshipcolorsButton.click(); $clearauthorshipcolorsButton.click();
// does the first divs span include an author class?
var hasAuthorClass = inner$('div span').first().attr('class').indexOf('author') !== -1;
// expect(hasAuthorClass).to.be(false);
// does the first div include an author class? // does the first div include an author class?
var hasAuthorClass = inner$('div').first().attr('class').indexOf('author') !== -1; let hasAuthorClass = inner$('div').first().attr('class').indexOf('author') !== -1;
expect(hasAuthorClass).to.be(false); expect(hasAuthorClass).to.be(false);
const e = inner$.Event(helper.evtType); const e = inner$.Event(helper.evtType);
@ -115,7 +110,8 @@ describe('clear authorship colors button', function () {
expect(hasAuthorClass).to.be(false); expect(hasAuthorClass).to.be(false);
helper.waitFor(() => { helper.waitFor(() => {
const disconnectVisible = chrome$('div.disconnected').attr('class').indexOf('visible') === -1; const disconnectVisible =
chrome$('div.disconnected').attr('class').indexOf('visible') === -1;
return (disconnectVisible === true); return (disconnectVisible === true);
}); });

View file

@ -1,3 +1,5 @@
'use strict';
describe('delete keystroke', function () { describe('delete keystroke', function () {
// create a new pad before each test run // create a new pad before each test run
beforeEach(function (cb) { beforeEach(function (cb) {
@ -6,8 +8,9 @@ describe('delete keystroke', function () {
}); });
it('makes text delete', function (done) { it('makes text delete', function (done) {
this.timeout(50);
const inner$ = helper.padInner$; const inner$ = helper.padInner$;
const chrome$ = helper.padChrome$;
// get the first text element out of the inner iframe // get the first text element out of the inner iframe
const $firstTextElement = inner$('div').first(); const $firstTextElement = inner$('div').first();
@ -15,15 +18,12 @@ describe('delete keystroke', function () {
// get the original length of this element // get the original length of this element
const elementLength = $firstTextElement.text().length; const elementLength = $firstTextElement.text().length;
// get the original string value minus the last char
const originalTextValue = $firstTextElement.text();
const originalTextValueMinusFirstChar = originalTextValue.substring(1, originalTextValue.length);
// simulate key presses to delete content // simulate key presses to delete content
$firstTextElement.sendkeys('{leftarrow}'); // simulate a keypress of the left arrow key $firstTextElement.sendkeys('{leftarrow}'); // simulate a keypress of the left arrow key
$firstTextElement.sendkeys('{del}'); // simulate a keypress of delete $firstTextElement.sendkeys('{del}'); // simulate a keypress of delete
// ace creates a new dom element when you press a keystroke, so just get the first text element again // ace creates a new dom element when you press a keystroke
// so just get the first text element again
const $newFirstTextElement = inner$('div').first(); const $newFirstTextElement = inner$('div').first();
// get the new length of this element // get the new length of this element

View file

@ -1,4 +1,7 @@
// WARNING: drag and drop is only simulated on these tests, so manual testing might also be necessary 'use strict';
// WARNING: drag and drop is only simulated on these tests
// so manual testing might also be necessary
describe('drag and drop', function () { describe('drag and drop', function () {
before(function (done) { before(function (done) {
helper.newPad(() => { helper.newPad(() => {
@ -27,6 +30,7 @@ describe('drag and drop', function () {
}); });
it('moves text back to its original place', function (done) { it('moves text back to its original place', function (done) {
this.timeout(50);
// test text was removed from drop target // test text was removed from drop target
const $targetLine = getLine(TARGET_LINE); const $targetLine = getLine(TARGET_LINE);
expect($targetLine.text()).to.be('Target line []'); expect($targetLine.text()).to.be('Target line []');
@ -62,6 +66,7 @@ describe('drag and drop', function () {
}); });
it('moves text back to its original place', function (done) { it('moves text back to its original place', function (done) {
this.timeout(50);
// test text was removed from drop target // test text was removed from drop target
const $targetLine = getLine(TARGET_LINE); const $targetLine = getLine(TARGET_LINE);
expect($targetLine.text()).to.be('Target line []'); expect($targetLine.text()).to.be('Target line []');
@ -78,18 +83,19 @@ describe('drag and drop', function () {
}); });
/* ********************* Helper functions/constants ********************* */ /* ********************* Helper functions/constants ********************* */
var TARGET_LINE = 2; const TARGET_LINE = 2;
var FIRST_SOURCE_LINE = 5; const FIRST_SOURCE_LINE = 5;
var getLine = function (lineNumber) { const getLine = function (lineNumber) {
const $lines = helper.padInner$('div'); const $lines = helper.padInner$('div');
return $lines.slice(lineNumber, lineNumber + 1); return $lines.slice(lineNumber, lineNumber + 1);
}; };
var createScriptWithSeveralLines = function (done) { const createScriptWithSeveralLines = function (done) {
// create some lines to be used on the tests // create some lines to be used on the tests
const $firstLine = helper.padInner$('div').first(); const $firstLine = helper.padInner$('div').first();
$firstLine.html('...<br>...<br>Target line []<br>...<br>...<br>Source line 1.<br>Source line 2.<br>'); $firstLine.html(
'...<br>...<br>Target line []<br>...<br>...<br>Source line 1.<br>Source line 2.<br>');
// wait for lines to be split // wait for lines to be split
helper.waitFor(() => { helper.waitFor(() => {
@ -98,7 +104,7 @@ describe('drag and drop', function () {
}).done(done); }).done(done);
}; };
var selectPartOfSourceLine = function () { const selectPartOfSourceLine = function () {
const $sourceLine = getLine(FIRST_SOURCE_LINE); const $sourceLine = getLine(FIRST_SOURCE_LINE);
// select 'line 1' from 'Source line 1.' // select 'line 1' from 'Source line 1.'
@ -106,14 +112,14 @@ describe('drag and drop', function () {
const end = start + 'line 1'.length; const end = start + 'line 1'.length;
helper.selectLines($sourceLine, $sourceLine, start, end); helper.selectLines($sourceLine, $sourceLine, start, end);
}; };
var selectMultipleSourceLines = function () { const selectMultipleSourceLines = function () {
const $firstSourceLine = getLine(FIRST_SOURCE_LINE); const $firstSourceLine = getLine(FIRST_SOURCE_LINE);
const $lastSourceLine = getLine(FIRST_SOURCE_LINE + 1); const $lastSourceLine = getLine(FIRST_SOURCE_LINE + 1);
helper.selectLines($firstSourceLine, $lastSourceLine); helper.selectLines($firstSourceLine, $lastSourceLine);
}; };
var dragSelectedTextAndDropItIntoMiddleOfLine = function (targetLineNumber) { const dragSelectedTextAndDropItIntoMiddleOfLine = function (targetLineNumber) {
// dragstart: start dragging content // dragstart: start dragging content
triggerEvent('dragstart'); triggerEvent('dragstart');
@ -126,7 +132,7 @@ describe('drag and drop', function () {
triggerEvent('dragend'); triggerEvent('dragend');
}; };
var getHtmlFromSelectedText = function () { const getHtmlFromSelectedText = function () {
const innerDocument = helper.padInner$.document; const innerDocument = helper.padInner$.document;
const range = innerDocument.getSelection().getRangeAt(0); const range = innerDocument.getSelection().getRangeAt(0);
@ -139,12 +145,12 @@ describe('drag and drop', function () {
return draggedHtml; return draggedHtml;
}; };
var triggerEvent = function (eventName) { const triggerEvent = function (eventName) {
const event = helper.padInner$.Event(eventName); const event = helper.padInner$.Event(eventName);
helper.padInner$('#innerdocbody').trigger(event); helper.padInner$('#innerdocbody').trigger(event);
}; };
var moveSelectionIntoTarget = function (draggedHtml, targetLineNumber) { const moveSelectionIntoTarget = function (draggedHtml, targetLineNumber) {
const innerDocument = helper.padInner$.document; const innerDocument = helper.padInner$.document;
// delete original content // delete original content

View file

@ -1,3 +1,5 @@
'use strict';
describe('embed links', function () { describe('embed links', function () {
const objectify = function (str) { const objectify = function (str) {
const hash = {}; const hash = {};
@ -55,6 +57,7 @@ describe('embed links', function () {
describe('the share link', function () { describe('the share link', function () {
it('is the actual pad url', function (done) { it('is the actual pad url', function (done) {
this.timeout(50);
const chrome$ = helper.padChrome$; const chrome$ = helper.padChrome$;
// open share dropdown // open share dropdown
@ -71,6 +74,7 @@ describe('embed links', function () {
describe('the embed as iframe code', function () { describe('the embed as iframe code', function () {
it('is an iframe with the the correct url parameters and correct size', function (done) { it('is an iframe with the the correct url parameters and correct size', function (done) {
this.timeout(50);
const chrome$ = helper.padChrome$; const chrome$ = helper.padChrome$;
// open share dropdown // open share dropdown
@ -94,6 +98,7 @@ describe('embed links', function () {
describe('the share link', function () { describe('the share link', function () {
it('shows a read only url', function (done) { it('shows a read only url', function (done) {
this.timeout(50);
const chrome$ = helper.padChrome$; const chrome$ = helper.padChrome$;
// open share dropdown // open share dropdown
@ -112,6 +117,7 @@ describe('embed links', function () {
describe('the embed as iframe code', function () { describe('the embed as iframe code', function () {
it('is an iframe with the the correct url parameters and correct size', function (done) { it('is an iframe with the the correct url parameters and correct size', function (done) {
this.timeout(50);
const chrome$ = helper.padChrome$; const chrome$ = helper.padChrome$;
// open share dropdown // open share dropdown

View file

@ -1,3 +1,5 @@
'use strict';
describe('enter keystroke', function () { describe('enter keystroke', function () {
// create a new pad before each test run // create a new pad before each test run
beforeEach(function (cb) { beforeEach(function (cb) {
@ -6,8 +8,9 @@ describe('enter keystroke', function () {
}); });
it('creates a new line & puts cursor onto a new line', function (done) { it('creates a new line & puts cursor onto a new line', function (done) {
this.timeout(2000);
const inner$ = helper.padInner$; const inner$ = helper.padInner$;
const chrome$ = helper.padChrome$;
// get the first text element out of the inner iframe // get the first text element out of the inner iframe
const $firstTextElement = inner$('div').first(); const $firstTextElement = inner$('div').first();
@ -18,14 +21,12 @@ describe('enter keystroke', function () {
// simulate key presses to enter content // simulate key presses to enter content
$firstTextElement.sendkeys('{enter}'); $firstTextElement.sendkeys('{enter}');
// ace creates a new dom element when you press a keystroke, so just get the first text element again
const $newFirstTextElement = inner$('div').first();
helper.waitFor(() => inner$('div').first().text() === '').done(() => { helper.waitFor(() => inner$('div').first().text() === '').done(() => {
const $newSecondLine = inner$('div').first().next(); const $newSecondLine = inner$('div').first().next();
const newFirstTextElementValue = inner$('div').first().text(); const newFirstTextElementValue = inner$('div').first().text();
expect(newFirstTextElementValue).to.be(''); // expect the first line to be blank expect(newFirstTextElementValue).to.be(''); // expect the first line to be blank
expect($newSecondLine.text()).to.be(originalTextValue); // expect the second line to be the same as the original first line. // expect the second line to be the same as the original first line.
expect($newSecondLine.text()).to.be(originalTextValue);
done(); done();
}); });
}); });

View file

@ -1,3 +1,5 @@
'use strict';
describe('font select', function () { describe('font select', function () {
// create a new pad before each test run // create a new pad before each test run
beforeEach(function (cb) { beforeEach(function (cb) {
@ -6,6 +8,7 @@ describe('font select', function () {
}); });
it('makes text RobotoMono', function (done) { it('makes text RobotoMono', function (done) {
this.timeout(100);
const inner$ = helper.padInner$; const inner$ = helper.padInner$;
const chrome$ = helper.padChrome$; const chrome$ = helper.padChrome$;
@ -15,7 +18,6 @@ describe('font select', function () {
// get the font menu and RobotoMono option // get the font menu and RobotoMono option
const $viewfontmenu = chrome$('#viewfontmenu'); const $viewfontmenu = chrome$('#viewfontmenu');
const $RobotoMonooption = $viewfontmenu.find('[value=RobotoMono]');
// select RobotoMono and fire change event // select RobotoMono and fire change event
// $RobotoMonooption.attr('selected','selected'); // $RobotoMonooption.attr('selected','selected');

View file

@ -1,3 +1,5 @@
'use strict';
describe('the test helper', function () { describe('the test helper', function () {
describe('the newPad method', function () { describe('the newPad method', function () {
xit("doesn't leak memory if you creates iframes over and over again", function (done) { xit("doesn't leak memory if you creates iframes over and over again", function (done) {
@ -5,7 +7,7 @@ describe('the test helper', function () {
let times = 10; let times = 10;
var loadPad = function () { const loadPad = function () {
helper.newPad(() => { helper.newPad(() => {
times--; times--;
if (times > 0) { if (times > 0) {

View file

@ -1,3 +1,5 @@
'use strict';
describe('indentation button', function () { describe('indentation button', function () {
// create a new pad before each test run // create a new pad before each test run
beforeEach(function (cb) { beforeEach(function (cb) {
@ -6,8 +8,8 @@ describe('indentation button', function () {
}); });
it('indent text with keypress', function (done) { it('indent text with keypress', function (done) {
this.timeout(100);
const inner$ = helper.padInner$; const inner$ = helper.padInner$;
const chrome$ = helper.padChrome$;
// get the first text element out of the inner iframe // get the first text element out of the inner iframe
const $firstTextElement = inner$('div').first(); const $firstTextElement = inner$('div').first();
@ -23,6 +25,7 @@ describe('indentation button', function () {
}); });
it('indent text with button', function (done) { it('indent text with button', function (done) {
this.timeout(100);
const inner$ = helper.padInner$; const inner$ = helper.padInner$;
const chrome$ = helper.padChrome$; const chrome$ = helper.padChrome$;
@ -33,6 +36,7 @@ describe('indentation button', function () {
}); });
it('keeps the indent on enter for the new line', function (done) { it('keeps the indent on enter for the new line', function (done) {
this.timeout(150);
const inner$ = helper.padInner$; const inner$ = helper.padInner$;
const chrome$ = helper.padChrome$; const chrome$ = helper.padChrome$;
@ -57,8 +61,8 @@ describe('indentation button', function () {
}); });
it("indents text with spaces on enter if previous line ends with ':', '[', '(', or '{'", function (done) { it("indents text with spaces on enter if previous line ends with ':', '[', '(', or '{'", function (done) {
this.timeout(150);
const inner$ = helper.padInner$; const inner$ = helper.padInner$;
const chrome$ = helper.padChrome$;
// type a bit, make a line break and type again // type a bit, make a line break and type again
const $firstTextElement = inner$('div').first(); const $firstTextElement = inner$('div').first();
@ -77,7 +81,8 @@ describe('indentation button', function () {
// curly braces // curly braces
const $lineWithCurlyBraces = inner$('div').first().next().next().next(); const $lineWithCurlyBraces = inner$('div').first().next().next().next();
$lineWithCurlyBraces.sendkeys('{{}'); $lineWithCurlyBraces.sendkeys('{{}');
pressEnter(); // cannot use sendkeys('{enter}') here, browser does not read the command properly // cannot use sendkeys('{enter}') here, browser does not read the command properly
pressEnter();
const $lineAfterCurlyBraces = inner$('div').first().next().next().next().next(); const $lineAfterCurlyBraces = inner$('div').first().next().next().next().next();
expect($lineAfterCurlyBraces.text()).to.match(/\s{4}/); // tab === 4 spaces expect($lineAfterCurlyBraces.text()).to.match(/\s{4}/); // tab === 4 spaces
@ -107,8 +112,8 @@ describe('indentation button', function () {
}); });
it("appends indentation to the indent of previous line if previous line ends with ':', '[', '(', or '{'", function (done) { it("appends indentation to the indent of previous line if previous line ends with ':', '[', '(', or '{'", function (done) {
this.timeout(150);
const inner$ = helper.padInner$; const inner$ = helper.padInner$;
const chrome$ = helper.padChrome$;
// type a bit, make a line break and type again // type a bit, make a line break and type again
const $firstTextElement = inner$('div').first(); const $firstTextElement = inner$('div').first();
@ -124,13 +129,15 @@ describe('indentation button', function () {
$lineWithColon.sendkeys(':'); $lineWithColon.sendkeys(':');
pressEnter(); pressEnter();
const $lineAfterColon = inner$('div').first().next(); const $lineAfterColon = inner$('div').first().next();
expect($lineAfterColon.text()).to.match(/\s{6}/); // previous line indentation + regular tab (4 spaces) // previous line indentation + regular tab (4 spaces)
expect($lineAfterColon.text()).to.match(/\s{6}/);
done(); done();
}); });
}); });
it("issue #2772 shows '*' when multiple indented lines receive a style and are outdented", function (done) { it("issue #2772 shows '*' when multiple indented lines receive a style and are outdented", function (done) {
this.timeout(150);
const inner$ = helper.padInner$; const inner$ = helper.padInner$;
const chrome$ = helper.padChrome$; const chrome$ = helper.padChrome$;
@ -302,9 +309,9 @@ describe('indentation button', function () {
});*/ });*/
}); });
function pressEnter() { const pressEnter = () => {
const inner$ = helper.padInner$; const inner$ = helper.padInner$;
const e = inner$.Event(helper.evtType); const e = inner$.Event(helper.evtType);
e.keyCode = 13; // enter :| e.keyCode = 13; // enter :|
inner$('#innerdocbody').trigger(e); inner$('#innerdocbody').trigger(e);
} };

View file

@ -1,3 +1,5 @@
'use strict';
describe('italic some text', function () { describe('italic some text', function () {
// create a new pad before each test run // create a new pad before each test run
beforeEach(function (cb) { beforeEach(function (cb) {
@ -6,6 +8,7 @@ describe('italic some text', function () {
}); });
it('makes text italic using button', function (done) { it('makes text italic using button', function (done) {
this.timeout(50);
const inner$ = helper.padInner$; const inner$ = helper.padInner$;
const chrome$ = helper.padChrome$; const chrome$ = helper.padChrome$;
@ -19,7 +22,6 @@ describe('italic some text', function () {
const $boldButton = chrome$('.buttonicon-italic'); const $boldButton = chrome$('.buttonicon-italic');
$boldButton.click(); $boldButton.click();
// ace creates a new dom element when you press a button, so just get the first text element again
const $newFirstTextElement = inner$('div').first(); const $newFirstTextElement = inner$('div').first();
// is there a <i> element now? // is there a <i> element now?
@ -35,8 +37,8 @@ describe('italic some text', function () {
}); });
it('makes text italic using keypress', function (done) { it('makes text italic using keypress', function (done) {
this.timeout(50);
const inner$ = helper.padInner$; const inner$ = helper.padInner$;
const chrome$ = helper.padChrome$;
// get the first text element out of the inner iframe // get the first text element out of the inner iframe
const $firstTextElement = inner$('div').first(); const $firstTextElement = inner$('div').first();
@ -49,7 +51,6 @@ describe('italic some text', function () {
e.which = 105; // i e.which = 105; // i
inner$('#innerdocbody').trigger(e); inner$('#innerdocbody').trigger(e);
// ace creates a new dom element when you press a button, so just get the first text element again
const $newFirstTextElement = inner$('div').first(); const $newFirstTextElement = inner$('div').first();
// is there a <i> element now? // is there a <i> element now?

View file

@ -1,6 +1,8 @@
function deletecookie(name) { 'use strict';
const deletecookie = (name) => {
document.cookie = `${name}=; expires=Thu, 01 Jan 1970 00:00:01 GMT;`; document.cookie = `${name}=; expires=Thu, 01 Jan 1970 00:00:01 GMT;`;
} };
describe('Language select and change', function () { describe('Language select and change', function () {
// Destroy language cookies // Destroy language cookies
@ -14,7 +16,7 @@ describe('Language select and change', function () {
// Destroy language cookies // Destroy language cookies
it('makes text german', function (done) { it('makes text german', function (done) {
const inner$ = helper.padInner$; this.timeout(100);
const chrome$ = helper.padChrome$; const chrome$ = helper.padChrome$;
// click on the settings button to make settings visible // click on the settings button to make settings visible
@ -29,7 +31,7 @@ describe('Language select and change', function () {
$languageoption.attr('selected', 'selected'); $languageoption.attr('selected', 'selected');
$language.change(); $language.change();
helper.waitFor(() => chrome$('.buttonicon-bold').parent()[0].title == 'Fett (Strg-B)') helper.waitFor(() => chrome$('.buttonicon-bold').parent()[0].title === 'Fett (Strg-B)')
.done(() => { .done(() => {
// get the value of the bold button // get the value of the bold button
const $boldButton = chrome$('.buttonicon-bold').parent(); const $boldButton = chrome$('.buttonicon-bold').parent();
@ -44,7 +46,7 @@ describe('Language select and change', function () {
}); });
it('makes text English', function (done) { it('makes text English', function (done) {
const inner$ = helper.padInner$; this.timeout(100);
const chrome$ = helper.padChrome$; const chrome$ = helper.padChrome$;
// click on the settings button to make settings visible // click on the settings button to make settings visible
@ -60,7 +62,7 @@ describe('Language select and change', function () {
// get the value of the bold button // get the value of the bold button
const $boldButton = chrome$('.buttonicon-bold').parent(); const $boldButton = chrome$('.buttonicon-bold').parent();
helper.waitFor(() => $boldButton[0].title != 'Fett (Strg+B)') helper.waitFor(() => $boldButton[0].title !== 'Fett (Strg+B)')
.done(() => { .done(() => {
// get the value of the bold button // get the value of the bold button
const $boldButton = chrome$('.buttonicon-bold').parent(); const $boldButton = chrome$('.buttonicon-bold').parent();
@ -75,7 +77,7 @@ describe('Language select and change', function () {
}); });
it('changes direction when picking an rtl lang', function (done) { it('changes direction when picking an rtl lang', function (done) {
const inner$ = helper.padInner$; this.timeout(200);
const chrome$ = helper.padChrome$; const chrome$ = helper.padChrome$;
// click on the settings button to make settings visible // click on the settings button to make settings visible
@ -91,7 +93,7 @@ describe('Language select and change', function () {
$language.val('ar'); $language.val('ar');
$languageoption.change(); $languageoption.change();
helper.waitFor(() => chrome$('html')[0].dir != 'ltr') helper.waitFor(() => chrome$('html')[0].dir !== 'ltr')
.done(() => { .done(() => {
// check if the document's direction was changed // check if the document's direction was changed
expect(chrome$('html')[0].dir).to.be('rtl'); expect(chrome$('html')[0].dir).to.be('rtl');
@ -100,7 +102,7 @@ describe('Language select and change', function () {
}); });
it('changes direction when picking an ltr lang', function (done) { it('changes direction when picking an ltr lang', function (done) {
const inner$ = helper.padInner$; this.timeout(200);
const chrome$ = helper.padChrome$; const chrome$ = helper.padChrome$;
// click on the settings button to make settings visible // click on the settings button to make settings visible
@ -117,7 +119,7 @@ describe('Language select and change', function () {
$language.val('en'); $language.val('en');
$languageoption.change(); $languageoption.change();
helper.waitFor(() => chrome$('html')[0].dir != 'rtl') helper.waitFor(() => chrome$('html')[0].dir !== 'rtl')
.done(() => { .done(() => {
// check if the document's direction was changed // check if the document's direction was changed
expect(chrome$('html')[0].dir).to.be('ltr'); expect(chrome$('html')[0].dir).to.be('ltr');

View file

@ -1,7 +1,9 @@
'use strict';
describe('author of pad edition', function () { describe('author of pad edition', function () {
// author 1 creates a new pad with some content (regular lines and lists) // author 1 creates a new pad with some content (regular lines and lists)
before(function (done) { before(function (done) {
var padId = helper.newPad(() => { const padId = helper.newPad(() => {
// make sure pad has at least 3 lines // make sure pad has at least 3 lines
const $firstLine = helper.padInner$('div').first(); const $firstLine = helper.padInner$('div').first();
$firstLine.html('Hello World'); $firstLine.html('Hello World');
@ -13,7 +15,8 @@ describe('author of pad edition', function () {
setTimeout(() => { setTimeout(() => {
// Expire cookie, so author is changed after reloading the pad. // Expire cookie, so author is changed after reloading the pad.
// See https://developer.mozilla.org/en-US/docs/Web/API/Document/cookie#Example_4_Reset_the_previous_cookie // See https://developer.mozilla.org/en-US/docs/Web/API/Document/cookie#Example_4_Reset_the_previous_cookie
helper.padChrome$.document.cookie = 'token=foo;expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/'; const cookieVal = 'token=foo;expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/';
helper.padChrome$.document.cookie = cookieVal;
helper.newPad(done, padId); helper.newPad(done, padId);
}, 1000); }, 1000);
@ -22,12 +25,7 @@ describe('author of pad edition', function () {
this.timeout(60000); this.timeout(60000);
}); });
// author 2 makes some changes on the pad const clearAuthorship = function (done) {
it('Clears Authorship by second user', function (done) {
clearAuthorship(done);
});
var clearAuthorship = function (done) {
const inner$ = helper.padInner$; const inner$ = helper.padInner$;
const chrome$ = helper.padChrome$; const chrome$ = helper.padChrome$;
@ -46,4 +44,10 @@ describe('author of pad edition', function () {
expect(hasAuthorClass).to.be(false); expect(hasAuthorClass).to.be(false);
done(); done();
}; };
// author 2 makes some changes on the pad
it('Clears Authorship by second user', function (done) {
this.timeout(100);
clearAuthorship(done);
});
}); });

View file

@ -1,3 +1,5 @@
'use strict';
describe('assign ordered list', function () { describe('assign ordered list', function () {
// create a new pad before each test run // create a new pad before each test run
beforeEach(function (cb) { beforeEach(function (cb) {
@ -6,6 +8,7 @@ describe('assign ordered list', function () {
}); });
it('inserts ordered list text', function (done) { it('inserts ordered list text', function (done) {
this.timeout(100);
const inner$ = helper.padInner$; const inner$ = helper.padInner$;
const chrome$ = helper.padChrome$; const chrome$ = helper.padChrome$;
@ -23,6 +26,7 @@ describe('assign ordered list', function () {
}); });
it('inserts unordered list', function (done) { it('inserts unordered list', function (done) {
this.timeout(50);
helper.waitFor(() => helper.padInner$('div').first().find('ol li').length === 1).done(done); helper.waitFor(() => helper.padInner$('div').first().find('ol li').length === 1).done(done);
}); });
}); });
@ -34,6 +38,7 @@ describe('assign ordered list', function () {
}); });
it('does not insert unordered list', function (done) { it('does not insert unordered list', function (done) {
this.timeout(3000);
helper.waitFor(() => helper.padInner$('div').first().find('ol li').length === 1).done(() => { helper.waitFor(() => helper.padInner$('div').first().find('ol li').length === 1).done(() => {
expect().fail(() => 'Unordered list inserted, should ignore shortcut'); expect().fail(() => 'Unordered list inserted, should ignore shortcut');
}).fail(() => { }).fail(() => {
@ -51,6 +56,7 @@ describe('assign ordered list', function () {
}); });
it('inserts unordered list', function (done) { it('inserts unordered list', function (done) {
this.timeout(100);
helper.waitFor(() => helper.padInner$('div').first().find('ol li').length === 1).done(done); helper.waitFor(() => helper.padInner$('div').first().find('ol li').length === 1).done(done);
}); });
}); });
@ -62,6 +68,7 @@ describe('assign ordered list', function () {
}); });
it('does not insert unordered list', function (done) { it('does not insert unordered list', function (done) {
this.timeout(3000);
helper.waitFor(() => helper.padInner$('div').first().find('ol li').length === 1).done(() => { helper.waitFor(() => helper.padInner$('div').first().find('ol li').length === 1).done(() => {
expect().fail(() => 'Unordered list inserted, should ignore shortcut'); expect().fail(() => 'Unordered list inserted, should ignore shortcut');
}).fail(() => { }).fail(() => {
@ -91,12 +98,13 @@ describe('assign ordered list', function () {
expect(hasOLElement).to.be(true); expect(hasOLElement).to.be(true);
expect($newSecondLine.text()).to.be('line 2'); expect($newSecondLine.text()).to.be('line 2');
const hasLineNumber = $newSecondLine.find('ol').attr('start') === 2; const hasLineNumber = $newSecondLine.find('ol').attr('start') === 2;
expect(hasLineNumber).to.be(true); // This doesn't work because pasting in content doesn't work // This doesn't work because pasting in content doesn't work
expect(hasLineNumber).to.be(true);
done(); done();
}); });
}); });
var triggerCtrlShiftShortcut = function (shortcutChar) { const triggerCtrlShiftShortcut = function (shortcutChar) {
const inner$ = helper.padInner$; const inner$ = helper.padInner$;
const e = inner$.Event(helper.evtType); const e = inner$.Event(helper.evtType);
e.ctrlKey = true; e.ctrlKey = true;
@ -105,10 +113,10 @@ describe('assign ordered list', function () {
inner$('#innerdocbody').trigger(e); inner$('#innerdocbody').trigger(e);
}; };
var makeSureShortcutIsDisabled = function (shortcut) { const makeSureShortcutIsDisabled = function (shortcut) {
helper.padChrome$.window.clientVars.padShortcutEnabled[shortcut] = false; helper.padChrome$.window.clientVars.padShortcutEnabled[shortcut] = false;
}; };
var makeSureShortcutIsEnabled = function (shortcut) { const makeSureShortcutIsEnabled = function (shortcut) {
helper.padChrome$.window.clientVars.padShortcutEnabled[shortcut] = true; helper.padChrome$.window.clientVars.padShortcutEnabled[shortcut] = true;
}; };
}); });
@ -121,6 +129,7 @@ describe('Pressing Tab in an OL increases and decreases indentation', function (
}); });
it('indent and de-indent list item with keypress', function (done) { it('indent and de-indent list item with keypress', function (done) {
this.timeout(100);
const inner$ = helper.padInner$; const inner$ = helper.padInner$;
const chrome$ = helper.padChrome$; const chrome$ = helper.padChrome$;
@ -155,6 +164,7 @@ describe('Pressing indent/outdent button in an OL increases and decreases indent
}); });
it('indent and de-indent list item with indent button', function (done) { it('indent and de-indent list item with indent button', function (done) {
this.timeout(100);
const inner$ = helper.padInner$; const inner$ = helper.padInner$;
const chrome$ = helper.padChrome$; const chrome$ = helper.padChrome$;

View file

@ -1,3 +1,5 @@
'use strict';
describe('Pad modal', function () { describe('Pad modal', function () {
context('when modal is a "force reconnect" message', function () { context('when modal is a "force reconnect" message', function () {
const MODAL_SELECTOR = '#connectivity'; const MODAL_SELECTOR = '#connectivity';
@ -16,6 +18,7 @@ describe('Pad modal', function () {
}); });
it('disables editor', function (done) { it('disables editor', function (done) {
this.timeout(20);
expect(isEditorDisabled()).to.be(true); expect(isEditorDisabled()).to.be(true);
done(); done();
@ -27,6 +30,7 @@ describe('Pad modal', function () {
}); });
it('does not close the modal', function (done) { it('does not close the modal', function (done) {
this.timeout(20);
const $modal = helper.padChrome$(MODAL_SELECTOR); const $modal = helper.padChrome$(MODAL_SELECTOR);
const modalIsVisible = $modal.hasClass('popup-show'); const modalIsVisible = $modal.hasClass('popup-show');
@ -42,6 +46,7 @@ describe('Pad modal', function () {
}); });
it('does not close the modal', function (done) { it('does not close the modal', function (done) {
this.timeout(20);
const $modal = helper.padChrome$(MODAL_SELECTOR); const $modal = helper.padChrome$(MODAL_SELECTOR);
const modalIsVisible = $modal.hasClass('popup-show'); const modalIsVisible = $modal.hasClass('popup-show');
@ -76,6 +81,7 @@ describe('Pad modal', function () {
}); });
it('closes the modal', function (done) { it('closes the modal', function (done) {
this.timeout(20);
expect(isModalOpened(MODAL_SELECTOR)).to.be(false); expect(isModalOpened(MODAL_SELECTOR)).to.be(false);
done(); done();
}); });
@ -87,23 +93,24 @@ describe('Pad modal', function () {
}); });
it('closes the modal', function (done) { it('closes the modal', function (done) {
this.timeout(20);
expect(isModalOpened(MODAL_SELECTOR)).to.be(false); expect(isModalOpened(MODAL_SELECTOR)).to.be(false);
done(); done();
}); });
}); });
}); });
var clickOnPadInner = function () { const clickOnPadInner = function () {
const $editor = helper.padInner$('#innerdocbody'); const $editor = helper.padInner$('#innerdocbody');
$editor.click(); $editor.click();
}; };
var clickOnPadOuter = function () { const clickOnPadOuter = function () {
const $lineNumbersColumn = helper.padOuter$('#sidedivinner'); const $lineNumbersColumn = helper.padOuter$('#sidedivinner');
$lineNumbersColumn.click(); $lineNumbersColumn.click();
}; };
var openSettingsAndWaitForModalToBeVisible = function (done) { const openSettingsAndWaitForModalToBeVisible = function (done) {
helper.padChrome$('.buttonicon-settings').click(); helper.padChrome$('.buttonicon-settings').click();
// wait for modal to be displayed // wait for modal to be displayed
@ -111,7 +118,7 @@ describe('Pad modal', function () {
helper.waitFor(() => isModalOpened(modalSelector), 10000).done(done); helper.waitFor(() => isModalOpened(modalSelector), 10000).done(done);
}; };
var isEditorDisabled = function () { const isEditorDisabled = function () {
const editorDocument = helper.padOuter$("iframe[name='ace_inner']").get(0).contentDocument; const editorDocument = helper.padOuter$("iframe[name='ace_inner']").get(0).contentDocument;
const editorBody = editorDocument.getElementById('innerdocbody'); const editorBody = editorDocument.getElementById('innerdocbody');
@ -121,7 +128,7 @@ describe('Pad modal', function () {
return editorIsDisabled; return editorIsDisabled;
}; };
var isModalOpened = function (modalSelector) { const isModalOpened = function (modalSelector) {
const $modal = helper.padChrome$(modalSelector); const $modal = helper.padChrome$(modalSelector);
return $modal.hasClass('popup-show'); return $modal.hasClass('popup-show');

View file

@ -1,3 +1,5 @@
'use strict';
describe('undo button then redo button', function () { describe('undo button then redo button', function () {
beforeEach(function (cb) { beforeEach(function (cb) {
helper.newPad(cb); // creates a new pad helper.newPad(cb); // creates a new pad
@ -5,6 +7,7 @@ describe('undo button then redo button', function () {
}); });
it('redo some typing with button', function (done) { it('redo some typing with button', function (done) {
this.timeout(100);
const inner$ = helper.padInner$; const inner$ = helper.padInner$;
const chrome$ = helper.padChrome$; const chrome$ = helper.padChrome$;
@ -32,8 +35,8 @@ describe('undo button then redo button', function () {
}); });
it('redo some typing with keypress', function (done) { it('redo some typing with keypress', function (done) {
this.timeout(100);
const inner$ = helper.padInner$; const inner$ = helper.padInner$;
const chrome$ = helper.padChrome$;
// get the first text element inside the editable space // get the first text element inside the editable space
const $firstTextElement = inner$('div span').first(); const $firstTextElement = inner$('div span').first();
@ -44,12 +47,12 @@ describe('undo button then redo button', function () {
const modifiedValue = $firstTextElement.text(); // get the modified value const modifiedValue = $firstTextElement.text(); // get the modified value
expect(modifiedValue).not.to.be(originalValue); // expect the value to change expect(modifiedValue).not.to.be(originalValue); // expect the value to change
var e = inner$.Event(helper.evtType); let e = inner$.Event(helper.evtType);
e.ctrlKey = true; // Control key e.ctrlKey = true; // Control key
e.which = 90; // z e.which = 90; // z
inner$('#innerdocbody').trigger(e); inner$('#innerdocbody').trigger(e);
var e = inner$.Event(helper.evtType); e = inner$.Event(helper.evtType);
e.ctrlKey = true; // Control key e.ctrlKey = true; // Control key
e.which = 121; // y e.which = 121; // y
inner$('#innerdocbody').trigger(e); inner$('#innerdocbody').trigger(e);

View file

@ -1,3 +1,5 @@
'use strict';
// Test for https://github.com/ether/etherpad-lite/issues/1763 // Test for https://github.com/ether/etherpad-lite/issues/1763
// This test fails in Opera, IE and Safari // This test fails in Opera, IE and Safari

View file

@ -11,7 +11,7 @@ describe('scrolls to line', function () {
}); });
it('Scrolls down to Line 4', async function () { it('Scrolls down to Line 4', async function () {
this.timeout(10000); this.timeout(100);
const chrome$ = helper.padChrome$; const chrome$ = helper.padChrome$;
await helper.waitForPromise(() => { await helper.waitForPromise(() => {
const topOffset = parseInt(chrome$('iframe').first('iframe') const topOffset = parseInt(chrome$('iframe').first('iframe')
@ -32,7 +32,7 @@ describe('doesnt break on weird hash input', function () {
}); });
it('Does NOT change scroll', async function () { it('Does NOT change scroll', async function () {
this.timeout(10000); this.timeout(100);
const chrome$ = helper.padChrome$; const chrome$ = helper.padChrome$;
await helper.waitForPromise(() => { await helper.waitForPromise(() => {
const topOffset = parseInt(chrome$('iframe').first('iframe') const topOffset = parseInt(chrome$('iframe').first('iframe')

View file

@ -1,3 +1,5 @@
'use strict';
describe('select formatting buttons when selection has style applied', function () { describe('select formatting buttons when selection has style applied', function () {
const STYLES = ['italic', 'bold', 'underline', 'strikethrough']; const STYLES = ['italic', 'bold', 'underline', 'strikethrough'];
const SHORTCUT_KEYS = ['I', 'B', 'U', '5']; // italic, bold, underline, strikethrough const SHORTCUT_KEYS = ['I', 'B', 'U', '5']; // italic, bold, underline, strikethrough
@ -21,7 +23,7 @@ describe('select formatting buttons when selection has style applied', function
return $formattingButton.parent().hasClass('selected'); return $formattingButton.parent().hasClass('selected');
}; };
var selectLine = function (lineNumber, offsetStart, offsetEnd) { const selectLine = function (lineNumber, offsetStart, offsetEnd) {
const inner$ = helper.padInner$; const inner$ = helper.padInner$;
const $line = inner$('div').eq(lineNumber); const $line = inner$('div').eq(lineNumber);
helper.selectLines($line, $line, offsetStart, offsetEnd); helper.selectLines($line, $line, offsetStart, offsetEnd);
@ -40,12 +42,14 @@ describe('select formatting buttons when selection has style applied', function
const testIfFormattingButtonIsDeselected = function (style) { const testIfFormattingButtonIsDeselected = function (style) {
it(`deselects the ${style} button`, function (done) { it(`deselects the ${style} button`, function (done) {
this.timeout(50);
helper.waitFor(() => isButtonSelected(style) === false).done(done); helper.waitFor(() => isButtonSelected(style) === false).done(done);
}); });
}; };
const testIfFormattingButtonIsSelected = function (style) { const testIfFormattingButtonIsSelected = function (style) {
it(`selects the ${style} button`, function (done) { it(`selects the ${style} button`, function (done) {
this.timeout(50);
helper.waitFor(() => isButtonSelected(style)).done(done); helper.waitFor(() => isButtonSelected(style)).done(done);
}); });
}; };
@ -58,7 +62,7 @@ describe('select formatting buttons when selection has style applied', function
applyStyleOnLineOnFullLineAndRemoveSelection(line, style, placeCaretOnLine, cb); applyStyleOnLineOnFullLineAndRemoveSelection(line, style, placeCaretOnLine, cb);
}; };
var applyStyleOnLineOnFullLineAndRemoveSelection = function (line, style, selectTarget, cb) { const applyStyleOnLineOnFullLineAndRemoveSelection = function (line, style, selectTarget, cb) {
// see if line html has changed // see if line html has changed
const inner$ = helper.padInner$; const inner$ = helper.padInner$;
const oldLineHTML = inner$.find('div')[line]; const oldLineHTML = inner$.find('div')[line];
@ -80,7 +84,6 @@ describe('select formatting buttons when selection has style applied', function
const pressFormattingShortcutOnSelection = function (key) { const pressFormattingShortcutOnSelection = function (key) {
const inner$ = helper.padInner$; const inner$ = helper.padInner$;
const chrome$ = helper.padChrome$;
// get the first text element out of the inner iframe // get the first text element out of the inner iframe
const $firstTextElement = inner$('div').first(); const $firstTextElement = inner$('div').first();
@ -134,6 +137,7 @@ describe('select formatting buttons when selection has style applied', function
}); });
it('selects the style button', function (done) { it('selects the style button', function (done) {
this.timeout(50);
expect(isButtonSelected(style)).to.be(true); expect(isButtonSelected(style)).to.be(true);
done(); done();
}); });

View file

@ -1,3 +1,5 @@
'use strict';
describe('strikethrough button', function () { describe('strikethrough button', function () {
// create a new pad before each test run // create a new pad before each test run
beforeEach(function (cb) { beforeEach(function (cb) {
@ -6,6 +8,7 @@ describe('strikethrough button', function () {
}); });
it('makes text strikethrough', function (done) { it('makes text strikethrough', function (done) {
this.timeout(100);
const inner$ = helper.padInner$; const inner$ = helper.padInner$;
const chrome$ = helper.padChrome$; const chrome$ = helper.padChrome$;
@ -19,7 +22,8 @@ describe('strikethrough button', function () {
const $strikethroughButton = chrome$('.buttonicon-strikethrough'); const $strikethroughButton = chrome$('.buttonicon-strikethrough');
$strikethroughButton.click(); $strikethroughButton.click();
// ace creates a new dom element when you press a button, so just get the first text element again // ace creates a new dom element when you press a button
// so just get the first text element again
const $newFirstTextElement = inner$('div').first(); const $newFirstTextElement = inner$('div').first();
// is there a <i> element now? // is there a <i> element now?

View file

@ -1,3 +1,5 @@
'use strict';
// deactivated, we need a nice way to get the timeslider, this is ugly // 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 () { xdescribe('timeslider button takes you to the timeslider of a pad', function () {
beforeEach(function (cb) { beforeEach(function (cb) {

View file

@ -9,6 +9,7 @@ describe('timeslider follow', function () {
// TODO needs test if content is also followed, when user a makes edits // TODO needs test if content is also followed, when user a makes edits
// while user b is in the timeslider // while user b is in the timeslider
it("content as it's added to timeslider", async function () { it("content as it's added to timeslider", async function () {
this.timeout(0); // JM TO DO
// send 6 revisions // send 6 revisions
const revs = 6; const revs = 6;
const message = 'a\n\n\n\n\n\n\n\n\n\n'; const message = 'a\n\n\n\n\n\n\n\n\n\n';

View file

@ -1,3 +1,5 @@
'use strict';
describe('timeslider', function () { describe('timeslider', function () {
// create a new pad before each test run // create a new pad before each test run
beforeEach(function (cb) { beforeEach(function (cb) {
@ -7,7 +9,8 @@ describe('timeslider', function () {
/** /**
* @todo test authorsList * @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 correctly formatted date and time', async function () {
this.timeout(12000);
// make some changes to produce 3 revisions // make some changes to produce 3 revisions
const revs = 3; const revs = 3;

View file

@ -1,3 +1,5 @@
'use strict';
describe('timeslider', function () { describe('timeslider', function () {
const padId = 735773577357 + (Math.round(Math.random() * 1000)); const padId = 735773577357 + (Math.round(Math.random() * 1000));
@ -7,6 +9,8 @@ describe('timeslider', function () {
}); });
it('Makes sure the export URIs are as expected when the padID is numeric', async function () { it('Makes sure the export URIs are as expected when the padID is numeric', async function () {
this.timeout(6000);
await helper.edit('a\n'); await helper.edit('a\n');
await helper.gotoTimeslider(1); await helper.gotoTimeslider(1);

View file

@ -1,3 +1,5 @@
'use strict';
describe('timeslider', function () { describe('timeslider', function () {
// create a new pad before each test run // create a new pad before each test run
beforeEach(function (cb) { beforeEach(function (cb) {
@ -5,7 +7,8 @@ describe('timeslider', function () {
this.timeout(60000); this.timeout(60000);
}); });
it('loads adds a hundred revisions', function (done) { // passes it('loads adds a hundred revisions', function (done) {
this.timeout(100000);
const inner$ = helper.padInner$; const inner$ = helper.padInner$;
const chrome$ = helper.padChrome$; const chrome$ = helper.padChrome$;
@ -23,7 +26,8 @@ describe('timeslider', function () {
setTimeout(() => { setTimeout(() => {
// go to timeslider // 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(() => { setTimeout(() => {
const timeslider$ = $('#iframe-container iframe')[0].contentWindow.$; const timeslider$ = $('#iframe-container iframe')[0].contentWindow.$;
@ -66,7 +70,6 @@ describe('timeslider', function () {
// Disabled as jquery trigger no longer works properly // Disabled as jquery trigger no longer works properly
xit('changes the url when clicking on the timeslider', function (done) { xit('changes the url when clicking on the timeslider', function (done) {
const inner$ = helper.padInner$; const inner$ = helper.padInner$;
const chrome$ = helper.padChrome$;
// make some changes to produce 7 revisions // make some changes to produce 7 revisions
const timePerRev = 1000; const timePerRev = 1000;
@ -81,13 +84,13 @@ describe('timeslider', function () {
setTimeout(() => { setTimeout(() => {
// go to timeslider // 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(() => { setTimeout(() => {
const timeslider$ = $('#iframe-container iframe')[0].contentWindow.$; const timeslider$ = $('#iframe-container iframe')[0].contentWindow.$;
const $sliderBar = timeslider$('#ui-slider-bar'); const $sliderBar = timeslider$('#ui-slider-bar');
const latestContents = timeslider$('#innerdocbody').text();
const oldUrl = $('#iframe-container iframe')[0].contentWindow.location.hash; const oldUrl = $('#iframe-container iframe')[0].contentWindow.location.hash;
// Click somewhere on the timeslider // Click somewhere on the timeslider
@ -96,20 +99,22 @@ describe('timeslider', function () {
e.clientY = e.pageY = 60; e.clientY = e.pageY = 60;
$sliderBar.trigger(e); $sliderBar.trigger(e);
helper.waitFor(() => $('#iframe-container iframe')[0].contentWindow.location.hash != oldUrl, 6000).always(() => { helper.waitFor(
expect($('#iframe-container iframe')[0].contentWindow.location.hash).not.to.eql(oldUrl); () => $('#iframe-container iframe')[0].contentWindow.location.hash !== oldUrl, 6000)
done(); .always(() => {
}); expect($('#iframe-container iframe')[0].contentWindow.location.hash)
.not.to.eql(oldUrl);
done();
});
}, 6000); }, 6000);
}, revs * timePerRev); }, revs * timePerRev);
}); });
it('jumps to a revision given in the url', function (done) { it('jumps to a revision given in the url', function (done) {
this.timeout(6000);
const inner$ = helper.padInner$; const inner$ = helper.padInner$;
const chrome$ = helper.padChrome$;
this.timeout(40000);
// wait for the text to be loaded // 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 newLines = inner$('body div').length;
const oldLength = inner$('body').text().length + newLines / 2; const oldLength = inner$('body').text().length + newLines / 2;
expect(oldLength).to.not.eql(0); expect(oldLength).to.not.eql(0);
@ -120,22 +125,25 @@ describe('timeslider', function () {
helper.waitFor(() => { helper.waitFor(() => {
// newLines takes the new lines into account which are strippen when using // newLines takes the new lines into account which are strippen when using
// inner$('body').text(), one <div> is used for one line in ACE. // inner$('body').text(), one <div> 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 <span>, which means that the revision // this waits for the color to be added to our <span>, which means that the revision
// was accepted by the server. // 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; return lenOkay && colorOkay;
}, 10000).always(() => { }, 10000).always(() => {
// go to timeslider with a specific revision set // 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 // wait for the timeslider to be loaded
helper.waitFor(() => { helper.waitFor(() => {
try { try {
timeslider$ = $('#iframe-container iframe')[0].contentWindow.$; timeslider$ = $('#iframe-container iframe')[0].contentWindow.$;
} catch (e) {} } catch (e) {
// silently fart. Deadly.
}
if (timeslider$) { if (timeslider$) {
return timeslider$('#innerdocbody').text().length == oldLength; return timeslider$('#innerdocbody').text().length === oldLength;
} }
}, 10000).always(() => { }, 10000).always(() => {
expect(timeslider$('#innerdocbody').text().length).to.eql(oldLength); expect(timeslider$('#innerdocbody').text().length).to.eql(oldLength);
@ -146,25 +154,28 @@ describe('timeslider', function () {
}); });
it('checks the export url', function (done) { it('checks the export url', function (done) {
this.timeout(6000);
const inner$ = helper.padInner$; const inner$ = helper.padInner$;
const chrome$ = helper.padChrome$;
this.timeout(11000); this.timeout(11000);
inner$('div').first().sendkeys('a'); inner$('div').first().sendkeys('a');
setTimeout(() => { setTimeout(() => {
// go to timeslider // 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 timeslider$;
let exportLink; let exportLink;
helper.waitFor(() => { helper.waitFor(() => {
try { try {
timeslider$ = $('#iframe-container iframe')[0].contentWindow.$; timeslider$ = $('#iframe-container iframe')[0].contentWindow.$;
} catch (e) {} } catch (e) {
// silently give up on life.
}
if (!timeslider$) return false; if (!timeslider$) return false;
exportLink = timeslider$('#exportplaina').attr('href'); exportLink = timeslider$('#exportplaina').attr('href');
if (!exportLink) return false; if (!exportLink) return false;
return exportLink.substr(exportLink.length - 12) == '0/export/txt'; return exportLink.substr(exportLink.length - 12) === '0/export/txt';
}, 6000).always(() => { }, 6000).always(() => {
expect(exportLink.substr(exportLink.length - 12)).to.eql('0/export/txt'); expect(exportLink.substr(exportLink.length - 12)).to.eql('0/export/txt');
done(); done();

View file

@ -1,3 +1,5 @@
'use strict';
describe('undo button', function () { describe('undo button', function () {
beforeEach(function (cb) { beforeEach(function (cb) {
helper.newPad(cb); // creates a new pad helper.newPad(cb); // creates a new pad
@ -5,6 +7,7 @@ describe('undo button', function () {
}); });
it('undo some typing by clicking undo button', function (done) { it('undo some typing by clicking undo button', function (done) {
this.timeout(100);
const inner$ = helper.padInner$; const inner$ = helper.padInner$;
const chrome$ = helper.padChrome$; const chrome$ = helper.padChrome$;
@ -29,8 +32,8 @@ describe('undo button', function () {
}); });
it('undo some typing using a keypress', function (done) { it('undo some typing using a keypress', function (done) {
this.timeout(100);
const inner$ = helper.padInner$; const inner$ = helper.padInner$;
const chrome$ = helper.padChrome$;
// get the first text element inside the editable space // get the first text element inside the editable space
const $firstTextElement = inner$('div span').first(); const $firstTextElement = inner$('div span').first();

View file

@ -1,3 +1,5 @@
'use strict';
describe('assign unordered list', function () { describe('assign unordered list', function () {
// create a new pad before each test run // create a new pad before each test run
beforeEach(function (cb) { beforeEach(function (cb) {
@ -6,6 +8,7 @@ describe('assign unordered list', function () {
}); });
it('insert unordered list text then removes by outdent', function (done) { it('insert unordered list text then removes by outdent', function (done) {
this.timeout(100);
const inner$ = helper.padInner$; const inner$ = helper.padInner$;
const chrome$ = helper.padChrome$; const chrome$ = helper.padChrome$;
const originalText = inner$('div').first().text(); const originalText = inner$('div').first().text();
@ -32,6 +35,7 @@ describe('assign unordered list', function () {
}); });
describe('unassign unordered list', function () { describe('unassign unordered list', function () {
this.timeout(100);
// create a new pad before each test run // create a new pad before each test run
beforeEach(function (cb) { beforeEach(function (cb) {
helper.newPad(cb); helper.newPad(cb);
@ -39,6 +43,7 @@ describe('unassign unordered list', function () {
}); });
it('insert unordered list text then remove by clicking list again', function (done) { it('insert unordered list text then remove by clicking list again', function (done) {
this.timeout(100);
const inner$ = helper.padInner$; const inner$ = helper.padInner$;
const chrome$ = helper.padChrome$; const chrome$ = helper.padChrome$;
const originalText = inner$('div').first().text(); const originalText = inner$('div').first().text();
@ -74,6 +79,7 @@ describe('keep unordered list on enter key', function () {
}); });
it('Keeps the unordered list on enter for the new line', function (done) { it('Keeps the unordered list on enter for the new line', function (done) {
this.timeout(1000);
const inner$ = helper.padInner$; const inner$ = helper.padInner$;
const chrome$ = helper.padChrome$; const chrome$ = helper.padChrome$;
@ -98,6 +104,7 @@ describe('keep unordered list on enter key', function () {
}); });
describe('Pressing Tab in an UL increases and decreases indentation', function () { describe('Pressing Tab in an UL increases and decreases indentation', function () {
this.timeout(100);
// create a new pad before each test run // create a new pad before each test run
beforeEach(function (cb) { beforeEach(function (cb) {
helper.newPad(cb); helper.newPad(cb);
@ -105,6 +112,7 @@ describe('Pressing Tab in an UL increases and decreases indentation', function (
}); });
it('indent and de-indent list item with keypress', function (done) { it('indent and de-indent list item with keypress', function (done) {
this.timeout(100);
const inner$ = helper.padInner$; const inner$ = helper.padInner$;
const chrome$ = helper.padChrome$; const chrome$ = helper.padChrome$;
@ -138,6 +146,7 @@ describe('Pressing indent/outdent button in an UL increases and decreases indent
}); });
it('indent and de-indent list item with indent button', function (done) { it('indent and de-indent list item with indent button', function (done) {
this.timeout(100);
const inner$ = helper.padInner$; const inner$ = helper.padInner$;
const chrome$ = helper.padChrome$; const chrome$ = helper.padChrome$;

View file

@ -20,6 +20,7 @@ describe('urls', function () {
describe('entering a URL makes a link', function () { describe('entering a URL makes a link', function () {
for (const url of ['https://etherpad.org', 'www.etherpad.org']) { for (const url of ['https://etherpad.org', 'www.etherpad.org']) {
it(url, async function () { it(url, async function () {
this.timeout(5000);
const url = 'https://etherpad.org'; const url = 'https://etherpad.org';
await helper.edit(url); await helper.edit(url);
await helper.waitForPromise(() => txt().find('a').length === 1, 2000); await helper.waitForPromise(() => txt().find('a').length === 1, 2000);
@ -34,6 +35,7 @@ describe('urls', function () {
for (const char of '-:@_.,~%+/?=&#!;()$\'*') { for (const char of '-:@_.,~%+/?=&#!;()$\'*') {
const url = `https://etherpad.org/${char}foo`; const url = `https://etherpad.org/${char}foo`;
it(url, async function () { it(url, async function () {
this.timeout(5000);
await helper.edit(url); await helper.edit(url);
await helper.waitForPromise(() => txt().find('a').length === 1); await helper.waitForPromise(() => txt().find('a').length === 1);
const link = txt().find('a'); const link = txt().find('a');
@ -48,6 +50,7 @@ describe('urls', function () {
const want = 'https://etherpad.org'; const want = 'https://etherpad.org';
const input = want + char; const input = want + char;
it(input, async function () { it(input, async function () {
this.timeout(5000);
await helper.edit(input); await helper.edit(input);
await helper.waitForPromise(() => txt().find('a').length === 1); await helper.waitForPromise(() => txt().find('a').length === 1);
const link = txt().find('a'); const link = txt().find('a');

View file

@ -1,3 +1,5 @@
'use strict';
describe('Automatic pad reload on Force Reconnect message', function () { describe('Automatic pad reload on Force Reconnect message', function () {
let padId, $originalPadFrame; let padId, $originalPadFrame;
@ -59,9 +61,8 @@ describe('Automatic pad reload on Force Reconnect message', function () {
}); });
it('reloads the pad', function (done) { it('reloads the pad', function (done) {
helper.waitFor(() => padWasReloaded, 5000).done(done);
this.timeout(5000); this.timeout(5000);
helper.waitFor(() => padWasReloaded, 5000).done(done);
}); });
}); });
}); });