From b1a6d66cf571cc38f0033c194b220e019114db4a Mon Sep 17 00:00:00 2001 From: Gusted Date: Sun, 10 Aug 2025 23:07:58 +0200 Subject: [PATCH] chore: add e2e test Check that emoji suggestion still work and that it is aware of custom emojis. --- tests/e2e/issue-comment.test.e2e.ts | 33 +++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/tests/e2e/issue-comment.test.e2e.ts b/tests/e2e/issue-comment.test.e2e.ts index 2017e4563e..bc2bc3d691 100644 --- a/tests/e2e/issue-comment.test.e2e.ts +++ b/tests/e2e/issue-comment.test.e2e.ts @@ -203,3 +203,36 @@ test('Pull quote reply', async ({page}, workerInfo) => { await editorTextarea.fill(''); }); + +test('Emoji suggestions', async ({page}) => { + const response = await page.goto('/user2/repo1/issues/1'); + expect(response?.status()).toBe(200); + + const textarea = page.locator('#comment-form textarea[name=content]'); + + await textarea.focus(); + await textarea.pressSequentially(':'); + + const suggestionList = page.locator('#comment-form .suggestions'); + await expect(suggestionList).toBeVisible(); + + const expectedSuggestions = [ + {emoji: '👍', name: '+1'}, + {emoji: '👎', name: '-1'}, + {emoji: '💯', name: '100'}, + {emoji: '🔢', name: '1234'}, + {emoji: '🥇', name: '1st_place_medal'}, + {emoji: '🥈', name: '2nd_place_medal'}, + ]; + + for (const {emoji, name} of expectedSuggestions) { + const item = suggestionList.locator(`li:has-text("${name}")`); + await expect(item).toContainText(`${emoji} ${name}`); + } + + await textarea.pressSequentially('forge'); + await expect(suggestionList).toBeVisible(); + + const item = suggestionList.locator(`li:has-text("forgejo")`); + await expect(item.locator('img')).toHaveAttribute('src', '/assets/img/emoji/forgejo.png'); +});