diff --git a/e2e-tests/tests/plan-merge.test.ts b/e2e-tests/tests/plan-merge.test.ts index 69f7794193..f6253bb238 100644 --- a/e2e-tests/tests/plan-merge.test.ts +++ b/e2e-tests/tests/plan-merge.test.ts @@ -98,3 +98,64 @@ test.describe.serial('Plan Merge', () => { await expect(page.locator('input[name="start-time"]')).toHaveValue(newActivityStartTime); }); }); + +test.describe.serial('Plan Merge with Deleted Source Plan', () => { + const newActivityStartTime: string = '2022-005T00:00:00'; + const planBranchName = uniqueNamesGenerator({ dictionaries: [adjectives, colors, animals] }); + + test('Add an activity to the parent plan', async () => { + await plan.addActivity('GrowBanana'); + }); + + test('Create a branch', async ({ baseURL }) => { + await plan.createBranch(baseURL, planBranchName); + }); + + test('Change the start time of the activity on the branch', async () => { + await page.waitForTimeout(2000); + const row = await page.getByRole('row', { name: 'GrowBanana' }); + await row.waitFor({ state: 'visible' }); + await row.first().click(); + await page.waitForSelector('.activity-header-title-edit-button:has-text("GrowBanana")', { + state: 'visible', + }); + await page.locator('input[name="start-time"]').click({ position: { x: 2, y: 2 } }); + await page.locator('input[name="start-time"]').fill(newActivityStartTime); + await page.locator('input[name="start-time"]').press('Enter'); + await plan.waitForToast('Activity Directive Updated Successfully'); + }); + + test('Create a merge request from branch to parent plan', async () => { + await page.getByText(planBranchName).first().click(); + await page.getByText('Create merge request').click(); + await page.getByRole('button', { name: 'Create Merge Request' }).click(); + await plan.waitForToast('Merge Request Created Successfully'); + }); + + test('Delete source plan', async () => { + await plans.goto(); + await plans.deletePlan(planBranchName); + }); + + test('Switch to parent plan', async () => { + await plan.goto(); + }); + + test('Start a merge review', async ({ baseURL }) => { + await page.getByRole('button', { name: '1 incoming, 0 outgoing' }).click(); + await page.getByRole('button', { name: 'Review' }).click(); + await page.waitForURL(`${baseURL}/plans/*/merge`); + await page.waitForTimeout(250); + }); + + test('Complete the merge review', async ({ baseURL }) => { + await page.getByRole('button', { name: 'Approve Changes' }).click(); + await page.waitForURL(`${baseURL}/plans/${plans.planId}/merge`); + await page.waitForTimeout(250); + }); + + test('Make sure the start time of the activity in the parent plan now equals the start time of the activity in branch', async () => { + await page.getByRole('gridcell', { name: 'GrowBanana' }).first().click(); + await expect(page.locator('input[name="start-time"]')).toHaveValue(newActivityStartTime); + }); +});