Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

feat: upload 0.7.0-canary.18 static output (#2883)

Alex Yang20fd9b65743b
diff --git a/.github/actions/setup-node/action.yml b/.github/actions/setup-node/action.yml
index b3fd946c4b..02efa4063a 100644
--- a/.github/actions/setup-node/action.yml
+++ b/.github/actions/setup-node/action.yml
@@ -82,7 +82,7 @@ runs:
id: playwright-version
if: ${{ inputs.playwright-install == 'true' }}
shell: bash
- run: echo "version=$(yarn why --json @playwright/test | grep -h 'workspace:.' | jq --raw-output '.children[].locator' | sed -e 's/@playwright\/test@.*://')" >> $GITHUB_OUTPUT
+ run: echo "version=$(yarn why --json @playwright/test | grep -h 'workspace:.' | jq --raw-output '.children[].locator' | sed -e 's/@playwright\/test@.*://' | head -n 1)" >> $GITHUB_OUTPUT
# Attempt to restore the correct Playwright browser binaries based on the
# currently installed version of Playwright (The browser binary versions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
index ad53f7579e..9d9a686c66 100644
--- a/.github/workflows/build.yml
+++ b/.github/workflows/build.yml
@@ -273,6 +273,26 @@ jobs:
path: ./test-results
if-no-files-found: ignore
+ e2e-migration-test:
+ name: E2E Migration Test
+ runs-on: ubuntu-latest
+ environment: development
+
+ steps:
+ - uses: actions/checkout@v3
+ - name: Setup Node.js
+ uses: ./.github/actions/setup-node
+ with:
+ playwright-install: true
+
+ - name: Unzip
+ run: yarn unzip
+ working-directory: ./tests/affine-legacy/0.7.0-canary.18
+
+ - name: Run legacy playwright tests
+ run: yarn e2e --forbid-only
+ working-directory: ./tests/affine-legacy/0.7.0-canary.18
+
desktop-test:
name: Desktop Test
runs-on: ${{ matrix.spec.os }}
diff --git a/package.json b/package.json
index 324cd420b8..14d558eae0 100644
--- a/package.json
+++ b/package.json
@@ -10,7 +10,8 @@
"plugins/*",
"packages/*",
"tests/fixtures",
- "tests/kit"
+ "tests/kit",
+ "tests/affine-legacy/*"
],
"scripts": {
"dev": "dev-web",
diff --git a/tests/affine-legacy/0.7.0-canary.18/.gitignore b/tests/affine-legacy/0.7.0-canary.18/.gitignore
new file mode 100644
index 0000000000..afadae9297
--- /dev/null
+++ b/tests/affine-legacy/0.7.0-canary.18/.gitignore
@@ -0,0 +1,2 @@
+static
+tests/fixtures/*.ydoc
diff --git a/tests/affine-legacy/0.7.0-canary.18/README.md b/tests/affine-legacy/0.7.0-canary.18/README.md
new file mode 100644
index 0000000000..a69605476c
--- /dev/null
+++ b/tests/affine-legacy/0.7.0-canary.18/README.md
@@ -0,0 +1,7 @@
+# AFFiNE Legacy 0.7.0-canary.18
+
+> This package is static output of AFFiNE 0.7.0-canary.18
+>
+> **This package is for debug only**.
+>
+> DO NOT MODIFY `affine-web.zip`
diff --git a/tests/affine-legacy/0.7.0-canary.18/affine-web.zip b/tests/affine-legacy/0.7.0-canary.18/affine-web.zip
new file mode 100644
index 0000000000..66d36ef0c8
Binary files /dev/null and b/tests/affine-legacy/0.7.0-canary.18/affine-web.zip differ
diff --git a/tests/affine-legacy/0.7.0-canary.18/package.json b/tests/affine-legacy/0.7.0-canary.18/package.json
new file mode 100644
index 0000000000..1ab98386e0
--- /dev/null
+++ b/tests/affine-legacy/0.7.0-canary.18/package.json
@@ -0,0 +1,16 @@
+{
+ "name": "@affine-legacy/0.7.0-canary.18",
+ "description": "AFFiNE 0.7.0-canary.18 static output",
+ "scripts": {
+ "unzip": "unzip affine-web -d static",
+ "start": "yarn exec serve -s static -l 8081",
+ "e2e": "playwright test"
+ },
+ "devDependencies": {
+ "@affine-test/fixtures": "workspace:*",
+ "@affine-test/kit": "workspace:*",
+ "@playwright/test": "=1.33.0",
+ "playwright": "=1.33.0",
+ "serve": "^14.2.0"
+ }
+}
diff --git a/tests/affine-legacy/0.7.0-canary.18/playwright.config.ts b/tests/affine-legacy/0.7.0-canary.18/playwright.config.ts
new file mode 100644
index 0000000000..1aec9a1442
--- /dev/null
+++ b/tests/affine-legacy/0.7.0-canary.18/playwright.config.ts
@@ -0,0 +1,41 @@
+import type {
+ PlaywrightTestConfig,
+ PlaywrightWorkerOptions,
+} from '@playwright/test';
+
+const config: PlaywrightTestConfig = {
+ testDir: './tests',
+ fullyParallel: true,
+ timeout: process.env.CI ? 50_000 : 30_000,
+ use: {
+ baseURL: 'http://localhost:8081/',
+ browserName:
+ (process.env.BROWSER as PlaywrightWorkerOptions['browserName']) ??
+ 'chromium',
+ permissions: ['clipboard-read', 'clipboard-write'],
+ viewport: { width: 1440, height: 800 },
+ actionTimeout: 5 * 1000,
+ locale: 'en-US',
+ trace: 'on-first-retry',
+ video: 'on-first-retry',
+ },
+ forbidOnly: !!process.env.CI,
+ workers: 4,
+ retries: 1,
+ reporter: process.env.CI ? 'github' : 'list',
+ webServer: [
+ {
+ command: 'yarn start',
+ port: 8081,
+ timeout: 120 * 1000,
+ reuseExistingServer: !process.env.CI,
+ },
+ ],
+};
+
+if (process.env.CI) {
+ config.retries = 3;
+ config.workers = '50%';
+}
+
+export default config;
diff --git a/tests/affine-legacy/0.7.0-canary.18/tests/basic.spec.ts b/tests/affine-legacy/0.7.0-canary.18/tests/basic.spec.ts
new file mode 100644
index 0000000000..dd9bb207d6
--- /dev/null
+++ b/tests/affine-legacy/0.7.0-canary.18/tests/basic.spec.ts
@@ -0,0 +1,22 @@
+import { resolve } from 'node:path';
+
+import { test } from '@playwright/test';
+
+test('init page', async ({ page }) => {
+ await page.goto('http://localhost:8081/');
+ await page.waitForSelector('v-line');
+
+ const currentWorkspaceId: string = await page.evaluate(
+ () => (globalThis.currentWorkspace as any).id
+ );
+
+ const downloadPromise = page.waitForEvent('download');
+ await page.evaluate(() => {
+ const workspace = (globalThis.currentWorkspace as any).blockSuiteWorkspace;
+ workspace.exportYDoc();
+ });
+
+ const download = await downloadPromise;
+ const output = resolve(__dirname, 'fixtures', currentWorkspaceId + '.ydoc');
+ await download.saveAs(output);
+});
diff --git a/yarn.lock b/yarn.lock
index 611f3eda04..0e80e1e0f6 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -12,6 +12,18 @@ __metadata:
languageName: node
linkType: hard
+"@affine-legacy/0.7.0-canary.18@workspace:tests/affine-legacy/0.7.0-canary.18":
+ version: 0.0.0-use.local
+ resolution: "@affine-legacy/0.7.0-canary.18@workspace:tests/affine-legacy/0.7.0-canary.18"
+ dependencies:
+ "@affine-test/fixtures": "workspace:*"
+ "@affine-test/kit": "workspace:*"
+ "@playwright/test": =1.33.0
+ playwright: =1.33.0
+ serve: ^14.2.0
+ languageName: unknown
+ linkType: soft
+
"@affine-test/fixtures@workspace:*, @affine-test/fixtures@workspace:tests/fixtures":
version: 0.0.0-use.local
resolution: "@affine-test/fixtures@workspace:tests/fixtures"