This commit is contained in:
parent
fc80848506
commit
12f20b2d58
|
@ -1,3 +1,3 @@
|
|||
export default {
|
||||
module.exports = {
|
||||
url: 'http://localhost:5000'
|
||||
};
|
||||
|
|
31
gulpfile.js
31
gulpfile.js
|
@ -4,6 +4,8 @@ const exec = require('child_process').exec;
|
|||
const PluginError = require('plugin-error');
|
||||
const argv = require('minimist')(process.argv.slice(2));
|
||||
const log = require('fancy-log');
|
||||
const request = require('request');
|
||||
const e2eConfig = require('./e2e/helpers/config.js');
|
||||
|
||||
// Configuration
|
||||
|
||||
|
@ -188,7 +190,31 @@ function e2eOnly() {
|
|||
}
|
||||
e2eOnly.description = `Runs the e2e tests only`;
|
||||
|
||||
e2e = gulp.series(docker, e2eOnly);
|
||||
async function backendStatus() {
|
||||
const milliseconds = 250;
|
||||
return new Promise(resolve => {
|
||||
let timer;
|
||||
let attempts = 1;
|
||||
timer = setInterval(() => {
|
||||
const url = `${e2eConfig.url}/api/Applications/status`;
|
||||
request.get(url, (err, res) => {
|
||||
if (res.body == 'true') {
|
||||
clearInterval(timer);
|
||||
resolve(attempts);
|
||||
} else
|
||||
attempts++;
|
||||
});
|
||||
}, milliseconds);
|
||||
});
|
||||
}
|
||||
backendStatus.description = `Performs a simple requests to check the backend status`;
|
||||
|
||||
e2e = gulp.series(docker, async function isBackendReady() {
|
||||
const attempts = await backendStatus();
|
||||
log(`Backend ready after ${attempts} attempt(s)`);
|
||||
|
||||
return attempts;
|
||||
}, e2eOnly);
|
||||
e2e.description = `Restarts database and runs the e2e tests`;
|
||||
|
||||
function smokesOnly() {
|
||||
|
@ -533,5 +559,6 @@ module.exports = {
|
|||
watch,
|
||||
docker,
|
||||
dockerStart,
|
||||
dockerWait
|
||||
dockerWait,
|
||||
backendStatus
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue