Skip to content

Commit ab7a8f1

Browse files
authored
[9.2] [console] Move api test to scout / playwright (#241561) (#242202)
# Backport This will backport the following commits from `main` to `9.2`: - [[console] Move api test to scout / playwright (#241561)](#241561) <!--- Backport version: 10.1.0 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sorenlouv/backport) <!--BACKPORT [{"author":{"name":"Matthew Kime","email":"[email protected]"},"sourceCommit":{"committedDate":"2025-11-05T11:33:45Z","message":"[console] Move api test to scout / playwright (#241561)\n\n## Summary\n\nMove console api integration test over to scout / playwright. Keeping\ntest as unchanged as possible to learn about using scout / playwright.\n\nPart of https://github.com/elastic/kibana/issues/241708\n\n---------\n\nCo-authored-by: kibanamachine <[email protected]>\nCo-authored-by: Dzmitry Lemechko <[email protected]>","sha":"496455cd33d3e799b47da77b808fef3ec9bbbfac","branchLabelMapping":{"^v9.3.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Feature:Console","Team:Kibana Management","release_note:skip","backport missing","backport:all-open","v9.3.0"],"title":"[console] Move api test to scout / playwright","number":241561,"url":"https://github.com/elastic/kibana/pull/241561","mergeCommit":{"message":"[console] Move api test to scout / playwright (#241561)\n\n## Summary\n\nMove console api integration test over to scout / playwright. Keeping\ntest as unchanged as possible to learn about using scout / playwright.\n\nPart of https://github.com/elastic/kibana/issues/241708\n\n---------\n\nCo-authored-by: kibanamachine <[email protected]>\nCo-authored-by: Dzmitry Lemechko <[email protected]>","sha":"496455cd33d3e799b47da77b808fef3ec9bbbfac"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.3.0","branchLabelMappingKey":"^v9.3.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/241561","number":241561,"mergeCommit":{"message":"[console] Move api test to scout / playwright (#241561)\n\n## Summary\n\nMove console api integration test over to scout / playwright. Keeping\ntest as unchanged as possible to learn about using scout / playwright.\n\nPart of https://github.com/elastic/kibana/issues/241708\n\n---------\n\nCo-authored-by: kibanamachine <[email protected]>\nCo-authored-by: Dzmitry Lemechko <[email protected]>","sha":"496455cd33d3e799b47da77b808fef3ec9bbbfac"}},{"url":"https://github.com/elastic/kibana/pull/242199","number":242199,"branch":"9.1","state":"OPEN"},{"url":"https://github.com/elastic/kibana/pull/242200","number":242200,"branch":"9.0","state":"OPEN"},{"url":"https://github.com/elastic/kibana/pull/242201","number":242201,"branch":"8.19","state":"OPEN"}]}] BACKPORT-->
1 parent a5bcff1 commit ab7a8f1

File tree

11 files changed

+71
-56
lines changed

11 files changed

+71
-56
lines changed

.buildkite/scout_ci_config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
plugins:
33
enabled:
44
- apm
5+
- console
56
- discover_enhanced
67
- maps
78
- observability
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the "Elastic License
4+
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
5+
* Public License v 1"; you may not use this file except in compliance with, at
6+
* your election, the "Elastic License 2.0", the "GNU Affero General Public
7+
* License v3.0 only", or the "Server Side Public License, v 1".
8+
*/
9+
10+
export const COMMON_HEADERS = {
11+
'kbn-xsrf': 'some-xsrf-token',
12+
'x-elastic-internal-origin': 'kibana',
13+
'Content-Type': 'application/json;charset=UTF-8',
14+
};
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the "Elastic License
4+
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
5+
* Public License v 1"; you may not use this file except in compliance with, at
6+
* your election, the "Elastic License 2.0", the "GNU Affero General Public
7+
* License v3.0 only", or the "Server Side Public License, v 1".
8+
*/
9+
10+
import { createPlaywrightConfig } from '@kbn/scout';
11+
12+
export default createPlaywrightConfig({
13+
testDir: './tests',
14+
});
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the "Elastic License
4+
* 2.0", the "GNU Affero General Public License v3.0 only", and the "Server Side
5+
* Public License v 1"; you may not use this file except in compliance with, at
6+
* your election, the "Elastic License 2.0", the "GNU Affero General Public
7+
* License v3.0 only", or the "Server Side Public License, v 1".
8+
*/
9+
10+
import type { RoleApiCredentials } from '@kbn/scout';
11+
import { apiTest, expect } from '@kbn/scout';
12+
import { COMMON_HEADERS } from '../fixtures/constants';
13+
14+
apiTest.describe(
15+
'GET /api/console/api_server',
16+
{ tag: ['@ess', '@svlSecurity', '@svlOblt', '@svlSearch'] },
17+
() => {
18+
let adminApiCredentials: RoleApiCredentials;
19+
apiTest.beforeAll(async ({ requestAuth }) => {
20+
adminApiCredentials = await requestAuth.getApiKey('viewer');
21+
});
22+
apiTest('returns autocomplete definitions', async ({ apiClient }) => {
23+
const { body, statusCode } = await apiClient.get('api/console/api_server', {
24+
headers: {
25+
...COMMON_HEADERS,
26+
...adminApiCredentials.apiKeyHeader,
27+
},
28+
responseType: 'json',
29+
});
30+
expect(statusCode).toBe(200);
31+
expect(body).toHaveProperty('es');
32+
const {
33+
es: { name, globals, endpoints },
34+
} = body;
35+
expect(name).toBe('es');
36+
expect(Object.keys(globals).length).toBeGreaterThan(0);
37+
expect(Object.keys(endpoints).length).toBeGreaterThan(0);
38+
});
39+
}
40+
);

src/platform/plugins/shared/console/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
"compilerOptions": {
44
"outDir": "target/types",
55
},
6-
"include": ["common/**/*", "public/**/*", "server/**/*"],
6+
"include": ["common/**/*", "public/**/*", "server/**/*", "test/**/*"],
77
"kbn_references": [
8+
"@kbn/scout",
89
"@kbn/core",
910
"@kbn/dev-tools-plugin",
1011
"@kbn/es-ui-shared-plugin",

x-pack/platform/test/api_integration_deployment_agnostic/apis/console/index.ts

Lines changed: 0 additions & 14 deletions
This file was deleted.

x-pack/platform/test/api_integration_deployment_agnostic/apis/console/spec_definitions.ts

Lines changed: 0 additions & 37 deletions
This file was deleted.

x-pack/platform/test/api_integration_deployment_agnostic/configs/serverless/oblt.index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ export default function ({ loadTestFile }: DeploymentAgnosticFtrProviderContext)
1212

1313
// load new oblt and platform deployment-agnostic test here
1414
// Note: if your tests runtime is over 5 minutes, create a new index and config file
15-
loadTestFile(require.resolve('../../apis/console'));
1615
loadTestFile(require.resolve('../../apis/core'));
1716
loadTestFile(require.resolve('../../apis/management'));
1817
loadTestFile(require.resolve('../../apis/painless_lab'));

x-pack/platform/test/api_integration_deployment_agnostic/configs/serverless/search.index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ export default function ({ loadTestFile }: DeploymentAgnosticFtrProviderContext)
1111
this.tags(['esGate']);
1212

1313
// load new search and platform deployment-agnostic test here
14-
loadTestFile(require.resolve('../../apis/console'));
1514
loadTestFile(require.resolve('../../apis/core'));
1615
loadTestFile(require.resolve('../../apis/management'));
1716
loadTestFile(require.resolve('../../apis/saved_objects_management'));

x-pack/platform/test/api_integration_deployment_agnostic/configs/serverless/security.index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ export default function ({ loadTestFile }: DeploymentAgnosticFtrProviderContext)
1111
this.tags(['esGate']);
1212

1313
// load new security and platform deployment-agnostic test here
14-
loadTestFile(require.resolve('../../apis/console'));
1514
loadTestFile(require.resolve('../../apis/core'));
1615
loadTestFile(require.resolve('../../apis/management'));
1716
loadTestFile(require.resolve('../../apis/painless_lab'));

0 commit comments

Comments
 (0)