2021-12-20 08:21:07 +00:00
|
|
|
import { expect } from '@playwright/test'
|
|
|
|
import { test } from './fixtures'
|
2021-12-21 00:29:22 +00:00
|
|
|
import { IsMac, createRandomPage, newBlock, newInnerBlock, lastBlock, lastInnerBlock } from './utils'
|
2021-12-20 08:21:07 +00:00
|
|
|
|
|
|
|
|
|
|
|
test('page alias', async ({ page }) => {
|
|
|
|
let hotkeyOpenLink = 'Control+o'
|
|
|
|
let hotkeyBack = 'Control+['
|
|
|
|
if (IsMac) {
|
|
|
|
hotkeyOpenLink = 'Meta+o'
|
|
|
|
hotkeyBack = 'Meta+['
|
|
|
|
}
|
|
|
|
|
|
|
|
// shortcut opening test
|
|
|
|
await createRandomPage(page)
|
|
|
|
|
|
|
|
await page.fill(':nth-match(textarea, 1)', '[[page alias test target page]]')
|
|
|
|
await page.keyboard.press(hotkeyOpenLink)
|
|
|
|
|
|
|
|
// build target Page with alias
|
|
|
|
await page.type(':nth-match(textarea, 1)', 'alias:: [[page alias test alias page]]')
|
|
|
|
await page.press(':nth-match(textarea, 1)', 'Enter') // double Enter for exit property editing
|
|
|
|
await page.press(':nth-match(textarea, 1)', 'Enter')
|
|
|
|
await page.type(':nth-match(textarea, 1)', 'page alias test content')
|
|
|
|
await page.keyboard.press(hotkeyBack)
|
|
|
|
|
|
|
|
// create alias ref in origin Page
|
|
|
|
await newBlock(page)
|
|
|
|
await page.type(':nth-match(textarea, 1)', '[[page alias test alias page]]')
|
|
|
|
await page.keyboard.press(hotkeyOpenLink)
|
|
|
|
|
|
|
|
// shortcut opening test
|
2021-12-21 00:29:22 +00:00
|
|
|
await lastInnerBlock(page)
|
2021-12-20 08:21:07 +00:00
|
|
|
expect(await page.inputValue(':nth-match(textarea, 1)')).toBe('page alias test content')
|
2021-12-21 00:29:22 +00:00
|
|
|
await newInnerBlock(page)
|
2021-12-20 08:21:07 +00:00
|
|
|
await page.type(':nth-match(textarea, 1)', 'yet another page alias test content')
|
|
|
|
await page.keyboard.press(hotkeyBack)
|
|
|
|
|
|
|
|
// pressing enter opening test
|
2021-12-21 00:29:22 +00:00
|
|
|
await lastInnerBlock(page)
|
2021-12-20 08:21:07 +00:00
|
|
|
await page.press(':nth-match(textarea, 1)', 'ArrowLeft')
|
|
|
|
await page.press(':nth-match(textarea, 1)', 'ArrowLeft')
|
|
|
|
await page.press(':nth-match(textarea, 1)', 'ArrowLeft')
|
|
|
|
await page.press(':nth-match(textarea, 1)', 'Enter')
|
2021-12-21 00:29:22 +00:00
|
|
|
await lastInnerBlock(page)
|
2021-12-20 08:21:07 +00:00
|
|
|
expect(await page.inputValue(':nth-match(textarea, 1)')).toBe('yet another page alias test content')
|
2021-12-21 00:29:22 +00:00
|
|
|
await newInnerBlock(page)
|
2021-12-20 08:21:07 +00:00
|
|
|
await page.type(':nth-match(textarea, 1)', 'still another page alias test content')
|
|
|
|
await page.keyboard.press(hotkeyBack)
|
|
|
|
|
|
|
|
// clicking opening test
|
|
|
|
await page.click('.page-blocks-inner .ls-block .page-ref >> nth=-1')
|
2021-12-21 00:29:22 +00:00
|
|
|
await lastInnerBlock(page)
|
2021-12-20 08:21:07 +00:00
|
|
|
expect(await page.inputValue(':nth-match(textarea, 1)')).toBe('still another page alias test content')
|
|
|
|
|
|
|
|
// TODO: test alias from graph clicking
|
|
|
|
// TODO: test alias from search clicking
|
|
|
|
})
|