1
- import { test } from '@playwright/test' ;
2
- import {
3
- authenticateWithBitbucketCloud ,
4
- authenticateWithJira ,
5
- connectRepository ,
6
- getIssueFrame ,
7
- setupIssueMock ,
8
- setupSearchMock ,
9
- } from 'e2e/helpers' ;
1
+ import { expect , test } from '@playwright/test' ;
2
+ import { authenticateWithJira , getIssueFrame , setupIssueMock , setupSearchMock } from 'e2e/helpers' ;
10
3
import { AtlascodeDrawer , JiraIssuePage , StartWorkPage } from 'e2e/page-objects' ;
11
4
12
- test . only ( 'I can start work on a Jira' , async ( { page, request, context } ) => {
13
- const issueName = 'BTS-1 - User Interface Bugs' ;
14
- const currentStatus = 'To Do' ;
15
- const nextStatus = 'In Progress' ;
5
+ const ISSUE_NAME = 'BTS-1 - User Interface Bugs' ;
6
+ const CURRENT_STATUS = 'To Do' ;
7
+ const NEXT_STATUS = 'In Progress' ;
16
8
9
+ test ( 'I can start work on a Jira' , async ( { page, request } ) => {
17
10
await authenticateWithJira ( page ) ;
18
11
await page . getByRole ( 'tab' , { name : 'Atlassian Settings' } ) . getByLabel ( / c l o s e / i) . click ( ) ;
19
12
20
- await authenticateWithBitbucketCloud ( page , context ) ;
21
- await connectRepository ( page ) ;
22
-
23
13
const atlascodeDrawer = new AtlascodeDrawer ( page ) ;
24
- await atlascodeDrawer . jira . openIssue ( issueName ) ;
14
+ await atlascodeDrawer . jira . openIssue ( ISSUE_NAME ) ;
25
15
26
16
const issueFrame = await getIssueFrame ( page ) ;
27
17
const jiraIssuePage = new JiraIssuePage ( issueFrame ) ;
28
- await jiraIssuePage . status . expectEqual ( currentStatus ) ;
29
-
30
- // setup mocks for next status
31
- const cleanupIssueMock = await setupIssueMock ( request , { status : nextStatus } ) ;
32
- const cleanupSearchMock = await setupSearchMock ( request , nextStatus ) ;
18
+ await jiraIssuePage . status . expectEqual ( CURRENT_STATUS ) ;
33
19
34
20
await jiraIssuePage . startWork ( ) ;
35
21
@@ -38,10 +24,25 @@ test.only('I can start work on a Jira', async ({ page, request, context }) => {
38
24
39
25
const startWorkFrame = await getIssueFrame ( page ) ;
40
26
const startWorkPage = new StartWorkPage ( startWorkFrame ) ;
41
-
27
+ await startWorkPage . setupGitBranch ( false ) ;
42
28
await startWorkPage . startWork ( ) ;
43
29
await page . waitForTimeout ( 2_000 ) ;
44
- await atlascodeDrawer . jira . expectIssueStatus ( issueName , nextStatus ) ;
30
+
31
+ expect ( startWorkFrame . getByText ( new RegExp ( 'Assigned the issue to you' , 'i' ) ) ) . toBeVisible ( ) ;
32
+ expect ( startWorkFrame . getByText ( new RegExp ( `Transitioned status to ${ NEXT_STATUS } ` , 'i' ) ) ) . toBeVisible ( ) ;
33
+
34
+ // setup mocks for next status
35
+ const cleanupIssueMock = await setupIssueMock ( request , { status : NEXT_STATUS } ) ;
36
+ const cleanupSearchMock = await setupSearchMock ( request , NEXT_STATUS ) ;
37
+
38
+ await page . getByRole ( 'tab' , { name : 'Start work on BTS-1' , exact : true } ) . getByLabel ( / c l o s e / i) . click ( ) ;
39
+
40
+ await atlascodeDrawer . jira . openIssue ( ISSUE_NAME ) ;
41
+ const updatedIssueFrame = await getIssueFrame ( page ) ;
42
+ const updatedIssuePage = new JiraIssuePage ( updatedIssueFrame ) ;
43
+
44
+ await updatedIssuePage . status . expectEqual ( NEXT_STATUS ) ;
45
+ await atlascodeDrawer . jira . openIssue ( ISSUE_NAME ) ;
45
46
46
47
await cleanupIssueMock ( ) ;
47
48
await cleanupSearchMock ( ) ;
0 commit comments