mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-12-23 08:53:27 +03:00
test: coverage on enable public workspace (#1733)
This commit is contained in:
parent
f18127dfd6
commit
62955e7de4
@ -38,6 +38,7 @@ export const EnableAffineCloudModal: React.FC<EnableAffineCloudModalProps> = ({
|
||||
{/* <StyleTips>{t('Retain cached cloud data')}</StyleTips> */}
|
||||
<div>
|
||||
<StyleButton
|
||||
data-testid="confirm-enable-affine-cloud-button"
|
||||
shape="round"
|
||||
type="primary"
|
||||
onClick={() => {
|
||||
|
@ -58,7 +58,12 @@ const PublishPanelAffine: React.FC<PublishPanelAffineProps> = ({
|
||||
<Content weight="500">{t('Share with link')}</Content>
|
||||
</Wrapper>
|
||||
<FlexWrapper>
|
||||
<Input width={582} value={shareUrl} disabled={true}></Input>
|
||||
<Input
|
||||
data-testid="share-url"
|
||||
width={582}
|
||||
value={shareUrl}
|
||||
disabled={true}
|
||||
></Input>
|
||||
<Button
|
||||
onClick={copyUrl}
|
||||
type="light"
|
||||
@ -86,6 +91,7 @@ const PublishPanelAffine: React.FC<PublishPanelAffineProps> = ({
|
||||
<>
|
||||
<Wrapper marginBottom="42px">{t('Publishing Description')}</Wrapper>
|
||||
<Button
|
||||
data-testid="publish-to-web-button"
|
||||
onClick={() => {
|
||||
publishWorkspace(true);
|
||||
}}
|
||||
@ -118,6 +124,7 @@ const PublishPanelLocal: React.FC<PublishPanelLocalProps> = ({
|
||||
{t('Publishing')}
|
||||
</Box>
|
||||
<Button
|
||||
data-testid="publish-enable-affine-cloud-button"
|
||||
type="light"
|
||||
shape="circle"
|
||||
onClick={() => {
|
||||
|
@ -3,3 +3,7 @@ import type { Page } from '@playwright/test';
|
||||
export async function clickCollaborationPanel(page: Page) {
|
||||
await page.click('[data-tab-key="collaboration"]');
|
||||
}
|
||||
|
||||
export async function clickPublishPanel(page: Page) {
|
||||
await page.click('[data-tab-key="publish"]');
|
||||
}
|
||||
|
36
tests/parallels/affine/affine-public-workspace.spec.ts
Normal file
36
tests/parallels/affine/affine-public-workspace.spec.ts
Normal file
@ -0,0 +1,36 @@
|
||||
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 { createFakeUser, loginUser, openHomePage } from '../../libs/utils';
|
||||
import { createWorkspace } from '../../libs/workspace';
|
||||
|
||||
test.describe('affine public workspace', () => {
|
||||
test('enable public workspace', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
await waitMarkdownImported(page);
|
||||
const [a] = await createFakeUser();
|
||||
await loginUser(page, a);
|
||||
const name = `test-${Date.now()}`;
|
||||
await createWorkspace({ name }, page);
|
||||
await page.waitForTimeout(50);
|
||||
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,
|
||||
});
|
||||
const url = await page.getByTestId('share-url').inputValue();
|
||||
expect(url.startsWith('http://localhost:8080/public-workspace/')).toBe(
|
||||
true
|
||||
);
|
||||
});
|
||||
});
|
@ -1,22 +1,22 @@
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
import { waitMarkdownImported } from '../libs/page-logic';
|
||||
import { waitMarkdownImported } from '../../libs/page-logic';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
const userA = require('../fixtures/userA.json');
|
||||
import { test } from '../libs/playwright';
|
||||
import { clickCollaborationPanel } from '../libs/setting';
|
||||
const userA = require('../../fixtures/userA.json');
|
||||
import { test } from '../../libs/playwright';
|
||||
import { clickCollaborationPanel } from '../../libs/setting';
|
||||
import {
|
||||
clickNewPageButton,
|
||||
clickSideBarAllPageButton,
|
||||
clickSideBarCurrentWorkspaceBanner,
|
||||
clickSideBarSettingButton,
|
||||
} from '../libs/sidebar';
|
||||
import { createFakeUser, loginUser, openHomePage } from '../libs/utils';
|
||||
} from '../../libs/sidebar';
|
||||
import { createFakeUser, loginUser, openHomePage } from '../../libs/utils';
|
||||
import {
|
||||
assertCurrentWorkspaceFlavour,
|
||||
createWorkspace,
|
||||
} from '../libs/workspace';
|
||||
} from '../../libs/workspace';
|
||||
|
||||
test.describe('affine workspace', () => {
|
||||
test('should login with user A', async ({ page }) => {
|
Loading…
Reference in New Issue
Block a user