tests: Delete overly aggressive timeouts

See https://github.com/ether/etherpad-lite/issues/4988 for rationale.
This commit is contained in:
Richard Hansen 2021-08-30 02:02:35 -04:00
parent 67dfb64095
commit 348bc0c269
4 changed files with 0 additions and 91 deletions

View file

@ -39,7 +39,6 @@ describe(__filename, function () {
*/ */
describe('createPad', function () { describe('createPad', function () {
this.timeout(400);
it('creates a new Pad', function (done) { it('creates a new Pad', function (done) {
agent.get(`${endPoint('createPad')}&padID=${padID}`) agent.get(`${endPoint('createPad')}&padID=${padID}`)
.expect((res) => { .expect((res) => {
@ -51,7 +50,6 @@ describe(__filename, function () {
}); });
describe('createAuthor', function () { describe('createAuthor', function () {
this.timeout(100);
it('Creates an author with a name set', function (done) { it('Creates an author with a name set', function (done) {
agent.get(endPoint('createAuthor')) agent.get(endPoint('createAuthor'))
.expect((res) => { .expect((res) => {
@ -66,7 +64,6 @@ describe(__filename, function () {
}); });
describe('appendChatMessage', function () { describe('appendChatMessage', function () {
this.timeout(100);
it('Adds a chat message to the pad', function (done) { it('Adds a chat message to the pad', function (done) {
agent.get(`${endPoint('appendChatMessage')}&padID=${padID}&text=blalblalbha` + agent.get(`${endPoint('appendChatMessage')}&padID=${padID}&text=blalblalbha` +
`&authorID=${authorID}&time=${timestamp}`) `&authorID=${authorID}&time=${timestamp}`)
@ -80,7 +77,6 @@ describe(__filename, function () {
describe('getChatHead', function () { describe('getChatHead', function () {
this.timeout(100);
it('Gets the head of chat', function (done) { it('Gets the head of chat', function (done) {
agent.get(`${endPoint('getChatHead')}&padID=${padID}`) agent.get(`${endPoint('getChatHead')}&padID=${padID}`)
.expect((res) => { .expect((res) => {
@ -94,7 +90,6 @@ describe(__filename, function () {
}); });
describe('getChatHistory', function () { describe('getChatHistory', function () {
this.timeout(40);
it('Gets Chat History of a Pad', function (done) { it('Gets Chat History of a Pad', function (done) {
agent.get(`${endPoint('getChatHistory')}&padID=${padID}`) agent.get(`${endPoint('getChatHistory')}&padID=${padID}`)
.expect((res) => { .expect((res) => {

View file

@ -31,7 +31,6 @@ describe(__filename, function () {
describe('Connectivity', function () { describe('Connectivity', function () {
it('can connect', async function () { it('can connect', async function () {
this.timeout(250);
await agent.get('/api/') await agent.get('/api/')
.expect(200) .expect(200)
.expect('Content-Type', /json/); .expect('Content-Type', /json/);
@ -40,7 +39,6 @@ describe(__filename, function () {
describe('API Versioning', function () { describe('API Versioning', function () {
it('finds the version tag', async function () { it('finds the version tag', async function () {
this.timeout(250);
await agent.get('/api/') await agent.get('/api/')
.expect(200) .expect(200)
.expect((res) => assert(res.body.currentVersion)); .expect((res) => assert(res.body.currentVersion));
@ -96,7 +94,6 @@ describe(__filename, function () {
}); });
it('creates a new Pad, imports content to it, checks that content', async function () { it('creates a new Pad, imports content to it, checks that content', async function () {
this.timeout(500);
await agent.get(`${endPoint('createPad')}&padID=${testPadId}`) await agent.get(`${endPoint('createPad')}&padID=${testPadId}`)
.expect(200) .expect(200)
.expect('Content-Type', /json/) .expect('Content-Type', /json/)
@ -111,7 +108,6 @@ describe(__filename, function () {
for (const authn of [false, true]) { for (const authn of [false, true]) {
it(`can export from read-only pad ID, authn ${authn}`, async function () { it(`can export from read-only pad ID, authn ${authn}`, async function () {
this.timeout(250);
settings.requireAuthentication = authn; settings.requireAuthentication = authn;
const get = (ep) => { const get = (ep) => {
let req = agent.get(ep); let req = agent.get(ep);
@ -129,8 +125,6 @@ describe(__filename, function () {
} }
describe('Import/Export tests requiring AbiWord/LibreOffice', function () { describe('Import/Export tests requiring AbiWord/LibreOffice', function () {
this.timeout(10000);
before(async function () { before(async function () {
if ((!settings.abiword || settings.abiword.indexOf('/') === -1) && if ((!settings.abiword || settings.abiword.indexOf('/') === -1) &&
(!settings.soffice || settings.soffice.indexOf('/') === -1)) { (!settings.soffice || settings.soffice.indexOf('/') === -1)) {

View file

@ -51,7 +51,6 @@ describe(__filename, function () {
describe('Connectivity', function () { describe('Connectivity', function () {
it('can connect', function (done) { it('can connect', function (done) {
this.timeout(200);
agent.get('/api/') agent.get('/api/')
.expect('Content-Type', /json/) .expect('Content-Type', /json/)
.expect(200, done); .expect(200, done);
@ -60,7 +59,6 @@ describe(__filename, function () {
describe('API Versioning', function () { describe('API Versioning', function () {
it('finds the version tag', function (done) { it('finds the version tag', function (done) {
this.timeout(150);
agent.get('/api/') agent.get('/api/')
.expect((res) => { .expect((res) => {
apiVersion = res.body.currentVersion; apiVersion = res.body.currentVersion;
@ -73,7 +71,6 @@ describe(__filename, function () {
describe('Permission', function () { describe('Permission', function () {
it('errors with invalid APIKey', function (done) { it('errors with invalid APIKey', function (done) {
this.timeout(150);
// This is broken because Etherpad doesn't handle HTTP codes properly see #2343 // This is broken because Etherpad doesn't handle HTTP codes properly see #2343
// If your APIKey is password you deserve to fail all tests anyway // If your APIKey is password you deserve to fail all tests anyway
const permErrorURL = `/api/${apiVersion}/createPad?apikey=password&padID=test`; const permErrorURL = `/api/${apiVersion}/createPad?apikey=password&padID=test`;
@ -126,7 +123,6 @@ describe(__filename, function () {
describe('deletePad', function () { describe('deletePad', function () {
it('deletes a Pad', function (done) { it('deletes a Pad', function (done) {
this.timeout(150);
agent.get(`${endPoint('deletePad')}&padID=${testPadId}`) agent.get(`${endPoint('deletePad')}&padID=${testPadId}`)
.expect('Content-Type', /json/) .expect('Content-Type', /json/)
.expect(200, done); // @TODO: we shouldn't expect 200 here since the pad may not exist .expect(200, done); // @TODO: we shouldn't expect 200 here since the pad may not exist
@ -135,7 +131,6 @@ describe(__filename, function () {
describe('createPad', function () { describe('createPad', function () {
it('creates a new Pad', function (done) { it('creates a new Pad', function (done) {
this.timeout(150);
agent.get(`${endPoint('createPad')}&padID=${testPadId}`) agent.get(`${endPoint('createPad')}&padID=${testPadId}`)
.expect((res) => { .expect((res) => {
if (res.body.code !== 0) throw new Error('Unable to create new Pad'); if (res.body.code !== 0) throw new Error('Unable to create new Pad');
@ -147,7 +142,6 @@ describe(__filename, function () {
describe('getRevisionsCount', function () { describe('getRevisionsCount', function () {
it('gets revision count of Pad', function (done) { it('gets revision count of Pad', function (done) {
this.timeout(150);
agent.get(`${endPoint('getRevisionsCount')}&padID=${testPadId}`) agent.get(`${endPoint('getRevisionsCount')}&padID=${testPadId}`)
.expect((res) => { .expect((res) => {
if (res.body.code !== 0) throw new Error('Unable to get Revision Count'); if (res.body.code !== 0) throw new Error('Unable to get Revision Count');
@ -160,7 +154,6 @@ describe(__filename, function () {
describe('getSavedRevisionsCount', function () { describe('getSavedRevisionsCount', function () {
it('gets saved revisions count of Pad', function (done) { it('gets saved revisions count of Pad', function (done) {
this.timeout(150);
agent.get(`${endPoint('getSavedRevisionsCount')}&padID=${testPadId}`) agent.get(`${endPoint('getSavedRevisionsCount')}&padID=${testPadId}`)
.expect((res) => { .expect((res) => {
if (res.body.code !== 0) throw new Error('Unable to get Saved Revisions Count'); if (res.body.code !== 0) throw new Error('Unable to get Saved Revisions Count');
@ -175,7 +168,6 @@ describe(__filename, function () {
describe('listSavedRevisions', function () { describe('listSavedRevisions', function () {
it('gets saved revision list of Pad', function (done) { it('gets saved revision list of Pad', function (done) {
this.timeout(150);
agent.get(`${endPoint('listSavedRevisions')}&padID=${testPadId}`) agent.get(`${endPoint('listSavedRevisions')}&padID=${testPadId}`)
.expect((res) => { .expect((res) => {
if (res.body.code !== 0) throw new Error('Unable to get Saved Revisions List'); if (res.body.code !== 0) throw new Error('Unable to get Saved Revisions List');
@ -188,7 +180,6 @@ describe(__filename, function () {
describe('getHTML', function () { describe('getHTML', function () {
it('get the HTML of Pad', function (done) { it('get the HTML of Pad', function (done) {
this.timeout(150);
agent.get(`${endPoint('getHTML')}&padID=${testPadId}`) agent.get(`${endPoint('getHTML')}&padID=${testPadId}`)
.expect((res) => { .expect((res) => {
if (res.body.data.html.length <= 1) throw new Error('Unable to get the HTML'); if (res.body.data.html.length <= 1) throw new Error('Unable to get the HTML');
@ -200,7 +191,6 @@ describe(__filename, function () {
describe('listAllPads', function () { describe('listAllPads', function () {
it('list all pads', function (done) { it('list all pads', function (done) {
this.timeout(150);
agent.get(endPoint('listAllPads')) agent.get(endPoint('listAllPads'))
.expect((res) => { .expect((res) => {
if (res.body.data.padIDs.includes(testPadId) !== true) { if (res.body.data.padIDs.includes(testPadId) !== true) {
@ -214,7 +204,6 @@ describe(__filename, function () {
describe('deletePad', function () { describe('deletePad', function () {
it('deletes a Pad', function (done) { it('deletes a Pad', function (done) {
this.timeout(150);
agent.get(`${endPoint('deletePad')}&padID=${testPadId}`) agent.get(`${endPoint('deletePad')}&padID=${testPadId}`)
.expect((res) => { .expect((res) => {
if (res.body.code !== 0) throw new Error('Pad Deletion failed'); if (res.body.code !== 0) throw new Error('Pad Deletion failed');
@ -226,7 +215,6 @@ describe(__filename, function () {
describe('listAllPads', function () { describe('listAllPads', function () {
it('list all pads', function (done) { it('list all pads', function (done) {
this.timeout(150);
agent.get(endPoint('listAllPads')) agent.get(endPoint('listAllPads'))
.expect((res) => { .expect((res) => {
if (res.body.data.padIDs.includes(testPadId) !== false) { if (res.body.data.padIDs.includes(testPadId) !== false) {
@ -240,7 +228,6 @@ describe(__filename, function () {
describe('getHTML', function () { describe('getHTML', function () {
it('get the HTML of a Pad -- Should return a failure', function (done) { it('get the HTML of a Pad -- Should return a failure', function (done) {
this.timeout(150);
agent.get(`${endPoint('getHTML')}&padID=${testPadId}`) agent.get(`${endPoint('getHTML')}&padID=${testPadId}`)
.expect((res) => { .expect((res) => {
if (res.body.code !== 1) throw new Error('Pad deletion failed'); if (res.body.code !== 1) throw new Error('Pad deletion failed');
@ -252,7 +239,6 @@ describe(__filename, function () {
describe('createPad', function () { describe('createPad', function () {
it('creates a new Pad with text', function (done) { it('creates a new Pad with text', function (done) {
this.timeout(200);
agent.get(`${endPoint('createPad')}&padID=${testPadId}&text=testText`) agent.get(`${endPoint('createPad')}&padID=${testPadId}&text=testText`)
.expect((res) => { .expect((res) => {
if (res.body.code !== 0) throw new Error('Pad Creation failed'); if (res.body.code !== 0) throw new Error('Pad Creation failed');
@ -264,7 +250,6 @@ describe(__filename, function () {
describe('getText', function () { describe('getText', function () {
it('gets the Pad text and expect it to be testText with \n which is a line break', function (done) { it('gets the Pad text and expect it to be testText with \n which is a line break', function (done) {
this.timeout(150);
agent.get(`${endPoint('getText')}&padID=${testPadId}`) agent.get(`${endPoint('getText')}&padID=${testPadId}`)
.expect((res) => { .expect((res) => {
if (res.body.data.text !== 'testText\n') throw new Error('Pad Creation with text'); if (res.body.data.text !== 'testText\n') throw new Error('Pad Creation with text');
@ -276,7 +261,6 @@ describe(__filename, function () {
describe('setText', function () { describe('setText', function () {
it('creates a new Pad with text', function (done) { it('creates a new Pad with text', function (done) {
this.timeout(200);
agent.post(endPoint('setText')) agent.post(endPoint('setText'))
.send({ .send({
padID: testPadId, padID: testPadId,
@ -292,7 +276,6 @@ describe(__filename, function () {
describe('getText', function () { describe('getText', function () {
it('gets the Pad text', function (done) { it('gets the Pad text', function (done) {
this.timeout(150);
agent.get(`${endPoint('getText')}&padID=${testPadId}`) agent.get(`${endPoint('getText')}&padID=${testPadId}`)
.expect((res) => { .expect((res) => {
if (res.body.data.text !== 'testTextTwo\n') throw new Error('Setting Text'); if (res.body.data.text !== 'testTextTwo\n') throw new Error('Setting Text');
@ -304,7 +287,6 @@ describe(__filename, function () {
describe('getRevisionsCount', function () { describe('getRevisionsCount', function () {
it('gets Revision Count of a Pad', function (done) { it('gets Revision Count of a Pad', function (done) {
this.timeout(150);
agent.get(`${endPoint('getRevisionsCount')}&padID=${testPadId}`) agent.get(`${endPoint('getRevisionsCount')}&padID=${testPadId}`)
.expect((res) => { .expect((res) => {
if (res.body.data.revisions !== 1) throw new Error('Unable to get text revision count'); if (res.body.data.revisions !== 1) throw new Error('Unable to get text revision count');
@ -316,7 +298,6 @@ describe(__filename, function () {
describe('saveRevision', function () { describe('saveRevision', function () {
it('saves Revision', function (done) { it('saves Revision', function (done) {
this.timeout(150);
agent.get(`${endPoint('saveRevision')}&padID=${testPadId}`) agent.get(`${endPoint('saveRevision')}&padID=${testPadId}`)
.expect((res) => { .expect((res) => {
if (res.body.code !== 0) throw new Error('Unable to save Revision'); if (res.body.code !== 0) throw new Error('Unable to save Revision');
@ -328,7 +309,6 @@ describe(__filename, function () {
describe('getSavedRevisionsCount', function () { describe('getSavedRevisionsCount', function () {
it('gets saved revisions count of Pad', function (done) { it('gets saved revisions count of Pad', function (done) {
this.timeout(150);
agent.get(`${endPoint('getSavedRevisionsCount')}&padID=${testPadId}`) agent.get(`${endPoint('getSavedRevisionsCount')}&padID=${testPadId}`)
.expect((res) => { .expect((res) => {
if (res.body.code !== 0) throw new Error('Unable to get Saved Revisions Count'); if (res.body.code !== 0) throw new Error('Unable to get Saved Revisions Count');
@ -343,7 +323,6 @@ describe(__filename, function () {
describe('listSavedRevisions', function () { describe('listSavedRevisions', function () {
it('gets saved revision list of Pad', function (done) { it('gets saved revision list of Pad', function (done) {
this.timeout(150);
agent.get(`${endPoint('listSavedRevisions')}&padID=${testPadId}`) agent.get(`${endPoint('listSavedRevisions')}&padID=${testPadId}`)
.expect((res) => { .expect((res) => {
if (res.body.code !== 0) throw new Error('Unable to get Saved Revisions List'); if (res.body.code !== 0) throw new Error('Unable to get Saved Revisions List');
@ -355,7 +334,6 @@ describe(__filename, function () {
}); });
describe('padUsersCount', function () { describe('padUsersCount', function () {
it('gets User Count of a Pad', function (done) { it('gets User Count of a Pad', function (done) {
this.timeout(150);
agent.get(`${endPoint('padUsersCount')}&padID=${testPadId}`) agent.get(`${endPoint('padUsersCount')}&padID=${testPadId}`)
.expect((res) => { .expect((res) => {
if (res.body.data.padUsersCount !== 0) throw new Error('Incorrect Pad User count'); if (res.body.data.padUsersCount !== 0) throw new Error('Incorrect Pad User count');
@ -367,7 +345,6 @@ describe(__filename, function () {
describe('getReadOnlyID', function () { describe('getReadOnlyID', function () {
it('Gets the Read Only ID of a Pad', function (done) { it('Gets the Read Only ID of a Pad', function (done) {
this.timeout(150);
agent.get(`${endPoint('getReadOnlyID')}&padID=${testPadId}`) agent.get(`${endPoint('getReadOnlyID')}&padID=${testPadId}`)
.expect((res) => { .expect((res) => {
if (!res.body.data.readOnlyID) throw new Error('No Read Only ID for Pad'); if (!res.body.data.readOnlyID) throw new Error('No Read Only ID for Pad');
@ -379,7 +356,6 @@ describe(__filename, function () {
describe('listAuthorsOfPad', function () { describe('listAuthorsOfPad', function () {
it('Get Authors of the Pad', function (done) { it('Get Authors of the Pad', function (done) {
this.timeout(150);
agent.get(`${endPoint('listAuthorsOfPad')}&padID=${testPadId}`) agent.get(`${endPoint('listAuthorsOfPad')}&padID=${testPadId}`)
.expect((res) => { .expect((res) => {
if (res.body.data.authorIDs.length !== 0) { if (res.body.data.authorIDs.length !== 0) {
@ -393,7 +369,6 @@ describe(__filename, function () {
describe('getLastEdited', function () { describe('getLastEdited', function () {
it('Get When Pad was left Edited', function (done) { it('Get When Pad was left Edited', function (done) {
this.timeout(150);
agent.get(`${endPoint('getLastEdited')}&padID=${testPadId}`) agent.get(`${endPoint('getLastEdited')}&padID=${testPadId}`)
.expect((res) => { .expect((res) => {
if (!res.body.data.lastEdited) { if (!res.body.data.lastEdited) {
@ -409,7 +384,6 @@ describe(__filename, function () {
describe('setText', function () { describe('setText', function () {
it('creates a new Pad with text', function (done) { it('creates a new Pad with text', function (done) {
this.timeout(200);
agent.post(endPoint('setText')) agent.post(endPoint('setText'))
.send({ .send({
padID: testPadId, padID: testPadId,
@ -425,7 +399,6 @@ describe(__filename, function () {
describe('getLastEdited', function () { describe('getLastEdited', function () {
it('Get When Pad was left Edited', function (done) { it('Get When Pad was left Edited', function (done) {
this.timeout(150);
agent.get(`${endPoint('getLastEdited')}&padID=${testPadId}`) agent.get(`${endPoint('getLastEdited')}&padID=${testPadId}`)
.expect((res) => { .expect((res) => {
if (res.body.data.lastEdited <= lastEdited) { if (res.body.data.lastEdited <= lastEdited) {
@ -439,7 +412,6 @@ describe(__filename, function () {
describe('padUsers', function () { describe('padUsers', function () {
it('gets User Count of a Pad', function (done) { it('gets User Count of a Pad', function (done) {
this.timeout(150);
agent.get(`${endPoint('padUsers')}&padID=${testPadId}`) agent.get(`${endPoint('padUsers')}&padID=${testPadId}`)
.expect((res) => { .expect((res) => {
if (res.body.data.padUsers.length !== 0) throw new Error('Incorrect Pad Users'); if (res.body.data.padUsers.length !== 0) throw new Error('Incorrect Pad Users');
@ -451,7 +423,6 @@ describe(__filename, function () {
describe('deletePad', function () { describe('deletePad', function () {
it('deletes a Pad', function (done) { it('deletes a Pad', function (done) {
this.timeout(150);
agent.get(`${endPoint('deletePad')}&padID=${testPadId}`) agent.get(`${endPoint('deletePad')}&padID=${testPadId}`)
.expect((res) => { .expect((res) => {
if (res.body.code !== 0) throw new Error('Pad Deletion failed'); if (res.body.code !== 0) throw new Error('Pad Deletion failed');
@ -466,7 +437,6 @@ describe(__filename, function () {
describe('createPad', function () { describe('createPad', function () {
it('creates a new Pad with text', function (done) { it('creates a new Pad with text', function (done) {
this.timeout(200);
agent.get(`${endPoint('createPad')}&padID=${testPadId}`) agent.get(`${endPoint('createPad')}&padID=${testPadId}`)
.expect((res) => { .expect((res) => {
if (res.body.code !== 0) throw new Error('Pad Creation failed'); if (res.body.code !== 0) throw new Error('Pad Creation failed');
@ -478,7 +448,6 @@ describe(__filename, function () {
describe('setText', function () { describe('setText', function () {
it('Sets text on a pad Id', function (done) { it('Sets text on a pad Id', function (done) {
this.timeout(150);
agent.post(`${endPoint('setText')}&padID=${testPadId}`) agent.post(`${endPoint('setText')}&padID=${testPadId}`)
.field({text}) .field({text})
.expect((res) => { .expect((res) => {
@ -491,7 +460,6 @@ describe(__filename, function () {
describe('getText', function () { describe('getText', function () {
it('Gets text on a pad Id', function (done) { it('Gets text on a pad Id', function (done) {
this.timeout(200);
agent.get(`${endPoint('getText')}&padID=${testPadId}`) agent.get(`${endPoint('getText')}&padID=${testPadId}`)
.expect((res) => { .expect((res) => {
if (res.body.code !== 0) throw new Error('Pad Get Text failed'); if (res.body.code !== 0) throw new Error('Pad Get Text failed');
@ -504,7 +472,6 @@ describe(__filename, function () {
describe('setText', function () { describe('setText', function () {
it('Sets text on a pad Id including an explicit newline', function (done) { it('Sets text on a pad Id including an explicit newline', function (done) {
this.timeout(200);
agent.post(`${endPoint('setText')}&padID=${testPadId}`) agent.post(`${endPoint('setText')}&padID=${testPadId}`)
.field({text: `${text}\n`}) .field({text: `${text}\n`})
.expect((res) => { .expect((res) => {
@ -517,7 +484,6 @@ describe(__filename, function () {
describe('getText', function () { describe('getText', function () {
it("Gets text on a pad Id and doesn't have an excess newline", function (done) { it("Gets text on a pad Id and doesn't have an excess newline", function (done) {
this.timeout(150);
agent.get(`${endPoint('getText')}&padID=${testPadId}`) agent.get(`${endPoint('getText')}&padID=${testPadId}`)
.expect((res) => { .expect((res) => {
if (res.body.code !== 0) throw new Error('Pad Get Text failed'); if (res.body.code !== 0) throw new Error('Pad Get Text failed');
@ -530,7 +496,6 @@ describe(__filename, function () {
describe('getLastEdited', function () { describe('getLastEdited', function () {
it('Gets when pad was last edited', function (done) { it('Gets when pad was last edited', function (done) {
this.timeout(150);
agent.get(`${endPoint('getLastEdited')}&padID=${testPadId}`) agent.get(`${endPoint('getLastEdited')}&padID=${testPadId}`)
.expect((res) => { .expect((res) => {
if (res.body.lastEdited === 0) throw new Error('Get Last Edited Failed'); if (res.body.lastEdited === 0) throw new Error('Get Last Edited Failed');
@ -542,7 +507,6 @@ describe(__filename, function () {
describe('movePad', function () { describe('movePad', function () {
it('Move a Pad to a different Pad ID', function (done) { it('Move a Pad to a different Pad ID', function (done) {
this.timeout(200);
agent.get(`${endPoint('movePad')}&sourceID=${testPadId}&destinationID=${newPadId}&force=true`) agent.get(`${endPoint('movePad')}&sourceID=${testPadId}&destinationID=${newPadId}&force=true`)
.expect((res) => { .expect((res) => {
if (res.body.code !== 0) throw new Error('Moving Pad Failed'); if (res.body.code !== 0) throw new Error('Moving Pad Failed');
@ -554,7 +518,6 @@ describe(__filename, function () {
describe('getText', function () { describe('getText', function () {
it('Gets text on a pad Id', function (done) { it('Gets text on a pad Id', function (done) {
this.timeout(150);
agent.get(`${endPoint('getText')}&padID=${newPadId}`) agent.get(`${endPoint('getText')}&padID=${newPadId}`)
.expect((res) => { .expect((res) => {
if (res.body.data.text !== `${text}\n`) throw new Error('Pad Get Text failed'); if (res.body.data.text !== `${text}\n`) throw new Error('Pad Get Text failed');
@ -566,7 +529,6 @@ describe(__filename, function () {
describe('movePad', function () { describe('movePad', function () {
it('Move a Pad to a different Pad ID', function (done) { it('Move a Pad to a different Pad ID', function (done) {
this.timeout(200);
agent.get(`${endPoint('movePad')}&sourceID=${newPadId}&destinationID=${testPadId}` + agent.get(`${endPoint('movePad')}&sourceID=${newPadId}&destinationID=${testPadId}` +
'&force=false') '&force=false')
.expect((res) => { .expect((res) => {
@ -579,7 +541,6 @@ describe(__filename, function () {
describe('getText', function () { describe('getText', function () {
it('Gets text on a pad Id', function (done) { it('Gets text on a pad Id', function (done) {
this.timeout(150);
agent.get(`${endPoint('getText')}&padID=${testPadId}`) agent.get(`${endPoint('getText')}&padID=${testPadId}`)
.expect((res) => { .expect((res) => {
if (res.body.data.text !== `${text}\n`) throw new Error('Pad Get Text failed'); if (res.body.data.text !== `${text}\n`) throw new Error('Pad Get Text failed');
@ -591,7 +552,6 @@ describe(__filename, function () {
describe('getLastEdited', function () { describe('getLastEdited', function () {
it('Gets when pad was last edited', function (done) { it('Gets when pad was last edited', function (done) {
this.timeout(150);
agent.get(`${endPoint('getLastEdited')}&padID=${testPadId}`) agent.get(`${endPoint('getLastEdited')}&padID=${testPadId}`)
.expect((res) => { .expect((res) => {
if (res.body.lastEdited === 0) throw new Error('Get Last Edited Failed'); if (res.body.lastEdited === 0) throw new Error('Get Last Edited Failed');
@ -603,7 +563,6 @@ describe(__filename, function () {
describe('appendText', function () { describe('appendText', function () {
it('Append text to a pad Id', function (done) { it('Append text to a pad Id', function (done) {
this.timeout(150);
agent.get(`${endPoint('appendText', '1.2.13')}&padID=${testPadId}&text=hello`) agent.get(`${endPoint('appendText', '1.2.13')}&padID=${testPadId}&text=hello`)
.expect((res) => { .expect((res) => {
if (res.body.code !== 0) throw new Error('Pad Append Text failed'); if (res.body.code !== 0) throw new Error('Pad Append Text failed');
@ -615,7 +574,6 @@ describe(__filename, function () {
describe('getText', function () { describe('getText', function () {
it('Gets text on a pad Id', function (done) { it('Gets text on a pad Id', function (done) {
this.timeout(150);
agent.get(`${endPoint('getText')}&padID=${testPadId}`) agent.get(`${endPoint('getText')}&padID=${testPadId}`)
.expect((res) => { .expect((res) => {
if (res.body.code !== 0) throw new Error('Pad Get Text failed'); if (res.body.code !== 0) throw new Error('Pad Get Text failed');
@ -631,7 +589,6 @@ describe(__filename, function () {
describe('setHTML', function () { describe('setHTML', function () {
it('Sets the HTML of a Pad attempting to pass ugly HTML', function (done) { it('Sets the HTML of a Pad attempting to pass ugly HTML', function (done) {
this.timeout(200);
const html = '<div><b>Hello HTML</title></head></div>'; const html = '<div><b>Hello HTML</title></head></div>';
agent.post(endPoint('setHTML')) agent.post(endPoint('setHTML'))
.send({ .send({
@ -650,7 +607,6 @@ describe(__filename, function () {
describe('setHTML', function () { describe('setHTML', function () {
it('Sets the HTML of a Pad with complex nested lists of different types', function (done) { it('Sets the HTML of a Pad with complex nested lists of different types', function (done) {
this.timeout(200);
agent.post(endPoint('setHTML')) agent.post(endPoint('setHTML'))
.send({ .send({
padID: testPadId, padID: testPadId,
@ -666,7 +622,6 @@ describe(__filename, function () {
describe('getHTML', function () { describe('getHTML', function () {
it('Gets back the HTML of a Pad with complex nested lists of different types', function (done) { it('Gets back the HTML of a Pad with complex nested lists of different types', function (done) {
this.timeout(150);
agent.get(`${endPoint('getHTML')}&padID=${testPadId}`) agent.get(`${endPoint('getHTML')}&padID=${testPadId}`)
.expect((res) => { .expect((res) => {
const receivedHtml = res.body.data.html.replace('<br></body>', '</body>').toLowerCase(); const receivedHtml = res.body.data.html.replace('<br></body>', '</body>').toLowerCase();
@ -690,7 +645,6 @@ describe(__filename, function () {
describe('setHTML', function () { describe('setHTML', function () {
it('Sets the HTML of a Pad with white space between list items', function (done) { it('Sets the HTML of a Pad with white space between list items', function (done) {
this.timeout(200);
agent.get(`${endPoint('setHTML')}&padID=${testPadId}&html=${ulSpaceHtml}`) agent.get(`${endPoint('setHTML')}&padID=${testPadId}&html=${ulSpaceHtml}`)
.expect((res) => { .expect((res) => {
if (res.body.code !== 0) throw new Error('List HTML cant be imported'); if (res.body.code !== 0) throw new Error('List HTML cant be imported');
@ -702,7 +656,6 @@ describe(__filename, function () {
describe('getHTML', function () { describe('getHTML', function () {
it('Gets back the HTML of a Pad with complex nested lists of different types', function (done) { it('Gets back the HTML of a Pad with complex nested lists of different types', function (done) {
this.timeout(150);
agent.get(`${endPoint('getHTML')}&padID=${testPadId}`) agent.get(`${endPoint('getHTML')}&padID=${testPadId}`)
.expect((res) => { .expect((res) => {
const receivedHtml = res.body.data.html.replace('<br></body>', '</body>').toLowerCase(); const receivedHtml = res.body.data.html.replace('<br></body>', '</body>').toLowerCase();
@ -725,7 +678,6 @@ describe(__filename, function () {
describe('createPad', function () { describe('createPad', function () {
it('errors if pad can be created', function (done) { it('errors if pad can be created', function (done) {
this.timeout(150);
const badUrlChars = ['/', '%23', '%3F', '%26']; const badUrlChars = ['/', '%23', '%3F', '%26'];
async.map( async.map(
badUrlChars, badUrlChars,
@ -743,7 +695,6 @@ describe(__filename, function () {
describe('copyPad', function () { describe('copyPad', function () {
it('copies the content of a existent pad', function (done) { it('copies the content of a existent pad', function (done) {
this.timeout(200);
agent.get(`${endPoint('copyPad')}&sourceID=${testPadId}&destinationID=${copiedPadId}` + agent.get(`${endPoint('copyPad')}&sourceID=${testPadId}&destinationID=${copiedPadId}` +
'&force=true') '&force=true')
.expect((res) => { .expect((res) => {
@ -767,7 +718,6 @@ describe(__filename, function () {
}); });
it('returns a successful response', function (done) { it('returns a successful response', function (done) {
this.timeout(200);
agent.get(`${endPoint('copyPadWithoutHistory')}&sourceID=${sourcePadId}` + agent.get(`${endPoint('copyPadWithoutHistory')}&sourceID=${sourcePadId}` +
`&destinationID=${newPad}&force=false`) `&destinationID=${newPad}&force=false`)
.expect((res) => { .expect((res) => {
@ -779,7 +729,6 @@ describe(__filename, function () {
// this test validates if the source pad's text and attributes are kept // this test validates if the source pad's text and attributes are kept
it('creates a new pad with the same content as the source pad', function (done) { it('creates a new pad with the same content as the source pad', function (done) {
this.timeout(200);
agent.get(`${endPoint('copyPadWithoutHistory')}&sourceID=${sourcePadId}` + agent.get(`${endPoint('copyPadWithoutHistory')}&sourceID=${sourcePadId}` +
`&destinationID=${newPad}&force=false`) `&destinationID=${newPad}&force=false`)
.expect((res) => { .expect((res) => {
@ -811,7 +760,6 @@ describe(__filename, function () {
const padId = makeid(); const padId = makeid();
const padWithNonExistentGroup = `notExistentGroup$${padId}`; const padWithNonExistentGroup = `notExistentGroup$${padId}`;
it('throws an error', function (done) { it('throws an error', function (done) {
this.timeout(150);
agent.get(`${endPoint('copyPadWithoutHistory')}&sourceID=${sourcePadId}&` + agent.get(`${endPoint('copyPadWithoutHistory')}&sourceID=${sourcePadId}&` +
`destinationID=${padWithNonExistentGroup}&force=true`) `destinationID=${padWithNonExistentGroup}&force=true`)
.expect((res) => { .expect((res) => {
@ -831,7 +779,6 @@ describe(__filename, function () {
context('and force is false', function () { context('and force is false', function () {
it('throws an error', function (done) { it('throws an error', function (done) {
this.timeout(150);
agent.get(`${endPoint('copyPadWithoutHistory')}&sourceID=${sourcePadId}` + agent.get(`${endPoint('copyPadWithoutHistory')}&sourceID=${sourcePadId}` +
`&destinationID=${padIdExistent}&force=false`) `&destinationID=${padIdExistent}&force=false`)
.expect((res) => { .expect((res) => {
@ -844,7 +791,6 @@ describe(__filename, function () {
context('and force is true', function () { context('and force is true', function () {
it('returns a successful response', function (done) { it('returns a successful response', function (done) {
this.timeout(200);
agent.get(`${endPoint('copyPadWithoutHistory')}&sourceID=${sourcePadId}` + agent.get(`${endPoint('copyPadWithoutHistory')}&sourceID=${sourcePadId}` +
`&destinationID=${padIdExistent}&force=true`) `&destinationID=${padIdExistent}&force=true`)
.expect((res) => { .expect((res) => {

View file

@ -142,27 +142,23 @@ describe(__filename, function () {
describe('Normal accesses', function () { describe('Normal accesses', function () {
it('!authn anonymous cookie /p/pad -> 200, ok', async function () { it('!authn anonymous cookie /p/pad -> 200, ok', async function () {
this.timeout(600);
const res = await agent.get('/p/pad').expect(200); const res = await agent.get('/p/pad').expect(200);
socket = await connect(res); socket = await connect(res);
const clientVars = await handshake(socket, 'pad'); const clientVars = await handshake(socket, 'pad');
assert.equal(clientVars.type, 'CLIENT_VARS'); assert.equal(clientVars.type, 'CLIENT_VARS');
}); });
it('!authn !cookie -> ok', async function () { it('!authn !cookie -> ok', async function () {
this.timeout(400);
socket = await connect(null); socket = await connect(null);
const clientVars = await handshake(socket, 'pad'); const clientVars = await handshake(socket, 'pad');
assert.equal(clientVars.type, 'CLIENT_VARS'); assert.equal(clientVars.type, 'CLIENT_VARS');
}); });
it('!authn user /p/pad -> 200, ok', async function () { it('!authn user /p/pad -> 200, ok', async function () {
this.timeout(400);
const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200); const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200);
socket = await connect(res); socket = await connect(res);
const clientVars = await handshake(socket, 'pad'); const clientVars = await handshake(socket, 'pad');
assert.equal(clientVars.type, 'CLIENT_VARS'); assert.equal(clientVars.type, 'CLIENT_VARS');
}); });
it('authn user /p/pad -> 200, ok', async function () { it('authn user /p/pad -> 200, ok', async function () {
this.timeout(400);
settings.requireAuthentication = true; settings.requireAuthentication = true;
const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200); const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200);
socket = await connect(res); socket = await connect(res);
@ -173,7 +169,6 @@ describe(__filename, function () {
for (const authn of [false, true]) { for (const authn of [false, true]) {
const desc = authn ? 'authn user' : '!authn anonymous'; const desc = authn ? 'authn user' : '!authn anonymous';
it(`${desc} read-only /p/pad -> 200, ok`, async function () { it(`${desc} read-only /p/pad -> 200, ok`, async function () {
this.timeout(400);
const get = (ep) => { const get = (ep) => {
let res = agent.get(ep); let res = agent.get(ep);
if (authn) res = res.auth('user', 'user-password'); if (authn) res = res.auth('user', 'user-password');
@ -197,7 +192,6 @@ describe(__filename, function () {
} }
it('authz user /p/pad -> 200, ok', async function () { it('authz user /p/pad -> 200, ok', async function () {
this.timeout(400);
settings.requireAuthentication = true; settings.requireAuthentication = true;
settings.requireAuthorization = true; settings.requireAuthorization = true;
const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200); const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200);
@ -206,7 +200,6 @@ describe(__filename, function () {
assert.equal(clientVars.type, 'CLIENT_VARS'); assert.equal(clientVars.type, 'CLIENT_VARS');
}); });
it('supports pad names with characters that must be percent-encoded', async function () { it('supports pad names with characters that must be percent-encoded', async function () {
this.timeout(400);
settings.requireAuthentication = true; settings.requireAuthentication = true;
// requireAuthorization is set to true here to guarantee that the user's padAuthorizations // requireAuthorization is set to true here to guarantee that the user's padAuthorizations
// object is populated. Technically this isn't necessary because the user's padAuthorizations // object is populated. Technically this isn't necessary because the user's padAuthorizations
@ -223,7 +216,6 @@ describe(__filename, function () {
describe('Abnormal access attempts', function () { describe('Abnormal access attempts', function () {
it('authn anonymous /p/pad -> 401, error', async function () { it('authn anonymous /p/pad -> 401, error', async function () {
this.timeout(400);
settings.requireAuthentication = true; settings.requireAuthentication = true;
const res = await agent.get('/p/pad').expect(401); const res = await agent.get('/p/pad').expect(401);
// Despite the 401, try to create the pad via a socket.io connection anyway. // Despite the 401, try to create the pad via a socket.io connection anyway.
@ -233,7 +225,6 @@ describe(__filename, function () {
}); });
it('authn anonymous read-only /p/pad -> 401, error', async function () { it('authn anonymous read-only /p/pad -> 401, error', async function () {
this.timeout(400);
settings.requireAuthentication = true; settings.requireAuthentication = true;
let res = await agent.get('/p/pad').auth('user', 'user-password').expect(200); let res = await agent.get('/p/pad').auth('user', 'user-password').expect(200);
socket = await connect(res); socket = await connect(res);
@ -250,14 +241,12 @@ describe(__filename, function () {
}); });
it('authn !cookie -> error', async function () { it('authn !cookie -> error', async function () {
this.timeout(400);
settings.requireAuthentication = true; settings.requireAuthentication = true;
socket = await connect(null); socket = await connect(null);
const message = await handshake(socket, 'pad'); const message = await handshake(socket, 'pad');
assert.equal(message.accessStatus, 'deny'); assert.equal(message.accessStatus, 'deny');
}); });
it('authorization bypass attempt -> error', async function () { it('authorization bypass attempt -> error', async function () {
this.timeout(400);
// Only allowed to access /p/pad. // Only allowed to access /p/pad.
authorize = (req) => req.path === '/p/pad'; authorize = (req) => req.path === '/p/pad';
settings.requireAuthentication = true; settings.requireAuthentication = true;
@ -278,7 +267,6 @@ describe(__filename, function () {
}); });
it("level='create' -> can create", async function () { it("level='create' -> can create", async function () {
this.timeout(400);
authorize = () => 'create'; authorize = () => 'create';
const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200); const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200);
socket = await connect(res); socket = await connect(res);
@ -287,7 +275,6 @@ describe(__filename, function () {
assert.equal(clientVars.data.readonly, false); assert.equal(clientVars.data.readonly, false);
}); });
it('level=true -> can create', async function () { it('level=true -> can create', async function () {
this.timeout(400);
authorize = () => true; authorize = () => true;
const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200); const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200);
socket = await connect(res); socket = await connect(res);
@ -296,7 +283,6 @@ describe(__filename, function () {
assert.equal(clientVars.data.readonly, false); assert.equal(clientVars.data.readonly, false);
}); });
it("level='modify' -> can modify", async function () { it("level='modify' -> can modify", async function () {
this.timeout(400);
await padManager.getPad('pad'); // Create the pad. await padManager.getPad('pad'); // Create the pad.
authorize = () => 'modify'; authorize = () => 'modify';
const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200); const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200);
@ -306,7 +292,6 @@ describe(__filename, function () {
assert.equal(clientVars.data.readonly, false); assert.equal(clientVars.data.readonly, false);
}); });
it("level='create' settings.editOnly=true -> unable to create", async function () { it("level='create' settings.editOnly=true -> unable to create", async function () {
this.timeout(400);
authorize = () => 'create'; authorize = () => 'create';
settings.editOnly = true; settings.editOnly = true;
const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200); const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200);
@ -315,7 +300,6 @@ describe(__filename, function () {
assert.equal(message.accessStatus, 'deny'); assert.equal(message.accessStatus, 'deny');
}); });
it("level='modify' settings.editOnly=false -> unable to create", async function () { it("level='modify' settings.editOnly=false -> unable to create", async function () {
this.timeout(400);
authorize = () => 'modify'; authorize = () => 'modify';
settings.editOnly = false; settings.editOnly = false;
const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200); const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200);
@ -324,7 +308,6 @@ describe(__filename, function () {
assert.equal(message.accessStatus, 'deny'); assert.equal(message.accessStatus, 'deny');
}); });
it("level='readOnly' -> unable to create", async function () { it("level='readOnly' -> unable to create", async function () {
this.timeout(400);
authorize = () => 'readOnly'; authorize = () => 'readOnly';
const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200); const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200);
socket = await connect(res); socket = await connect(res);
@ -332,7 +315,6 @@ describe(__filename, function () {
assert.equal(message.accessStatus, 'deny'); assert.equal(message.accessStatus, 'deny');
}); });
it("level='readOnly' -> unable to modify", async function () { it("level='readOnly' -> unable to modify", async function () {
this.timeout(400);
await padManager.getPad('pad'); // Create the pad. await padManager.getPad('pad'); // Create the pad.
authorize = () => 'readOnly'; authorize = () => 'readOnly';
const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200); const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200);
@ -349,7 +331,6 @@ describe(__filename, function () {
}); });
it('user.canCreate = true -> can create and modify', async function () { it('user.canCreate = true -> can create and modify', async function () {
this.timeout(400);
settings.users.user.canCreate = true; settings.users.user.canCreate = true;
const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200); const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200);
socket = await connect(res); socket = await connect(res);
@ -358,7 +339,6 @@ describe(__filename, function () {
assert.equal(clientVars.data.readonly, false); assert.equal(clientVars.data.readonly, false);
}); });
it('user.canCreate = false -> unable to create', async function () { it('user.canCreate = false -> unable to create', async function () {
this.timeout(400);
settings.users.user.canCreate = false; settings.users.user.canCreate = false;
const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200); const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200);
socket = await connect(res); socket = await connect(res);
@ -366,7 +346,6 @@ describe(__filename, function () {
assert.equal(message.accessStatus, 'deny'); assert.equal(message.accessStatus, 'deny');
}); });
it('user.readOnly = true -> unable to create', async function () { it('user.readOnly = true -> unable to create', async function () {
this.timeout(400);
settings.users.user.readOnly = true; settings.users.user.readOnly = true;
const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200); const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200);
socket = await connect(res); socket = await connect(res);
@ -374,7 +353,6 @@ describe(__filename, function () {
assert.equal(message.accessStatus, 'deny'); assert.equal(message.accessStatus, 'deny');
}); });
it('user.readOnly = true -> unable to modify', async function () { it('user.readOnly = true -> unable to modify', async function () {
this.timeout(400);
await padManager.getPad('pad'); // Create the pad. await padManager.getPad('pad'); // Create the pad.
settings.users.user.readOnly = true; settings.users.user.readOnly = true;
const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200); const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200);
@ -384,7 +362,6 @@ describe(__filename, function () {
assert.equal(clientVars.data.readonly, true); assert.equal(clientVars.data.readonly, true);
}); });
it('user.readOnly = false -> can create and modify', async function () { it('user.readOnly = false -> can create and modify', async function () {
this.timeout(400);
settings.users.user.readOnly = false; settings.users.user.readOnly = false;
const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200); const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200);
socket = await connect(res); socket = await connect(res);
@ -393,7 +370,6 @@ describe(__filename, function () {
assert.equal(clientVars.data.readonly, false); assert.equal(clientVars.data.readonly, false);
}); });
it('user.readOnly = true, user.canCreate = true -> unable to create', async function () { it('user.readOnly = true, user.canCreate = true -> unable to create', async function () {
this.timeout(400);
settings.users.user.canCreate = true; settings.users.user.canCreate = true;
settings.users.user.readOnly = true; settings.users.user.readOnly = true;
const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200); const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200);
@ -410,7 +386,6 @@ describe(__filename, function () {
}); });
it('authorize hook does not elevate level from user settings', async function () { it('authorize hook does not elevate level from user settings', async function () {
this.timeout(400);
settings.users.user.readOnly = true; settings.users.user.readOnly = true;
authorize = () => 'create'; authorize = () => 'create';
const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200); const res = await agent.get('/p/pad').auth('user', 'user-password').expect(200);
@ -419,7 +394,6 @@ describe(__filename, function () {
assert.equal(message.accessStatus, 'deny'); assert.equal(message.accessStatus, 'deny');
}); });
it('user settings does not elevate level from authorize hook', async function () { it('user settings does not elevate level from authorize hook', async function () {
this.timeout(400);
settings.users.user.readOnly = false; settings.users.user.readOnly = false;
settings.users.user.canCreate = true; settings.users.user.canCreate = true;
authorize = () => 'readOnly'; authorize = () => 'readOnly';