editor.spec.ts 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. import { expect } from '@playwright/test'
  2. import { test } from './fixtures'
  3. import { createRandomPage, IsMac } from './utils'
  4. test('hashtag and quare brackets in same line #4178', async ({ page }) => {
  5. await createRandomPage(page)
  6. await page.type(':nth-match(textarea, 1)', '#foo bar')
  7. await page.press(':nth-match(textarea, 1)', 'Enter')
  8. await page.type(':nth-match(textarea, 1)', 'bar [[blah]]')
  9. for (let i = 0; i < 12; i++) {
  10. await page.press(':nth-match(textarea, 1)', 'ArrowLeft')
  11. }
  12. await page.type(':nth-match(textarea, 1)', ' ')
  13. await page.press(':nth-match(textarea, 1)', 'ArrowLeft')
  14. await page.type(':nth-match(textarea, 1)', '#')
  15. await page.waitForSelector('text="Search for a page"', { state: 'visible' })
  16. await page.type(':nth-match(textarea, 1)', 'fo')
  17. await page.click('.absolute >> text=' + 'foo')
  18. expect(await page.inputValue(':nth-match(textarea, 1)')).toBe(
  19. '#foo bar [[blah]]'
  20. )
  21. })
  22. // FIXME: ClipboardItem is not defined when running with this test
  23. // test('copy & paste block ref and replace its content', async ({ page }) => {
  24. // await createRandomPage(page)
  25. // await page.type(':nth-match(textarea, 1)', 'Some random text')
  26. // if (IsMac) {
  27. // await page.keyboard.press('Meta+c')
  28. // } else {
  29. // await page.keyboard.press('Control+c')
  30. // }
  31. // await page.pause()
  32. // await page.press(':nth-match(textarea, 1)', 'Enter')
  33. // if (IsMac) {
  34. // await page.keyboard.press('Meta+v')
  35. // } else {
  36. // await page.keyboard.press('Control+v')
  37. // }
  38. // await page.keyboard.press('Escape')
  39. // const blockRef$ = page.locator('.block-ref >> text="Some random text"');
  40. // // Check if the newly created block-ref has the same referenced content
  41. // await expect(blockRef$).toHaveCount(1);
  42. // // Edit the last block
  43. // await blockRef$.press('Enter')
  44. // // Move cursor into the block ref
  45. // for (let i = 0; i < 4; i++) {
  46. // await page.press(':nth-match(textarea, 1)', 'ArrowLeft')
  47. // }
  48. // // Trigger replace-block-reference-with-content-at-point
  49. // if (IsMac) {
  50. // await page.keyboard.press('Meta+Shift+r')
  51. // } else {
  52. // await page.keyboard.press('Control+Shift+v')
  53. // }
  54. // })