Skip to content

Commit 0f1ef9d

Browse files
authored
[kbn/scout] disable side/solution tour before tests run (#245071)
## Summary Original solution with local storage didn't work, so I use Kibana uiSettings API to disable tours: - `hideAnnouncements: true` should be set for each space - Scout sets it for the default space when `samlAuth` fixture is loaded (assuming first login attempt to be made) - Scout sets it for the newly created space (parallel run) I also added a log message to explicitly mention the environment we run tests on: ``` info [scout-worker] Running tests against MKI oblt project info [scout-worker] Reading cloud user credentials from /Users/dmle/github/kibana/.ftr/role_users.json ``` It should help us identifying misconfiguration when Playwright runner gets a wrong configuration input file.
1 parent 2d044b3 commit 0f1ef9d

File tree

3 files changed

+24
-9
lines changed

3 files changed

+24
-9
lines changed

src/platform/packages/shared/kbn-scout/src/playwright/fixtures/scope/test/context/page_context.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,8 @@ import { coreWorkerFixtures } from '../../worker';
1919
* ensuring consistent browser state across all tests.
2020
*/
2121
export const pageContextFixture = coreWorkerFixtures.extend<{ context: BrowserContext }>({
22-
context: async ({ context, log }, use) => {
23-
// Add init script to set localStorage flags before any page navigation
24-
// This will be executed on every page load/reload
25-
await context.addInitScript(() => {
26-
// Force hide tour for the solution navigation
27-
localStorage.setItem('solutionNavigationTour:completed', 'true');
28-
});
29-
30-
log.debug('Page context initialized');
22+
context: async ({ context }, use) => {
23+
// set localStorage flags before any page navigation
3124
await use(context);
3225
},
3326
});

src/platform/packages/shared/kbn-scout/src/playwright/fixtures/scope/worker/core_fixtures.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,18 @@ export const coreWorkerFixtures = base.extend<{}, CoreWorkerFixtures>({
8989
const serversConfigDir = projectUse.serversConfigDir;
9090
const configInstance = createScoutConfig(serversConfigDir, projectUse.configName, log);
9191

92+
log.info(
93+
`Running tests against ${
94+
configInstance.isCloud
95+
? configInstance.serverless
96+
? `MKI ${configInstance.projectType} project`
97+
: 'ECH deployment'
98+
: `local ${
99+
configInstance.serverless ? `serverless ${configInstance.projectType}` : 'stateful'
100+
} cluster`
101+
}`
102+
);
103+
92104
use(configInstance);
93105
},
94106
{ scope: 'worker' },
@@ -179,6 +191,8 @@ export const coreWorkerFixtures = base.extend<{}, CoreWorkerFixtures>({
179191

180192
customRoleHash = newRoleHash;
181193
};
194+
// Hide the announcements (including the sidenav tour) in the default space
195+
await kbnClient.uiSettings.update({ hideAnnouncements: true });
182196

183197
await use({ session, customRoleName, setCustomRole });
184198

src/platform/packages/shared/kbn-scout/src/playwright/fixtures/scope/worker/scout_space/parallel.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,14 @@ export const scoutSpaceParallelFixture = coreWorkerFixtures.extend<
126126
setDefaultTime,
127127
};
128128

129+
/**
130+
* To hide the sidenav tour we need to enable 'hideAnnouncements' setting
131+
* It should hide both space tour and sidenav tour.
132+
* Currently it can be set only per space, so we set it right after new space is created.
133+
* TODO: update if setting becomes global https://github.com/elastic/kibana/issues/234771
134+
*/
135+
await kbnClient.uiSettings.update({ hideAnnouncements: true }, { space: spaceId });
136+
129137
log.serviceMessage('scoutSpace', `New Kibana space '${spaceId}' created`);
130138
await use({ savedObjects, uiSettings, id: spaceId });
131139

0 commit comments

Comments
 (0)