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

This commit is contained in:
Alex Yang
2023-06-28 03:10:08 +08:00
committed by GitHub
parent 26ac56e163
commit 20fd9b6574
10 changed files with 123 additions and 2 deletions

View File

@@ -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

View File

@@ -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 }}

View File

@@ -10,7 +10,8 @@
"plugins/*",
"packages/*",
"tests/fixtures",
"tests/kit"
"tests/kit",
"tests/affine-legacy/*"
],
"scripts": {
"dev": "dev-web",

View File

@@ -0,0 +1,2 @@
static
tests/fixtures/*.ydoc

View File

@@ -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`

Binary file not shown.

View File

@@ -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"
}
}

View File

@@ -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;

View File

@@ -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);
});

View File

@@ -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"