Skip to content

Commit

Permalink
Add e2e test
Browse files Browse the repository at this point in the history
  • Loading branch information
AaronPlave committed Oct 31, 2024
1 parent ec1dabe commit a26aef5
Showing 1 changed file with 61 additions and 0 deletions.
61 changes: 61 additions & 0 deletions e2e-tests/tests/plan-merge.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});

0 comments on commit a26aef5

Please sign in to comment.