Skip to content

Commit 8bc50ee

Browse files
committed
refactor: separate dc and cloud e2e jira tests
1 parent d8051de commit 8bc50ee

File tree

3 files changed

+58
-23
lines changed

3 files changed

+58
-23
lines changed

e2e/helpers/jira-auth.ts

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,18 @@ import { expect } from '@playwright/test';
33

44
import { closeAllNotifications, openAtlassianSettings } from './common';
55

6+
const BASE_URL: string = 'https://mockedteams.atlassian.net';
7+
const USERNAME: string = '[email protected]';
8+
const PASSWORD: string = '12345';
9+
610
/**
711
* Helper function to authenticate with Jira using the provided credentials
812
*/
913
export const authenticateWithJira = async (
1014
page: Page,
11-
baseUrl: string = 'https://mockedteams.atlassian.net',
12-
username: string = '[email protected]',
13-
password: string = '12345',
15+
baseUrl: string = BASE_URL,
16+
username: string = USERNAME,
17+
password: string = PASSWORD,
1418
) => {
1519
const settingsFrame = await openAtlassianSettings(page, 'Please login to Jira');
1620

@@ -52,9 +56,9 @@ export const authenticateWithJira = async (
5256
*/
5357
export const authenticateWithJiraDC = async (
5458
page: Page,
55-
baseUrl: string = 'https://jira.mockeddomain.com',
56-
username: string = 'dcUser',
57-
password: string = '12345',
59+
baseUrl: string = BASE_URL,
60+
username: string = USERNAME,
61+
password: string = PASSWORD,
5862
) => {
5963
const settingsFrame = await openAtlassianSettings(page, 'Please login to Jira');
6064

e2e/tests/jira/jiraCloud.spec.ts

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
import { test } from '@playwright/test';
2+
import { authenticateWithJira } from 'e2e/helpers';
3+
import {
4+
addComment,
5+
assigningFlow,
6+
attachFile,
7+
authFlowJira,
8+
checkImageInDescription,
9+
createIssue,
10+
renameIssue,
11+
updateDescription,
12+
updateIssueStatus,
13+
updateLabelsFlow,
14+
viewCommentWithImage,
15+
} from 'e2e/scenarios/jira';
16+
17+
export const jiraScenarios = [
18+
{ name: 'Authenticate with Jira', run: authFlowJira },
19+
{ name: 'Create issue', run: createIssue },
20+
{ name: 'Rename issue', run: renameIssue },
21+
{ name: 'Update issue description', run: updateDescription },
22+
{ name: 'Update issue status', run: updateIssueStatus },
23+
{ name: 'Add comment to issue', run: addComment },
24+
{ name: 'View comment with image in issue', run: viewCommentWithImage },
25+
{ name: 'Attach file to issue', run: attachFile },
26+
{ name: 'Assigning issue to myself', run: assigningFlow },
27+
{ name: 'Add and remove existing labels', run: updateLabelsFlow },
28+
{ name: 'Check image in description', run: checkImageInDescription },
29+
];
30+
31+
test.describe('Jira Cloud', () => {
32+
for (const scenario of jiraScenarios) {
33+
test(scenario.name, async ({ page, request }) => {
34+
await authenticateWithJira(page);
35+
await scenario.run(page, request);
36+
});
37+
}
38+
});
Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { test } from '@playwright/test';
2-
import { authenticateWithJira, authenticateWithJiraDC } from 'e2e/helpers';
2+
import { authenticateWithJiraDC } from 'e2e/helpers';
33
import {
44
addComment,
55
assigningFlow,
@@ -14,11 +14,6 @@ import {
1414
// checkImageInDescription,
1515
} from 'e2e/scenarios/jira';
1616

17-
const authTypes = [
18-
{ name: 'Jira Cloud', authFunc: authenticateWithJira },
19-
{ name: 'Jira DC', authFunc: authenticateWithJiraDC },
20-
];
21-
2217
export const jiraScenarios = [
2318
{ name: 'Authenticate with Jira', run: authFlowJira },
2419
{ name: 'Create issue', run: createIssue },
@@ -30,17 +25,15 @@ export const jiraScenarios = [
3025
{ name: 'Attach file to issue', run: attachFile },
3126
{ name: 'Assigning issue to myself', run: assigningFlow },
3227
{ name: 'Add and remove existing labels', run: updateLabelsFlow },
33-
// Skipped for now, because it's not working in Jira DC
28+
// Skipped for now, because it's not working in Jira DC (separate issue)
3429
// { name: 'Check image in description', run: checkImageInDescription },
3530
];
3631

37-
for (const authType of authTypes) {
38-
test.describe(authType.name, () => {
39-
for (const scenario of jiraScenarios) {
40-
test(scenario.name, async ({ page, request }) => {
41-
await authType.authFunc(page);
42-
await scenario.run(page, request);
43-
});
44-
}
45-
});
46-
}
32+
test.describe('Jira DC', () => {
33+
for (const scenario of jiraScenarios) {
34+
test(scenario.name, async ({ page, request }) => {
35+
await authenticateWithJiraDC(page);
36+
await scenario.run(page, request);
37+
});
38+
}
39+
});

0 commit comments

Comments
 (0)