mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 22:40:14 -05:00
Fixed e2e-framework not waiting for Ghost to start
no-issue Because we were returning the call to `boot`, rather than awaiting it, it meant that once a test was provided with an API Agent the Ghost application hadn't necessarily started. This was noticed whilst working on the Members API which requires the frontend to be loaded. When the frontend is loaded we must also wait for the url service to have finished initialising, so that we do not run into 503 maintenance errors when hitting the frontend.
This commit is contained in:
parent
af66ab02c8
commit
126fc8cb81
1 changed files with 11 additions and 2 deletions
|
@ -23,6 +23,7 @@ const uuid = require('uuid');
|
|||
const fixtureUtils = require('./fixture-utils');
|
||||
const redirectsUtils = require('./redirects');
|
||||
const configUtils = require('./configUtils');
|
||||
const urlServiceUtils = require('./url-service-utils');
|
||||
const mockManager = require('./e2e-framework-mock-manager');
|
||||
|
||||
const boot = require('../../core/boot');
|
||||
|
@ -34,7 +35,7 @@ const db = require('./db-utils');
|
|||
* @param {Boolean} [options.backend] Boot the backend
|
||||
* @param {Boolean} [options.frontend] Boot the frontend
|
||||
* @param {Boolean} [options.server] Start a server
|
||||
* @returns {Express.Application} ghost
|
||||
* @returns {Promise<Express.Application>} ghost
|
||||
*/
|
||||
const startGhost = async (options = {}) => {
|
||||
/**
|
||||
|
@ -56,7 +57,15 @@ const startGhost = async (options = {}) => {
|
|||
// Ensure the DB state
|
||||
await resetDb();
|
||||
|
||||
return boot(Object.assign({}, defaults, options));
|
||||
const bootOptions = Object.assign({}, defaults, options);
|
||||
|
||||
const ghostServer = await boot(bootOptions);
|
||||
|
||||
if (bootOptions.frontend) {
|
||||
await urlServiceUtils.isFinished();
|
||||
}
|
||||
|
||||
return ghostServer;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue