Skip to content

Commit 72f4d28

Browse files
committed
fix(): running times
1 parent 02c2a86 commit 72f4d28

12 files changed

+294
-44
lines changed

e2e/060_builds.e2e.ts

+50-12
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { browser, by, element, ExpectedConditions } from 'protractor';
2-
import { login, logout, waitForUrlToChangeTo, delay } from './utils';
2+
import { login, logout, waitForUrlToChangeTo, delay, isLoaded } from './utils';
33
import {
44
request as pushEventRequest,
55
requestD3,
@@ -34,6 +34,7 @@ describe('Builds', () => {
3434
.then((): any => browser.wait(() => element.all(by.css('.list-item')).count().then(cnt => {
3535
return cnt === 1;
3636
})))
37+
.then(() => delay(2000))
3738
.then((): any => browser.wait(() => {
3839
return element.all(by.css('.is-running')).count().then(count => count === 1);
3940
}))
@@ -46,6 +47,9 @@ describe('Builds', () => {
4647
.then((): any => browser.wait(() => {
4748
return element(by.css('.list-item:nth-child(1) .stop-build')).isPresent();
4849
}))
50+
.then((): any => browser.wait(() => {
51+
return element(by.css('.list-item:nth-child(1) .stop-build')).isEnabled();
52+
}))
4953
.then(() => delay(2000))
5054
.then((): any => element.all(by.css('.list-item:nth-child(1) .stop-build')).click())
5155
.then((): any => browser.wait(() => {
@@ -65,7 +69,7 @@ describe('Builds', () => {
6569

6670
it('should start new build (send reopen_pull_request event)', () => {
6771
return sendGitHubRequest(requestD3, pushEventHeader)
68-
.then((): any => browser.wait(() => element.all(by.css('.list-item')).count().then(cnt => {
72+
.then((): any => browser.wait(() => element.all(by.css('.list-item')).count().then(cnt => {
6973
return cnt === 2;
7074
})))
7175
.then((): any => browser.wait(() => {
@@ -80,6 +84,9 @@ describe('Builds', () => {
8084
.then((): any => browser.wait(() => {
8185
return element.all(by.css('.list-item:nth-child(1) .stop-build')).isPresent();
8286
}))
87+
.then((): any => browser.wait(() => {
88+
return element.all(by.css('.list-item:nth-child(1) .stop-build')).isEnabled();
89+
}))
8390
.then((): any => {
8491
return browser.wait(() => {
8592
const el = element(by.css('.list-item:nth-child(1) .stop-build'));
@@ -110,6 +117,9 @@ describe('Builds', () => {
110117
.then((): any => browser.wait(() => {
111118
return element.all(by.css('.list-item:nth-child(1) .stop-build')).isPresent();
112119
}))
120+
.then((): any => browser.wait(() => {
121+
return element.all(by.css('.list-item:nth-child(1) .stop-build')).isEnabled();
122+
}))
113123
.then((): any => {
114124
return browser.wait(() => {
115125
const el = element(by.css('.list-item:nth-child(1) .stop-build'));
@@ -131,6 +141,9 @@ describe('Builds', () => {
131141
.then((): any => browser.wait(() => {
132142
return element.all(by.css('.restart-build')).first().isPresent();
133143
}))
144+
.then((): any => browser.wait(() => {
145+
return element.all(by.css('.restart-build')).first().isEnabled();
146+
}))
134147
.then(() => delay(2000))
135148
.then((): any => element.all(by.css('.restart-build')).first().click())
136149
.then((): any => browser.wait(() => {
@@ -143,13 +156,17 @@ describe('Builds', () => {
143156
.then((): any => browser.wait(() => {
144157
return element.all(by.css('.stop-build')).first().isPresent();
145158
}))
159+
.then((): any => browser.wait(() => {
160+
return element.all(by.css('.stop-build')).first().isDisplayed();
161+
}))
162+
.then((): any => browser.wait(() => {
163+
return element.all(by.css('.stop-build')).first().isEnabled();
164+
}))
165+
.then(() => delay(2000))
146166
.then((): any => {
147-
return browser.wait(() => {
148-
const el = element(by.css('.stop-build'));
149-
return ExpectedConditions.elementToBeClickable(el);
150-
});
167+
return browser.wait(() =>
168+
ExpectedConditions.elementToBeClickable(element.all(by.css('.stop-build')).first()));
151169
})
152-
.then(() => delay(2000))
153170
.then((): any => element.all(by.css('.stop-build')).first().click())
154171
.then((): any => browser.wait(() => {
155172
return element.all(by.css('.is-running')).count().then(count => count === 0);
@@ -164,6 +181,9 @@ describe('Builds', () => {
164181
.then((): any => browser.wait(() => {
165182
return element.all(by.css('.restart-build')).first().isPresent();
166183
}))
184+
.then((): any => browser.wait(() => {
185+
return element.all(by.css('.restart-build')).first().isEnabled();
186+
}))
167187
.then(() => delay(2000))
168188
.then((): any => element.all(by.css('.restart-build')).first().click())
169189
.then((): any => browser.wait(() => {
@@ -172,19 +192,37 @@ describe('Builds', () => {
172192
.then((): any => browser.wait(() => {
173193
return element(by.css('.build-time')).isPresent();
174194
}))
195+
.then((): any => browser.wait(() => {
196+
return element(by.css('.build-time')).isDisplayed();
197+
}))
198+
.then((): any => {
199+
return browser.wait(() => element.all(by.css('.build-time')).first()
200+
.getAttribute('innerHTML').then(html => html.trim() === '00:04'));
201+
})
202+
.then(() => browser.get('/'))
203+
.then(() => isLoaded())
204+
.then(() => delay(1000))
205+
.then((): any => {
206+
return browser.wait(() => element.all(by.css('.build-time')).first()
207+
.getAttribute('innerHTML').then(html => html.trim() === '00:08'));
208+
})
175209
.then((): any => browser.wait(() => {
176210
return element.all(by.css('.disabled')).count().then(cnt => cnt === 0);
177211
}))
178212
.then((): any => browser.wait(() => {
179213
return element.all(by.css('.stop-build')).first().isPresent();
180214
}))
215+
.then((): any => browser.wait(() => {
216+
return element.all(by.css('.stop-build')).first().isDisplayed();
217+
}))
218+
.then((): any => browser.wait(() => {
219+
return element.all(by.css('.stop-build')).first().isEnabled();
220+
}))
221+
.then(() => delay(2000))
181222
.then((): any => {
182-
return browser.wait(() => {
183-
const el = element(by.css('.stop-build'));
184-
return ExpectedConditions.elementToBeClickable(el);
185-
});
223+
return browser.wait(() =>
224+
ExpectedConditions.elementToBeClickable(element.all(by.css('.stop-build')).first()));
186225
})
187-
.then(() => delay(2000))
188226
.then((): any => element.all(by.css('.stop-build')).first().click())
189227
.then((): any => browser.wait(() => {
190228
return element.all(by.css('.is-running')).count().then(count => count === 0);

e2e/070_build.e2e.ts

+18-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { browser, by, element, ExpectedConditions } from 'protractor';
2-
import { login, logout, delay } from './utils';
2+
import { login, logout, delay, isLoaded } from './utils';
33
import { requestD3, header } from '../tests/e2e/webhooks/github/PushEvent';
44
import { sendGitHubRequest } from '../tests/e2e/utils/utils';
55
import * as chai from 'chai';
@@ -26,11 +26,24 @@ describe('Build Details', () => {
2626
return cnt === 0;
2727
})))
2828
.then((): any => browser.wait(() => element(by.css(`[name="restart-build"]`)).isPresent()))
29+
.then((): any => browser.wait(() => element(by.css(`[name="restart-build"]`)).isEnabled()))
2930
.then((): any => element(by.css(`[name="restart-build"]`)).click())
3031
.then((): any => element.all(by.css('.list-item')).count())
3132
.then(num => browser.wait(() => element.all(by.css('.is-running')).count().then(cnt => {
3233
return cnt === num;
3334
})))
35+
.then(() => delay(1000))
36+
.then((): any => {
37+
return browser.wait(() => element.all(by.css('.total-time > span')).first()
38+
.getAttribute('innerHTML').then(html => html.trim() === '00:04'));
39+
})
40+
.then(() => browser.get('/build/1'))
41+
.then(() => isLoaded())
42+
.then(() => delay(1000))
43+
.then((): any => {
44+
return browser.wait(() => element.all(by.css('.total-time > span')).first()
45+
.getAttribute('innerHTML').then(html => html.trim() === '00:08'));
46+
})
3447
.then(() => delay(2000))
3548
.then(() => element.all(by.css(`[name="stop-job"]`)).each(el => el.click()))
3649
.then(num => browser.wait(() => element.all(by.css('.is-running')).count().then(cnt => {
@@ -56,9 +69,10 @@ describe('Build Details', () => {
5669
return browser.wait(() => element.all(by.css('.is-running')).count()
5770
.then(cnt => cnt === 1));
5871
})
72+
.then(() => delay(2000))
5973
.then((): any => {
6074
return browser.wait(() => element.all(by.css('.job-time')).then(els => els[0])
61-
.then(el => el.getAttribute('innerHTML').then(html => html === '00:05')));
75+
.then(el => el.getAttribute('innerHTML').then(html => html === '00:06')));
6276
})
6377
.then((): any => {
6478
return browser
@@ -226,6 +240,7 @@ describe('Build Details', () => {
226240
return cnt === 0;
227241
})))
228242
.then((): any => browser.wait(() => element(by.css(`[name="restart-build"]`)).isPresent()))
243+
.then((): any => browser.wait(() => element(by.css(`[name="restart-build"]`)).isEnabled()))
229244
.then((): any => browser.wait(() => {
230245
return ExpectedConditions.elementToBeClickable(element(by.css(`[name="restart-build"]`)));
231246
}))
@@ -245,6 +260,7 @@ describe('Build Details', () => {
245260
});
246261
})
247262
.then((): any => browser.wait(() => element(by.css(`[name="stop-build"]`)).isPresent()))
263+
.then((): any => browser.wait(() => element(by.css(`[name="stop-build"]`)).isEnabled()))
248264
.then(() => browser.wait(
249265
ExpectedConditions.presenceOf(element(by.css(`[name="stop-build"]`)))))
250266
.then(() => delay(1000))

e2e/080_job.e2e.ts

+1
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ describe('Job Details', () => {
4646
return cnt > 0;
4747
})))
4848
.then((): any => browser.wait(() => element(by.css(`[name="restart-build"]`)).isPresent()))
49+
.then((): any => browser.wait(() => element(by.css(`[name="restart-build"]`)).isEnabled()))
4950
.then((): any => browser.wait(() => {
5051
return ExpectedConditions.elementToBeClickable(element(by.css(`[name="restart-build"]`)));
5152
}))

e2e/090_bitbucket.e2e.ts

+12
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ describe('Bitbucket repositories', () => {
3737
.then((): any => browser.wait(() => {
3838
return element(by.css('.list-item:nth-child(1) .stop-build')).isPresent();
3939
}))
40+
.then((): any => browser.wait(() => {
41+
return element(by.css('.list-item:nth-child(1) .stop-build')).isEnabled();
42+
}))
4043
.then(() => delay(2000))
4144
.then((): any => element.all(by.css('.list-item:nth-child(1) .stop-build')).click())
4245
.then((): any => browser.wait(() => {
@@ -58,6 +61,9 @@ describe('Bitbucket repositories', () => {
5861
.then((): any => browser.wait(() => {
5962
return element.all(by.css('.list-item:nth-child(1) .stop-build')).isPresent();
6063
}))
64+
.then((): any => browser.wait(() => {
65+
return element.all(by.css('.list-item:nth-child(1) .stop-build')).isEnabled();
66+
}))
6167
.then((): any => {
6268
return browser.wait(() => {
6369
const el = element(by.css('.list-item:nth-child(1) .stop-build'));
@@ -79,6 +85,9 @@ describe('Bitbucket repositories', () => {
7985
.then((): any => browser.wait(() => {
8086
return element.all(by.css('.restart-build')).first().isPresent();
8187
}))
88+
.then((): any => browser.wait(() => {
89+
return element.all(by.css('.restart-build')).first().isEnabled();
90+
}))
8291
.then(() => delay(2000))
8392
.then((): any => element.all(by.css('.restart-build')).first().click())
8493
.then((): any => browser.wait(() => {
@@ -93,6 +102,9 @@ describe('Bitbucket repositories', () => {
93102
.then((): any => browser.wait(() => {
94103
return element.all(by.css('.stop-build')).first().isPresent();
95104
}))
105+
.then((): any => browser.wait(() => {
106+
return element.all(by.css('.stop-build')).first().isEnabled();
107+
}))
96108
.then((): any => {
97109
return browser.wait(() => {
98110
const el = element(by.css('.stop-build'));

e2e/100_gitlab.e2e.ts

+12
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ describe('Gitlab repositories', () => {
3030
.then((): any => browser.wait(() => {
3131
return element(by.css('.list-item:nth-child(1) .stop-build')).isPresent();
3232
}))
33+
.then((): any => browser.wait(() => {
34+
return element(by.css('.list-item:nth-child(1) .stop-build')).isEnabled();
35+
}))
3336
.then(() => delay(2000))
3437
.then((): any => element.all(by.css('.list-item:nth-child(1) .stop-build')).click())
3538
.then((): any => browser.wait(() => {
@@ -51,6 +54,9 @@ describe('Gitlab repositories', () => {
5154
.then((): any => browser.wait(() => {
5255
return element.all(by.css('.list-item:nth-child(1) .stop-build')).isPresent();
5356
}))
57+
.then((): any => browser.wait(() => {
58+
return element.all(by.css('.list-item:nth-child(1) .stop-build')).isEnabled();
59+
}))
5460
.then((): any => {
5561
return browser.wait(() => {
5662
const el = element(by.css('.list-item:nth-child(1) .stop-build'));
@@ -72,6 +78,9 @@ describe('Gitlab repositories', () => {
7278
.then((): any => browser.wait(() => {
7379
return element.all(by.css('.restart-build')).first().isPresent();
7480
}))
81+
.then((): any => browser.wait(() => {
82+
return element.all(by.css('.restart-build')).first().isEnabled();
83+
}))
7584
.then(() => delay(2000))
7685
.then((): any => element.all(by.css('.restart-build')).first().click())
7786
.then((): any => browser.wait(() => {
@@ -86,6 +95,9 @@ describe('Gitlab repositories', () => {
8695
.then((): any => browser.wait(() => {
8796
return element.all(by.css('.stop-build')).first().isPresent();
8897
}))
98+
.then((): any => browser.wait(() => {
99+
return element.all(by.css('.stop-build')).first().isEnabled();
100+
}))
89101
.then((): any => {
90102
return browser.wait(() => {
91103
const el = element(by.css('.stop-build'));

e2e/110_gogs.e2e.ts

+12
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@ describe('Gogs repositories', () => {
3030
.then((): any => browser.wait(() => {
3131
return element(by.css('.list-item:nth-child(1) .stop-build')).isPresent();
3232
}))
33+
.then((): any => browser.wait(() => {
34+
return element(by.css('.list-item:nth-child(1) .stop-build')).isEnabled();
35+
}))
3336
.then(() => delay(2000))
3437
.then((): any => element.all(by.css('.list-item:nth-child(1) .stop-build')).click())
3538
.then((): any => browser.wait(() => {
@@ -51,6 +54,9 @@ describe('Gogs repositories', () => {
5154
.then((): any => browser.wait(() => {
5255
return element.all(by.css('.list-item:nth-child(1) .stop-build')).isPresent();
5356
}))
57+
.then((): any => browser.wait(() => {
58+
return element.all(by.css('.list-item:nth-child(1) .stop-build')).isEnabled();
59+
}))
5460
.then(() => delay(2000))
5561
.then((): any => element.all(by.css('.stop-build')).first().click())
5662
.then((): any => browser.wait(() => {
@@ -66,6 +72,9 @@ describe('Gogs repositories', () => {
6672
.then((): any => browser.wait(() => {
6773
return element.all(by.css('.restart-build')).first().isPresent();
6874
}))
75+
.then((): any => browser.wait(() => {
76+
return element.all(by.css('.restart-build')).first().isEnabled();
77+
}))
6978
.then(() => delay(2000))
7079
.then((): any => element.all(by.css('.restart-build')).first().click())
7180
.then((): any => browser.wait(() => {
@@ -80,6 +89,9 @@ describe('Gogs repositories', () => {
8089
.then((): any => browser.wait(() => {
8190
return element.all(by.css('.stop-build')).first().isPresent();
8291
}))
92+
.then((): any => browser.wait(() => {
93+
return element.all(by.css('.stop-build')).first().isEnabled();
94+
}))
8395
.then((): any => {
8496
return browser.wait(() => {
8597
const el = element(by.css('.stop-build'));

src/api/commit-status.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,8 @@ export function sendPendingStatus(buildData: any, buildId: number): Promise<void
8181
return Promise.resolve();
8282
}
8383
} else {
84-
85-
const name = buildData.repository && buildData.repository.full_name ||
86-
buildData.data.repository.full_name;
84+
const name = buildData.repository && (buildData.repository.full_name ||
85+
buildData.data.repository.full_name);
8786
const msg: LogMessageType = {
8887
message: `[error]: repository: ${name} => access token is not set`,
8988
type: 'error',

0 commit comments

Comments
 (0)