[8.x] [Spaces solution tour] Fix functional test (#198928) (#198952)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[Spaces solution tour] Fix functional test
(#198928)](https://github.com/elastic/kibana/pull/198928)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Sébastien
Loix","email":"sebastien.loix@elastic.co"},"sourceCommit":{"committedDate":"2024-11-05T13:55:44Z","message":"[Spaces
solution tour] Fix functional test
(#198928)","sha":"83026f485cac79f93375e34310f633faa141fe9b","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Security/Spaces","release_note:skip","v9.0.0","backport:prev-minor"],"title":"[Spaces
solution tour] Fix functional
test","number":198928,"url":"https://github.com/elastic/kibana/pull/198928","mergeCommit":{"message":"[Spaces
solution tour] Fix functional test
(#198928)","sha":"83026f485cac79f93375e34310f633faa141fe9b"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/198928","number":198928,"mergeCommit":{"message":"[Spaces
solution tour] Fix functional test
(#198928)","sha":"83026f485cac79f93375e34310f633faa141fe9b"}}]}]
BACKPORT-->

Co-authored-by: Sébastien Loix <sebastien.loix@elastic.co>
This commit is contained in:
Kibana Machine 2024-11-06 03:04:30 +11:00 committed by GitHub
parent d4d8b981ea
commit b0fdae4344
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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$/, '');
@ -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 () => {
@ -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,