feat: add preloading template

This commit is contained in:
Flrande
2023-06-07 17:31:54 +08:00
committed by himself65
parent ead106b940
commit e6cd2ace7d
67 changed files with 6732 additions and 385 deletions
@@ -2,7 +2,7 @@ import { test } from '@affine-test/kit/playwright';
import { expect } from '@playwright/test';
import { openHomePage } from '../../libs/load-page';
import { waitMarkdownImported } from '../../libs/page-logic';
import { waitEditorLoad } from '../../libs/page-logic';
import {
clickNewPageButton,
clickSideBarCurrentWorkspaceBanner,
@@ -11,7 +11,7 @@ import { getBuiltInUser, loginUser } from '../../libs/utils';
test('collaborative', async ({ page, browser }) => {
await openHomePage(page);
await waitMarkdownImported(page);
await waitEditorLoad(page);
const [a, b] = await getBuiltInUser();
await loginUser(page, a);
await page.reload();
@@ -2,14 +2,14 @@ import { test } from '@affine-test/kit/playwright';
import { expect } from '@playwright/test';
import { openHomePage } from '../../libs/load-page';
import { waitMarkdownImported } from '../../libs/page-logic';
import { waitEditorLoad } from '../../libs/page-logic';
import { clickSideBarAllPageButton } from '../../libs/sidebar';
import { createFakeUser, loginUser } from '../../libs/utils';
import { enableAffineCloudWorkspace } from '../../libs/workspace';
test('authorization expired', async ({ page }) => {
await openHomePage(page);
await waitMarkdownImported(page);
await waitEditorLoad(page);
const [a] = await createFakeUser();
await loginUser(page, a);
await enableAffineCloudWorkspace(page);
@@ -2,7 +2,7 @@ import { test } from '@affine-test/kit/playwright';
import { expect } from '@playwright/test';
import { openHomePage } from '../../libs/load-page';
import { waitMarkdownImported } from '../../libs/page-logic';
import { waitEditorLoad } from '../../libs/page-logic';
import { clickNewPageButton } from '../../libs/sidebar';
import { createFakeUser, loginUser } from '../../libs/utils';
import { createWorkspace } from '../../libs/workspace';
@@ -13,7 +13,7 @@ test('public single page', async ({ page, browser }) => {
await loginUser(page, a);
const name = `test-${Date.now()}`;
await createWorkspace({ name }, page);
await waitMarkdownImported(page);
await waitEditorLoad(page);
await clickNewPageButton(page);
const page1Id = page.url().split('/').at(-1);
await clickNewPageButton(page);
@@ -2,7 +2,7 @@ import { test } from '@affine-test/kit/playwright';
import { expect } from '@playwright/test';
import { openHomePage } from '../../libs/load-page';
import { waitMarkdownImported } from '../../libs/page-logic';
import { waitEditorLoad } from '../../libs/page-logic';
import { clickPublishPanel } from '../../libs/setting';
import {
clickSideBarAllPageButton,
@@ -15,10 +15,10 @@ test('enable public workspace', async ({ page, context }) => {
await openHomePage(page);
const [a] = await createFakeUser();
await loginUser(page, a);
await waitMarkdownImported(page);
await waitEditorLoad(page);
const name = `test-${Date.now()}`;
await createWorkspace({ name }, page);
await waitMarkdownImported(page);
await waitEditorLoad(page);
await clickSideBarSettingButton(page);
await page.waitForTimeout(50);
await clickPublishPanel(page);
@@ -45,10 +45,10 @@ test('access public workspace page', async ({ page, browser }) => {
await openHomePage(page);
const [a] = await createFakeUser();
await loginUser(page, a);
await waitMarkdownImported(page);
await waitEditorLoad(page);
const name = `test-${Date.now()}`;
await createWorkspace({ name }, page);
await waitMarkdownImported(page);
await waitEditorLoad(page);
await clickSideBarSettingButton(page);
await page.waitForTimeout(50);
await clickPublishPanel(page);
@@ -1,7 +1,7 @@
import { expect } from '@playwright/test';
import { openHomePage } from '../../libs/load-page';
import { waitMarkdownImported } from '../../libs/page-logic';
import { waitEditorLoad } from '../../libs/page-logic';
// eslint-disable-next-line @typescript-eslint/no-var-requires
const userA = require('../../fixtures/userA.json');
@@ -23,7 +23,7 @@ import {
test('should login with user A', async ({ page }) => {
await openHomePage(page);
await waitMarkdownImported(page);
await waitEditorLoad(page);
const [a] = await createFakeUser(userA, userB);
await loginUser(page, a);
await clickSideBarCurrentWorkspaceBanner(page);
@@ -35,7 +35,7 @@ test('should login with user A', async ({ page }) => {
test('should enable affine workspace successfully', async ({ page }) => {
await openHomePage(page);
await waitMarkdownImported(page);
await waitEditorLoad(page);
const [a] = await createFakeUser();
await loginUser(page, a);
const name = `test-${Date.now()}`;
@@ -50,6 +50,6 @@ test('should enable affine workspace successfully', async ({ page }) => {
await assertCurrentWorkspaceFlavour('affine', page);
await openWorkspaceListModal(page);
await page.getByTestId('workspace-list-modal-sign-out').click();
await waitMarkdownImported(page);
await waitEditorLoad(page);
await assertCurrentWorkspaceFlavour('local', page);
});