Permalink
Browse files

fix(): running times

  • Loading branch information...
Izak88 committed Sep 22, 2017
1 parent 02c2a86 commit 72f4d285be7ef48f665f33b41189c941ced9f09a
@@ -1,5 +1,5 @@
import { browser, by, element, ExpectedConditions } from 'protractor';
import { login, logout, waitForUrlToChangeTo, delay } from './utils';
import { login, logout, waitForUrlToChangeTo, delay, isLoaded } from './utils';
import {
request as pushEventRequest,
requestD3,
@@ -34,6 +34,7 @@ describe('Builds', () => {
.then((): any => browser.wait(() => element.all(by.css('.list-item')).count().then(cnt => {
return cnt === 1;
})))
.then(() => delay(2000))
.then((): any => browser.wait(() => {
return element.all(by.css('.is-running')).count().then(count => count === 1);
}))
@@ -46,6 +47,9 @@ describe('Builds', () => {
.then((): any => browser.wait(() => {
return element(by.css('.list-item:nth-child(1) .stop-build')).isPresent();
}))
.then((): any => browser.wait(() => {
return element(by.css('.list-item:nth-child(1) .stop-build')).isEnabled();
}))
.then(() => delay(2000))
.then((): any => element.all(by.css('.list-item:nth-child(1) .stop-build')).click())
.then((): any => browser.wait(() => {
@@ -65,7 +69,7 @@ describe('Builds', () => {

it('should start new build (send reopen_pull_request event)', () => {
return sendGitHubRequest(requestD3, pushEventHeader)
.then((): any => browser.wait(() => element.all(by.css('.list-item')).count().then(cnt => {
.then((): any => browser.wait(() => element.all(by.css('.list-item')).count().then(cnt => {
return cnt === 2;
})))
.then((): any => browser.wait(() => {
@@ -80,6 +84,9 @@ describe('Builds', () => {
.then((): any => browser.wait(() => {
return element.all(by.css('.list-item:nth-child(1) .stop-build')).isPresent();
}))
.then((): any => browser.wait(() => {
return element.all(by.css('.list-item:nth-child(1) .stop-build')).isEnabled();
}))
.then((): any => {
return browser.wait(() => {
const el = element(by.css('.list-item:nth-child(1) .stop-build'));
@@ -110,6 +117,9 @@ describe('Builds', () => {
.then((): any => browser.wait(() => {
return element.all(by.css('.list-item:nth-child(1) .stop-build')).isPresent();
}))
.then((): any => browser.wait(() => {
return element.all(by.css('.list-item:nth-child(1) .stop-build')).isEnabled();
}))
.then((): any => {
return browser.wait(() => {
const el = element(by.css('.list-item:nth-child(1) .stop-build'));
@@ -131,6 +141,9 @@ describe('Builds', () => {
.then((): any => browser.wait(() => {
return element.all(by.css('.restart-build')).first().isPresent();
}))
.then((): any => browser.wait(() => {
return element.all(by.css('.restart-build')).first().isEnabled();
}))
.then(() => delay(2000))
.then((): any => element.all(by.css('.restart-build')).first().click())
.then((): any => browser.wait(() => {
@@ -143,13 +156,17 @@ describe('Builds', () => {
.then((): any => browser.wait(() => {
return element.all(by.css('.stop-build')).first().isPresent();
}))
.then((): any => browser.wait(() => {
return element.all(by.css('.stop-build')).first().isDisplayed();
}))
.then((): any => browser.wait(() => {
return element.all(by.css('.stop-build')).first().isEnabled();
}))
.then(() => delay(2000))
.then((): any => {
return browser.wait(() => {
const el = element(by.css('.stop-build'));
return ExpectedConditions.elementToBeClickable(el);
});
return browser.wait(() =>
ExpectedConditions.elementToBeClickable(element.all(by.css('.stop-build')).first()));
})
.then(() => delay(2000))
.then((): any => element.all(by.css('.stop-build')).first().click())
.then((): any => browser.wait(() => {
return element.all(by.css('.is-running')).count().then(count => count === 0);
@@ -164,6 +181,9 @@ describe('Builds', () => {
.then((): any => browser.wait(() => {
return element.all(by.css('.restart-build')).first().isPresent();
}))
.then((): any => browser.wait(() => {
return element.all(by.css('.restart-build')).first().isEnabled();
}))
.then(() => delay(2000))
.then((): any => element.all(by.css('.restart-build')).first().click())
.then((): any => browser.wait(() => {
@@ -172,19 +192,37 @@ describe('Builds', () => {
.then((): any => browser.wait(() => {
return element(by.css('.build-time')).isPresent();
}))
.then((): any => browser.wait(() => {
return element(by.css('.build-time')).isDisplayed();
}))
.then((): any => {
return browser.wait(() => element.all(by.css('.build-time')).first()
.getAttribute('innerHTML').then(html => html.trim() === '00:04'));
})
.then(() => browser.get('/'))
.then(() => isLoaded())
.then(() => delay(1000))
.then((): any => {
return browser.wait(() => element.all(by.css('.build-time')).first()
.getAttribute('innerHTML').then(html => html.trim() === '00:08'));
})
.then((): any => browser.wait(() => {
return element.all(by.css('.disabled')).count().then(cnt => cnt === 0);
}))
.then((): any => browser.wait(() => {
return element.all(by.css('.stop-build')).first().isPresent();
}))
.then((): any => browser.wait(() => {
return element.all(by.css('.stop-build')).first().isDisplayed();
}))
.then((): any => browser.wait(() => {
return element.all(by.css('.stop-build')).first().isEnabled();
}))
.then(() => delay(2000))
.then((): any => {
return browser.wait(() => {
const el = element(by.css('.stop-build'));
return ExpectedConditions.elementToBeClickable(el);
});
return browser.wait(() =>
ExpectedConditions.elementToBeClickable(element.all(by.css('.stop-build')).first()));
})
.then(() => delay(2000))
.then((): any => element.all(by.css('.stop-build')).first().click())
.then((): any => browser.wait(() => {
return element.all(by.css('.is-running')).count().then(count => count === 0);
@@ -1,5 +1,5 @@
import { browser, by, element, ExpectedConditions } from 'protractor';
import { login, logout, delay } from './utils';
import { login, logout, delay, isLoaded } from './utils';
import { requestD3, header } from '../tests/e2e/webhooks/github/PushEvent';
import { sendGitHubRequest } from '../tests/e2e/utils/utils';
import * as chai from 'chai';
@@ -26,11 +26,24 @@ describe('Build Details', () => {
return cnt === 0;
})))
.then((): any => browser.wait(() => element(by.css(`[name="restart-build"]`)).isPresent()))
.then((): any => browser.wait(() => element(by.css(`[name="restart-build"]`)).isEnabled()))
.then((): any => element(by.css(`[name="restart-build"]`)).click())
.then((): any => element.all(by.css('.list-item')).count())
.then(num => browser.wait(() => element.all(by.css('.is-running')).count().then(cnt => {
return cnt === num;
})))
.then(() => delay(1000))
.then((): any => {
return browser.wait(() => element.all(by.css('.total-time > span')).first()
.getAttribute('innerHTML').then(html => html.trim() === '00:04'));
})
.then(() => browser.get('/build/1'))
.then(() => isLoaded())
.then(() => delay(1000))
.then((): any => {
return browser.wait(() => element.all(by.css('.total-time > span')).first()
.getAttribute('innerHTML').then(html => html.trim() === '00:08'));
})
.then(() => delay(2000))
.then(() => element.all(by.css(`[name="stop-job"]`)).each(el => el.click()))
.then(num => browser.wait(() => element.all(by.css('.is-running')).count().then(cnt => {
@@ -56,9 +69,10 @@ describe('Build Details', () => {
return browser.wait(() => element.all(by.css('.is-running')).count()
.then(cnt => cnt === 1));
})
.then(() => delay(2000))
.then((): any => {
return browser.wait(() => element.all(by.css('.job-time')).then(els => els[0])
.then(el => el.getAttribute('innerHTML').then(html => html === '00:05')));
.then(el => el.getAttribute('innerHTML').then(html => html === '00:06')));
})
.then((): any => {
return browser
@@ -226,6 +240,7 @@ describe('Build Details', () => {
return cnt === 0;
})))
.then((): any => browser.wait(() => element(by.css(`[name="restart-build"]`)).isPresent()))
.then((): any => browser.wait(() => element(by.css(`[name="restart-build"]`)).isEnabled()))
.then((): any => browser.wait(() => {
return ExpectedConditions.elementToBeClickable(element(by.css(`[name="restart-build"]`)));
}))
@@ -245,6 +260,7 @@ describe('Build Details', () => {
});
})
.then((): any => browser.wait(() => element(by.css(`[name="stop-build"]`)).isPresent()))
.then((): any => browser.wait(() => element(by.css(`[name="stop-build"]`)).isEnabled()))
.then(() => browser.wait(
ExpectedConditions.presenceOf(element(by.css(`[name="stop-build"]`)))))
.then(() => delay(1000))
@@ -46,6 +46,7 @@ describe('Job Details', () => {
return cnt > 0;
})))
.then((): any => browser.wait(() => element(by.css(`[name="restart-build"]`)).isPresent()))
.then((): any => browser.wait(() => element(by.css(`[name="restart-build"]`)).isEnabled()))
.then((): any => browser.wait(() => {
return ExpectedConditions.elementToBeClickable(element(by.css(`[name="restart-build"]`)));
}))
@@ -37,6 +37,9 @@ describe('Bitbucket repositories', () => {
.then((): any => browser.wait(() => {
return element(by.css('.list-item:nth-child(1) .stop-build')).isPresent();
}))
.then((): any => browser.wait(() => {
return element(by.css('.list-item:nth-child(1) .stop-build')).isEnabled();
}))
.then(() => delay(2000))
.then((): any => element.all(by.css('.list-item:nth-child(1) .stop-build')).click())
.then((): any => browser.wait(() => {
@@ -58,6 +61,9 @@ describe('Bitbucket repositories', () => {
.then((): any => browser.wait(() => {
return element.all(by.css('.list-item:nth-child(1) .stop-build')).isPresent();
}))
.then((): any => browser.wait(() => {
return element.all(by.css('.list-item:nth-child(1) .stop-build')).isEnabled();
}))
.then((): any => {
return browser.wait(() => {
const el = element(by.css('.list-item:nth-child(1) .stop-build'));
@@ -79,6 +85,9 @@ describe('Bitbucket repositories', () => {
.then((): any => browser.wait(() => {
return element.all(by.css('.restart-build')).first().isPresent();
}))
.then((): any => browser.wait(() => {
return element.all(by.css('.restart-build')).first().isEnabled();
}))
.then(() => delay(2000))
.then((): any => element.all(by.css('.restart-build')).first().click())
.then((): any => browser.wait(() => {
@@ -93,6 +102,9 @@ describe('Bitbucket repositories', () => {
.then((): any => browser.wait(() => {
return element.all(by.css('.stop-build')).first().isPresent();
}))
.then((): any => browser.wait(() => {
return element.all(by.css('.stop-build')).first().isEnabled();
}))
.then((): any => {
return browser.wait(() => {
const el = element(by.css('.stop-build'));
@@ -30,6 +30,9 @@ describe('Gitlab repositories', () => {
.then((): any => browser.wait(() => {
return element(by.css('.list-item:nth-child(1) .stop-build')).isPresent();
}))
.then((): any => browser.wait(() => {
return element(by.css('.list-item:nth-child(1) .stop-build')).isEnabled();
}))
.then(() => delay(2000))
.then((): any => element.all(by.css('.list-item:nth-child(1) .stop-build')).click())
.then((): any => browser.wait(() => {
@@ -51,6 +54,9 @@ describe('Gitlab repositories', () => {
.then((): any => browser.wait(() => {
return element.all(by.css('.list-item:nth-child(1) .stop-build')).isPresent();
}))
.then((): any => browser.wait(() => {
return element.all(by.css('.list-item:nth-child(1) .stop-build')).isEnabled();
}))
.then((): any => {
return browser.wait(() => {
const el = element(by.css('.list-item:nth-child(1) .stop-build'));
@@ -72,6 +78,9 @@ describe('Gitlab repositories', () => {
.then((): any => browser.wait(() => {
return element.all(by.css('.restart-build')).first().isPresent();
}))
.then((): any => browser.wait(() => {
return element.all(by.css('.restart-build')).first().isEnabled();
}))
.then(() => delay(2000))
.then((): any => element.all(by.css('.restart-build')).first().click())
.then((): any => browser.wait(() => {
@@ -86,6 +95,9 @@ describe('Gitlab repositories', () => {
.then((): any => browser.wait(() => {
return element.all(by.css('.stop-build')).first().isPresent();
}))
.then((): any => browser.wait(() => {
return element.all(by.css('.stop-build')).first().isEnabled();
}))
.then((): any => {
return browser.wait(() => {
const el = element(by.css('.stop-build'));
@@ -30,6 +30,9 @@ describe('Gogs repositories', () => {
.then((): any => browser.wait(() => {
return element(by.css('.list-item:nth-child(1) .stop-build')).isPresent();
}))
.then((): any => browser.wait(() => {
return element(by.css('.list-item:nth-child(1) .stop-build')).isEnabled();
}))
.then(() => delay(2000))
.then((): any => element.all(by.css('.list-item:nth-child(1) .stop-build')).click())
.then((): any => browser.wait(() => {
@@ -51,6 +54,9 @@ describe('Gogs repositories', () => {
.then((): any => browser.wait(() => {
return element.all(by.css('.list-item:nth-child(1) .stop-build')).isPresent();
}))
.then((): any => browser.wait(() => {
return element.all(by.css('.list-item:nth-child(1) .stop-build')).isEnabled();
}))
.then(() => delay(2000))
.then((): any => element.all(by.css('.stop-build')).first().click())
.then((): any => browser.wait(() => {
@@ -66,6 +72,9 @@ describe('Gogs repositories', () => {
.then((): any => browser.wait(() => {
return element.all(by.css('.restart-build')).first().isPresent();
}))
.then((): any => browser.wait(() => {
return element.all(by.css('.restart-build')).first().isEnabled();
}))
.then(() => delay(2000))
.then((): any => element.all(by.css('.restart-build')).first().click())
.then((): any => browser.wait(() => {
@@ -80,6 +89,9 @@ describe('Gogs repositories', () => {
.then((): any => browser.wait(() => {
return element.all(by.css('.stop-build')).first().isPresent();
}))
.then((): any => browser.wait(() => {
return element.all(by.css('.stop-build')).first().isEnabled();
}))
.then((): any => {
return browser.wait(() => {
const el = element(by.css('.stop-build'));
@@ -81,9 +81,8 @@ export function sendPendingStatus(buildData: any, buildId: number): Promise<void
return Promise.resolve();
}
} else {

const name = buildData.repository && buildData.repository.full_name ||
buildData.data.repository.full_name;
const name = buildData.repository && (buildData.repository.full_name ||
buildData.data.repository.full_name);
const msg: LogMessageType = {
message: `[error]: repository: ${name} => access token is not set`,
type: 'error',
Oops, something went wrong.

0 comments on commit 72f4d28

Please sign in to comment.