refactor page rename

This commit is contained in:
Konstantinos Kaloutas
2023-06-09 16:56:22 +03:00
committed by Gabriel Horner
parent e6a136a37a
commit 5cb107a7b4
4 changed files with 5 additions and 7 deletions

View File

@@ -43,6 +43,7 @@ test('undo/redo of a renamed page should be preserved', async ({ page, block })
await page.waitForTimeout(500) // Wait for 500ms autosave period to expire
await renamePage(page, randomString(10))
await page.click('.ui__confirm-modal button')
await page.keyboard.press(modKey + '+z')
await page.waitForTimeout(100)

View File

@@ -15,6 +15,7 @@ async function page_rename_test(page: Page, original_page_name: string, new_page
// Rename page in UI
await renamePage(page, new_name)
await page.click('.ui__confirm-modal button')
expect(await page.innerText('.page-title .title')).toBe(new_name)
@@ -45,6 +46,7 @@ async function homepage_rename_test(page: Page, original_page_name: string, new_
expect(await page.locator('.home-nav span.flex-1').innerText()).toBe(original_name);
await renamePage(page, new_name)
await page.click('.ui__confirm-modal button')
expect(await page.locator('.home-nav span.flex-1').innerText()).toBe(new_name);

View File

@@ -11,5 +11,4 @@ export async function renamePage(page: Page, new_name: string) {
await page.fill('input[type="text"]', '')
await page.type('.title input', new_name)
await page.keyboard.press('Enter')
await page.click('.ui__confirm-modal button')
}

View File

@@ -1,6 +1,6 @@
import { expect } from '@playwright/test'
import { test } from './fixtures'
import { modKey } from './utils'
import { modKey, renamePage } from './utils'
test('enable whiteboards', async ({ page }) => {
if (await page.$('.nav-header .whiteboard') === null) {
@@ -495,11 +495,7 @@ test('New page should have the correct name', async ({ page }) => {
})
test('Renaming a page to an existing whiteboard name should be prohibited', async ({ page }) => {
await page.click('.ls-page-title .page-title')
await page.waitForSelector('input[type="text"]')
await page.fill('input[type="text"]', '')
await page.type('.title input', "My embedded whiteboard")
await page.keyboard.press('Enter')
await renamePage(page, "My embedded whiteboard")
await expect(page.locator('.page-title input')).toHaveValue('My page')
})