Skip to content

Commit f59006f

Browse files
committed
AXON-537 added e2e test for pullrequest creation
1 parent e5d070f commit f59006f

31 files changed

+1331
-8
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { test as base } from '@playwright/test';
2+
3+
export const test = base.extend<{ forEachTest: void }>({
4+
forEachTest: [
5+
async ({ page }, use) => {
6+
await use();
7+
8+
// after test script
9+
await page.getByRole('button', { name: 'Manage' }).click();
10+
await page.waitForTimeout(250);
11+
await page.getByRole('menuitem', { name: 'Command Palette' }).click();
12+
await page.waitForTimeout(500);
13+
await page.keyboard.type('Workspaces: Close Workspace');
14+
await page.waitForTimeout(250);
15+
await page.keyboard.press('Enter');
16+
await page.waitForTimeout(1500);
17+
},
18+
{ auto: true },
19+
],
20+
});

e2e/helpers/create-pr.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import type { Page } from '@playwright/test';
2+
3+
export const createPullrequest = async (page: Page) => {
4+
const createPRFrame = page.frameLocator('iframe.webview').frameLocator('iframe[title="Create pull request"]');
5+
await createPRFrame.getByRole('combobox').filter({ hasText: 'Source branch' }).locator('input').click();
6+
await page.waitForTimeout(250);
7+
8+
await createPRFrame.getByRole('option', { name: 'test-branch' }).click();
9+
await page.waitForTimeout(250);
10+
11+
await createPRFrame
12+
.locator('div:has-text("Push latest changes from local to remote branch")')
13+
.locator('input[type="checkbox"]')
14+
.first()
15+
.click();
16+
17+
await createPRFrame.getByRole('button', { name: 'Create pull request' }).click();
18+
await page.waitForTimeout(250);
19+
};

e2e/helpers/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
export { updateIssueField } from './update-jira-issue';
22
export { authenticateWithBitbucketDC, authenticateWithBitbucketCloud } from './bitbucket-auth';
33
export { connectRepository } from './bitbucket-connect-repository';
4+
export { createPullrequest } from './create-pr';
45
export { authenticateWithJira } from './jira-auth';
56
export { getIssueFrame, openAtlassianSettings } from './common';
67
export { cleanupWireMockMapping, setupWireMockMapping, setupSearchMock, setupIssueMock } from './setup-mock';

e2e/helpers/update-jira-issue.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { defaultComment } from '../fixtures/comments';
1+
import { defaultComment } from '../mock-data/comments';
22
import type { FieldUpdater } from './types';
33

44
const updateAttachment: FieldUpdater = (issue, value) => {
File renamed without changes.
File renamed without changes.
File renamed without changes.

e2e/setup-mock-repository.sh

100644100755
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
set -e
33

44
echo "Setting up global git configuration..."
5-
git config --global user.name "Test User"
6-
git config --global user.email "[email protected]"
5+
git config --global user.name "Mock User"
6+
git config --global user.email "[email protected]"
77
git config --global init.defaultBranch main
88

99
echo "Creating mock repository that simulates a Bitbucket clone..."
@@ -14,7 +14,7 @@ cd /mock-repository
1414
git init
1515

1616
# Add remote and configure it properly (like git clone does)
17-
git remote add origin [email protected]/test-repository.git
17+
git remote add origin [email protected]:mockuser/test-repository.git
1818
git config branch.main.remote origin
1919
git config branch.main.merge refs/heads/main
2020
git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { expect } from '@playwright/test';
2+
import { authenticateWithBitbucketCloud, connectRepository, createPullrequest } from 'e2e/helpers';
3+
4+
import { test } from '../../fixtures/repository-disconnection';
5+
6+
test('PR creation works', async ({ page, context }) => {
7+
await authenticateWithBitbucketCloud(page, context);
8+
await page.getByRole('tab', { name: 'Atlassian Settings' }).getByLabel(/close/i).click();
9+
10+
await connectRepository(page);
11+
12+
await page.getByRole('treeitem', { name: 'Create pull request' }).click();
13+
14+
await createPullrequest(page);
15+
await page.waitForTimeout(250);
16+
17+
await expect(
18+
page
19+
.frameLocator('iframe.webview')
20+
.frameLocator('iframe[title="Pull Request 123"]')
21+
.getByText('test-repository: Pull request #123'),
22+
).toBeVisible();
23+
});

e2e/tests/bitbucket/repositoryConnection.spec.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1-
import { expect, test } from '@playwright/test';
1+
import { expect } from '@playwright/test';
22
import { authenticateWithBitbucketCloud, connectRepository } from 'e2e/helpers';
33

4+
import { test } from '../../fixtures/repository-disconnection';
5+
46
test.skip('Adding Bitbucket repository works', async ({ page, context }) => {
57
await authenticateWithBitbucketCloud(page, context);
68
await page.getByRole('tab', { name: 'Atlassian Settings' }).getByLabel(/close/i).click();

0 commit comments

Comments
 (0)