diff --git a/test/common/services/kibana_server/ui_settings.js b/test/common/services/kibana_server/ui_settings.js index 565248c6c7a153..7c6439e0783b13 100644 --- a/test/common/services/kibana_server/ui_settings.js +++ b/test/common/services/kibana_server/ui_settings.js @@ -66,7 +66,7 @@ export class KibanaServerUiSettings { async replace(doc) { this._log.debug('replacing kibana config doc: %j', doc); - await this._savedObjectsClient.create('config', { doc }, { + await this._savedObjectsClient.create('config', doc, { id: await this._id(), overwrite: true, }); diff --git a/test/functional/apps/visualize/index.js b/test/functional/apps/visualize/index.js index ee0333e4a50677..945bf87876cf4b 100644 --- a/test/functional/apps/visualize/index.js +++ b/test/functional/apps/visualize/index.js @@ -5,21 +5,13 @@ export default function ({ getService, loadTestFile }) { const kibanaServer = getService('kibanaServer'); describe('visualize app', function () { - before(function () { - remote.setWindowSize(1280,800); - + before(async function () { log.debug('Starting visualize before method'); - const logstash = esArchiver.loadIfNeeded('logstash_functional'); - // delete .kibana index and update configDoc - return kibanaServer.uiSettings.replace({ 'dateFormat:tz':'UTC', 'defaultIndex':'logstash-*' }) - .then(function loadkibanaIndexPattern() { - log.debug('load kibana index with default index pattern'); - return esArchiver.load('visualize'); - }) - // wait for the logstash data load to finish if it hasn't already - .then(function () { - return logstash; - }); + remote.setWindowSize(1280, 800); + await esArchiver.loadIfNeeded('logstash_functional'); + await esArchiver.load('visualize'); + await kibanaServer.waitForStabilization(); + await kibanaServer.uiSettings.replace({ 'dateFormat:tz': 'UTC', 'defaultIndex': 'logstash-*' }); }); loadTestFile(require.resolve('./_chart_types'));