mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-12-24 19:22:49 +03:00
feat: add create workspace test (#914)
This commit is contained in:
parent
5a93b26cc3
commit
3d6d8694ba
@ -106,6 +106,7 @@ export const PageList = ({
|
|||||||
{pageList.map((pageMeta, index) => {
|
{pageList.map((pageMeta, index) => {
|
||||||
return (
|
return (
|
||||||
<StyledTableRow
|
<StyledTableRow
|
||||||
|
data-testid="page-list-item"
|
||||||
key={`${pageMeta.id}-${index}`}
|
key={`${pageMeta.id}-${index}`}
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
if (isPublic) {
|
if (isPublic) {
|
||||||
|
@ -71,6 +71,7 @@ export const WorkspaceModal = ({ open, onClose }: WorkspaceModalProps) => {
|
|||||||
<LanguageMenu />
|
<LanguageMenu />
|
||||||
<StyledSplitLine />
|
<StyledSplitLine />
|
||||||
<ModalCloseButton
|
<ModalCloseButton
|
||||||
|
data-testid="close-workspace-modal"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
onClose();
|
onClose();
|
||||||
}}
|
}}
|
||||||
|
@ -18,7 +18,7 @@ import { Upload } from '@/components/file-upload';
|
|||||||
export const GeneralPage = ({ workspace }: { workspace: WorkspaceUnit }) => {
|
export const GeneralPage = ({ workspace }: { workspace: WorkspaceUnit }) => {
|
||||||
const [showDelete, setShowDelete] = useState<boolean>(false);
|
const [showDelete, setShowDelete] = useState<boolean>(false);
|
||||||
const [showLeave, setShowLeave] = useState<boolean>(false);
|
const [showLeave, setShowLeave] = useState<boolean>(false);
|
||||||
const [workspaceName, setWorkspaceName] = useState<string>(workspace.name);
|
const [workspaceName, setWorkspaceName] = useState<string>(workspace?.name);
|
||||||
const { currentWorkspace, isOwner } = useAppState();
|
const { currentWorkspace, isOwner } = useAppState();
|
||||||
const { updateWorkspace } = useWorkspaceHelper();
|
const { updateWorkspace } = useWorkspaceHelper();
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
@ -125,7 +125,8 @@ export const WorkSpaceSliderBar = () => {
|
|||||||
</StyledListItem>
|
</StyledListItem>
|
||||||
<Link href={{ pathname: paths.all }}>
|
<Link href={{ pathname: paths.all }}>
|
||||||
<StyledListItem active={router.asPath === paths.all}>
|
<StyledListItem active={router.asPath === paths.all}>
|
||||||
<AllPagesIcon /> <span>{t('All pages')}</span>
|
<AllPagesIcon />
|
||||||
|
<span data-testid="all-pages">{t('All pages')}</span>
|
||||||
</StyledListItem>
|
</StyledListItem>
|
||||||
</Link>
|
</Link>
|
||||||
<StyledListItem active={router.asPath === paths.favorite}>
|
<StyledListItem active={router.asPath === paths.favorite}>
|
||||||
|
@ -27,6 +27,21 @@ test.describe('Local first workspace list', () => {
|
|||||||
//check workspace list length
|
//check workspace list length
|
||||||
const workspaceCards = await page.$$('data-testid=workspace-card');
|
const workspaceCards = await page.$$('data-testid=workspace-card');
|
||||||
expect(workspaceCards.length).toBe(2);
|
expect(workspaceCards.length).toBe(2);
|
||||||
|
|
||||||
|
//check page list length
|
||||||
|
const closeWorkspaceModal = page.getByTestId('close-workspace-modal');
|
||||||
|
await closeWorkspaceModal.click();
|
||||||
|
const allPageButton = page.getByTestId('all-pages');
|
||||||
|
await allPageButton.click();
|
||||||
|
await page.waitForTimeout(1000);
|
||||||
|
const pageList = page.locator('[data-testid=page-list-item]');
|
||||||
|
const result = await pageList.count();
|
||||||
|
expect(result).toBe(1);
|
||||||
|
await page.reload();
|
||||||
|
await page.waitForTimeout(1000);
|
||||||
|
const pageList1 = page.locator('[data-testid=page-list-item]');
|
||||||
|
const result1 = await pageList1.count();
|
||||||
|
expect(result1).toBe(1);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('create multi workspace in the workspace list', async ({ page }) => {
|
test('create multi workspace in the workspace list', async ({ page }) => {
|
||||||
|
Loading…
Reference in New Issue
Block a user