mirror of https://github.com/logseq/logseq
chore: add more tests and ids
parent
8c3bc8ad29
commit
1e15062896
|
@ -12,7 +12,7 @@ test('enable whiteboards', async ({ page }) => {
|
|||
|
||||
test('create new whiteboard', async ({ page }) => {
|
||||
await page.click('.nav-header .whiteboard')
|
||||
await page.click('#main-content-container .dashboard-create-card')
|
||||
await page.click('#tl-create-whiteboard')
|
||||
await expect(page.locator('.logseq-tldraw')).toBeVisible()
|
||||
})
|
||||
|
||||
|
@ -24,6 +24,38 @@ test('set whiteboard title', async ({ page }) => {
|
|||
await expect(page.locator('.whiteboard-page-title .title')).toContainText(title);
|
||||
})
|
||||
|
||||
test('select rectangle tool', async ({ page }) => {
|
||||
await page.keyboard.press('R')
|
||||
await expect(page.locator('.tl-geometry-tools-pane-anchor [title="Rectangle (r)"]')).toHaveAttribute('data-selected', 'true')
|
||||
})
|
||||
|
||||
test('draw a rectangle', async ({ page }) => {
|
||||
const canvas = await page.waitForSelector('.logseq-tldraw');
|
||||
const bounds = (await canvas.boundingBox())!;
|
||||
|
||||
await page.keyboard.press('R')
|
||||
|
||||
await page.mouse.move(bounds.x, bounds.y);
|
||||
await page.mouse.down();
|
||||
|
||||
await page.mouse.move(bounds.x + bounds.width / 2, bounds.y + bounds.height / 2);
|
||||
await page.mouse.up();
|
||||
|
||||
await page.keyboard.press('Escape')
|
||||
|
||||
await expect(page.locator('.logseq-tldraw .tl-positioned-svg rect')).toHaveCount(2);
|
||||
})
|
||||
|
||||
test('zoom in', async ({ page }) => {
|
||||
await page.click('#tl-zoom-in')
|
||||
await expect(page.locator('#tl-zoom')).toContainText('125%');
|
||||
})
|
||||
|
||||
test('zoom out', async ({ page }) => {
|
||||
await page.click('#tl-zoom-out')
|
||||
await expect(page.locator('#tl-zoom')).toContainText('100%');
|
||||
})
|
||||
|
||||
test('open context menu', async ({ page }) => {
|
||||
await page.locator('.logseq-tldraw').click({button: "right"})
|
||||
await expect(page.locator('.tl-context-menu')).toBeVisible()
|
||||
|
|
|
@ -120,7 +120,7 @@
|
|||
|
||||
(rum/defc dashboard-create-card
|
||||
[]
|
||||
[:div.dashboard-card.dashboard-create-card.cursor-pointer
|
||||
[:div.dashboard-card.dashboard-create-card.cursor-pointer#tl-create-whiteboard
|
||||
{:on-click
|
||||
(fn [e]
|
||||
(util/stop e)
|
||||
|
|
|
@ -37,10 +37,10 @@ export const ActionBar = observer(function ActionBar(): JSX.Element {
|
|||
</div>
|
||||
|
||||
<div className="tl-zoom-bar">
|
||||
<button title="Zoom in" onClick={zoomIn}>
|
||||
<button title="Zoom in" onClick={zoomIn} id="tl-zoom-in">
|
||||
<TablerIcon name="plus" />
|
||||
</button>
|
||||
<button title="Zoom out" onClick={zoomOut}>
|
||||
<button title="Zoom out" onClick={zoomOut} id="tl-zoom-out">
|
||||
<TablerIcon name="minus" />
|
||||
</button>
|
||||
<ZoomMenu />
|
||||
|
|
|
@ -11,7 +11,7 @@ export const ZoomMenu = observer(function ZoomMenu(): JSX.Element {
|
|||
|
||||
return (
|
||||
<DropdownMenuPrimitive.Root>
|
||||
<DropdownMenuPrimitive.Trigger>
|
||||
<DropdownMenuPrimitive.Trigger id="tl-zoom">
|
||||
{(app.viewport.camera.zoom * 100).toFixed(0) + '%'}
|
||||
</DropdownMenuPrimitive.Trigger>
|
||||
<DropdownMenuPrimitive.Content
|
||||
|
|
Loading…
Reference in New Issue