2023-03-17 10:51:00 +03:00
|
|
|
import { expect } from '@playwright/test';
|
|
|
|
|
2023-03-29 04:57:50 +03:00
|
|
|
import { waitMarkdownImported } from '../../libs/page-logic';
|
2023-03-28 08:25:16 +03:00
|
|
|
|
2023-03-23 07:22:29 +03:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
2023-03-29 04:57:50 +03:00
|
|
|
const userA = require('../../fixtures/userA.json');
|
2023-04-06 17:20:36 +03:00
|
|
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
|
|
const userB = require('../../fixtures/userB.json');
|
2023-03-29 04:57:50 +03:00
|
|
|
import { test } from '../../libs/playwright';
|
|
|
|
import { clickCollaborationPanel } from '../../libs/setting';
|
2023-03-17 10:51:00 +03:00
|
|
|
import {
|
|
|
|
clickNewPageButton,
|
|
|
|
clickSideBarAllPageButton,
|
|
|
|
clickSideBarCurrentWorkspaceBanner,
|
|
|
|
clickSideBarSettingButton,
|
2023-03-29 04:57:50 +03:00
|
|
|
} from '../../libs/sidebar';
|
|
|
|
import { createFakeUser, loginUser, openHomePage } from '../../libs/utils';
|
2023-03-23 07:22:29 +03:00
|
|
|
import {
|
|
|
|
assertCurrentWorkspaceFlavour,
|
|
|
|
createWorkspace,
|
2023-04-07 00:14:23 +03:00
|
|
|
openWorkspaceListModal,
|
2023-03-29 04:57:50 +03:00
|
|
|
} from '../../libs/workspace';
|
2023-03-17 10:51:00 +03:00
|
|
|
|
|
|
|
test.describe('affine workspace', () => {
|
|
|
|
test('should login with user A', async ({ page }) => {
|
|
|
|
await openHomePage(page);
|
2023-03-28 08:25:16 +03:00
|
|
|
await waitMarkdownImported(page);
|
2023-04-06 17:20:36 +03:00
|
|
|
const [a] = await createFakeUser(userA, userB);
|
2023-03-17 10:51:00 +03:00
|
|
|
await loginUser(page, a);
|
|
|
|
await clickSideBarCurrentWorkspaceBanner(page);
|
|
|
|
const footer = page.locator('[data-testid="workspace-list-modal-footer"]');
|
|
|
|
expect(await footer.getByText(userA.name).isVisible()).toBe(true);
|
|
|
|
expect(await footer.getByText(userA.email).isVisible()).toBe(true);
|
2023-03-23 07:22:29 +03:00
|
|
|
await assertCurrentWorkspaceFlavour('local', page);
|
2023-03-17 10:51:00 +03:00
|
|
|
});
|
|
|
|
|
2023-03-20 23:34:48 +03:00
|
|
|
test('should enable affine workspace successfully', async ({ page }) => {
|
2023-03-17 10:51:00 +03:00
|
|
|
await openHomePage(page);
|
2023-03-28 08:25:16 +03:00
|
|
|
await waitMarkdownImported(page);
|
2023-03-17 10:51:00 +03:00
|
|
|
const [a] = await createFakeUser();
|
|
|
|
await loginUser(page, a);
|
2023-03-21 06:26:05 +03:00
|
|
|
const name = `test-${Date.now()}`;
|
2023-03-20 23:34:48 +03:00
|
|
|
await createWorkspace({ name }, page);
|
2023-03-17 10:51:00 +03:00
|
|
|
await page.waitForTimeout(50);
|
|
|
|
await clickSideBarSettingButton(page);
|
|
|
|
await page.waitForTimeout(50);
|
|
|
|
await clickCollaborationPanel(page);
|
|
|
|
await page.getByTestId('local-workspace-enable-cloud-button').click();
|
|
|
|
await page.getByTestId('confirm-enable-cloud-button').click();
|
|
|
|
await page.waitForSelector("[data-testid='member-length']", {
|
2023-03-31 05:00:19 +03:00
|
|
|
timeout: 20000,
|
2023-03-17 10:51:00 +03:00
|
|
|
});
|
|
|
|
await clickSideBarAllPageButton(page);
|
|
|
|
await clickNewPageButton(page);
|
|
|
|
await page.locator('[data-block-is-title="true"]').type('Hello, world!', {
|
|
|
|
delay: 50,
|
|
|
|
});
|
2023-03-23 07:22:29 +03:00
|
|
|
await assertCurrentWorkspaceFlavour('affine', page);
|
2023-04-07 00:14:23 +03:00
|
|
|
await openWorkspaceListModal(page);
|
|
|
|
await page.getByTestId('workspace-list-modal-sign-out').click();
|
|
|
|
await page.waitForTimeout(1000);
|
|
|
|
await assertCurrentWorkspaceFlavour('local', page);
|
2023-03-17 10:51:00 +03:00
|
|
|
});
|
|
|
|
});
|