test: fix multi-tenant flakes (#12983)

This commit is contained in:
Jarrod Flesch
2025-06-30 17:18:41 -04:00
committed by GitHub
parent 0e8ac0bad5
commit c07187d804
3 changed files with 24 additions and 2 deletions

View File

@@ -187,7 +187,15 @@ export const TenantSelectionProviderClient = ({
// Users with no cookie set and only 1 tenant should set that tenant automatically
setTenant({ id: tenantOptionsFromProps[0]?.value, refresh: true })
setTenantOptions(tenantOptionsFromProps)
} else if ((!tenantOptions || tenantOptions.length === 0) && tenantOptionsFromProps) {
} else if (
(!tenantOptions || tenantOptions.length === 0) &&
tenantOptionsFromProps.length > 0
) {
// If there are no tenant options, set them from the props
setTenantOptions(tenantOptionsFromProps)
}
} else if (userID && tenantCookie) {
if ((!tenantOptions || tenantOptions.length === 0) && tenantOptionsFromProps.length > 0) {
// If there are no tenant options, set them from the props
setTenantOptions(tenantOptionsFromProps)
}

View File

@@ -160,7 +160,6 @@ test.describe('Multi Tenant', () => {
data: credentials.admin,
})
await page.goto(globalMenuURL.list)
await page.waitForURL(globalMenuURL.create)
await expect(page.locator('.collection-edit')).toBeVisible()
})
@@ -282,6 +281,7 @@ test.describe('Multi Tenant', () => {
urlUtil: tenantsURL,
})
await expect(page.locator('#field-name')).toBeVisible()
await page.locator('#field-name').fill('Red Dog')
await saveDocAndAssert(page)

View File

@@ -159,6 +159,13 @@ export interface User {
hash?: string | null;
loginAttempts?: number | null;
lockUntil?: string | null;
sessions?:
| {
id: string;
createdAt?: string | null;
expiresAt: string;
}[]
| null;
password?: string | null;
}
/**
@@ -291,6 +298,13 @@ export interface UsersSelect<T extends boolean = true> {
hash?: T;
loginAttempts?: T;
lockUntil?: T;
sessions?:
| T
| {
id?: T;
createdAt?: T;
expiresAt?: T;
};
}
/**
* This interface was referenced by `Config`'s JSON-Schema