From 1ce1eecf1691b546c5e9fb955bac97888939472c Mon Sep 17 00:00:00 2001 From: Ada Mandala <ada@cubething.dev> Date: Fri, 14 Jun 2024 00:35:55 -0500 Subject: [PATCH] Ensure sub-issues get proper labels when moved to by parent. (#5714) (#5816) Signed-off-by: ada mandala <ada.mandala@pm.me> --- plugins/tracker-resources/src/utils.ts | 4 ++- .../model/tracker/issues-details-page.ts | 1 + tests/sanity/tests/tracker/subissues.spec.ts | 28 +++++++++++++++++++ 3 files changed, 32 insertions(+), 1 deletion(-) diff --git a/plugins/tracker-resources/src/utils.ts b/plugins/tracker-resources/src/utils.ts index b3054bb76d..3246eb3c5f 100644 --- a/plugins/tracker-resources/src/utils.ts +++ b/plugins/tracker-resources/src/utils.ts @@ -569,6 +569,7 @@ async function updateIssuesOnMove ( }, true ) + const number = (incResult as any).object.sequence await updateIssuesOnMove( client, applyOps, @@ -577,7 +578,8 @@ async function updateIssuesOnMove ( { ...updates.get(attached._id as Ref<Issue>), rank: makeRank(lastOne?.rank, undefined), - number: (incResult as any).object.sequence + number, + identifier: `${space.identifier}-${number}` }, updates ) diff --git a/tests/sanity/tests/model/tracker/issues-details-page.ts b/tests/sanity/tests/model/tracker/issues-details-page.ts index 421ab897c9..3aae8afb0c 100644 --- a/tests/sanity/tests/model/tracker/issues-details-page.ts +++ b/tests/sanity/tests/model/tracker/issues-details-page.ts @@ -12,6 +12,7 @@ export class IssuesDetailsPage extends CommonTrackerPage { readonly inputTitle = (): Locator => this.page.locator('div.popupPanel-body input[type="text"]') readonly inputDescription = (): Locator => this.page.locator('div.popupPanel-body div.textInput div.tiptap') + readonly textIdentifier = (): Locator => this.page.locator('div.title.not-active') readonly buttonStatus = (): Locator => this.page.locator('//span[text()="Status"]/../button[1]//span') readonly buttonPriority = (): Locator => this.page.locator('//span[text()="Priority"]/../button[2]//span') readonly buttonAssignee = (): Locator => this.page.locator('(//span[text()="Assignee"]/../div/button)[2]') diff --git a/tests/sanity/tests/tracker/subissues.spec.ts b/tests/sanity/tests/tracker/subissues.spec.ts index f9833dbc2b..e77c9b1d85 100644 --- a/tests/sanity/tests/tracker/subissues.spec.ts +++ b/tests/sanity/tests/tracker/subissues.spec.ts @@ -161,4 +161,32 @@ test.describe('Tracker sub-issues tests', () => { parentIssue: parentIssue.title }) }) + + test('Sub-issues move with parent issue', async ({ page }) => { + const secondProjectName = 'Second Project' + const newIssue: NewIssue = { + title: `Issue for the sub-issue-${generateId()}`, + description: 'Description Issue for the sub-issue' + } + const newSubIssue: NewIssue = { + title: `New Sub-Issue with parameter-${generateId()}`, + description: 'New Description Sub-Issue with parameter' + } + + await leftSideMenuPage.clickTracker() + await issuesPage.clickModelSelectorAll() + await issuesPage.createNewIssue(newIssue) + await issuesPage.searchIssueByName(newIssue.title) + await issuesPage.openIssueByName(newIssue.title) + await issuesDetailsPage.clickButtonAddSubIssue() + + await issuesPage.fillNewIssueForm(newSubIssue) + await issuesPage.clickButtonCreateIssue() + + await issuesDetailsPage.moreActionOnIssue('Move to project') + await issuesDetailsPage.fillMoveIssuesModal(secondProjectName) + + await issuesDetailsPage.openSubIssueByName(newSubIssue.title) + await expect(issuesDetailsPage.textIdentifier()).toHaveText(/SECON-\d+/) + }) })