From 7f02f4722cf85f9b3db7b81935e4520b28a1f8d6 Mon Sep 17 00:00:00 2001 From: Sai Nane Date: Fri, 30 Aug 2024 12:53:40 +0000 Subject: [PATCH] Test: Milestone assignment in new issue This test currently fails, as expected, given this functionality is currently broken. --- tests/e2e/issue-sidebar.test.e2e.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/tests/e2e/issue-sidebar.test.e2e.js b/tests/e2e/issue-sidebar.test.e2e.js index 3bda7bdd17..0311910a34 100644 --- a/tests/e2e/issue-sidebar.test.e2e.js +++ b/tests/e2e/issue-sidebar.test.e2e.js @@ -119,3 +119,25 @@ test('Issue: Milestone', async ({browser}, workerInfo) => { await expect(selectedMilestone).toContainText('No milestone'); await expect(page.locator('.timeline-item.event').last()).toContainText('user2 removed this from the milestone1 milestone'); }); + +test('New Issue: Milestone', async ({browser}, workerInfo) => { + test.skip(workerInfo.project.name === 'Mobile Safari', 'Unable to get tests working on Safari Mobile, see https://codeberg.org/forgejo/forgejo/pulls/3445#issuecomment-1789636'); + const page = await login({browser}, workerInfo); + + const response = await page.goto('/user2/repo1/issues/new'); + await expect(response?.status()).toBe(200); + + const selectedMilestone = page.locator('.issue-content-right .select-milestone.list'); + const milestoneDropdown = page.locator('.issue-content-right .select-milestone.dropdown'); + await expect(selectedMilestone).toContainText('No milestone'); + + // Add milestone. + await milestoneDropdown.click(); + await page.getByRole('option', {name: 'milestone1'}).click(); + await expect(selectedMilestone).toContainText('milestone1'); + + // Clear milestone. + await milestoneDropdown.click(); + await page.getByText('Clear milestone', {exact: true}).click(); + await expect(selectedMilestone).toContainText('No milestone'); +});