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> */}
|
{/* <StyleTips>{t('Retain cached cloud data')}</StyleTips> */}
|
||||||
<div>
|
<div>
|
||||||
<StyleButton
|
<StyleButton
|
||||||
|
data-testid="confirm-enable-affine-cloud-button"
|
||||||
shape="round"
|
shape="round"
|
||||||
type="primary"
|
type="primary"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
@ -58,7 +58,12 @@ const PublishPanelAffine: React.FC<PublishPanelAffineProps> = ({
|
|||||||
<Content weight="500">{t('Share with link')}</Content>
|
<Content weight="500">{t('Share with link')}</Content>
|
||||||
</Wrapper>
|
</Wrapper>
|
||||||
<FlexWrapper>
|
<FlexWrapper>
|
||||||
<Input width={582} value={shareUrl} disabled={true}></Input>
|
<Input
|
||||||
|
data-testid="share-url"
|
||||||
|
width={582}
|
||||||
|
value={shareUrl}
|
||||||
|
disabled={true}
|
||||||
|
></Input>
|
||||||
<Button
|
<Button
|
||||||
onClick={copyUrl}
|
onClick={copyUrl}
|
||||||
type="light"
|
type="light"
|
||||||
@ -86,6 +91,7 @@ const PublishPanelAffine: React.FC<PublishPanelAffineProps> = ({
|
|||||||
<>
|
<>
|
||||||
<Wrapper marginBottom="42px">{t('Publishing Description')}</Wrapper>
|
<Wrapper marginBottom="42px">{t('Publishing Description')}</Wrapper>
|
||||||
<Button
|
<Button
|
||||||
|
data-testid="publish-to-web-button"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
publishWorkspace(true);
|
publishWorkspace(true);
|
||||||
}}
|
}}
|
||||||
@ -118,6 +124,7 @@ const PublishPanelLocal: React.FC<PublishPanelLocalProps> = ({
|
|||||||
{t('Publishing')}
|
{t('Publishing')}
|
||||||
</Box>
|
</Box>
|
||||||
<Button
|
<Button
|
||||||
|
data-testid="publish-enable-affine-cloud-button"
|
||||||
type="light"
|
type="light"
|
||||||
shape="circle"
|
shape="circle"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
|
@ -3,3 +3,7 @@ import type { Page } from '@playwright/test';
|
|||||||
export async function clickCollaborationPanel(page: Page) {
|
export async function clickCollaborationPanel(page: Page) {
|
||||||
await page.click('[data-tab-key="collaboration"]');
|
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 { 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
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||||
const userA = require('../fixtures/userA.json');
|
const userA = require('../../fixtures/userA.json');
|
||||||
import { test } from '../libs/playwright';
|
import { test } from '../../libs/playwright';
|
||||||
import { clickCollaborationPanel } from '../libs/setting';
|
import { clickCollaborationPanel } from '../../libs/setting';
|
||||||
import {
|
import {
|
||||||
clickNewPageButton,
|
clickNewPageButton,
|
||||||
clickSideBarAllPageButton,
|
clickSideBarAllPageButton,
|
||||||
clickSideBarCurrentWorkspaceBanner,
|
clickSideBarCurrentWorkspaceBanner,
|
||||||
clickSideBarSettingButton,
|
clickSideBarSettingButton,
|
||||||
} from '../libs/sidebar';
|
} from '../../libs/sidebar';
|
||||||
import { createFakeUser, loginUser, openHomePage } from '../libs/utils';
|
import { createFakeUser, loginUser, openHomePage } from '../../libs/utils';
|
||||||
import {
|
import {
|
||||||
assertCurrentWorkspaceFlavour,
|
assertCurrentWorkspaceFlavour,
|
||||||
createWorkspace,
|
createWorkspace,
|
||||||
} from '../libs/workspace';
|
} from '../../libs/workspace';
|
||||||
|
|
||||||
test.describe('affine workspace', () => {
|
test.describe('affine workspace', () => {
|
||||||
test('should login with user A', async ({ page }) => {
|
test('should login with user A', async ({ page }) => {
|
Loading…
Reference in New Issue
Block a user