mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 04:18:54 +00:00
test: move playwright test suite to top level (#2113)
This commit is contained in:
2
tests/fixtures/tsconfig.json
vendored
2
tests/fixtures/tsconfig.json
vendored
@@ -1,4 +1,4 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"include": ["./src"]
|
||||
"include": ["."]
|
||||
}
|
||||
|
||||
16
tests/kit/package.json
Normal file
16
tests/kit/package.json
Normal file
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"name": "@affine-test/kit",
|
||||
"private": true,
|
||||
"version": "0.5.4-canary.9",
|
||||
"exports": {
|
||||
"./playwright": "./playwright.ts"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@playwright/test": "^1.32.3",
|
||||
"playwright": "^1.32.3"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@playwright/test": "*",
|
||||
"playwright": "*"
|
||||
}
|
||||
}
|
||||
4
tests/kit/tsconfig.json
Normal file
4
tests/kit/tsconfig.json
Normal file
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"extends": "../../tsconfig.json",
|
||||
"include": ["./*.ts"]
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
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 { test } from '../../libs/playwright';
|
||||
import {
|
||||
clickNewPageButton,
|
||||
clickSideBarCurrentWorkspaceBanner,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { test } from '@affine-test/kit/playwright';
|
||||
|
||||
import { openHomePage } from '../../libs/load-page';
|
||||
import { waitMarkdownImported } from '../../libs/page-logic';
|
||||
import { test } from '../../libs/playwright';
|
||||
import { clickSideBarAllPageButton } from '../../libs/sidebar';
|
||||
import { createFakeUser, loginUser } from '../../libs/utils';
|
||||
import { enableAffineCloudWorkspace } from '../../libs/workspace';
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
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 { test } from '../../libs/playwright';
|
||||
import { clickNewPageButton } from '../../libs/sidebar';
|
||||
import { createFakeUser, loginUser } from '../../libs/utils';
|
||||
import { createWorkspace } from '../../libs/workspace';
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
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 { test } from '../../libs/playwright';
|
||||
import { clickPublishPanel } from '../../libs/setting';
|
||||
import {
|
||||
clickSideBarAllPageButton,
|
||||
|
||||
@@ -7,7 +7,8 @@ import { waitMarkdownImported } from '../../libs/page-logic';
|
||||
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 { test } from '@affine-test/kit/playwright';
|
||||
|
||||
import {
|
||||
clickNewPageButton,
|
||||
clickSideBarCurrentWorkspaceBanner,
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { test } from '@affine-test/kit/playwright';
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
import { openHomePage } from '../libs/load-page';
|
||||
import { clickPageMoreActions, waitMarkdownImported } from '../libs/page-logic';
|
||||
import { test } from '../libs/playwright';
|
||||
|
||||
test('Switch to edgeless by switch edgeless item', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
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 { test } from '../libs/playwright';
|
||||
|
||||
test('Click right-bottom corner contact icon', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { test } from '@affine-test/kit/playwright';
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
import { test } from '../libs/playwright';
|
||||
|
||||
test('should have page0', async ({ page }) => {
|
||||
await page.goto('http://localhost:8080/_debug/init-page?type=importMarkdown');
|
||||
await page.waitForSelector('v-line');
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { test } from '@affine-test/kit/playwright';
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
import { test } from '../libs/playwright';
|
||||
|
||||
test('should broadcast a message to all debug pages', async ({
|
||||
page,
|
||||
context,
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { test } from '@affine-test/kit/playwright';
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
import { test } from '../libs/playwright';
|
||||
|
||||
test('visit 404 page', async ({ page }) => {
|
||||
await page.goto('http://localhost:8080/404');
|
||||
const notFoundTip = page.locator('[data-testid=notFound]');
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import { test } from '@affine-test/kit/playwright';
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
import { test } from '../libs/playwright';
|
||||
|
||||
test('the link has expired', async ({ page }) => {
|
||||
await page.goto('http://localhost:8080//invite/abc');
|
||||
await page.waitForTimeout(1000);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
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 { test } from '../libs/playwright';
|
||||
|
||||
test('Collapse Sidebar', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { test } from '@affine-test/kit/playwright';
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
import { openHomePage } from '../libs/load-page';
|
||||
import { newPage, waitMarkdownImported } from '../libs/page-logic';
|
||||
import { test } from '../libs/playwright';
|
||||
import { assertCurrentWorkspaceFlavour } from '../libs/workspace';
|
||||
|
||||
test('should create a page with a local first avatar', async ({ page }) => {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { test } from '@affine-test/kit/playwright';
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
import { openHomePage } from '../libs/load-page';
|
||||
@@ -6,7 +7,6 @@ import {
|
||||
newPage,
|
||||
waitMarkdownImported,
|
||||
} from '../libs/page-logic';
|
||||
import { test } from '../libs/playwright';
|
||||
import { assertCurrentWorkspaceFlavour } from '../libs/workspace';
|
||||
|
||||
test('New a page , then delete it in all pages, permanently delete it', async ({
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
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 { test } from '../libs/playwright';
|
||||
import { clickSideBarSettingButton } from '../libs/sidebar';
|
||||
import { assertCurrentWorkspaceFlavour } from '../libs/workspace';
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { test } from '@affine-test/kit/playwright';
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
import { openHomePage } from '../libs/load-page';
|
||||
@@ -7,7 +8,6 @@ import {
|
||||
newPage,
|
||||
waitMarkdownImported,
|
||||
} from '../libs/page-logic';
|
||||
import { test } from '../libs/playwright';
|
||||
import { assertCurrentWorkspaceFlavour } from '../libs/workspace';
|
||||
|
||||
test.skip('New a page ,then open it and export html', async ({ page }) => {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { test } from '@affine-test/kit/playwright';
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
import { openHomePage } from '../libs/load-page';
|
||||
@@ -7,7 +8,6 @@ import {
|
||||
newPage,
|
||||
waitMarkdownImported,
|
||||
} from '../libs/page-logic';
|
||||
import { test } from '../libs/playwright';
|
||||
import { assertCurrentWorkspaceFlavour } from '../libs/workspace';
|
||||
|
||||
test('New a page and open it ,then favorite it', async ({ page }) => {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { test } from '@affine-test/kit/playwright';
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
import { openHomePage } from '../libs/load-page';
|
||||
@@ -7,7 +8,6 @@ import {
|
||||
newPage,
|
||||
waitMarkdownImported,
|
||||
} from '../libs/page-logic';
|
||||
import { test } from '../libs/playwright';
|
||||
import { assertCurrentWorkspaceFlavour } from '../libs/workspace';
|
||||
|
||||
test('Show favorite items in sidebar', async ({ page }) => {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { test } from '@affine-test/kit/playwright';
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
import { openHomePage } from '../libs/load-page';
|
||||
@@ -6,7 +7,6 @@ import {
|
||||
newPage,
|
||||
waitMarkdownImported,
|
||||
} from '../libs/page-logic';
|
||||
import { test } from '../libs/playwright';
|
||||
import { assertCurrentWorkspaceFlavour } from '../libs/workspace';
|
||||
|
||||
test('click btn new page', async ({ page }) => {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { test } from '@affine-test/kit/playwright';
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
import { openHomePage } from '../libs/load-page';
|
||||
@@ -6,7 +7,6 @@ import {
|
||||
newPage,
|
||||
waitMarkdownImported,
|
||||
} from '../libs/page-logic';
|
||||
import { test } from '../libs/playwright';
|
||||
import { assertCurrentWorkspaceFlavour } from '../libs/workspace';
|
||||
|
||||
test('click btn bew page and open in tab', async ({ page }) => {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { test } from '@affine-test/kit/playwright';
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
import { openHomePage } from '../libs/load-page';
|
||||
@@ -6,7 +7,6 @@ import {
|
||||
newPage,
|
||||
waitMarkdownImported,
|
||||
} from '../libs/page-logic';
|
||||
import { test } from '../libs/playwright';
|
||||
import { assertCurrentWorkspaceFlavour } from '../libs/workspace';
|
||||
|
||||
test('New a page , then delete it in all pages, restore it', async ({
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { resolve } from 'node:path';
|
||||
|
||||
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 { test } from '../libs/playwright';
|
||||
import { clickSideBarSettingButton } from '../libs/sidebar';
|
||||
import { testResultDir } from '../libs/utils';
|
||||
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { test } from '@affine-test/kit/playwright';
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
import { openHomePage } from '../libs/load-page';
|
||||
@@ -7,7 +8,6 @@ import {
|
||||
newPage,
|
||||
waitMarkdownImported,
|
||||
} from '../libs/page-logic';
|
||||
import { test } from '../libs/playwright';
|
||||
import { assertCurrentWorkspaceFlavour } from '../libs/workspace';
|
||||
|
||||
test('New a page ,then open it and show delete modal', async ({ page }) => {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { test } from '@affine-test/kit/playwright';
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
import { openHomePage } from '../libs/load-page';
|
||||
@@ -6,7 +7,6 @@ import {
|
||||
newPage,
|
||||
waitMarkdownImported,
|
||||
} from '../libs/page-logic';
|
||||
import { test } from '../libs/playwright';
|
||||
import { assertCurrentWorkspaceFlavour } from '../libs/workspace';
|
||||
|
||||
test('New a page , then delete it in all pages, finally find it in trash', async ({
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
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 { test } from '../libs/playwright';
|
||||
import { clickSideBarAllPageButton } from '../libs/sidebar';
|
||||
import { createWorkspace, openWorkspaceListModal } from '../libs/workspace';
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
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 { test } from '../libs/playwright';
|
||||
import { clickSideBarCurrentWorkspaceBanner } from '../libs/sidebar';
|
||||
import { assertCurrentWorkspaceFlavour } from '../libs/workspace';
|
||||
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
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 { test } from '../libs/playwright';
|
||||
import { createWorkspace } from '../libs/workspace';
|
||||
|
||||
test('Open last workspace when back to affine', async ({ page }) => {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
import { test } from '@affine-test/kit/playwright';
|
||||
import type { Page } from '@playwright/test';
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
import { initHomePageWithPinboard } from '../libs/load-page';
|
||||
import { createPinboardPage } from '../libs/page-logic';
|
||||
import { test } from '../libs/playwright';
|
||||
import { getMetas } from '../libs/utils';
|
||||
|
||||
async function openPinboardPageOperationMenu(page: Page, id: string) {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import { test } from '@affine-test/kit/playwright';
|
||||
import { expect, type Page } from '@playwright/test';
|
||||
|
||||
import { withCtrlOrMeta } from '../libs/keyboard';
|
||||
@@ -7,7 +8,6 @@ import {
|
||||
newPage,
|
||||
waitMarkdownImported,
|
||||
} from '../libs/page-logic';
|
||||
import { test } from '../libs/playwright';
|
||||
|
||||
const openQuickSearchByShortcut = async (page: Page) =>
|
||||
await withCtrlOrMeta(page, () => page.keyboard.press('k', { delay: 50 }));
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import { test } from '@affine-test/kit/playwright';
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
import { openHomePage, webUrl } from '../libs/load-page';
|
||||
import { waitMarkdownImported } from '../libs/page-logic';
|
||||
import { test } from '../libs/playwright';
|
||||
import { clickSideBarAllPageButton } from '../libs/sidebar';
|
||||
|
||||
test('goto not found page', async ({ page }) => {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
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 { test } from '../libs/playwright';
|
||||
|
||||
test('Open shortcuts modal', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
|
||||
@@ -1,8 +1,7 @@
|
||||
import { test } from '@affine-test/kit/playwright';
|
||||
import type { Page } from '@playwright/test';
|
||||
import { expect } from '@playwright/test';
|
||||
|
||||
import { test } from '../../libs/playwright';
|
||||
|
||||
async function openStorybook(page: Page, storyName?: string) {
|
||||
return page.goto(`http://localhost:6006`);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
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 { test } from '../libs/playwright';
|
||||
|
||||
test('Create subpage', async ({ page }) => {
|
||||
await openHomePage(page);
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
import { resolve } from 'node:path';
|
||||
|
||||
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 { test } from '../libs/playwright';
|
||||
import { testResultDir } from '../libs/utils';
|
||||
|
||||
// default could be anything according to the system
|
||||
|
||||
Reference in New Issue
Block a user