Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.x] [Search] [Onboarding] unskip FTR tests (#202818) #203494

Merged
merged 3 commits into from
Dec 9, 2024
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
72 changes: 6 additions & 66 deletions oas_docs/bundle.json
Original file line number Diff line number Diff line change
Expand Up @@ -5883,18 +5883,6 @@
"description": "This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.",
"operationId": "get-dashboards-dashboard",
"parameters": [
{
"description": "The version of the API to use",
"in": "header",
"name": "elastic-api-version",
"schema": {
"default": "2023-10-31",
"enum": [
"2023-10-31"
],
"type": "string"
}
},
{
"description": "The page number to return. Default is \"1\".",
"in": "query",
Expand All @@ -5921,7 +5909,7 @@
"responses": {
"200": {
"content": {
"application/json; Elastic-Api-Version=2023-10-31": {
"application/json": {
"schema": {
"additionalProperties": false,
"properties": {
Expand Down Expand Up @@ -6070,18 +6058,6 @@
"description": "This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.",
"operationId": "delete-dashboards-dashboard-id",
"parameters": [
{
"description": "The version of the API to use",
"in": "header",
"name": "elastic-api-version",
"schema": {
"default": "2023-10-31",
"enum": [
"2023-10-31"
],
"type": "string"
}
},
{
"description": "A required header to protect against CSRF attacks",
"in": "header",
Expand Down Expand Up @@ -6113,18 +6089,6 @@
"description": "This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.",
"operationId": "get-dashboards-dashboard-id",
"parameters": [
{
"description": "The version of the API to use",
"in": "header",
"name": "elastic-api-version",
"schema": {
"default": "2023-10-31",
"enum": [
"2023-10-31"
],
"type": "string"
}
},
{
"description": "A unique identifier for the dashboard.",
"in": "path",
Expand All @@ -6138,7 +6102,7 @@
"responses": {
"200": {
"content": {
"application/json; Elastic-Api-Version=2023-10-31": {
"application/json": {
"schema": {
"additionalProperties": false,
"properties": {
Expand Down Expand Up @@ -6773,18 +6737,6 @@
"description": "This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.",
"operationId": "post-dashboards-dashboard-id",
"parameters": [
{
"description": "The version of the API to use",
"in": "header",
"name": "elastic-api-version",
"schema": {
"default": "2023-10-31",
"enum": [
"2023-10-31"
],
"type": "string"
}
},
{
"description": "A required header to protect against CSRF attacks",
"in": "header",
Expand All @@ -6807,7 +6759,7 @@
],
"requestBody": {
"content": {
"application/json; Elastic-Api-Version=2023-10-31": {
"application/json": {
"schema": {
"additionalProperties": false,
"properties": {
Expand Down Expand Up @@ -7342,7 +7294,7 @@
"responses": {
"200": {
"content": {
"application/json; Elastic-Api-Version=2023-10-31": {
"application/json": {
"schema": {
"additionalProperties": false,
"properties": {
Expand Down Expand Up @@ -7949,18 +7901,6 @@
"description": "This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.",
"operationId": "put-dashboards-dashboard-id",
"parameters": [
{
"description": "The version of the API to use",
"in": "header",
"name": "elastic-api-version",
"schema": {
"default": "2023-10-31",
"enum": [
"2023-10-31"
],
"type": "string"
}
},
{
"description": "A required header to protect against CSRF attacks",
"in": "header",
Expand All @@ -7983,7 +7923,7 @@
],
"requestBody": {
"content": {
"application/json; Elastic-Api-Version=2023-10-31": {
"application/json": {
"schema": {
"additionalProperties": false,
"properties": {
Expand Down Expand Up @@ -8512,7 +8452,7 @@
"responses": {
"200": {
"content": {
"application/json; Elastic-Api-Version=2023-10-31": {
"application/json": {
"schema": {
"additionalProperties": false,
"properties": {
Expand Down
40 changes: 0 additions & 40 deletions oas_docs/output/kibana.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7638,14 +7638,6 @@ paths:
description: This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.
operationId: get-dashboards-dashboard
parameters:
- description: The version of the API to use
in: header
name: elastic-api-version
schema:
default: '2023-10-31'
enum:
- '2023-10-31'
type: string
- description: The page number to return. Default is "1".
in: query
name: page
Expand Down Expand Up @@ -7768,14 +7760,6 @@ paths:
description: This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.
operationId: delete-dashboards-dashboard-id
parameters:
- description: The version of the API to use
in: header
name: elastic-api-version
schema:
default: '2023-10-31'
enum:
- '2023-10-31'
type: string
- description: A required header to protect against CSRF attacks
in: header
name: kbn-xsrf
Expand All @@ -7798,14 +7782,6 @@ paths:
description: This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.
operationId: get-dashboards-dashboard-id
parameters:
- description: The version of the API to use
in: header
name: elastic-api-version
schema:
default: '2023-10-31'
enum:
- '2023-10-31'
type: string
- description: A unique identifier for the dashboard.
in: path
name: id
Expand Down Expand Up @@ -8269,14 +8245,6 @@ paths:
description: This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.
operationId: post-dashboards-dashboard-id
parameters:
- description: The version of the API to use
in: header
name: elastic-api-version
schema:
default: '2023-10-31'
enum:
- '2023-10-31'
type: string
- description: A required header to protect against CSRF attacks
in: header
name: kbn-xsrf
Expand Down Expand Up @@ -9110,14 +9078,6 @@ paths:
description: This functionality is in technical preview and may be changed or removed in a future release. Elastic will work to fix any issues, but features in technical preview are not subject to the support SLA of official GA features.
operationId: put-dashboards-dashboard-id
parameters:
- description: The version of the API to use
in: header
name: elastic-api-version
schema:
default: '2023-10-31'
enum:
- '2023-10-31'
type: string
- description: A required header to protect against CSRF attacks
in: header
name: kbn-xsrf
Expand Down
18 changes: 17 additions & 1 deletion x-pack/test_serverless/functional/page_objects/svl_api_keys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/

import expect from '@kbn/expect';
import { SecurityApiKey } from '@elastic/elasticsearch/lib/api/types';
import { FtrProviderContext } from '../ftr_provider_context';

const APIKEY_MASK = '•'.repeat(60);
Expand All @@ -27,6 +28,10 @@ export function SvlApiKeysProvider({ getService, getPageObjects }: FtrProviderCo
await browser.clearSessionStorage();
},

async expectAPIKeyExists() {
await testSubjects.existOrFail('apiKeyFormAPIKey', { timeout: 1000 });
},

async expectAPIKeyAvailable() {
await testSubjects.existOrFail('apiKeyFormAPIKey');
await retry.try(async () => {
Expand Down Expand Up @@ -84,8 +89,19 @@ export function SvlApiKeysProvider({ getService, getPageObjects }: FtrProviderCo
},

async deleteAPIKeys() {
const filterInvalid = (key: SecurityApiKey) => !key.invalidated;

const { api_keys: apiKeys } = await es.security.getApiKey();
await es.security.invalidateApiKey({ ids: apiKeys.map((key) => key.id) });

const validKeys = apiKeys.filter(filterInvalid);

if (validKeys.length === 0) {
return;
}

await es.security.invalidateApiKey({
ids: validKeys.map((key) => key.id),
});
},

async expectCreateApiKeyAction() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
const esDeleteAllIndices = getService('esDeleteAllIndices');
const es = getService('es');
const browser = getService('browser');
const retry = getService('retry');

const deleteAllTestIndices = async () => {
await esDeleteAllIndices(['search-*', 'test-*']);
Expand Down Expand Up @@ -95,7 +96,20 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
it('should show the api key in code view', async () => {
await pageObjects.svlSearchElasticsearchStartPage.expectToBeOnStartPage();
await pageObjects.svlSearchElasticsearchStartPage.clickCodeViewButton();
// sometimes the API key exists in the cluster and its lost in sessionStorage
// if fails we retry to delete the API key and refresh the browser
await retry.try(
async () => {
await pageObjects.svlApiKeys.expectAPIKeyExists();
},
async () => {
await pageObjects.svlApiKeys.deleteAPIKeys();
await browser.refresh();
await pageObjects.svlSearchElasticsearchStartPage.clickCodeViewButton();
}
);
await pageObjects.svlApiKeys.expectAPIKeyAvailable();

const apiKeyUI = await pageObjects.svlApiKeys.getAPIKeyFromUI();
const apiKeySession = await pageObjects.svlApiKeys.getAPIKeyFromSessionStorage();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
const svlSearchNavigation = getService('svlSearchNavigation');
const es = getService('es');
const security = getService('security');
const browser = getService('browser');
const retry = getService('retry');

const esDeleteAllIndices = getService('esDeleteAllIndices');
const indexName = 'test-my-index';
Expand Down Expand Up @@ -89,6 +91,27 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
await svlSearchNavigation.navigateToIndexDetailPage(indexName);
});

describe('API key details', () => {
it('should show api key', async () => {
await pageObjects.svlApiKeys.deleteAPIKeys();
await svlSearchNavigation.navigateToIndexDetailPage(indexName);
// sometimes the API key exists in the cluster and its lost in sessionStorage
// if fails we retry to delete the API key and refresh the browser
await retry.try(
async () => {
await pageObjects.svlApiKeys.expectAPIKeyExists();
},
async () => {
await pageObjects.svlApiKeys.deleteAPIKeys();
await browser.refresh();
}
);
await pageObjects.svlApiKeys.expectAPIKeyAvailable();
const apiKey = await pageObjects.svlApiKeys.getAPIKeyFromUI();
await pageObjects.svlSearchIndexDetailPage.expectAPIKeyToBeVisibleInCodeBlock(apiKey);
});
});

it('should show code examples for adding documents', async () => {
await pageObjects.svlSearchIndexDetailPage.expectAddDocumentCodeExamples();
await pageObjects.svlSearchIndexDetailPage.expectSelectedLanguage('python');
Expand Down
Loading