1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2025-09-30 19:22:08 +00:00

chore: add e2e test

Check that emoji suggestion still work and that it is aware of custom emojis.
This commit is contained in:
Gusted 2025-08-10 23:07:58 +02:00
parent 4237603dd6
commit b1a6d66cf5
No known key found for this signature in database
GPG key ID: FD821B732837125F

View file

@ -203,3 +203,36 @@ test('Pull quote reply', async ({page}, workerInfo) => {
await editorTextarea.fill(''); 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');
});