mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-11 22:18:54 +08:00
feat: single page API in public workspace (#1794)
This commit is contained in:
@@ -3,7 +3,10 @@ import { expect } from '@playwright/test';
|
||||
import { waitMarkdownImported } from '../../libs/page-logic';
|
||||
import { test } from '../../libs/playwright';
|
||||
import { clickPublishPanel } from '../../libs/setting';
|
||||
import { clickSideBarSettingButton } from '../../libs/sidebar';
|
||||
import {
|
||||
clickSideBarAllPageButton,
|
||||
clickSideBarSettingButton,
|
||||
} from '../../libs/sidebar';
|
||||
import { createFakeUser, loginUser, openHomePage } from '../../libs/utils';
|
||||
import { createWorkspace } from '../../libs/workspace';
|
||||
|
||||
@@ -39,4 +42,33 @@ test.describe('affine public workspace', () => {
|
||||
});
|
||||
await page2.getByText('Welcome to AFFiNE').click();
|
||||
});
|
||||
|
||||
test('access public workspace page', async ({ page, browser }) => {
|
||||
await openHomePage(page);
|
||||
const [a] = await createFakeUser();
|
||||
await loginUser(page, a);
|
||||
await waitMarkdownImported(page);
|
||||
const name = `test-${Date.now()}`;
|
||||
await createWorkspace({ name }, page);
|
||||
await waitMarkdownImported(page);
|
||||
await clickSideBarSettingButton(page);
|
||||
await page.waitForTimeout(50);
|
||||
await clickPublishPanel(page);
|
||||
await page.getByTestId('publish-enable-affine-cloud-button').click();
|
||||
await page.getByTestId('confirm-enable-affine-cloud-button').click();
|
||||
await page.getByTestId('publish-to-web-button').waitFor({
|
||||
timeout: 10000,
|
||||
});
|
||||
await page.getByTestId('publish-to-web-button').click();
|
||||
await page.getByTestId('share-url').waitFor({
|
||||
timeout: 10000,
|
||||
});
|
||||
await clickSideBarAllPageButton(page);
|
||||
await page.locator('tr').nth(1).click();
|
||||
const url = page.url();
|
||||
const context = await browser.newContext();
|
||||
const page2 = await context.newPage();
|
||||
await page2.goto(url.replace('workspace', 'public-workspace'));
|
||||
await page2.waitForSelector('v-line');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -4,6 +4,8 @@ import { waitMarkdownImported } from '../../libs/page-logic';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
const userA = require('../../fixtures/userA.json');
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
const userB = require('../../fixtures/userB.json');
|
||||
import { test } from '../../libs/playwright';
|
||||
import { clickCollaborationPanel } from '../../libs/setting';
|
||||
import {
|
||||
@@ -22,7 +24,7 @@ test.describe('affine workspace', () => {
|
||||
test('should login with user A', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
const [a] = await createFakeUser();
|
||||
const [a] = await createFakeUser(userA, userB);
|
||||
await loginUser(page, a);
|
||||
await clickSideBarCurrentWorkspaceBanner(page);
|
||||
const footer = page.locator('[data-testid="workspace-list-modal-footer"]');
|
||||
|
||||
Reference in New Issue
Block a user