mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-12-23 13:01:59 +03:00
test(electron): fix cloud test (#4411)
This commit is contained in:
parent
63bd1fbf02
commit
9aafaf865e
@ -1,5 +1,4 @@
|
||||
import { useCollectionManager } from '@affine/component/page-list';
|
||||
import { DEFAULT_HELLO_WORLD_PAGE_ID_SUFFIX } from '@affine/env/constant';
|
||||
import { WorkspaceSubPath } from '@affine/env/workspace';
|
||||
import { assertExists } from '@blocksuite/global/utils';
|
||||
import { getActiveBlockSuiteWorkspaceAtom } from '@toeverything/infra/__internal__/workspace';
|
||||
@ -20,14 +19,12 @@ export const loader: LoaderFunction = async args => {
|
||||
const workspaceAtom = getActiveBlockSuiteWorkspaceAtom(workspaceId);
|
||||
const workspace = await rootStore.get(workspaceAtom);
|
||||
for (const pageId of workspace.pages.keys()) {
|
||||
if (pageId.endsWith(DEFAULT_HELLO_WORLD_PAGE_ID_SUFFIX)) {
|
||||
const page = workspace.getPage(pageId);
|
||||
if (page && page.meta.jumpOnce) {
|
||||
workspace.meta.setPageMeta(page.id, {
|
||||
jumpOnce: false,
|
||||
});
|
||||
return redirect(`/workspace/${workspace.id}/${page.id}`);
|
||||
}
|
||||
const page = workspace.getPage(pageId);
|
||||
if (page && page.meta.jumpOnce) {
|
||||
workspace.meta.setPageMeta(page.id, {
|
||||
jumpOnce: false,
|
||||
});
|
||||
return redirect(`/workspace/${workspace.id}/${page.id}`);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
@ -7,6 +7,8 @@ import {
|
||||
import { waitForEditorLoad } from '@affine-test/kit/utils/page-logic';
|
||||
import { createLocalWorkspace } from '@affine-test/kit/utils/workspace';
|
||||
|
||||
process.env.DEV_SERVER_URL = 'http://localhost:8080';
|
||||
|
||||
let user: {
|
||||
name: string;
|
||||
email: string;
|
||||
@ -18,7 +20,9 @@ test.beforeEach(async () => {
|
||||
});
|
||||
|
||||
test.beforeEach(async ({ page }) => {
|
||||
await loginUser(page, user.email);
|
||||
await loginUser(page, user.email, {
|
||||
isElectron: true,
|
||||
});
|
||||
});
|
||||
|
||||
test('new page', async ({ page }) => {
|
||||
|
@ -133,12 +133,15 @@ export async function loginUser(
|
||||
page: Page,
|
||||
userEmail: string,
|
||||
config?: {
|
||||
isElectron?: boolean;
|
||||
beforeLogin?: () => Promise<void>;
|
||||
afterLogin?: () => Promise<void>;
|
||||
}
|
||||
) {
|
||||
await openHomePage(page);
|
||||
await waitForEditorLoad(page);
|
||||
if (config?.isElectron !== true) {
|
||||
await openHomePage(page);
|
||||
await waitForEditorLoad(page);
|
||||
}
|
||||
|
||||
await clickSideBarCurrentWorkspaceBanner(page);
|
||||
await page.getByTestId('cloud-signin-button').click({
|
||||
|
Loading…
Reference in New Issue
Block a user