Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,16 @@ describe('read_manifest', () => {
expect(getKibanaModulePath(configPath)).toBe(expectedPath);
});

it(`should throw an error if 'scout' is not in the path`, () => {
it('should resolve the manifest path correctly for a scout_* config path', () => {
const configPath = '/plugins/my_plugin/test/scout_custom_config/api/playwright.config.ts';
const expectedPath = path.resolve('/plugins/my_plugin/kibana.jsonc');
expect(getKibanaModulePath(configPath)).toBe(expectedPath);
});

it(`should throw an error if 'scout' or 'scout_*' is not in the path`, () => {
const configPath = '/plugins/my_plugin/tests/playwright.config.ts';
expect(() => getKibanaModulePath(configPath)).toThrow(
/Invalid path: "scout" directory not found/
/Invalid path: "scout" or "scout_\*" directory not found/
);
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,18 @@ export interface KibanaModuleMetadata {
* Resolves the path to the `kibana.jsonc` manifest based on the Playwright configuration file path.
* @param configPath - Absolute path to the Playwright configuration file.
* @returns Absolute path to the `kibana.jsonc` file.
* @throws Error if `scout` is not found in the path.
* @throws Error if `scout` or `scout_*` is not found in the path.
*/
export const getKibanaModulePath = (configPath: string): string => {
const pathSegments = configPath.split(path.sep);
const testDirIndex = pathSegments.indexOf('scout');
const testDirIndex = pathSegments.findIndex(
(segment) => segment === 'scout' || segment.startsWith('scout_')
Copy link
Contributor Author

@csr csr Jan 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Problem: previously, the Scout Reporter wasn't able to infer the plugin manifest file path (this is important to derive info on the Kibana module type (e.g., plugin), group (e.g. platform), etc.

Fix: we now add support and the Kibana config file path is being reported correctly. We also no longer see errors like this one when we run tests (using npx playwright test --config ...):

Error in reporter Error: Invalid path: "scout" directory not found in /Users/cesaredecal/dev/kibana/x-pack/platform/plugins/shared/security/test/scout_uiam_local/api/parallel.playwright.config.ts.

);

if (testDirIndex === -1) {
throw new Error(
`Invalid path: "scout" directory not found in ${configPath}.
Ensure playwright configuration file is in the plugin directory: '/plugins/<plugin-name>/test/scout/ui/<config-file>'`
`Invalid path: "scout" or "scout_*" directory not found in ${configPath}.
Ensure Playwright configuration file is in the plugin directory: '/plugins/<plugin-name>/test/{scout,scout_*}/ui/<config-file>'`
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,8 @@ export class ScoutPlaywrightReporter implements Reporter {
}

private getScoutConfigCategory(configPath: string): ScoutTestRunConfigCategory {
const pattern = /scout\/(api|ui)\//;
// Matches scout/{api|ui} or scout_<custom>/{api|ui} and captures api|ui
const pattern = /scout(?:_[^/]+)?\/(api|ui)\//;
const match = configPath.match(pattern);
if (match) {
return match[1] === 'api'
Expand Down
Loading