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
This commit is contained in:
Richard van der Hoff 2025-11-27 19:40:29 +00:00 committed by GitHub
parent 4c928d2854
commit 0d46bc924c

View File

@ -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)!;