fix(tests): Add timeout on all async tests

This commit is contained in:
smizrahi
2024-09-26 17:53:34 +02:00
parent 5e72e37c76
commit 748acc251c
15 changed files with 55 additions and 55 deletions

View File

@@ -136,7 +136,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
@@ -148,7 +148,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
@@ -165,5 +165,5 @@ describe('PreventInvitations', function() {
// Second, try again to invite, it should work
await _addAttendee()
await _verifyEvent()
}, config.timeout || 10000)
})
})

View File

@@ -24,7 +24,7 @@ describe('read and set calendar properties', function() {
expect(response[0].status)
.withContext(`HTTP status code of MKCALENDAR`)
.toEqual(405)
}, config.timeout || 10000)
})
// CalDAVPropertiesTest
@@ -40,7 +40,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
@@ -69,7 +69,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`
@@ -129,5 +129,5 @@ END:VCALENDAR`
expect(utility.componentsAreEqual(response[0].props.calendarData, event))
.withContext(`Returned vCalendar matches ${filename}`)
.toBe(true)
}, config.timeout || 10000)
})
})

View File

@@ -167,7 +167,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'
@@ -217,7 +217,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'
@@ -264,7 +264,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'
@@ -311,7 +311,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
@@ -412,7 +412,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
@@ -545,7 +545,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:
@@ -662,7 +662,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'
@@ -713,7 +713,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'
@@ -735,7 +735,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'
@@ -937,5 +937,5 @@ describe('CalDAV Scheduling', function() {
vcalendarInvitationAttendee = await _getEvent(webdavAttendee1, attendee1Calendar, icsName, 404)
vcalendarInvitationDelegate = await _getEvent(webdavAttendee1Delegate, attendee1DelegateCalendar, icsName, 404)
}, config.timeout || 10000) // increase timeout for this long test
}) // increase timeout for this long test
})

View File

@@ -106,7 +106,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
@@ -170,7 +170,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
@@ -236,7 +236,7 @@ describe('CardDAV extensions', function() {
expect(emails)
.withContext(`Returned vCard has email of ${config.attendee1_username} (${config.attendee1})`)
.toContain(config.attendee1)
}, config.timeout || 10000) // increase timeout for this long test
}) // increase timeout for this long test
// CARDDAV:addressbook-multiget Report
// https://datatracker.ietf.org/doc/html/rfc6352#section-8.7
@@ -270,5 +270,5 @@ describe('CardDAV extensions', function() {
.withContext(`Cards returned in addressbook-multiget`)
.toBe(true)
}
}, config.timeout || 10000)
})
})

View File

@@ -38,5 +38,5 @@ describe('config tests', function() {
.toBeUndefined()
userHash[user] = true
}
}, config.timeout || 10000)
})
})

View File

@@ -214,33 +214,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)
})
})

View File

@@ -427,30 +427,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)
})
})

View File

@@ -135,7 +135,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
@@ -179,7 +179,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/`
@@ -233,5 +233,5 @@ describe('Apple iCal', function() {
.toBe(0)
await webdav_su.deleteObject(otherResource)
}, config.timeout || 10000) // increase timeout for this long test
}) // increase timeout for this long test
})

View File

@@ -39,7 +39,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']) {
@@ -50,5 +50,5 @@ describe('calendar classification', function() {
.toBe(207)
}
}
}, config.timeout || 10000)
})
})

View File

@@ -154,7 +154,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/`
@@ -180,6 +180,6 @@ describe('public access', function() {
expect(href)
.withContext('Unique href must be the Calendar parent collection')
.toBe(parentColl)
}, config.timeout || 10000)
})
})

View File

@@ -115,6 +115,6 @@ END:VCALENDAR`
// 4. Delete
const response = await webdav_su.deleteObject(resource)
expect(response.status).toBe(204)
}, config.timeout || 10000)
})
})

View File

@@ -68,5 +68,5 @@ describe('contacts categories', function() {
.toContain('Toto')
expect(results)
.toContain('Cuicui')
}, config.timeout || 10000)
})
})

View File

@@ -15,21 +15,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')
@@ -39,5 +39,5 @@ describe('public access', function() {
expect(status)
.withContext('DAV public resources must be accessible')
.toBe(200)
}, config.timeout || 10000)
})
})

View File

@@ -49,6 +49,6 @@ describe('HTTP Calendar', function() {
expect(response.status)
.withContext(`HTTP status code when unsubscribing to a Web calendar`)
.toBe(204)
}, config.timeout || 10000)
})
})

View File

@@ -30,12 +30,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)
@@ -48,7 +48,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)
@@ -56,5 +56,5 @@ describe('preferences', function() {
expect(whitelist.PreventInvitationsWhitelist)
.withContext(`Set/get Settings/Calendar/PreventInvitationsWhitelist`)
.toEqual(config.white_listed_attendee)
}, config.timeout || 10000)
})
})