-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: support for basic usability testing using playwright (#11)
* feat: support for basic usability testing using playwright * feat: remove unused code
- Loading branch information
Showing
23 changed files
with
771 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,17 +5,17 @@ | |
"license": " MPL-2.0 license", | ||
"private": true, | ||
"packageManager": "[email protected]", | ||
"scripts": { | ||
"build": "pnpm build:esbuild && pnpm build:next && pnpm build:nuxt && pnpm build:rspack && pnpm build:webpack", | ||
"build:esbuild": "pnpm --filter esbuild build", | ||
"build:next": "pnpm --filter next build", | ||
"build:nuxt": "pnpm --filter nuxt build", | ||
"build:rspack": "pnpm --filter rspack build", | ||
"build:webpack": "pnpm --filter webpack build" | ||
}, | ||
"scripts": {}, | ||
"dependencies": { | ||
"@blocksuite/blocks": "nightly", | ||
"@blocksuite/editor": "nightly", | ||
"@blocksuite/global": "^0.9.0", | ||
"@blocksuite/store": "nightly", | ||
"@blocksuite/editor": "nightly" | ||
"@blocksuite/virgo": "^0.9.0" | ||
}, | ||
"devDependencies": { | ||
"@playwright/test": "^1.40.0", | ||
"@types/node": "^20.8.10", | ||
"serve": "^14.2.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/// <reference types="node" /> | ||
import type { PlaywrightWorkerOptions } from '@playwright/test'; | ||
import { defineConfig } from '@playwright/test'; | ||
|
||
export default defineConfig({ | ||
testDir: 'tests', | ||
fullyParallel: true, | ||
use: { | ||
browserName: | ||
(process.env.BROWSER as PlaywrightWorkerOptions['browserName']) ?? | ||
'chromium', | ||
viewport: { width: 960, height: 900 }, | ||
// Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer | ||
// You can open traces locally(`npx playwright show-trace trace.zip`) | ||
// or in your browser on [Playwright Trace Viewer](https://trace.playwright.dev/). | ||
trace: 'on-first-retry', | ||
// Record video only when retrying a test for the first time. | ||
video: 'on-first-retry', | ||
// Timeout for each action | ||
actionTimeout: 5_000, | ||
permissions: ['clipboard-read', 'clipboard-write'], | ||
}, | ||
workers: '80%', | ||
retries: process.env.CI ? 3 : 0, | ||
// 'github' for GitHub Actions CI to generate annotations, plus a concise 'dot' | ||
// default 'list' when running locally | ||
// See https://playwright.dev/docs/test-reporters#github-actions-annotations | ||
reporter: process.env.CI ? 'github' : 'list', | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { test } from '@playwright/test'; | ||
|
||
import { focusRichText } from '../../../tests/utils/misc'; | ||
import { | ||
redoByKeyboard, | ||
type, | ||
undoByKeyboard, | ||
} from '../../../tests/utils/keyboard'; | ||
import { assertText, assertEmpty } from '../../../tests/utils/asserts'; | ||
|
||
const PORT = 3000; | ||
const TEST_URL = `http://localhost:${PORT}`; | ||
|
||
test.describe('webpack build test', () => { | ||
test('basic input & undo/redo', async ({ page }) => { | ||
await page.goto(TEST_URL); | ||
|
||
await focusRichText(page); | ||
await type(page, 'hello'); | ||
|
||
await assertText(page, 'hello'); | ||
await undoByKeyboard(page); | ||
await assertEmpty(page); | ||
await redoByKeyboard(page); | ||
await assertText(page, 'hello'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/// <reference types="node" /> | ||
import type { PlaywrightWorkerOptions } from '@playwright/test'; | ||
import { defineConfig } from '@playwright/test'; | ||
|
||
export default defineConfig({ | ||
testDir: 'tests', | ||
fullyParallel: true, | ||
use: { | ||
browserName: | ||
(process.env.BROWSER as PlaywrightWorkerOptions['browserName']) ?? | ||
'chromium', | ||
viewport: { width: 960, height: 900 }, | ||
// Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer | ||
// You can open traces locally(`npx playwright show-trace trace.zip`) | ||
// or in your browser on [Playwright Trace Viewer](https://trace.playwright.dev/). | ||
trace: 'on-first-retry', | ||
// Record video only when retrying a test for the first time. | ||
video: 'on-first-retry', | ||
// Timeout for each action | ||
actionTimeout: 5_000, | ||
permissions: ['clipboard-read', 'clipboard-write'], | ||
}, | ||
workers: '80%', | ||
retries: process.env.CI ? 3 : 0, | ||
// 'github' for GitHub Actions CI to generate annotations, plus a concise 'dot' | ||
// default 'list' when running locally | ||
// See https://playwright.dev/docs/test-reporters#github-actions-annotations | ||
reporter: process.env.CI ? 'github' : 'list', | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { test } from '@playwright/test'; | ||
|
||
import { focusRichText } from '../../../tests/utils/misc'; | ||
import { | ||
redoByKeyboard, | ||
type, | ||
undoByKeyboard, | ||
} from '../../../tests/utils/keyboard'; | ||
import { assertText, assertEmpty } from '../../../tests/utils/asserts'; | ||
|
||
const PORT = 3002; | ||
const TEST_URL = `http://localhost:${PORT}`; | ||
|
||
test.describe('webpack build test', () => { | ||
test('basic input & undo/redo', async ({ page }) => { | ||
await page.goto(TEST_URL); | ||
|
||
await focusRichText(page); | ||
await type(page, 'hello'); | ||
|
||
await assertText(page, 'hello'); | ||
await undoByKeyboard(page); | ||
await assertEmpty(page); | ||
await redoByKeyboard(page); | ||
await assertText(page, 'hello'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/// <reference types="node" /> | ||
import type { PlaywrightWorkerOptions } from '@playwright/test'; | ||
import { defineConfig } from '@playwright/test'; | ||
|
||
export default defineConfig({ | ||
testDir: 'tests', | ||
fullyParallel: true, | ||
use: { | ||
browserName: | ||
(process.env.BROWSER as PlaywrightWorkerOptions['browserName']) ?? | ||
'chromium', | ||
viewport: { width: 960, height: 900 }, | ||
// Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer | ||
// You can open traces locally(`npx playwright show-trace trace.zip`) | ||
// or in your browser on [Playwright Trace Viewer](https://trace.playwright.dev/). | ||
trace: 'on-first-retry', | ||
// Record video only when retrying a test for the first time. | ||
video: 'on-first-retry', | ||
// Timeout for each action | ||
actionTimeout: 5_000, | ||
permissions: ['clipboard-read', 'clipboard-write'], | ||
}, | ||
workers: '80%', | ||
retries: process.env.CI ? 3 : 0, | ||
// 'github' for GitHub Actions CI to generate annotations, plus a concise 'dot' | ||
// default 'list' when running locally | ||
// See https://playwright.dev/docs/test-reporters#github-actions-annotations | ||
reporter: process.env.CI ? 'github' : 'list', | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { test } from '@playwright/test'; | ||
|
||
import { focusRichText } from '../../../tests/utils/misc'; | ||
import { | ||
redoByKeyboard, | ||
type, | ||
undoByKeyboard, | ||
} from '../../../tests/utils/keyboard'; | ||
import { assertText, assertEmpty } from '../../../tests/utils/asserts'; | ||
|
||
const PORT = 3002; | ||
const TEST_URL = `http://localhost:${PORT}`; | ||
|
||
test.describe('webpack build test', () => { | ||
test('basic input & undo/redo', async ({ page }) => { | ||
await page.goto(TEST_URL); | ||
|
||
await focusRichText(page); | ||
await type(page, 'hello'); | ||
|
||
await assertText(page, 'hello'); | ||
await undoByKeyboard(page); | ||
await assertEmpty(page); | ||
await redoByKeyboard(page); | ||
await assertText(page, 'hello'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/// <reference types="node" /> | ||
import type { PlaywrightWorkerOptions } from '@playwright/test'; | ||
import { defineConfig } from '@playwright/test'; | ||
|
||
export default defineConfig({ | ||
testDir: 'tests', | ||
fullyParallel: true, | ||
use: { | ||
browserName: | ||
(process.env.BROWSER as PlaywrightWorkerOptions['browserName']) ?? | ||
'chromium', | ||
viewport: { width: 960, height: 900 }, | ||
// Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer | ||
// You can open traces locally(`npx playwright show-trace trace.zip`) | ||
// or in your browser on [Playwright Trace Viewer](https://trace.playwright.dev/). | ||
trace: 'on-first-retry', | ||
// Record video only when retrying a test for the first time. | ||
video: 'on-first-retry', | ||
// Timeout for each action | ||
actionTimeout: 5_000, | ||
permissions: ['clipboard-read', 'clipboard-write'], | ||
}, | ||
workers: '80%', | ||
retries: process.env.CI ? 3 : 0, | ||
// 'github' for GitHub Actions CI to generate annotations, plus a concise 'dot' | ||
// default 'list' when running locally | ||
// See https://playwright.dev/docs/test-reporters#github-actions-annotations | ||
reporter: process.env.CI ? 'github' : 'list', | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { test } from '@playwright/test'; | ||
|
||
import { focusRichText } from '../../../tests/utils/misc'; | ||
import { | ||
redoByKeyboard, | ||
type, | ||
undoByKeyboard, | ||
} from '../../../tests/utils/keyboard'; | ||
import { assertText, assertEmpty } from '../../../tests/utils/asserts'; | ||
|
||
const PORT = 3003; | ||
const TEST_URL = `http://localhost:${PORT}`; | ||
|
||
test.describe('webpack build test', () => { | ||
test('basic input & undo/redo', async ({ page }) => { | ||
await page.goto(TEST_URL); | ||
|
||
await focusRichText(page); | ||
await type(page, 'hello'); | ||
|
||
await assertText(page, 'hello'); | ||
await undoByKeyboard(page); | ||
await assertEmpty(page); | ||
await redoByKeyboard(page); | ||
await assertText(page, 'hello'); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/// <reference types="node" /> | ||
import type { PlaywrightWorkerOptions } from '@playwright/test'; | ||
import { defineConfig } from '@playwright/test'; | ||
|
||
export default defineConfig({ | ||
testDir: 'tests', | ||
fullyParallel: true, | ||
use: { | ||
browserName: | ||
(process.env.BROWSER as PlaywrightWorkerOptions['browserName']) ?? | ||
'chromium', | ||
viewport: { width: 960, height: 900 }, | ||
// Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer | ||
// You can open traces locally(`npx playwright show-trace trace.zip`) | ||
// or in your browser on [Playwright Trace Viewer](https://trace.playwright.dev/). | ||
trace: 'on-first-retry', | ||
// Record video only when retrying a test for the first time. | ||
video: 'on-first-retry', | ||
// Timeout for each action | ||
actionTimeout: 5_000, | ||
permissions: ['clipboard-read', 'clipboard-write'], | ||
}, | ||
workers: '80%', | ||
retries: process.env.CI ? 3 : 0, | ||
// 'github' for GitHub Actions CI to generate annotations, plus a concise 'dot' | ||
// default 'list' when running locally | ||
// See https://playwright.dev/docs/test-reporters#github-actions-annotations | ||
reporter: process.env.CI ? 'github' : 'list', | ||
}); |
Oops, something went wrong.