From 8e249d4abf93e98e46424720e03d46e373784745 Mon Sep 17 00:00:00 2001 From: smizrahi Date: Thu, 26 Sep 2024 17:15:27 +0200 Subject: [PATCH] fix(tests): Add timeout on all async tests --- Tests/spec/CalDAVPreventInvitationsSpec.js | 6 +++--- Tests/spec/CalDAVPropertiesSpec.js | 8 ++++---- Tests/spec/CalDAVSchedulingSpec.js | 20 ++++++++++---------- Tests/spec/CardDAVSpec.js | 8 ++++---- Tests/spec/ConfigSpec.js | 2 +- Tests/spec/DAVAddressBookAclSpec.js | 16 ++++++++-------- Tests/spec/DAVCalendarAclSpec.js | 14 +++++++------- Tests/spec/DAVCalendarAppleiCalSpec.js | 6 +++--- Tests/spec/DAVCalendarClassificationSpec.js | 4 ++-- Tests/spec/DAVCalendarPublicAclSpec.js | 4 ++-- Tests/spec/DAVCalendarSuperUserAclSpec.js | 2 +- Tests/spec/DAVContactsCategoriesSpec.js | 2 +- Tests/spec/DAVPublicAccessSpec.js | 8 ++++---- Tests/spec/HTTPCalendarSpec.js | 2 +- Tests/spec/HTTPPreferencesSpec.js | 8 ++++---- 15 files changed, 55 insertions(+), 55 deletions(-) diff --git a/Tests/spec/CalDAVPreventInvitationsSpec.js b/Tests/spec/CalDAVPreventInvitationsSpec.js index e77d593c1..465a9c04c 100644 --- a/Tests/spec/CalDAVPreventInvitationsSpec.js +++ b/Tests/spec/CalDAVPreventInvitationsSpec.js @@ -132,7 +132,7 @@ describe('PreventInvitations', function() { .toBe(0) await _addAttendee() await _verifyEvent() - }) + }, config.timeout || 10000) it(`Enable, refuse the invitation`, async function() { // Second, enable PreventInviation and refuse it @@ -144,7 +144,7 @@ describe('PreventInvitations', function() { .toBe(1) await _addAttendee(409) await _verifyEvent(404) - }) + }, config.timeout || 10000) it(`Enable, update whitelist, accept the invitation`, async function() { // First, add the Organiser to the Attendee's whitelist @@ -161,5 +161,5 @@ describe('PreventInvitations', function() { // Second, try again to invite, it should work await _addAttendee() await _verifyEvent() - }) + }, config.timeout || 10000) }) \ No newline at end of file diff --git a/Tests/spec/CalDAVPropertiesSpec.js b/Tests/spec/CalDAVPropertiesSpec.js index 0c9ddb000..498e0234f 100644 --- a/Tests/spec/CalDAVPropertiesSpec.js +++ b/Tests/spec/CalDAVPropertiesSpec.js @@ -20,7 +20,7 @@ describe('read and set calendar properties', function() { expect(response[0].status) .withContext(`HTTP status code of MKCALENDAR`) .toEqual(405) - }) + }, config.timeout || 10000) // CalDAVPropertiesTest @@ -36,7 +36,7 @@ describe('read and set calendar properties', function() { expect(Object.keys(prop.scheduleCalendarTransp).includes('opaque')) .withContext('schedule-calendar-transp is "opaque" on new') .toBeTrue() - }) + }, config.timeout || 10000) it("proppatch", async function() { let newValueNode @@ -65,7 +65,7 @@ describe('read and set calendar properties', function() { expect(results[0].status) .withContext(`Setting transparency to ${newValueNode} is successful`) .toBe(207) - }) + }, config.timeout || 10000) it("calendar-query", async function() { const filename = `new.ics` @@ -125,5 +125,5 @@ END:VCALENDAR` expect(utility.componentsAreEqual(response[0].props.calendarData, event)) .withContext(`Returned vCalendar matches ${filename}`) .toBe(true) - }) + }, config.timeout || 10000) }) \ No newline at end of file diff --git a/Tests/spec/CalDAVSchedulingSpec.js b/Tests/spec/CalDAVSchedulingSpec.js index 7c724d795..808293f13 100644 --- a/Tests/spec/CalDAVSchedulingSpec.js +++ b/Tests/spec/CalDAVSchedulingSpec.js @@ -163,7 +163,7 @@ describe('CalDAV Scheduling', function() { expect(veventAttendee.getFirstProperty('uid').getFirstValue()) .withContext(`UID in organizer's calendar and attendees's calendar are identical`) .toBe(vevent.getFirstProperty('uid').getFirstValue()) - }) + }, config.timeout || 10000) it('Remove attendee after event creation', async function() { const icsName = 'test-remove-attendee.ics' @@ -213,7 +213,7 @@ describe('CalDAV Scheduling', function() { // 6. verify that the attendee doesn't have the event anymore await _getEvent(webdavAttendee1, attendee1Calendar, icsName, 404) - }) + }, config.timeout || 10000) it('try to overbook a resource', async function() { const icsName = 'test-no-overbook.ics' @@ -260,7 +260,7 @@ describe('CalDAV Scheduling', function() { // put the event - should trigger a 409 await _putEvent(webdav, userCalendar, obIcsName, vcalendar, 409) - }) + }, config.timeout || 10000) it('try to overbook a resource - multiplebookings=0', async function() { const icsName = 'test-can-overbook.ics' @@ -307,7 +307,7 @@ describe('CalDAV Scheduling', function() { // put the event - should be fine since we can overbook this one await _putEvent(webdav, userCalendar, obIcsName, vcalendar) - }) + }, config.timeout || 10000) it('Resource booking overlap detection - bug #1837', async function() { // There used to be some problems with recurring events and resources booking @@ -408,7 +408,7 @@ describe('CalDAV Scheduling', function() { vevent.addProperty(utility.createDateTimeProperty('dtend', nenddate)) vevent.updatePropertyWithValue('uid', 'recurring - nooverlap') await _putEvent(webdav, userCalendar, overlapRecurringIcsName, vcalendarNoOverlap, 409) - }) + }, config.timeout || 10000) it('RRULE exception invitation dance', async function() { // This workflow is based on what lightning 1.2.1 does @@ -541,7 +541,7 @@ describe('CalDAV Scheduling', function() { vcalendarOrganizer.removeSubcomponent(veventException) await _putEvent(webdav, userCalendar, icsName, vcalendarOrganizer, 204) await _getEvent(webdavAttendee1, attendee1Calendar, icsName, 404) - }) + }, config.timeout || 10000) it ('RRULE invitation delete exdate dance', async function() { // Workflow: @@ -658,7 +658,7 @@ describe('CalDAV Scheduling', function() { expect(attendee.getParameter('partstat')) .withContext('Partstat of attendee is declined for the exception') .toBe('DECLINED') - }) + }, config.timeout || 10000) it('iCal organizer is attendee - bug #1839', async function() { const icsName = 'test-organizer-is-attendee.ics' @@ -709,7 +709,7 @@ describe('CalDAV Scheduling', function() { .withContext(`Organizer is not an attendee`) .not.toBe(user.email) } - }) + }, config.timeout || 10000) it('PUT 2 events with the same UID - bug #1853', async function () { const icsName = 'test-same-uid.ics' @@ -731,7 +731,7 @@ describe('CalDAV Scheduling', function() { // PUT the same event with a new filename - should trigger a 409 await _putEvent(webdav, userCalendar, conflictIcsName, vcalendar, 409) - }) + }, config.timeout || 10000) it('invitation delegation', async function () { const icsName = 'test-delegation.ics' @@ -933,5 +933,5 @@ describe('CalDAV Scheduling', function() { vcalendarInvitationAttendee = await _getEvent(webdavAttendee1, attendee1Calendar, icsName, 404) vcalendarInvitationDelegate = await _getEvent(webdavAttendee1Delegate, attendee1DelegateCalendar, icsName, 404) - }, 10000) // increase timeout for this long test + }, config.timeout || 10000) // increase timeout for this long test }) \ No newline at end of file diff --git a/Tests/spec/CardDAVSpec.js b/Tests/spec/CardDAVSpec.js index 23cf91329..2610f0dd2 100644 --- a/Tests/spec/CardDAVSpec.js +++ b/Tests/spec/CardDAVSpec.js @@ -102,7 +102,7 @@ describe('CardDAV extensions', function() { expect(response[0].status) .withContext(`HTTP status code of MKCOL`) .toEqual(405) - }) + }, config.timeout || 10000) // CARDDAV:addressbook-query Report // https://datatracker.ietf.org/doc/html/rfc6352#section-8.6 @@ -166,7 +166,7 @@ describe('CardDAV extensions', function() { expect(utility.componentsAreEqual(response[0].props.addressData, cards[name])) .withContext(`Returned vCard matches ${name}`) .toBe(true) - }) + }, config.timeout || 10000) // CARDDAV:addressbook-query Report // https://datatracker.ietf.org/doc/html/rfc6352#section-8.6 @@ -232,7 +232,7 @@ describe('CardDAV extensions', function() { expect(emails) .withContext(`Returned vCard has email of ${config.attendee1_username} (${config.attendee1})`) .toContain(config.attendee1) - }, 10000) // increase timeout for this long test + }, config.timeout || 10000) // increase timeout for this long test // CARDDAV:addressbook-multiget Report // https://datatracker.ietf.org/doc/html/rfc6352#section-8.7 @@ -266,5 +266,5 @@ describe('CardDAV extensions', function() { .withContext(`Cards returned in addressbook-multiget`) .toBe(true) } - }) + }, config.timeout || 10000) }) \ No newline at end of file diff --git a/Tests/spec/ConfigSpec.js b/Tests/spec/ConfigSpec.js index 419da043d..ee6c7d1c3 100644 --- a/Tests/spec/ConfigSpec.js +++ b/Tests/spec/ConfigSpec.js @@ -34,5 +34,5 @@ describe('config tests', function() { .toBeUndefined() userHash[user] = true } - }) + }, config.timeout || 10000) }) \ No newline at end of file diff --git a/Tests/spec/DAVAddressBookAclSpec.js b/Tests/spec/DAVAddressBookAclSpec.js index 65b09fc9c..ff57ed320 100644 --- a/Tests/spec/DAVAddressBookAclSpec.js +++ b/Tests/spec/DAVAddressBookAclSpec.js @@ -210,33 +210,33 @@ END:VCARD` it("'view' only", async function() { await _testRights({ v: true }) - }) + }, config.timeout || 10000) it("'edit' only", async function() { await _testRights({ e: true }) - }) + }, config.timeout || 10000) it("'create' only", async function() { await _testRights({ c: true }) - }) + }, config.timeout || 10000) it("'delete' only", async function() { await _testRights({ d: true }) - }) + }, config.timeout || 10000) it("'create', 'delete'", async function() { await _testRights({ c: true, d: true }) - }) + }, config.timeout || 10000) it("'view', 'delete'", async function() { await _testRights({ v: true, d: true }) - }) + }, config.timeout || 10000) it("'edit', 'create'", async function() { await _testRights({ c: true, e: true }) - }) + }, config.timeout || 10000) it("'edit', 'delete'", async function() { await _testRights({ d: true, e: true }) - }) + }, config.timeout || 10000) }) \ No newline at end of file diff --git a/Tests/spec/DAVCalendarAclSpec.js b/Tests/spec/DAVCalendarAclSpec.js index f5ee52a45..9d90e6b21 100644 --- a/Tests/spec/DAVCalendarAclSpec.js +++ b/Tests/spec/DAVCalendarAclSpec.js @@ -423,30 +423,30 @@ END:VCALENDAR` it("'view all' on a specific class (PUBLIC)", async function() { await _testRights({ pu: 'v' }) - }) + }, config.timeout || 10000) it("'modify' PUBLIC, 'view all' PRIVATE, 'view d&t' confidential", async function() { await _testRights({ pu: 'm', pr: 'v', co: 'd' }) - }) + }, config.timeout || 10000) it("'create' only", async function() { await _testRights({ c: true }) - }) + }, config.timeout || 10000) it("'delete' only", async function() { await _testRights({ d: true }) - }) + }, config.timeout || 10000) it("'create', 'delete', 'view d&t' PUBLIC, 'modify' PRIVATE", async function() { await _testRights({ c: true, d: true, pu: 'd', pr: 'm' }) - }) + }, config.timeout || 10000) it("'create', 'respond to' PUBLIC", async function() { await _testRights({ c: true, pu: 'r' }) - }) + }, config.timeout || 10000) it("no right given", async function() { await _testRights({}) - }) + }, config.timeout || 10000) }) \ No newline at end of file diff --git a/Tests/spec/DAVCalendarAppleiCalSpec.js b/Tests/spec/DAVCalendarAppleiCalSpec.js index fb2833a6f..7e43854fb 100644 --- a/Tests/spec/DAVCalendarAppleiCalSpec.js +++ b/Tests/spec/DAVCalendarAppleiCalSpec.js @@ -131,7 +131,7 @@ describe('Apple iCal', function() { .withContext(`DAV header includes class ${davClass}`) .toBeTrue() } - }) + }, config.timeout || 10000) it(`calendar-proxy as used from iCal`, async function() { let membership, perm, users, proxyFor @@ -175,7 +175,7 @@ describe('Apple iCal', function() { expect(proxyFor).toContain(`/SOGo/dav/${owner}/`) } } - }) + }, config.timeout || 10000) it('calendar-proxy as used from SOGo', async function() { const personalResource = `/SOGo/dav/${config.username}/Calendar/personal/` @@ -229,5 +229,5 @@ describe('Apple iCal', function() { .toBe(0) await webdav_su.deleteObject(otherResource) - }, 10000) // increase timeout for this long test + }, config.timeout || 10000) // increase timeout for this long test }) \ No newline at end of file diff --git a/Tests/spec/DAVCalendarClassificationSpec.js b/Tests/spec/DAVCalendarClassificationSpec.js index ca72dfc19..f98c369b3 100644 --- a/Tests/spec/DAVCalendarClassificationSpec.js +++ b/Tests/spec/DAVCalendarClassificationSpec.js @@ -35,7 +35,7 @@ describe('calendar classification', function() { expect(status) .withContext('Setting an invalid classification') .toBe(403) - }) + }, config.timeout || 10000) it('setting a valid classification', async function() { for (let component of ['events', 'tasks']) { @@ -46,5 +46,5 @@ describe('calendar classification', function() { .toBe(207) } } - }) + }, config.timeout || 10000) }) \ No newline at end of file diff --git a/Tests/spec/DAVCalendarPublicAclSpec.js b/Tests/spec/DAVCalendarPublicAclSpec.js index 54607eaee..2931cad04 100644 --- a/Tests/spec/DAVCalendarPublicAclSpec.js +++ b/Tests/spec/DAVCalendarPublicAclSpec.js @@ -150,7 +150,7 @@ describe('public access', function() { .withContext('First href must be the Calendar parent collection') .toBe(parentColl) - }) + }, config.timeout || 10000) it("user accessing (non-)shared Calendars", async function() { const parentColl = `/SOGo/dav/${config.subscriber_username}/Calendar/` @@ -176,6 +176,6 @@ describe('public access', function() { expect(href) .withContext('Unique href must be the Calendar parent collection') .toBe(parentColl) - }) + }, config.timeout || 10000) }) \ No newline at end of file diff --git a/Tests/spec/DAVCalendarSuperUserAclSpec.js b/Tests/spec/DAVCalendarSuperUserAclSpec.js index 3ad6fdda6..7339d440d 100644 --- a/Tests/spec/DAVCalendarSuperUserAclSpec.js +++ b/Tests/spec/DAVCalendarSuperUserAclSpec.js @@ -111,6 +111,6 @@ END:VCALENDAR` // 4. Delete const response = await webdav_su.deleteObject(resource) expect(response.status).toBe(204) - }) + }, config.timeout || 10000) }) \ No newline at end of file diff --git a/Tests/spec/DAVContactsCategoriesSpec.js b/Tests/spec/DAVContactsCategoriesSpec.js index d21b2c94a..52a2387d6 100644 --- a/Tests/spec/DAVContactsCategoriesSpec.js +++ b/Tests/spec/DAVContactsCategoriesSpec.js @@ -64,5 +64,5 @@ describe('contacts categories', function() { .toContain('Toto') expect(results) .toContain('Cuicui') - }) + }, config.timeout || 10000) }) \ No newline at end of file diff --git a/Tests/spec/DAVPublicAccessSpec.js b/Tests/spec/DAVPublicAccessSpec.js index d837dd067..0fad63983 100644 --- a/Tests/spec/DAVPublicAccessSpec.js +++ b/Tests/spec/DAVPublicAccessSpec.js @@ -11,21 +11,21 @@ describe('public access', function() { expect(status) .withContext('/SOGo/so/public must not be accessible') .toBe(404) - }) + }, config.timeout || 10000) it("access to /SOGo/public", async function() { const [{ status }] = await webdav_anon.options('/SOGo/public') expect(status) .withContext('/SOGo/public must not be accessible') .toBe(404) - }) + }, config.timeout || 10000) it("access to non-public resource", async function() { const [{ status }] = await webdav_anon.options(`/SOGo/dav/${config.username}`) expect(status) .withContext('DAV non-public resources should request authentication') .toBe(401) - }) + }, config.timeout || 10000) it("access to public resource", async function() { const [{ status }] = await webdav_anon.options('/SOGo/dav/public') @@ -35,5 +35,5 @@ describe('public access', function() { expect(status) .withContext('DAV public resources must be accessible') .toBe(200) - }) + }, config.timeout || 10000) }) \ No newline at end of file diff --git a/Tests/spec/HTTPCalendarSpec.js b/Tests/spec/HTTPCalendarSpec.js index 53046c4a7..e40ad4a91 100644 --- a/Tests/spec/HTTPCalendarSpec.js +++ b/Tests/spec/HTTPCalendarSpec.js @@ -45,6 +45,6 @@ describe('HTTP Calendar', function() { expect(response.status) .withContext(`HTTP status code when unsubscribing to a Web calendar`) .toBe(204) - }) + }, config.timeout || 10000) }) diff --git a/Tests/spec/HTTPPreferencesSpec.js b/Tests/spec/HTTPPreferencesSpec.js index 3ecc92030..2f38b9b0d 100644 --- a/Tests/spec/HTTPPreferencesSpec.js +++ b/Tests/spec/HTTPPreferencesSpec.js @@ -26,12 +26,12 @@ describe('preferences', function() { it('Set/get a text preference - normal characters', async function() { await _setTextPref('defaultText') - }) + }, config.timeout || 10000) it('Set/get a text preference - weird characters - used to crash on 1.3.12', async function() { const prefText = `weird data \ ' \"; ^` await _setTextPref(prefText) - }) + }, config.timeout || 10000) it('Set/get the PreventInvitation pref', async function() { await prefs.set('PreventInvitations', 0) @@ -44,7 +44,7 @@ describe('preferences', function() { expect(isset.PreventInvitations) .withContext(`Set/get Settings/Calendar/PreventInvitations (1)`) .toEqual(1) - }) + }, config.timeout || 10000) it('Set/get the PreventInvitations Whitelist', async function() { await prefs.set('PreventInvitationsWhitelist', config.white_listed_attendee) @@ -52,5 +52,5 @@ describe('preferences', function() { expect(whitelist.PreventInvitationsWhitelist) .withContext(`Set/get Settings/Calendar/PreventInvitationsWhitelist`) .toEqual(config.white_listed_attendee) - }) + }, config.timeout || 10000) })