Skip to content

Commit

Permalink
[Spaces solution tour] Fix functional test (elastic#198928)
Browse files Browse the repository at this point in the history
  • Loading branch information
sebelga authored Nov 5, 2024
1 parent d312358 commit 83026f4
Showing 1 changed file with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,20 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
const browser = getService('browser');
const es = getService('es');
const log = getService('log');
const retry = getService('retry');

describe('space solution tour', () => {
let version: string | undefined;

const getGlobalSettings = async () => {
const doc = await es.get(
{ id: `config-global:${version}`, index: '.kibana' },
{ headers: { 'kbn-xsrf': 'spaces' }, ignore: [404] }
);
const value = (doc?._source as any)?.['config-global'] || null;
return value;
};

const removeGlobalSettings = async () => {
version = version ?? (await kibanaServer.version.get());
version = version.replace(/-SNAPSHOT$/, '');
Expand All @@ -37,7 +47,10 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
throw error;
});

await PageObjects.common.sleep(500); // just to be on the safe side
await retry.tryForTime(3000, async () => {
const value = await getGlobalSettings();
return value === null;
});
};

before(async () => {
Expand Down Expand Up @@ -66,6 +79,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {

before(async () => {
_defaultSpace = await spacesService.get('default');
await removeGlobalSettings(); // Make sure we start from a clean state

await PageObjects.common.navigateToUrl('management', 'kibana/spaces', {
shouldUseHashForSubUrl: false,
Expand Down

0 comments on commit 83026f4

Please sign in to comment.