mirror of
https://github.com/nextcloud/server.git
synced 2026-10-30 17:15:52 +01:00
The session and account fixtures retried a failed login or `createRandomUser()` exactly once after a fixed 800 ms. The transient failures are real (logins answered with HTTP 500 twice in a row, user creation exiting non-zero), and a single fixed-delay retry is not enough to ride them out. Share a `retryWithBackoff` helper that tries three times with an exponential delay, and use it in every fixture that had its own copy of the single retry. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
24 lines
822 B
TypeScript
24 lines
822 B
TypeScript
/*
|
|
* SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
|
|
* SPDX-License-Identifier: AGPL-3.0-or-later
|
|
*/
|
|
|
|
import type { User } from '@nextcloud/e2e-test-server'
|
|
|
|
import { runOcc } from '@nextcloud/e2e-test-server/docker'
|
|
import { createRandomUser } from '@nextcloud/e2e-test-server/playwright'
|
|
import { test as baseTest } from '@playwright/test'
|
|
import { retryWithBackoff } from '../utils/retry.ts'
|
|
|
|
/**
|
|
* Extends the base test with a freshly-created random `user`.
|
|
* The user is deleted in teardown regardless of test outcome.
|
|
*/
|
|
export const test = baseTest.extend<{ user: User }>({
|
|
user: async ({}, use) => {
|
|
const user = await retryWithBackoff('Creating a random user', () => createRandomUser())
|
|
await use(user)
|
|
await runOcc(['user:delete', user.userId], { failOnError: false })
|
|
},
|
|
})
|