@@ -52,14 +52,19 @@ func doTestRepoCommitWithStatus(t *testing.T, state string, classes ...string) {
5252
5353	// Call API to add status for commit 
5454	ctx  :=  NewAPITestContext (t , "user2" , "repo1" , auth_model .AccessTokenScopeRepo )
55- 	t .Run ("CreateStatus" , doAPICreateCommitStatus (ctx , path .Base (commitURL ), api .CommitStatusState (state )))
55+ 	t .Run ("CreateStatus" , doAPICreateCommitStatus (ctx , path .Base (commitURL ), api.CreateStatusOption {
56+ 		State :       api .CommitStatusState (state ),
57+ 		TargetURL :   "http://test.ci/" ,
58+ 		Description : "" ,
59+ 		Context :     "testci" ,
60+ 	}))
5661
5762	req  =  NewRequest (t , "GET" , "/user2/repo1/commits/branch/master" )
5863	resp  =  session .MakeRequest (t , req , http .StatusOK )
5964
6065	doc  =  NewHTMLParser (t , resp .Body )
61- 	// Check if commit status is displayed in message column 
62- 	sel  :=  doc .doc .Find ("#commits-table tbody tr td.message a.commit-statuses-trigger  .commit-status" )
66+ 	// Check if commit status is displayed in message column (.tippy-target to ignore the tippy trigger)  
67+ 	sel  :=  doc .doc .Find ("#commits-table tbody tr td.message .tippy-target  .commit-status" )
6368	assert .Equal (t , 1 , sel .Length ())
6469	for  _ , class  :=  range  classes  {
6570		assert .True (t , sel .HasClass (class ))
@@ -145,11 +150,56 @@ func TestRepoCommitsStatusParallel(t *testing.T) {
145150		go  func (parentT  * testing.T , i  int ) {
146151			parentT .Run (fmt .Sprintf ("ParallelCreateStatus_%d" , i ), func (t  * testing.T ) {
147152				ctx  :=  NewAPITestContext (t , "user2" , "repo1" , auth_model .AccessTokenScopeRepoStatus )
148- 				runBody  :=  doAPICreateCommitStatus (ctx , path .Base (commitURL ), api .CommitStatusState ("pending" ))
153+ 				runBody  :=  doAPICreateCommitStatus (ctx , path .Base (commitURL ), api.CreateStatusOption {
154+ 					State :       api .CommitStatusPending ,
155+ 					TargetURL :   "http://test.ci/" ,
156+ 					Description : "" ,
157+ 					Context :     "testci" ,
158+ 				})
149159				runBody (t )
150160				wg .Done ()
151161			})
152162		}(t , i )
153163	}
154164	wg .Wait ()
155165}
166+ 
167+ func  TestRepoCommitsStatusMultiple (t  * testing.T ) {
168+ 	defer  tests .PrepareTestEnv (t )()
169+ 
170+ 	session  :=  loginUser (t , "user2" )
171+ 
172+ 	// Request repository commits page 
173+ 	req  :=  NewRequest (t , "GET" , "/user2/repo1/commits/branch/master" )
174+ 	resp  :=  session .MakeRequest (t , req , http .StatusOK )
175+ 
176+ 	doc  :=  NewHTMLParser (t , resp .Body )
177+ 	// Get first commit URL 
178+ 	commitURL , exists  :=  doc .doc .Find ("#commits-table tbody tr td.sha a" ).Attr ("href" )
179+ 	assert .True (t , exists )
180+ 	assert .NotEmpty (t , commitURL )
181+ 
182+ 	// Call API to add status for commit 
183+ 	ctx  :=  NewAPITestContext (t , "user2" , "repo1" , auth_model .AccessTokenScopeRepo )
184+ 	t .Run ("CreateStatus" , doAPICreateCommitStatus (ctx , path .Base (commitURL ), api.CreateStatusOption {
185+ 		State :       api .CommitStatusSuccess ,
186+ 		TargetURL :   "http://test.ci/" ,
187+ 		Description : "" ,
188+ 		Context :     "testci" ,
189+ 	}))
190+ 
191+ 	t .Run ("CreateStatus" , doAPICreateCommitStatus (ctx , path .Base (commitURL ), api.CreateStatusOption {
192+ 		State :       api .CommitStatusSuccess ,
193+ 		TargetURL :   "http://test.ci/" ,
194+ 		Description : "" ,
195+ 		Context :     "other_context" ,
196+ 	}))
197+ 
198+ 	req  =  NewRequest (t , "GET" , "/user2/repo1/commits/branch/master" )
199+ 	resp  =  session .MakeRequest (t , req , http .StatusOK )
200+ 
201+ 	doc  =  NewHTMLParser (t , resp .Body )
202+ 	// Check that the data-tippy="commit-statuses" (for trigger) and commit-status (svg) are present 
203+ 	sel  :=  doc .doc .Find ("#commits-table tbody tr td.message [data-tippy=\" commit-statuses\" ] .commit-status" )
204+ 	assert .Equal (t , 1 , sel .Length ())
205+ }
0 commit comments