2023-04-25 06:12:48 +03:00
|
|
|
import { test } from '@affine-test/kit/playwright';
|
2023-03-30 01:49:13 +03:00
|
|
|
import { expect } from '@playwright/test';
|
|
|
|
|
2023-04-22 04:44:29 +03:00
|
|
|
import { openHomePage } from '../../libs/load-page';
|
2023-03-30 01:49:13 +03:00
|
|
|
import { waitMarkdownImported } from '../../libs/page-logic';
|
|
|
|
import {
|
|
|
|
clickNewPageButton,
|
|
|
|
clickSideBarCurrentWorkspaceBanner,
|
|
|
|
} from '../../libs/sidebar';
|
2023-04-22 04:44:29 +03:00
|
|
|
import { getBuiltInUser, loginUser } from '../../libs/utils';
|
2023-03-30 01:49:13 +03:00
|
|
|
|
2023-04-17 00:02:41 +03:00
|
|
|
test('collaborative', async ({ page, browser }) => {
|
|
|
|
await openHomePage(page);
|
|
|
|
await waitMarkdownImported(page);
|
|
|
|
const [a, b] = await getBuiltInUser();
|
|
|
|
await loginUser(page, a);
|
|
|
|
await page.reload();
|
|
|
|
await page.waitForTimeout(50);
|
|
|
|
await clickSideBarCurrentWorkspaceBanner(page);
|
|
|
|
await page.getByText('Cloud Workspace').click();
|
|
|
|
const context2 = await browser.newContext();
|
|
|
|
const page2 = await context2.newPage();
|
|
|
|
await openHomePage(page2);
|
|
|
|
await loginUser(page2, b);
|
|
|
|
await page2.reload();
|
|
|
|
await clickSideBarCurrentWorkspaceBanner(page2);
|
|
|
|
await page2.getByText('Joined Workspace').click();
|
|
|
|
await clickNewPageButton(page);
|
|
|
|
const url = page.url();
|
|
|
|
await page2.goto(url);
|
|
|
|
await page.focus('.affine-default-page-block-title');
|
|
|
|
await page.type('.affine-default-page-block-title', 'hello', {
|
|
|
|
delay: 100,
|
2023-03-30 01:49:13 +03:00
|
|
|
});
|
2023-04-17 00:02:41 +03:00
|
|
|
await page.waitForTimeout(100);
|
|
|
|
const title = (await page
|
|
|
|
.locator('.affine-default-page-block-title')
|
|
|
|
.textContent()) as string;
|
|
|
|
expect(title.trim()).toBe('hello');
|
2023-03-30 01:49:13 +03:00
|
|
|
});
|