mirror of
https://github.com/logto-io/logto.git
synced 2025-01-20 21:32:31 -05:00
fix(test): fix cloud UI test create new account idling URL mismatch error (#4037)
This commit is contained in:
parent
5c3c8434f3
commit
9fa2bc9235
2 changed files with 11 additions and 12 deletions
|
@ -1,7 +1,8 @@
|
|||
import { useLogto } from '@logto/react';
|
||||
import { type TenantInfo } from '@logto/schemas/models';
|
||||
import { conditional, yes } from '@silverhand/essentials';
|
||||
import { HTTPError } from 'ky';
|
||||
import { useContext, useEffect, useState } from 'react';
|
||||
import { useCallback, useContext, useEffect, useState } from 'react';
|
||||
import { useHref, useSearchParams } from 'react-router-dom';
|
||||
|
||||
import { useCloudApi } from '@/cloud/hooks/use-cloud-api';
|
||||
|
@ -36,6 +37,13 @@ function Protected() {
|
|||
}
|
||||
}, [api, setTenants, tenants]);
|
||||
|
||||
const onAdd = useCallback(
|
||||
(tenant: TenantInfo) => {
|
||||
setTenants([...(tenants ?? []), tenant]);
|
||||
},
|
||||
[setTenants, tenants]
|
||||
);
|
||||
|
||||
if (error) {
|
||||
if (error instanceof HTTPError && error.response.status === 401) {
|
||||
return <SessionExpired error={error} />;
|
||||
|
@ -49,14 +57,7 @@ function Protected() {
|
|||
return <Redirect tenants={tenants} toTenantId={currentTenantId} />;
|
||||
}
|
||||
|
||||
return (
|
||||
<Tenants
|
||||
data={tenants}
|
||||
onAdd={(tenant) => {
|
||||
setTenants([...tenants, tenant]);
|
||||
}}
|
||||
/>
|
||||
);
|
||||
return <Tenants data={tenants} onAdd={onAdd} />;
|
||||
}
|
||||
|
||||
return <AppLoading />;
|
||||
|
|
|
@ -169,9 +169,7 @@ describe('smoke testing for cloud', () => {
|
|||
});
|
||||
|
||||
await expect(page).toClick('button[name=submit]');
|
||||
await page.waitForNavigation({ waitUntil: 'networkidle0' });
|
||||
|
||||
console.log('???', page.url());
|
||||
await page.waitForNavigation({ waitUntil: 'networkidle0', timeout: 5000 });
|
||||
|
||||
expect(page.url().startsWith(logtoCloudUrl.href)).toBeTruthy();
|
||||
expect(new URL(page.url()).pathname.endsWith('/onboarding/welcome')).toBeTruthy();
|
||||
|
|
Loading…
Add table
Reference in a new issue