浏览代码

chore: add tests

Konstantinos Kaloutas 2 年之前
父节点
当前提交
83e33905b2
共有 1 个文件被更改,包括 30 次插入0 次删除
  1. 30 0
      e2e-tests/whiteboards.spec.ts

+ 30 - 0
e2e-tests/whiteboards.spec.ts

@@ -126,6 +126,36 @@ test('clone the rectangle', async ({ page }) => {
   await expect(page.locator('.logseq-tldraw .tl-box-container')).toHaveCount(2)
 })
 
+test('group the rectangles', async ({ page }) => {
+  await page.keyboard.press(modKey + '+a')
+  await page.keyboard.press(modKey + '+g')
+
+  await expect(page.locator('.logseq-tldraw .tl-group-container')).toHaveCount(1)
+})
+
+test('deleting the group', async ({ page }) => {
+  await page.keyboard.press(modKey + '+a')
+  await page.keyboard.press(modKey + '+g')
+
+  // should also delete the grouped shapes
+  await expect(page.locator('.logseq-tldraw .tl-group-container')).toHaveCount(0)
+  await expect(page.locator('.logseq-tldraw .tl-box-container')).toHaveCount(0)
+})
+
+test('undo the group deletion', async ({ page }) => {
+  await page.keyboard.press(modKey + '+z')
+
+  await expect(page.locator('.logseq-tldraw .tl-group-container')).toHaveCount(1)
+  await expect(page.locator('.logseq-tldraw .tl-box-container')).toHaveCount(2)
+})
+
+test('undo the group cation', async ({ page }) => {
+  await page.keyboard.press(modKey + '+z')
+
+  await expect(page.locator('.logseq-tldraw .tl-group-container')).toHaveCount(0)
+  await expect(page.locator('.logseq-tldraw .tl-box-container')).toHaveCount(2)
+})
+
 test('connect rectangles with an arrow', async ({ page }) => {
   const canvas = await page.waitForSelector('.logseq-tldraw')
   const bounds = (await canvas.boundingBox())!