mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 12:28:42 +00:00
feat!: affine cloud support (#3813)
Co-authored-by: Hongtao Lye <codert.sn@gmail.com> Co-authored-by: liuyi <forehalo@gmail.com> Co-authored-by: LongYinan <lynweklm@gmail.com> Co-authored-by: X1a0t <405028157@qq.com> Co-authored-by: JimmFly <yangjinfei001@gmail.com> Co-authored-by: Peng Xiao <pengxiao@outlook.com> Co-authored-by: xiaodong zuo <53252747+zuoxiaodong0815@users.noreply.github.com> Co-authored-by: DarkSky <25152247+darkskygit@users.noreply.github.com> Co-authored-by: Qi <474021214@qq.com> Co-authored-by: danielchim <kahungchim@gmail.com>
This commit is contained in:
62
tests/affine-cloud/e2e/basic.spec.ts
Normal file
62
tests/affine-cloud/e2e/basic.spec.ts
Normal file
@@ -0,0 +1,62 @@
|
||||
import { test } from '@affine-test/kit/playwright';
|
||||
import {
|
||||
createRandomUser,
|
||||
deleteUser,
|
||||
getLoginCookie,
|
||||
} from '@affine-test/kit/utils/cloud';
|
||||
import { openHomePage } from '@affine-test/kit/utils/load-page';
|
||||
import { waitEditorLoad } from '@affine-test/kit/utils/page-logic';
|
||||
import { clickSideBarCurrentWorkspaceBanner } from '@affine-test/kit/utils/sidebar';
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
let user: {
|
||||
name: string;
|
||||
email: string;
|
||||
password: string;
|
||||
};
|
||||
|
||||
test.beforeEach(async () => {
|
||||
user = await createRandomUser();
|
||||
});
|
||||
|
||||
test.afterEach(async () => {
|
||||
// if you want to keep the user in the database for debugging,
|
||||
// comment this line
|
||||
await deleteUser(user.email);
|
||||
});
|
||||
|
||||
test('server exist', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
await waitEditorLoad(page);
|
||||
|
||||
const json = await (await fetch('http://localhost:3010')).json();
|
||||
expect(json.message).toMatch(/^AFFiNE GraphQL server/);
|
||||
});
|
||||
|
||||
test('enable cloud success', async ({ page, context }) => {
|
||||
await page.goto('http://localhost:8080');
|
||||
await page.waitForSelector('v-line');
|
||||
|
||||
await clickSideBarCurrentWorkspaceBanner(page);
|
||||
await page.getByTestId('cloud-signin-button').click({
|
||||
delay: 200,
|
||||
});
|
||||
await page.getByPlaceholder('Enter your email address').type(user.email, {
|
||||
delay: 50,
|
||||
});
|
||||
await page.getByTestId('continue-login-button').click({
|
||||
delay: 200,
|
||||
});
|
||||
await page.getByTestId('sign-in-with-password').click({
|
||||
delay: 200,
|
||||
});
|
||||
await page.getByTestId('password-input').type('123456', {
|
||||
delay: 50,
|
||||
});
|
||||
expect(await getLoginCookie(context)).toBeUndefined();
|
||||
await page.getByTestId('sign-in-button').click();
|
||||
await page.waitForTimeout(1000);
|
||||
await page.reload();
|
||||
await waitEditorLoad(page);
|
||||
expect(await getLoginCookie(context)).toBeTruthy();
|
||||
});
|
||||
17
tests/affine-cloud/e2e/login.spec.ts
Normal file
17
tests/affine-cloud/e2e/login.spec.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { test } from '@affine-test/kit/playwright';
|
||||
import { openHomePage } from '@affine-test/kit/utils/load-page';
|
||||
import { waitEditorLoad } from '@affine-test/kit/utils/page-logic';
|
||||
import { clickSideBarCurrentWorkspaceBanner } from '@affine-test/kit/utils/sidebar';
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
test.describe('login', () => {
|
||||
test('can open login modal in workspace list', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
await waitEditorLoad(page);
|
||||
await clickSideBarCurrentWorkspaceBanner(page);
|
||||
await page.getByTestId('cloud-signin-button').click({
|
||||
delay: 200,
|
||||
});
|
||||
await expect(page.getByTestId('auth-modal')).toBeVisible();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user