test: fix multi-tenant flakes (#12983)
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user