Skip to content

Commit 0402c0f

Browse files
authored
[Origin] AXON-106: Installed editor-plugin-tasks-and-decisions, ADF (#1266)
* AXON-106: Installed editor-plugin-tasks-and-decisions, ADF format, Bumped pi-client * AXON-106: check for build * AXON-106: bump jira-pi-client * AXON-1489: fixed/updated E2E tests
1 parent f6b001d commit 0402c0f

30 files changed

+313
-153
lines changed

e2e/helpers/setup-mock.ts

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -83,15 +83,13 @@ export async function setupIssueMock(
8383
request: APIRequestContext,
8484
updates: Record<string, any>,
8585
method: 'GET' | 'PUT' = 'GET',
86+
type: JiraTypes = JiraTypes.Cloud,
8687
) {
87-
const issueJSON = JSON.parse(fs.readFileSync('e2e/wiremock-mappings/mockedteams/BTS-1/bts1.json', 'utf-8'));
88+
const file = type === JiraTypes.DC ? 'BTS-1/bts1-dc.json' : 'BTS-1/bts1.json';
89+
const issueJSON = JSON.parse(fs.readFileSync(`e2e/wiremock-mappings/mockedteams/${file}`, 'utf-8'));
8890

89-
const { id } = await setupWireMockMapping(
90-
request,
91-
method,
92-
updateIssueField(issueJSON, updates),
93-
'/rest/api/2/issue/BTS-1',
94-
);
91+
const urlPath = type === JiraTypes.DC ? '/rest/api/2/issue/BTS-1' : '/rest/api/3/issue/BTS-1';
92+
const { id } = await setupWireMockMapping(request, method, updateIssueField(issueJSON, updates), urlPath);
9593
return () => cleanupWireMockMapping(request, id);
9694
}
9795

e2e/scenarios/bitbucket/startWorkFlow.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ export async function startWorkFlow(page: Page, type: BitbucketTypes, request: A
5959
).toBeVisible();
6060

6161
// setup mocks for next status
62-
const cleanupIssueMock = await setupIssueMock(request, { status: NEXT_STATUS });
62+
const cleanupIssueMock = await setupIssueMock(request, { status: NEXT_STATUS }, 'GET', type);
6363
const cleanupSearchMock = await setupSearchMock(request, NEXT_STATUS, type);
6464

6565
await page.getByRole('tab', { name: 'Start work on BTS-1', exact: true }).getByLabel(/close/i).click();

e2e/scenarios/jira/attachFile.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,20 @@
11
import { APIRequestContext, Page } from '@playwright/test';
22
import { getIssueFrame, setupIssueMock } from 'e2e/helpers';
3+
import { JiraTypes } from 'e2e/helpers/types';
34
import { attachment } from 'e2e/mock-data/attachment';
45
import { AtlascodeDrawer, AtlassianSettings, JiraIssuePage } from 'e2e/page-objects';
56

67
const FILE_NAME = 'test.jpg';
78
const FILE_PATH = `e2e/wiremock-mappings/mockedteams/test-files/${FILE_NAME}`;
89

9-
export async function attachFile(page: Page, request: APIRequestContext) {
10+
export async function attachFile(page: Page, request: APIRequestContext, type: JiraTypes) {
1011
await new AtlassianSettings(page).closeSettingsPage();
1112
await new AtlascodeDrawer(page).jira.openIssue('BTS-1 - User Interface Bugs');
1213

1314
const issueFrame = await getIssueFrame(page);
1415
const issuePage = new JiraIssuePage(issueFrame);
1516

16-
const cleanupIssueMock = await setupIssueMock(request, { attachment });
17+
const cleanupIssueMock = await setupIssueMock(request, { attachment }, 'GET', type);
1718

1819
await issuePage.content.addAttachment(FILE_PATH);
1920
await page.waitForTimeout(1_000);

e2e/scenarios/jira/checkImageInDescription.spec.ts

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,14 @@ const IMAGE_TEST_ID = 'description-image';
1010
export async function checkImageInDescription(page: Page, request: APIRequestContext, type: JiraTypes) {
1111
await new AtlassianSettings(page).closeSettingsPage();
1212

13-
const cleanupIssueMock = await setupIssueMock(request, {
14-
description: type === JiraTypes.DC ? description.dc : description.cloud,
15-
});
13+
const cleanupIssueMock = await setupIssueMock(
14+
request,
15+
{
16+
description: type === JiraTypes.DC ? description.dc : description.cloud,
17+
},
18+
'GET',
19+
type,
20+
);
1621

1722
await new AtlascodeDrawer(page).jira.openIssue(ISSUE_NAME);
1823

e2e/scenarios/jira/renameIssue.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import { APIRequestContext, Page } from '@playwright/test';
22
import { getIssueFrame, setupIssueMock } from 'e2e/helpers';
3+
import { JiraTypes } from 'e2e/helpers/types';
34
import { AtlascodeDrawer, AtlassianSettings, JiraIssuePage } from 'e2e/page-objects';
45

56
const OLD_TITLE = 'User Interface Bugs';
67
const NEW_TITLE = 'Check if renaming works';
78

8-
export async function renameIssue(page: Page, request: APIRequestContext) {
9+
export async function renameIssue(page: Page, request: APIRequestContext, type: JiraTypes) {
910
await new AtlassianSettings(page).closeSettingsPage();
1011
await new AtlascodeDrawer(page).jira.openIssue('BTS-1 - User Interface Bugs');
1112

@@ -15,7 +16,7 @@ export async function renameIssue(page: Page, request: APIRequestContext) {
1516
await issuePage.title.expectEqual(OLD_TITLE);
1617

1718
// Add the updated mock
18-
const cleanupIssueMock = await setupIssueMock(request, { summary: NEW_TITLE });
19+
const cleanupIssueMock = await setupIssueMock(request, { summary: NEW_TITLE }, 'GET', type);
1920

2021
await issuePage.title.changeTo(NEW_TITLE);
2122
await page.waitForTimeout(2_000);

e2e/scenarios/jira/updateDescription.spec.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
11
import { APIRequestContext, Page } from '@playwright/test';
22
import { getIssueFrame, setupIssueMock } from 'e2e/helpers';
3+
import { JiraTypes } from 'e2e/helpers/types';
34
import { updatedDescription } from 'e2e/mock-data/description';
45
import { AtlascodeDrawer, AtlassianSettings, JiraIssuePage } from 'e2e/page-objects';
56

67
const OLD_DESCRIPTION = 'Track and resolve bugs related to the user interface.';
78
const NEW_DESCRIPTION = 'Add e2e test for this functionality';
89

9-
export async function updateDescription(page: Page, request: APIRequestContext) {
10+
export async function updateDescription(page: Page, request: APIRequestContext, type: JiraTypes) {
1011
await new AtlassianSettings(page).closeSettingsPage();
1112
await new AtlascodeDrawer(page).jira.openIssue('BTS-1 - User Interface Bugs');
1213

@@ -17,7 +18,12 @@ export async function updateDescription(page: Page, request: APIRequestContext)
1718
await issuePage.description.changeTo(NEW_DESCRIPTION);
1819
await page.waitForTimeout(500);
1920

20-
const cleanupIssueMock = await setupIssueMock(request, { description: updatedDescription(NEW_DESCRIPTION) });
21+
const cleanupIssueMock = await setupIssueMock(
22+
request,
23+
{ description: updatedDescription(NEW_DESCRIPTION) },
24+
'GET',
25+
type,
26+
);
2127

2228
await issuePage.saveChanges();
2329
await page.waitForTimeout(1_000);

e2e/scenarios/jira/updateIssueStatus.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ export async function updateIssueStatus(page: Page, request: APIRequestContext,
1919
await jiraIssuePage.status.expectEqual(CURRENT_STATUS);
2020

2121
// setup mocks for next status
22-
const cleanupIssueMock = await setupIssueMock(request, { status: NEXT_STATUS });
22+
const cleanupIssueMock = await setupIssueMock(request, { status: NEXT_STATUS }, 'GET', type);
2323
const cleanupSearchMock = await setupSearchMock(request, NEXT_STATUS, type);
2424

2525
await jiraIssuePage.status.changeTo(NEXT_STATUS);

e2e/scenarios/jira/updateLabelsFlow.spec.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import { APIRequestContext, expect, Page } from '@playwright/test';
22
import { getIssueFrame, setupIssueMock } from 'e2e/helpers';
3+
import { JiraTypes } from 'e2e/helpers/types';
34
import { AtlascodeDrawer, AtlassianSettings } from 'e2e/page-objects';
45

56
const LABELS_FIELD_PLACEHOLDER = 'Type to search';
67
const LABEL = 'testing';
78

8-
export async function updateLabelsFlow(page: Page, request: APIRequestContext) {
9+
export async function updateLabelsFlow(page: Page, request: APIRequestContext, type: JiraTypes) {
910
await new AtlassianSettings(page).closeSettingsPage();
1011

1112
await new AtlascodeDrawer(page).jira.openIssue('BTS-1 - User Interface Bugs');
@@ -29,15 +30,15 @@ export async function updateLabelsFlow(page: Page, request: APIRequestContext) {
2930
// Check the label option is visible and contains the label
3031
await expect(labelOption).toBeVisible();
3132

32-
const cleanupIssueMock = await setupIssueMock(request, { labels: [LABEL] });
33+
const cleanupIssueMock = await setupIssueMock(request, { labels: [LABEL] }, 'GET', type);
3334

3435
await labelOption.click();
3536
await page.waitForTimeout(1000);
3637

3738
// Check the updated label field
3839
await expect(issueFrame.getByText(LABEL, { exact: true })).toBeVisible();
3940

40-
const cleanupIssueMock2 = await setupIssueMock(request, { labels: [LABEL] }, 'PUT');
41+
const cleanupIssueMock2 = await setupIssueMock(request, { labels: [LABEL] }, 'PUT', type);
4142

4243
// Label remove button
4344
await issueFrame.locator('.ac-select__multi-value__remove').click();

e2e/scenarios/jira/viewCommentWithImage.spec.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import { APIRequestContext, expect, Page } from '@playwright/test';
22
import { getIssueFrame, setupIssueMock } from 'e2e/helpers';
3+
import { JiraTypes } from 'e2e/helpers/types';
34
import { AtlascodeDrawer, AtlassianSettings } from 'e2e/page-objects';
45

56
const IMAGE_SRC = 'https://mockedteams.atlassian.net/secure/attachment/10001/test-image.jpg';
67
const COMMENT_CONTENT = `<p><span class="image-wrap" style=""><img src="${IMAGE_SRC}" alt="test-image.jpg" height="360" width="540" style="border: 0px solid black" /></span></p>`;
78

8-
export async function viewCommentWithImage(page: Page, request: APIRequestContext) {
9+
export async function viewCommentWithImage(page: Page, request: APIRequestContext, type: JiraTypes) {
910
await new AtlassianSettings(page).closeSettingsPage();
1011

11-
const cleanupIssueMock = await setupIssueMock(request, { comment: COMMENT_CONTENT });
12+
const cleanupIssueMock = await setupIssueMock(request, { comment: COMMENT_CONTENT }, 'GET', type);
1213

1314
await new AtlascodeDrawer(page).jira.openIssue('BTS-1 - User Interface Bugs');
1415

e2e/wiremock-mappings/mockedteams/BTS-1/bts1-dc.json

Lines changed: 18 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)