Merge pull request #787 from toeverything/test-coverage
chore: add test coverage check
This commit is contained in:
@@ -1,7 +0,0 @@
|
|||||||
**/webpack.config.js
|
|
||||||
**/scripts/*.js
|
|
||||||
**/node_modules/**
|
|
||||||
.github/**
|
|
||||||
**/__tests__/**
|
|
||||||
**/tests/**
|
|
||||||
|
|
||||||
64
.github/workflows/tests.yml
vendored
64
.github/workflows/tests.yml
vendored
@@ -5,7 +5,58 @@ on:
|
|||||||
pull_request:
|
pull_request:
|
||||||
branches: [master]
|
branches: [master]
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
e2e-test:
|
||||||
|
timeout-minutes: 60
|
||||||
|
runs-on: self-hosted
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- uses: pnpm/action-setup@v2
|
||||||
|
with:
|
||||||
|
version: 'latest'
|
||||||
|
|
||||||
|
- uses: actions/setup-node@v3
|
||||||
|
with:
|
||||||
|
node-version: 16
|
||||||
|
registry-url: https://npm.pkg.github.com
|
||||||
|
scope: '@toeverything'
|
||||||
|
cache: 'pnpm'
|
||||||
|
|
||||||
|
- run: node scripts/module-resolve/ci.cjs
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: pnpm install --no-frozen-lockfile
|
||||||
|
env:
|
||||||
|
NODE_AUTH_TOKEN: ${{ secrets.NPM_GITHUB_AUTH_TOKEN }}
|
||||||
|
|
||||||
|
- name: Install Playwright browsers
|
||||||
|
run: npx playwright install chromium
|
||||||
|
|
||||||
|
- name: Run E2E tests
|
||||||
|
run: pnpm run test:coverage
|
||||||
|
# env:
|
||||||
|
# NEXT_PUBLIC_FIREBASE_API_KEY: ${{ secrets.NEXT_PUBLIC_FIREBASE_API_KEY }}
|
||||||
|
# NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN: ${{ secrets.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN }}
|
||||||
|
# NEXT_PUBLIC_FIREBASE_PROJECT_ID: ${{ secrets.NEXT_PUBLIC_FIREBASE_PROJECT_ID }}
|
||||||
|
# NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET: ${{ secrets.NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET }}
|
||||||
|
# NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID: ${{ secrets.NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID }}
|
||||||
|
# NEXT_PUBLIC_FIREBASE_APP_ID: ${{ secrets.NEXT_PUBLIC_FIREBASE_APP_ID }}
|
||||||
|
# NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID: ${{ secrets.NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID }}
|
||||||
|
|
||||||
|
- name: Collect code coverage report
|
||||||
|
run: pnpm exec nyc report -t .nyc_output --report-dir .coverage --reporter=lcov
|
||||||
|
|
||||||
|
- name: Upload e2e test coverage results
|
||||||
|
uses: codecov/codecov-action@v3
|
||||||
|
with:
|
||||||
|
token: ${{ secrets.CODECOV_TOKEN }}
|
||||||
|
files: ./.coverage/lcov.info
|
||||||
|
flags: e2etest
|
||||||
|
name: affine
|
||||||
|
fail_ci_if_error: true
|
||||||
|
|
||||||
|
unit-test:
|
||||||
timeout-minutes: 60
|
timeout-minutes: 60
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
@@ -33,16 +84,5 @@ jobs:
|
|||||||
- name: Install Playwright browsers
|
- name: Install Playwright browsers
|
||||||
run: npx playwright install chromium
|
run: npx playwright install chromium
|
||||||
|
|
||||||
# - name: Run E2E tests
|
|
||||||
# run: pnpm run test:e2e
|
|
||||||
# env:
|
|
||||||
# NEXT_PUBLIC_FIREBASE_API_KEY: ${{ secrets.NEXT_PUBLIC_FIREBASE_API_KEY }}
|
|
||||||
# NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN: ${{ secrets.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN }}
|
|
||||||
# NEXT_PUBLIC_FIREBASE_PROJECT_ID: ${{ secrets.NEXT_PUBLIC_FIREBASE_PROJECT_ID }}
|
|
||||||
# NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET: ${{ secrets.NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET }}
|
|
||||||
# NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID: ${{ secrets.NEXT_PUBLIC_FIREBASE_MESSAGING_SENDER_ID }}
|
|
||||||
# NEXT_PUBLIC_FIREBASE_APP_ID: ${{ secrets.NEXT_PUBLIC_FIREBASE_APP_ID }}
|
|
||||||
# NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID: ${{ secrets.NEXT_PUBLIC_FIREBASE_MEASUREMENT_ID }}
|
|
||||||
|
|
||||||
- name: Run Unit tests
|
- name: Run Unit tests
|
||||||
run: pnpm run test:unit
|
run: pnpm run test:unit
|
||||||
|
|||||||
2
.gitignore
vendored
2
.gitignore
vendored
@@ -4,6 +4,8 @@
|
|||||||
*dist
|
*dist
|
||||||
/tmp
|
/tmp
|
||||||
/out-tsc
|
/out-tsc
|
||||||
|
.nyc_output
|
||||||
|
.coverage
|
||||||
|
|
||||||
# dependencies
|
# dependencies
|
||||||
node_modules
|
node_modules
|
||||||
|
|||||||
8
.vscode/settings.json
vendored
8
.vscode/settings.json
vendored
@@ -10,5 +10,11 @@
|
|||||||
"pnpm",
|
"pnpm",
|
||||||
"selfhosted",
|
"selfhosted",
|
||||||
"testid"
|
"testid"
|
||||||
]
|
],
|
||||||
|
"explorer.fileNesting.patterns": {
|
||||||
|
"*.js": "${capture}.js.map, ${capture}.min.js, ${capture}.d.ts, ${capture}.d.ts.map",
|
||||||
|
"package.json": ".browserslist*, .circleci*, .codecov, .commitlint*, .cz-config.js, .czrc, .dlint.json, .dprint.json, .editorconfig, .eslint*, .firebase*, .flowconfig, .github*, .gitlab*, .gitpod*, .huskyrc*, .jslint*, .lighthouserc.*, .lintstagedrc*, .markdownlint*, .mocha*, .node-version, .nodemon*, .npm*, .nvmrc, .pm2*, .pnp.*, .pnpm*, .prettier*, .releaserc*, .sentry*, .stackblitz*, .styleci*, .stylelint*, .tazerc*, .textlint*, .tool-versions, .travis*, .versionrc*, .vscode*, .watchman*, .xo-config*, .yamllint*, .yarnrc*, Procfile, api-extractor.json, apollo.config.*, appveyor*, ava.config.*, azure-pipelines*, bower.json, build.config.*, commitlint*, crowdin*, cypress.*, dangerfile*, dlint.json, dprint.json, firebase.json, grunt*, gulp*, histoire.config.*, jasmine.*, jenkins*, jest.config.*, jsconfig.*, karma*, lerna*, lighthouserc.*, lint-staged*, nest-cli.*, netlify*, nodemon*, nx.*, package-lock.json, package.nls*.json, phpcs.xml, playwright.config.*, pm2.*, pnpm*, prettier*, pullapprove*, puppeteer.config.*, pyrightconfig.json, release-tasks.sh, renovate*, rollup.config.*, stylelint*, tsconfig.*, tsdoc.*, tslint*, tsup.config.*, turbo*, typedoc*, unlighthouse*, vercel*, vetur.config.*, vitest.config.*, webpack*, workspace.json, xo.config.*, yarn*, babel.*, .babelrc, project.json",
|
||||||
|
"Cargo.toml": "Cargo.lock",
|
||||||
|
"README.md": "LICENSE, CHANGELOG.md, CODE_OF_CONDUCT.md, CONTRIBUTING.md"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
22
package.json
22
package.json
@@ -8,18 +8,16 @@
|
|||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "pnpm --filter=!@affine/app build && pnpm --filter @affine/app dev",
|
"dev": "pnpm --filter=!@affine/app build && pnpm --filter @affine/app dev",
|
||||||
"dev:ac": "pnpm --filter=!@affine/app build && NODE_API_SERVER=ac pnpm --filter @affine/app dev",
|
"dev:ac": "pnpm --filter=!@affine/app build && NODE_API_SERVER=ac pnpm --filter @affine/app dev",
|
||||||
"dev:local": "pnpm --filter=!@affine/app build && NODE_API_SERVER=local pnpm --filter @affine/app dev",
|
"dev:local": "pnpm --filter=!@affine/app build && cross-env NODE_API_SERVER=local pnpm --filter @affine/app dev",
|
||||||
"build": " pnpm --filter=!@affine/app build && pnpm --filter!=@affine/datacenter -r build",
|
"build": " pnpm --filter=!@affine/app build && pnpm --filter!=@affine/datacenter -r build",
|
||||||
"export": "pnpm --filter @affine/app export",
|
"export": "pnpm --filter @affine/app export",
|
||||||
"start": "pnpm --filter @affine/app start",
|
"start": "pnpm --filter @affine/app start",
|
||||||
"lint": "pnpm --filter @affine/app lint",
|
"lint": "pnpm --filter @affine/app lint",
|
||||||
"test": "playwright test",
|
"test": "playwright test",
|
||||||
"test:dc": "pnpm --filter @affine/datacenter test",
|
"test:coverage": "cross-env COVERAGE=true pnpm test -- --forbid-only",
|
||||||
"test:e2e:codegen": "npx playwright codegen http://localhost:8080",
|
|
||||||
"test:unit": "playwright test --config=playwright.config.unit.ts",
|
"test:unit": "playwright test --config=playwright.config.unit.ts",
|
||||||
"postinstall": "husky install",
|
"postinstall": "husky install",
|
||||||
"notify": "node --experimental-modules scripts/notify.mjs",
|
"notify": "node --experimental-modules scripts/notify.mjs",
|
||||||
"check:ci": "pnpm lint & pnpm test",
|
|
||||||
"update:blocksuite": "pnpm i --filter @affine/app --filter @affine/datacenter @blocksuite/blocks@nightly @blocksuite/store@nightly && pnpm i --filter @affine/app @blocksuite/editor@nightly"
|
"update:blocksuite": "pnpm i --filter @affine/app --filter @affine/datacenter @blocksuite/blocks@nightly @blocksuite/store@nightly && pnpm i --filter @affine/app @blocksuite/editor@nightly"
|
||||||
},
|
},
|
||||||
"lint-staged": {
|
"lint-staged": {
|
||||||
@@ -28,12 +26,13 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@changesets/cli": "^2.26.0",
|
"@changesets/cli": "^2.26.0",
|
||||||
"@jest/globals": "^29.3.1",
|
|
||||||
"@playwright/test": "^1.29.1",
|
"@playwright/test": "^1.29.1",
|
||||||
"@types/eslint": "^8.4.10",
|
"@types/eslint": "^8.4.10",
|
||||||
"@types/node": "^18.11.17",
|
"@types/node": "^18.11.17",
|
||||||
"@typescript-eslint/eslint-plugin": "^5.47.0",
|
"@typescript-eslint/eslint-plugin": "^5.47.0",
|
||||||
"@typescript-eslint/parser": "^5.47.0",
|
"@typescript-eslint/parser": "^5.47.0",
|
||||||
|
"babel-plugin-istanbul": "^6.1.1",
|
||||||
|
"cross-env": "^7.0.3",
|
||||||
"eslint": "^8.30.0",
|
"eslint": "^8.30.0",
|
||||||
"eslint-config-next": "12.3.1",
|
"eslint-config-next": "12.3.1",
|
||||||
"eslint-config-prettier": "^8.5.0",
|
"eslint-config-prettier": "^8.5.0",
|
||||||
@@ -41,8 +40,8 @@
|
|||||||
"fake-indexeddb": "4.0.1",
|
"fake-indexeddb": "4.0.1",
|
||||||
"got": "^12.5.3",
|
"got": "^12.5.3",
|
||||||
"husky": "^8.0.2",
|
"husky": "^8.0.2",
|
||||||
"jest": "^29.3.1",
|
|
||||||
"lint-staged": "^13.1.0",
|
"lint-staged": "^13.1.0",
|
||||||
|
"nyc": "^15.1.0",
|
||||||
"prettier": "^2.7.1",
|
"prettier": "^2.7.1",
|
||||||
"typescript": "^4.9.3"
|
"typescript": "^4.9.3"
|
||||||
},
|
},
|
||||||
@@ -67,9 +66,16 @@
|
|||||||
},
|
},
|
||||||
"reportUnusedDisableDirectives": true,
|
"reportUnusedDisableDirectives": true,
|
||||||
"ignorePatterns": [
|
"ignorePatterns": [
|
||||||
"src/**/*.test.ts",
|
|
||||||
"package/**/dist/*",
|
"package/**/dist/*",
|
||||||
"package/**/sync.js"
|
"package/**/.babelrc.js",
|
||||||
|
"package/**/sync.js",
|
||||||
|
"src/**/*.test.ts",
|
||||||
|
"**/webpack.config.js",
|
||||||
|
"**/scripts/*.js",
|
||||||
|
"**/node_modules/**",
|
||||||
|
".github/**",
|
||||||
|
"**/__tests__/**",
|
||||||
|
"**/tests/**"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
13
packages/app/.babelrc.js
Normal file
13
packages/app/.babelrc.js
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
const plugins = [];
|
||||||
|
|
||||||
|
if (process.env.NODE_ENV === 'development' || process.env.COVERAGE === 'true') {
|
||||||
|
console.log(
|
||||||
|
'Detected development environment. Instrumenting code for coverage.'
|
||||||
|
);
|
||||||
|
plugins.push('istanbul');
|
||||||
|
}
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
presets: ['next/babel'],
|
||||||
|
plugins,
|
||||||
|
};
|
||||||
@@ -12,7 +12,7 @@ const EDITOR_VERSION = enableDebugLocal
|
|||||||
const profileTarget = {
|
const profileTarget = {
|
||||||
ac: '100.85.73.88:12001',
|
ac: '100.85.73.88:12001',
|
||||||
dev: '100.77.180.48:11001',
|
dev: '100.77.180.48:11001',
|
||||||
test: '100.85.73.88:12001',
|
test: '100.77.180.48:11001',
|
||||||
stage: '',
|
stage: '',
|
||||||
pro: 'http://pathfinder.affine.pro',
|
pro: 'http://pathfinder.affine.pro',
|
||||||
local: '127.0.0.1:3000',
|
local: '127.0.0.1:3000',
|
||||||
|
|||||||
@@ -35,6 +35,9 @@ const config: PlaywrightTestConfig = {
|
|||||||
port: 8080,
|
port: 8080,
|
||||||
timeout: 120 * 1000,
|
timeout: 120 * 1000,
|
||||||
reuseExistingServer: !process.env.CI,
|
reuseExistingServer: !process.env.CI,
|
||||||
|
env: {
|
||||||
|
COVERAGE: process.env.COVERAGE || 'false',
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
1247
pnpm-lock.yaml
generated
1247
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -1,10 +1,11 @@
|
|||||||
import { test, expect } from '@playwright/test';
|
import { expect } from '@playwright/test';
|
||||||
|
import { test } from './libs/playwright.js';
|
||||||
import { loadPage } from './libs/load-page.js';
|
import { loadPage } from './libs/load-page.js';
|
||||||
import { clickPageMoreActions } from './libs/page-logic.js';
|
import { clickPageMoreActions } from './libs/page-logic.js';
|
||||||
loadPage();
|
loadPage();
|
||||||
|
|
||||||
test.skip('Change page mode(Paper or Edgeless)', () => {
|
test.describe('Change page mode(Paper or Edgeless)', () => {
|
||||||
test.skip('Switch to edgeless by switch edgeless item', async ({ page }) => {
|
test('Switch to edgeless by switch edgeless item', async ({ page }) => {
|
||||||
const switcher = page.locator('[data-testid=editor-mode-switcher]');
|
const switcher = page.locator('[data-testid=editor-mode-switcher]');
|
||||||
const box = await switcher.boundingBox();
|
const box = await switcher.boundingBox();
|
||||||
expect(box?.x).not.toBeUndefined();
|
expect(box?.x).not.toBeUndefined();
|
||||||
@@ -35,7 +36,7 @@ test.skip('Change page mode(Paper or Edgeless)', () => {
|
|||||||
expect(await edgeless.isVisible()).toBe(true);
|
expect(await edgeless.isVisible()).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
test.skip('Convert to edgeless by editor header items', async ({ page }) => {
|
test('Convert to edgeless by editor header items', async ({ page }) => {
|
||||||
await clickPageMoreActions(page);
|
await clickPageMoreActions(page);
|
||||||
const menusEdgelessItem = page.getByTestId('editor-option-menu-edgeless');
|
const menusEdgelessItem = page.getByTestId('editor-option-menu-edgeless');
|
||||||
await menusEdgelessItem.click();
|
await menusEdgelessItem.click();
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { test, expect } from '@playwright/test';
|
import { expect } from '@playwright/test';
|
||||||
|
import { test } from './libs/playwright.js';
|
||||||
import { loadPage } from './libs/load-page.js';
|
import { loadPage } from './libs/load-page.js';
|
||||||
|
|
||||||
loadPage();
|
loadPage();
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
import { test, expect } from '@playwright/test';
|
import { expect } from '@playwright/test';
|
||||||
|
import { test } from './libs/playwright.js';
|
||||||
import { loadPage } from './libs/load-page.js';
|
import { loadPage } from './libs/load-page.js';
|
||||||
|
|
||||||
loadPage();
|
loadPage();
|
||||||
|
|
||||||
test.skip('Open contact us', () => {
|
test.describe('Open contact us', () => {
|
||||||
test.skip('Click about us', async ({ page }) => {
|
test.skip('Click about us', async ({ page }) => {
|
||||||
const currentWorkspace = page.getByTestId('current-workspace');
|
const currentWorkspace = page.getByTestId('current-workspace');
|
||||||
await currentWorkspace.click();
|
await currentWorkspace.click();
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
import { test, expect } from '@playwright/test';
|
import { expect } from '@playwright/test';
|
||||||
|
import { test } from './libs/playwright.js';
|
||||||
import { loadPage } from './libs/load-page.js';
|
import { loadPage } from './libs/load-page.js';
|
||||||
|
|
||||||
loadPage();
|
loadPage();
|
||||||
|
|
||||||
// ps aux | grep 8080
|
// ps aux | grep 8080
|
||||||
test.skip('exception page', () => {
|
test.describe('exception page', () => {
|
||||||
test('visit 404 page', async ({ page }) => {
|
test('visit 404 page', async ({ page }) => {
|
||||||
await page.goto('http://localhost:8080/404');
|
await page.goto('http://localhost:8080/404');
|
||||||
await page.waitForTimeout(1000);
|
await page.waitForTimeout(1000);
|
||||||
|
|||||||
@@ -1,10 +1,11 @@
|
|||||||
import { test, expect } from '@playwright/test';
|
import { expect } from '@playwright/test';
|
||||||
|
import { test } from './libs/playwright.js';
|
||||||
import { loadPage } from './libs/load-page.js';
|
import { loadPage } from './libs/load-page.js';
|
||||||
|
|
||||||
loadPage();
|
loadPage();
|
||||||
|
|
||||||
// ps aux | grep 8080
|
// ps aux | grep 8080
|
||||||
test.skip('invite code page', () => {
|
test.describe('invite code page', () => {
|
||||||
test('the link has expired', async ({ page }) => {
|
test('the link has expired', async ({ page }) => {
|
||||||
await page.goto('http://localhost:8080//invite/abc');
|
await page.goto('http://localhost:8080//invite/abc');
|
||||||
await page.waitForTimeout(1000);
|
await page.waitForTimeout(1000);
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
import { test, expect } from '@playwright/test';
|
import { expect } from '@playwright/test';
|
||||||
|
import { test } from './libs/playwright.js';
|
||||||
import { loadPage } from './libs/load-page.js';
|
import { loadPage } from './libs/load-page.js';
|
||||||
|
|
||||||
loadPage();
|
loadPage();
|
||||||
|
|
||||||
test.skip('Layout ui', () => {
|
test.describe('Layout ui', () => {
|
||||||
test('Collapse Sidebar', async ({ page }) => {
|
test('Collapse Sidebar', async ({ page }) => {
|
||||||
await page.getByTestId('sliderBar-arrowButton').click();
|
await page.getByTestId('sliderBar-arrowButton').click();
|
||||||
const sliderBarArea = page.getByTestId('sliderBar');
|
const sliderBarArea = page.getByTestId('sliderBar');
|
||||||
|
|||||||
52
tests/libs/playwright.ts
Normal file
52
tests/libs/playwright.ts
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
import { test as baseTest } from '@playwright/test';
|
||||||
|
import fs from 'node:fs';
|
||||||
|
import path from 'node:path';
|
||||||
|
import process from 'node:process';
|
||||||
|
import crypto from 'node:crypto';
|
||||||
|
|
||||||
|
const istanbulTempDir = process.env.ISTANBUL_TEMP_DIR
|
||||||
|
? path.resolve(process.env.ISTANBUL_TEMP_DIR)
|
||||||
|
: path.join(process.cwd(), '.nyc_output');
|
||||||
|
|
||||||
|
function generateUUID() {
|
||||||
|
return crypto.randomUUID();
|
||||||
|
}
|
||||||
|
|
||||||
|
const enableCoverage = !!process.env.CI || !!process.env.COVERAGE;
|
||||||
|
|
||||||
|
export const test = baseTest.extend({
|
||||||
|
context: async ({ context }, use) => {
|
||||||
|
if (enableCoverage) {
|
||||||
|
await context.addInitScript(() =>
|
||||||
|
window.addEventListener('beforeunload', () =>
|
||||||
|
// @ts-expect-error
|
||||||
|
window.collectIstanbulCoverage(JSON.stringify(window.__coverage__))
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
await fs.promises.mkdir(istanbulTempDir, { recursive: true });
|
||||||
|
await context.exposeFunction(
|
||||||
|
'collectIstanbulCoverage',
|
||||||
|
(coverageJSON?: string) => {
|
||||||
|
if (coverageJSON)
|
||||||
|
fs.writeFileSync(
|
||||||
|
path.join(
|
||||||
|
istanbulTempDir,
|
||||||
|
`playwright_coverage_${generateUUID()}.json`
|
||||||
|
),
|
||||||
|
coverageJSON
|
||||||
|
);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
await use(context);
|
||||||
|
if (enableCoverage) {
|
||||||
|
for (const page of context.pages()) {
|
||||||
|
await page.evaluate(() =>
|
||||||
|
// @ts-expect-error
|
||||||
|
window.collectIstanbulCoverage(JSON.stringify(window.__coverage__))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
});
|
||||||
@@ -1,10 +1,11 @@
|
|||||||
import { test, expect } from '@playwright/test';
|
import { expect } from '@playwright/test';
|
||||||
|
import { test } from './libs/playwright.js';
|
||||||
import { loadPage } from './libs/load-page.js';
|
import { loadPage } from './libs/load-page.js';
|
||||||
import { newPage } from './libs/page-logic.js';
|
import { newPage } from './libs/page-logic.js';
|
||||||
|
|
||||||
loadPage();
|
loadPage();
|
||||||
|
|
||||||
test.skip('Local first delete page', () => {
|
test.describe('Local first delete page', () => {
|
||||||
test('New a page , then delete it in all pages, permanently delete it', async ({
|
test('New a page , then delete it in all pages, permanently delete it', async ({
|
||||||
page,
|
page,
|
||||||
}) => {
|
}) => {
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
import { test, expect } from '@playwright/test';
|
import { expect } from '@playwright/test';
|
||||||
|
import { test } from './libs/playwright.js';
|
||||||
import { loadPage } from './libs/load-page.js';
|
import { loadPage } from './libs/load-page.js';
|
||||||
import { newPage, clickPageMoreActions } from './libs/page-logic.js';
|
import { newPage, clickPageMoreActions } from './libs/page-logic.js';
|
||||||
loadPage();
|
loadPage();
|
||||||
|
|
||||||
test.skip('Local first export page', () => {
|
test.describe('Local first export page', () => {
|
||||||
test('New a page ,then open it and export html', async ({ page }) => {
|
test('New a page ,then open it and export html', async ({ page }) => {
|
||||||
await newPage(page);
|
await newPage(page);
|
||||||
await page.getByPlaceholder('Title').click();
|
await page.getByPlaceholder('Title').click();
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
import { test, expect } from '@playwright/test';
|
import { expect } from '@playwright/test';
|
||||||
|
import { test } from './libs/playwright.js';
|
||||||
import { loadPage } from './libs/load-page.js';
|
import { loadPage } from './libs/load-page.js';
|
||||||
import { newPage, clickPageMoreActions } from './libs/page-logic.js';
|
import { newPage, clickPageMoreActions } from './libs/page-logic.js';
|
||||||
loadPage();
|
loadPage();
|
||||||
|
|
||||||
test.skip('Local first favorite and cancel favorite page', () => {
|
test.describe('Local first favorite and cancel favorite page', () => {
|
||||||
test('New a page and open it ,then favorite it', async ({ page }) => {
|
test('New a page and open it ,then favorite it', async ({ page }) => {
|
||||||
await newPage(page);
|
await newPage(page);
|
||||||
await page.getByPlaceholder('Title').click();
|
await page.getByPlaceholder('Title').click();
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
import { test, expect } from '@playwright/test';
|
import { expect } from '@playwright/test';
|
||||||
|
import { test } from './libs/playwright.js';
|
||||||
import { loadPage } from './libs/load-page.js';
|
import { loadPage } from './libs/load-page.js';
|
||||||
import { newPage, clickPageMoreActions } from './libs/page-logic.js';
|
import { newPage, clickPageMoreActions } from './libs/page-logic.js';
|
||||||
loadPage();
|
loadPage();
|
||||||
|
|
||||||
test.skip('Local first favorite items ui', () => {
|
test.describe('Local first favorite items ui', () => {
|
||||||
test('Show favorite items in sidebar', async ({ page }) => {
|
test('Show favorite items in sidebar', async ({ page }) => {
|
||||||
await newPage(page);
|
await newPage(page);
|
||||||
await page.getByPlaceholder('Title').click();
|
await page.getByPlaceholder('Title').click();
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
import { test, expect } from '@playwright/test';
|
import { expect } from '@playwright/test';
|
||||||
|
import { test } from './libs/playwright.js';
|
||||||
import { loadPage } from './libs/load-page.js';
|
import { loadPage } from './libs/load-page.js';
|
||||||
import { newPage } from './libs/page-logic.js';
|
import { newPage } from './libs/page-logic.js';
|
||||||
loadPage();
|
loadPage();
|
||||||
|
|
||||||
test.skip('local first new page', () => {
|
test.describe('local first new page', () => {
|
||||||
test('click btn new page', async ({ page }) => {
|
test('click btn new page', async ({ page }) => {
|
||||||
const originPageId = page.url().split('/').reverse()[0];
|
const originPageId = page.url().split('/').reverse()[0];
|
||||||
await newPage(page);
|
await newPage(page);
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
import { test, expect } from '@playwright/test';
|
import { expect } from '@playwright/test';
|
||||||
|
import { test } from './libs/playwright.js';
|
||||||
import { loadPage } from './libs/load-page.js';
|
import { loadPage } from './libs/load-page.js';
|
||||||
import { newPage } from './libs/page-logic.js';
|
import { newPage } from './libs/page-logic.js';
|
||||||
loadPage();
|
loadPage();
|
||||||
|
|
||||||
test.skip('local first new page', () => {
|
test.describe('local first new page', () => {
|
||||||
test('click btn bew page and open in tab', async ({ page }) => {
|
test('click btn bew page and open in tab', async ({ page }) => {
|
||||||
await newPage(page);
|
await newPage(page);
|
||||||
await page.getByPlaceholder('Title').click();
|
await page.getByPlaceholder('Title').click();
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
import { test, expect } from '@playwright/test';
|
import { expect } from '@playwright/test';
|
||||||
|
import { test } from './libs/playwright.js';
|
||||||
import { loadPage } from './libs/load-page.js';
|
import { loadPage } from './libs/load-page.js';
|
||||||
import { newPage } from './libs/page-logic.js';
|
import { newPage } from './libs/page-logic.js';
|
||||||
loadPage();
|
loadPage();
|
||||||
|
|
||||||
test.skip('Local first delete page', () => {
|
test.describe('Local first delete page', () => {
|
||||||
test('New a page , then delete it in all pages, restore it', async ({
|
test('New a page , then delete it in all pages, restore it', async ({
|
||||||
page,
|
page,
|
||||||
}) => {
|
}) => {
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
import { test, expect } from '@playwright/test';
|
import { expect } from '@playwright/test';
|
||||||
|
import { test } from './libs/playwright.js';
|
||||||
import { loadPage } from './libs/load-page.js';
|
import { loadPage } from './libs/load-page.js';
|
||||||
import { newPage, clickPageMoreActions } from './libs/page-logic.js';
|
import { newPage, clickPageMoreActions } from './libs/page-logic.js';
|
||||||
loadPage();
|
loadPage();
|
||||||
|
|
||||||
test.skip('Local first delete page', () => {
|
test.describe('Local first delete page', () => {
|
||||||
test('New a page ,then open it and show delete modal', async ({ page }) => {
|
test('New a page ,then open it and show delete modal', async ({ page }) => {
|
||||||
await newPage(page);
|
await newPage(page);
|
||||||
await page.getByPlaceholder('Title').click();
|
await page.getByPlaceholder('Title').click();
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
import { test, expect } from '@playwright/test';
|
import { expect } from '@playwright/test';
|
||||||
|
import { test } from './libs/playwright.js';
|
||||||
import { loadPage } from './libs/load-page.js';
|
import { loadPage } from './libs/load-page.js';
|
||||||
import { newPage } from './libs/page-logic.js';
|
import { newPage } from './libs/page-logic.js';
|
||||||
loadPage();
|
loadPage();
|
||||||
|
|
||||||
test.skip('Local first trash page', () => {
|
test.describe('Local first trash page', () => {
|
||||||
test('New a page , then delete it in all pages, finally find it in trash', async ({
|
test('New a page , then delete it in all pages, finally find it in trash', async ({
|
||||||
page,
|
page,
|
||||||
}) => {
|
}) => {
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { test, expect } from '@playwright/test';
|
import { expect } from '@playwright/test';
|
||||||
|
import { test } from './libs/playwright.js';
|
||||||
import { loadPage } from './libs/load-page.js';
|
import { loadPage } from './libs/load-page.js';
|
||||||
|
|
||||||
loadPage();
|
loadPage();
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
import { test, expect } from '@playwright/test';
|
import { test } from './libs/playwright.js';
|
||||||
import { loadPage } from './libs/load-page.js';
|
import { loadPage } from './libs/load-page.js';
|
||||||
|
|
||||||
loadPage();
|
loadPage();
|
||||||
|
|
||||||
test.skip('Login Flow', () => {
|
test.describe('Login Flow', () => {
|
||||||
test.skip('Open login modal by click current workspace', async ({ page }) => {
|
test.skip('Open login modal by click current workspace', async ({ page }) => {
|
||||||
await page.getByTestId('current-workspace').click();
|
await page.getByTestId('current-workspace').click();
|
||||||
await page.waitForTimeout(800);
|
await page.waitForTimeout(800);
|
||||||
@@ -15,7 +15,7 @@ test.skip('Login Flow', () => {
|
|||||||
.click();
|
.click();
|
||||||
});
|
});
|
||||||
|
|
||||||
test('Open login modal by click cloud-unsync-icon', async ({ page }) => {
|
test.skip('Open login modal by click cloud-unsync-icon', async ({ page }) => {
|
||||||
await page.getByTestId('cloud-unsync-icon').click();
|
await page.getByTestId('cloud-unsync-icon').click();
|
||||||
|
|
||||||
await page.waitForTimeout(800);
|
await page.waitForTimeout(800);
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import { test, expect, type Page } from '@playwright/test';
|
import { expect, type Page } from '@playwright/test';
|
||||||
|
import { test } from './libs/playwright.js';
|
||||||
import { loadPage } from './libs/load-page.js';
|
import { loadPage } from './libs/load-page.js';
|
||||||
import { withCtrlOrMeta } from './libs/keyboard.js';
|
import { withCtrlOrMeta } from './libs/keyboard.js';
|
||||||
import { newPage } from './libs/page-logic.js';
|
import { newPage } from './libs/page-logic.js';
|
||||||
@@ -21,7 +22,7 @@ async function assertResultList(page: Page, texts: string[]) {
|
|||||||
expect(actual).toEqual(texts);
|
expect(actual).toEqual(texts);
|
||||||
}
|
}
|
||||||
|
|
||||||
test.skip('Open quick search', () => {
|
test.describe('Open quick search', () => {
|
||||||
test('Click slider bar button', async ({ page }) => {
|
test('Click slider bar button', async ({ page }) => {
|
||||||
await newPage(page);
|
await newPage(page);
|
||||||
const quickSearchButton = page.locator(
|
const quickSearchButton = page.locator(
|
||||||
@@ -50,7 +51,7 @@ test.skip('Open quick search', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test.skip('Add new page in quick search', () => {
|
test.describe('Add new page in quick search', () => {
|
||||||
// FIXME: not working
|
// FIXME: not working
|
||||||
test('Create a new page without keyword', async ({ page }) => {
|
test('Create a new page without keyword', async ({ page }) => {
|
||||||
await newPage(page);
|
await newPage(page);
|
||||||
@@ -72,7 +73,7 @@ test.skip('Add new page in quick search', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test.skip('Search and select', () => {
|
test.describe('Search and select', () => {
|
||||||
test('Create a new page and search this page', async ({ page }) => {
|
test('Create a new page and search this page', async ({ page }) => {
|
||||||
await newPage(page);
|
await newPage(page);
|
||||||
await openQuickSearchByShortcut(page);
|
await openQuickSearchByShortcut(page);
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
import { test, expect } from '@playwright/test';
|
import { expect } from '@playwright/test';
|
||||||
|
import { test } from './libs/playwright.js';
|
||||||
import { loadPage } from './libs/load-page.js';
|
import { loadPage } from './libs/load-page.js';
|
||||||
|
|
||||||
loadPage();
|
loadPage();
|
||||||
|
|
||||||
test.skip('Shortcuts Modal', () => {
|
test.describe('Shortcuts Modal', () => {
|
||||||
test('Open shortcuts modal', async ({ page }) => {
|
test('Open shortcuts modal', async ({ page }) => {
|
||||||
const faqIcon = page.locator('[data-testid=faq-icon]');
|
const faqIcon = page.locator('[data-testid=faq-icon]');
|
||||||
const box = await faqIcon.boundingBox();
|
const box = await faqIcon.boundingBox();
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
import { test, expect } from '@playwright/test';
|
import { expect } from '@playwright/test';
|
||||||
|
import { test } from './libs/playwright.js';
|
||||||
import { loadPage } from './libs/load-page.js';
|
import { loadPage } from './libs/load-page.js';
|
||||||
|
|
||||||
loadPage();
|
loadPage();
|
||||||
|
|
||||||
test.skip('Change Theme', () => {
|
test.describe('Change Theme', () => {
|
||||||
test('default white', async ({ page }) => {
|
test('default white', async ({ page }) => {
|
||||||
await page.waitForSelector('html');
|
await page.waitForSelector('html');
|
||||||
const root = page.locator('html');
|
const root = page.locator('html');
|
||||||
|
|||||||
Reference in New Issue
Block a user