|
|
@@ -221,9 +221,8 @@ test('undo and redo after starting an action should not destroy text #6267', asy
|
|
|
|
|
|
// Then type more, start an action prompt, and undo
|
|
|
await page.keyboard.type('text2 ', { delay: 50 })
|
|
|
- for (const char of '[[') {
|
|
|
- await page.keyboard.type(char, { delay: 50 })
|
|
|
- }
|
|
|
+ await page.keyboard.type('[[', { delay: 50 })
|
|
|
+
|
|
|
await expect(page.locator(`[data-modal-name="page-search"]`)).toBeVisible()
|
|
|
if (IsMac) {
|
|
|
await page.keyboard.press('Meta+z')
|
|
|
@@ -254,10 +253,8 @@ test('undo after starting an action should close the action menu #6269', async (
|
|
|
// Open the action modal
|
|
|
await block.mustType('text1 ')
|
|
|
await page.waitForTimeout(550)
|
|
|
- for (const char of commandTrigger) {
|
|
|
- await page.keyboard.type(char)
|
|
|
- await page.waitForTimeout(50)
|
|
|
- }
|
|
|
+ await page.keyboard.type(commandTrigger, { delay: 10 })
|
|
|
+
|
|
|
await page.waitForTimeout(100) // Tolerable delay for the action menu to open
|
|
|
await expect(page.locator(`[data-modal-name="${modalName}"]`)).toBeVisible()
|
|
|
|
|
|
@@ -279,10 +276,8 @@ test('#6266 moving cursor outside of brackets should close autocomplete menu', a
|
|
|
await createRandomPage(page)
|
|
|
|
|
|
await block.mustFill('')
|
|
|
- for (const char of commandTrigger) {
|
|
|
- await page.keyboard.type(char)
|
|
|
- await page.waitForTimeout(10) // Sometimes it doesn't trigger without this
|
|
|
- }
|
|
|
+ await page.keyboard.type(commandTrigger, { delay: 10 })
|
|
|
+
|
|
|
await page.waitForTimeout(100) // Sometimes it doesn't trigger without this
|
|
|
await autocompleteMenu.expectVisible(modalName)
|
|
|
|
|
|
@@ -294,10 +289,8 @@ test('#6266 moving cursor outside of brackets should close autocomplete menu', a
|
|
|
await createRandomPage(page)
|
|
|
|
|
|
await block.mustFill('')
|
|
|
- for (const char of commandTrigger) {
|
|
|
- await page.keyboard.type(char)
|
|
|
- await page.waitForTimeout(10) // Sometimes it doesn't trigger without this
|
|
|
- }
|
|
|
+ await page.keyboard.type(commandTrigger, { delay: 10 })
|
|
|
+
|
|
|
await page.waitForTimeout(100)
|
|
|
await autocompleteMenu.expectVisible(modalName)
|
|
|
|
|
|
@@ -318,10 +311,9 @@ test('#6266 moving cursor outside of parens immediately after searching should s
|
|
|
// TODO: Maybe remove these "text " entries in tests that don't need them
|
|
|
await block.mustFill('')
|
|
|
await page.waitForTimeout(550)
|
|
|
- for (const char of commandTrigger) {
|
|
|
- await page.keyboard.type(char)
|
|
|
- await page.waitForTimeout(10) // Sometimes it doesn't trigger without this
|
|
|
- }
|
|
|
+
|
|
|
+ await page.keyboard.type(commandTrigger, { delay: 10 })
|
|
|
+
|
|
|
await page.waitForTimeout(100)
|
|
|
await page.keyboard.type("some block search text")
|
|
|
await page.waitForTimeout(100) // Sometimes it doesn't trigger without this
|
|
|
@@ -340,10 +332,8 @@ test('pressing up and down should NOT close autocomplete menu', async ({ page, b
|
|
|
|
|
|
// Open the autocomplete menu
|
|
|
await block.mustFill('')
|
|
|
- for (const char of commandTrigger) {
|
|
|
- await page.keyboard.type(char)
|
|
|
- await page.waitForTimeout(10) // Sometimes it doesn't trigger without this
|
|
|
- }
|
|
|
+ await page.keyboard.type(commandTrigger, { delay: 10 })
|
|
|
+
|
|
|
await page.waitForTimeout(100) // Sometimes it doesn't trigger without this
|
|
|
await autocompleteMenu.expectVisible(modalName)
|
|
|
const cursorPos = await block.selectionStart()
|
|
|
@@ -366,10 +356,8 @@ test('moving cursor inside of brackets should NOT close autocomplete menu', asyn
|
|
|
|
|
|
// Open the autocomplete menu
|
|
|
await block.mustFill('')
|
|
|
- for (const char of commandTrigger) {
|
|
|
- await page.keyboard.type(char)
|
|
|
- await page.waitForTimeout(10) // Sometimes it doesn't trigger without this
|
|
|
- }
|
|
|
+ await page.keyboard.type(commandTrigger, { delay: 10 })
|
|
|
+
|
|
|
await page.waitForTimeout(100)
|
|
|
if (commandTrigger === '[[') {
|
|
|
await autocompleteMenu.expectVisible(modalName)
|
|
|
@@ -393,10 +381,8 @@ test('moving cursor inside of brackets when autocomplete menu is closed should N
|
|
|
|
|
|
// Open the autocomplete menu
|
|
|
await block.mustFill('')
|
|
|
- for (const char of commandTrigger) {
|
|
|
- await page.keyboard.type(char)
|
|
|
- await page.waitForTimeout(10) // Sometimes it doesn't trigger without this
|
|
|
- }
|
|
|
+ await page.keyboard.type(commandTrigger, { delay: 10 })
|
|
|
+
|
|
|
await page.waitForTimeout(100) // Sometimes it doesn't trigger without this
|
|
|
await autocompleteMenu.expectVisible(modalName)
|
|
|
|
|
|
@@ -408,16 +394,14 @@ test('moving cursor inside of brackets when autocomplete menu is closed should N
|
|
|
await page.waitForTimeout(100)
|
|
|
await autocompleteMenu.expectHidden(modalName)
|
|
|
|
|
|
- await page.keyboard.press('ArrowLeft')
|
|
|
- await page.waitForTimeout(100)
|
|
|
+ await page.keyboard.press('ArrowLeft', {delay: 50})
|
|
|
await autocompleteMenu.expectHidden(modalName)
|
|
|
|
|
|
- await page.keyboard.press('ArrowLeft')
|
|
|
- await page.waitForTimeout(100)
|
|
|
+ await page.keyboard.press('ArrowLeft', {delay: 50})
|
|
|
await autocompleteMenu.expectHidden(modalName)
|
|
|
|
|
|
// Type a letter, this should open the autocomplete menu
|
|
|
- await page.keyboard.type('z')
|
|
|
+ await page.keyboard.type('z', { delay: 10 })
|
|
|
await page.waitForTimeout(100)
|
|
|
await autocompleteMenu.expectVisible(modalName)
|
|
|
}
|
|
|
@@ -429,14 +413,12 @@ test('selecting text inside of brackets should NOT close autocomplete menu', asy
|
|
|
|
|
|
// Open the autocomplete menu
|
|
|
await block.mustFill('')
|
|
|
- for (const char of commandTrigger) {
|
|
|
- await page.keyboard.type(char)
|
|
|
- await page.waitForTimeout(10) // Sometimes it doesn't trigger without this
|
|
|
- }
|
|
|
+ await page.keyboard.type(commandTrigger, { delay: 10 })
|
|
|
+
|
|
|
await page.waitForTimeout(100)
|
|
|
await autocompleteMenu.expectVisible(modalName)
|
|
|
|
|
|
- await page.keyboard.type("some page search text")
|
|
|
+ await page.keyboard.type("some page search text", {delay: 10})
|
|
|
await page.waitForTimeout(100)
|
|
|
await autocompleteMenu.expectVisible(modalName)
|
|
|
|
|
|
@@ -453,14 +435,12 @@ test('pressing backspace and remaining inside of brackets should NOT close autoc
|
|
|
|
|
|
// Open the autocomplete menu
|
|
|
await block.mustFill('')
|
|
|
- for (const char of commandTrigger) {
|
|
|
- await page.keyboard.type(char)
|
|
|
- await page.waitForTimeout(10) // Sometimes it doesn't trigger without this
|
|
|
- }
|
|
|
+ await page.keyboard.type(commandTrigger, { delay: 10 })
|
|
|
+
|
|
|
await page.waitForTimeout(100)
|
|
|
await autocompleteMenu.expectVisible(modalName)
|
|
|
|
|
|
- await page.keyboard.type("some page search text")
|
|
|
+ await page.keyboard.type("some page search text", {delay: 10})
|
|
|
await page.waitForTimeout(100)
|
|
|
await autocompleteMenu.expectVisible(modalName)
|
|
|
|
|
|
@@ -478,9 +458,8 @@ test('press escape when autocomplete menu is open, should close autocomplete men
|
|
|
// Open the action modal
|
|
|
await block.mustFill('text ')
|
|
|
await page.waitForTimeout(550)
|
|
|
- for (const char of commandTrigger) {
|
|
|
- await page.keyboard.type(char) // Type it one character at a time, because too quickly can fail to trigger it sometimes
|
|
|
- }
|
|
|
+ await page.keyboard.type(commandTrigger, { delay: 10 })
|
|
|
+
|
|
|
await page.waitForTimeout(100)
|
|
|
await expect(page.locator(`[data-modal-name="${modalName}"]`)).toBeVisible()
|
|
|
await page.waitForTimeout(100)
|
|
|
@@ -501,9 +480,8 @@ test('press escape when link/image dialog is open, should restore focus to input
|
|
|
// Open the action modal
|
|
|
await block.mustFill('')
|
|
|
await page.waitForTimeout(550)
|
|
|
- for (const char of commandTrigger) {
|
|
|
- await page.keyboard.type(char) // Type it one character at a time, because too quickly can fail to trigger it sometimes
|
|
|
- }
|
|
|
+ await page.keyboard.type(commandTrigger, { delay: 10 })
|
|
|
+
|
|
|
await page.waitForTimeout(100)
|
|
|
await expect(page.locator(`[data-modal-name="${modalName}"]`)).toBeVisible()
|
|
|
await page.waitForTimeout(100)
|
|
|
@@ -525,12 +503,9 @@ test('should show text after soft return when node is collapsed #5074', async ({
|
|
|
const delay = 100
|
|
|
await createRandomPage(page)
|
|
|
|
|
|
- await page.type('textarea >> nth=0', 'Before soft return')
|
|
|
- await page.waitForTimeout(delay)
|
|
|
- await page.keyboard.press('Shift+Enter')
|
|
|
- await page.waitForTimeout(delay)
|
|
|
- await page.type('textarea >> nth=0', 'After soft return')
|
|
|
- await page.waitForTimeout(delay)
|
|
|
+ await page.type('textarea >> nth=0', 'Before soft return', {delay: 10})
|
|
|
+ await page.keyboard.press('Shift+Enter', {delay: 10})
|
|
|
+ await page.type('textarea >> nth=0', 'After soft return', {delay: 10})
|
|
|
|
|
|
await block.enterNext()
|
|
|
expect(await block.indent()).toBe(true)
|