From 1e0bc3eff215b11645bdd169c805848803ea31cf Mon Sep 17 00:00:00 2001 From: Zihua Li Date: Fri, 22 Sep 2023 12:30:41 +0800 Subject: [PATCH] Add tests for navigating with arrow keys --- e2e/list.spec.ts | 22 +++++++++++++ package-lock.json | 81 +++++++++++++++++------------------------------ package.json | 4 +-- 3 files changed, 53 insertions(+), 54 deletions(-) create mode 100644 e2e/list.spec.ts diff --git a/e2e/list.spec.ts b/e2e/list.spec.ts new file mode 100644 index 0000000000..6063e3339c --- /dev/null +++ b/e2e/list.spec.ts @@ -0,0 +1,22 @@ +import { expect } from '@playwright/test'; +import { test } from './fixtures'; + +test.describe('list', () => { + test.beforeEach(async ({ editorPage }) => { + await editorPage.open(); + }); + + test('cmd + arrow keys to navigate', async ({ page, editorPage }) => { + await editorPage.setContents([ + { insert: 'item 1' }, + { insert: '\n', attributes: { list: 'bullet' } }, + ]); + + await editorPage.moveCursorAfterText('item 1'); + await page.keyboard.press('Control+a'); + expect(await editorPage.getSelection()).toEqual({ index: 0, length: 0 }); + + await page.keyboard.press('Control+e'); + expect(await editorPage.getSelection()).toEqual({ index: 6, length: 0 }); + }); +}); diff --git a/package-lock.json b/package-lock.json index 0837ec0afd..637492cb8b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,7 +24,7 @@ "@babel/core": "^7.22.5", "@babel/preset-env": "^7.22.5", "@babel/preset-typescript": "^7.22.5", - "@playwright/test": "^1.34.3", + "@playwright/test": "^1.38.1", "@types/lodash.clonedeep": "^4.5.7", "@types/lodash.isequal": "^4.5.6", "@types/lodash.merge": "^4.6.7", @@ -47,7 +47,7 @@ "lodash": "^4.17.15", "mini-css-extract-plugin": "^2.7.6", "npm-run-all": "^4.1.5", - "playwright": "^1.36.0", + "playwright": "^1.38.1", "prettier": "^3.0.1", "style-loader": "^3.3.3", "stylus": "^0.59.0", @@ -4247,22 +4247,18 @@ "dev": true }, "node_modules/@playwright/test": { - "version": "1.34.3", - "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.34.3.tgz", - "integrity": "sha512-zPLef6w9P6T/iT6XDYG3mvGOqOyb6eHaV9XtkunYs0+OzxBtrPAAaHotc0X+PJ00WPPnLfFBTl7mf45Mn8DBmw==", + "version": "1.38.1", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.38.1.tgz", + "integrity": "sha512-NqRp8XMwj3AK+zKLbZShl0r/9wKgzqI/527bkptKXomtuo+dOjU9NdMASQ8DNC9z9zLOMbG53T4eihYr3XR+BQ==", "dev": true, "dependencies": { - "@types/node": "*", - "playwright-core": "1.34.3" + "playwright": "1.38.1" }, "bin": { "playwright": "cli.js" }, "engines": { - "node": ">=14" - }, - "optionalDependencies": { - "fsevents": "2.3.2" + "node": ">=16" } }, "node_modules/@pmmmwh/react-refresh-webpack-plugin": { @@ -19222,37 +19218,27 @@ "integrity": "sha512-fnWVljUchTro6RiCFvCXBbNhJc2NijN7oIQxbwsyL0buWJPG85v81ehlHI9fXrJsMNgTofEoWIQeClKpgxFLrg==" }, "node_modules/playwright": { - "version": "1.36.0", - "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.36.0.tgz", - "integrity": "sha512-ODVOTp5WoRMxDJY3liMmC+wVNicc0cQB17gASvQ+zLBggVK9a2x3gdT5mbl7av+zomvtdirWOqqfD+O6qIrFgw==", + "version": "1.38.1", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.38.1.tgz", + "integrity": "sha512-oRMSJmZrOu1FP5iu3UrCx8JEFRIMxLDM0c/3o4bpzU5Tz97BypefWf7TuTNPWeCe279TPal5RtPPZ+9lW/Qkow==", "dev": true, - "hasInstallScript": true, "dependencies": { - "playwright-core": "1.36.0" + "playwright-core": "1.38.1" }, "bin": { "playwright": "cli.js" }, "engines": { "node": ">=16" - } - }, - "node_modules/playwright-core": { - "version": "1.34.3", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.34.3.tgz", - "integrity": "sha512-2pWd6G7OHKemc5x1r1rp8aQcpvDh7goMBZlJv6Co5vCNLVcQJdhxRL09SGaY6HcyHH9aT4tiynZabMofVasBYw==", - "dev": true, - "bin": { - "playwright-core": "cli.js" }, - "engines": { - "node": ">=14" + "optionalDependencies": { + "fsevents": "2.3.2" } }, - "node_modules/playwright/node_modules/playwright-core": { - "version": "1.36.0", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.36.0.tgz", - "integrity": "sha512-7RTr8P6YJPAqB+8j5ATGHqD6LvLLM39sYVNsslh78g8QeLcBs5750c6+msjrHUwwGt+kEbczBj1XB22WMwn+WA==", + "node_modules/playwright-core": { + "version": "1.38.1", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.38.1.tgz", + "integrity": "sha512-tQqNFUKa3OfMf4b2jQ7aGLB8o9bS3bOY0yMEtldtC2+spf8QXG9zvXLTXUeRsoNuxEYMgLYR+NXfAa1rjKRcrg==", "dev": true, "bin": { "playwright-core": "cli.js" @@ -28443,14 +28429,12 @@ } }, "@playwright/test": { - "version": "1.34.3", - "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.34.3.tgz", - "integrity": "sha512-zPLef6w9P6T/iT6XDYG3mvGOqOyb6eHaV9XtkunYs0+OzxBtrPAAaHotc0X+PJ00WPPnLfFBTl7mf45Mn8DBmw==", + "version": "1.38.1", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.38.1.tgz", + "integrity": "sha512-NqRp8XMwj3AK+zKLbZShl0r/9wKgzqI/527bkptKXomtuo+dOjU9NdMASQ8DNC9z9zLOMbG53T4eihYr3XR+BQ==", "dev": true, "requires": { - "@types/node": "*", - "fsevents": "2.3.2", - "playwright-core": "1.34.3" + "playwright": "1.38.1" } }, "@pmmmwh/react-refresh-webpack-plugin": { @@ -39381,26 +39365,19 @@ "integrity": "sha512-fnWVljUchTro6RiCFvCXBbNhJc2NijN7oIQxbwsyL0buWJPG85v81ehlHI9fXrJsMNgTofEoWIQeClKpgxFLrg==" }, "playwright": { - "version": "1.36.0", - "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.36.0.tgz", - "integrity": "sha512-ODVOTp5WoRMxDJY3liMmC+wVNicc0cQB17gASvQ+zLBggVK9a2x3gdT5mbl7av+zomvtdirWOqqfD+O6qIrFgw==", + "version": "1.38.1", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.38.1.tgz", + "integrity": "sha512-oRMSJmZrOu1FP5iu3UrCx8JEFRIMxLDM0c/3o4bpzU5Tz97BypefWf7TuTNPWeCe279TPal5RtPPZ+9lW/Qkow==", "dev": true, "requires": { - "playwright-core": "1.36.0" - }, - "dependencies": { - "playwright-core": { - "version": "1.36.0", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.36.0.tgz", - "integrity": "sha512-7RTr8P6YJPAqB+8j5ATGHqD6LvLLM39sYVNsslh78g8QeLcBs5750c6+msjrHUwwGt+kEbczBj1XB22WMwn+WA==", - "dev": true - } + "fsevents": "2.3.2", + "playwright-core": "1.38.1" } }, "playwright-core": { - "version": "1.34.3", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.34.3.tgz", - "integrity": "sha512-2pWd6G7OHKemc5x1r1rp8aQcpvDh7goMBZlJv6Co5vCNLVcQJdhxRL09SGaY6HcyHH9aT4tiynZabMofVasBYw==", + "version": "1.38.1", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.38.1.tgz", + "integrity": "sha512-tQqNFUKa3OfMf4b2jQ7aGLB8o9bS3bOY0yMEtldtC2+spf8QXG9zvXLTXUeRsoNuxEYMgLYR+NXfAa1rjKRcrg==", "dev": true }, "postcss": { diff --git a/package.json b/package.json index bc0b8bc8ef..53004ac22c 100644 --- a/package.json +++ b/package.json @@ -28,7 +28,7 @@ "@babel/core": "^7.22.5", "@babel/preset-env": "^7.22.5", "@babel/preset-typescript": "^7.22.5", - "@playwright/test": "^1.34.3", + "@playwright/test": "^1.38.1", "@types/lodash.clonedeep": "^4.5.7", "@types/lodash.isequal": "^4.5.6", "@types/lodash.merge": "^4.6.7", @@ -51,7 +51,7 @@ "lodash": "^4.17.15", "mini-css-extract-plugin": "^2.7.6", "npm-run-all": "^4.1.5", - "playwright": "^1.36.0", + "playwright": "^1.38.1", "prettier": "^3.0.1", "style-loader": "^3.3.3", "stylus": "^0.59.0",