test(electron): fix cloud test (#4411)

This commit is contained in:
Alex Yang
2023-09-19 02:08:35 +00:00
committed by GitHub
parent 63bd1fbf02
commit 9aafaf865e
3 changed files with 16 additions and 12 deletions
+5 -1
View File
@@ -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 }) => {
+5 -2
View File
@@ -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({