page-rename.spec.ts 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. import { expect } from '@playwright/test'
  2. import { test } from './fixtures'
  3. import { IsMac, createPage, newBlock, newInnerBlock, randomString, lastBlock } from './utils'
  4. /***
  5. * Test rename feature
  6. ***/
  7. async function page_rename_test(page, original_page_name: string, new_page_name: string) {
  8. let selectAll = 'Control+a'
  9. if (IsMac) {
  10. selectAll = 'Meta+a'
  11. }
  12. const rand = randomString(10)
  13. let original_name = original_page_name + rand
  14. let new_name = new_page_name + rand
  15. await createPage(page, original_name)
  16. await page.click('.page-title .title')
  17. await page.waitForSelector('input[type="text"]')
  18. await page.keyboard.press(selectAll)
  19. await page.keyboard.press('Backspace')
  20. await page.type('.title input', new_name)
  21. await page.keyboard.press('Enter')
  22. await page.click('.ui__confirm-modal button')
  23. expect(await page.innerText('.page-title .title')).toBe(new_name)
  24. // TODO: Test if page is renamed in re-entrance
  25. // TODO: Test if page is hierarchy
  26. }
  27. test('page rename test', async ({ page }) => {
  28. await page_rename_test(page, "abcd", "a.b.c.d")
  29. await page_rename_test(page, "abcd", "a/b/c/d")
  30. })