From 0d46bc924c95a8f4a6fc683e6b7c00f846d2ff15 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> Date: Thu, 27 Nov 2025 19:40:29 +0000 Subject: [PATCH] Fix "Error: No request context set" in `credentials` fixture (#145) Make sure that we've run the `context` fixture first, so that the request API is configured --- packages/element-web-playwright-common/src/fixtures/user.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/element-web-playwright-common/src/fixtures/user.ts b/packages/element-web-playwright-common/src/fixtures/user.ts index a5fae14b9f..073b6149d8 100644 --- a/packages/element-web-playwright-common/src/fixtures/user.ts +++ b/packages/element-web-playwright-common/src/fixtures/user.ts @@ -70,7 +70,11 @@ export const test = base.extend<{ user: Credentials; }>({ displayName: undefined, - credentials: async ({ homeserver, displayName: testDisplayName }, use, testInfo) => { + + // We don't directly depend upon the `context` fixture, but we do need to make sure that it has been run + // before this fixture, since it is responsible for configuring the APIRequestContext on the homeserver, so + // without it we cannot register the user. + credentials: async ({ context, homeserver, displayName: testDisplayName }, use, testInfo) => { const names = ["Alice", "Bob", "Charlie", "Daniel", "Eve", "Frank", "Grace", "Hannah", "Isaac", "Judy"]; const password = uniqueId("password_"); const displayName = testDisplayName ?? sample(names)!;