[8.5] [DOCS] Automate connector-listing.png (#143605) (#145661)

This commit is contained in:
Lisa Cawley 2022-11-23 14:04:10 -08:00 committed by GitHub
parent ac61f40e3d
commit b3ea3bf12c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 207 additions and 39 deletions

View file

@ -82,6 +82,7 @@ Rules use connectors to route actions to different destinations like log files,
[role="screenshot"]
image::images/connector-listing.png[Example connector listing in the {rac-ui} UI]
// NOTE: This is an autogenerated screenshot. Do not edit it directly.
[float]
=== Required permissions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 479 KiB

After

Width:  |  Height:  |  Size: 114 KiB

Before After
Before After

View file

@ -169,6 +169,9 @@ export default async function ({ readConfigFile }) {
observability: {
pathname: '/app/observability',
},
connectors: {
pathname: '/app/management/insightsAndAlerting/triggersActions/connectors',
},
},
// choose where screenshots should be saved

View file

@ -0,0 +1,46 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { FtrProviderContext } from '../../ftr_provider_context';
export function ActionsAPIServiceProvider({ getService }: FtrProviderContext) {
const kbnSupertest = getService('supertest');
return {
async createConnector({
name,
config,
secrets,
connectorTypeId,
}: {
name: string;
config: Record<string, unknown>;
secrets: Record<string, unknown>;
connectorTypeId: string;
}) {
const { body: createdAction } = await kbnSupertest
.post(`/api/actions/connector`)
.set('kbn-xsrf', 'foo')
.send({
name,
config,
secrets,
connector_type_id: connectorTypeId,
})
.expect(200);
return createdAction;
},
async deleteConnector(id: string) {
return kbnSupertest
.delete(`/api/actions/connector/${id}`)
.set('kbn-xsrf', 'foo')
.expect(204, '');
},
};
}

View file

@ -0,0 +1,15 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { FtrProviderContext } from '../../ftr_provider_context';
import { ActionsAPIServiceProvider } from './api';
export function ActionsServiceProvider(context: FtrProviderContext) {
return {
api: ActionsAPIServiceProvider(context),
};
}

View file

@ -70,7 +70,9 @@ import { SearchSessionsService } from './search_sessions';
import { ObservabilityProvider } from './observability';
// import { CompareImagesProvider } from './compare_images';
import { CasesServiceProvider } from './cases';
import { ActionsServiceProvider } from './actions';
import { AiopsProvider } from './aiops';
import { SampleDataServiceProvider } from './sample_data';
// define the name and providers for services that should be
// available to your tests. If you don't specify anything here
@ -130,6 +132,8 @@ export const services = {
searchSessions: SearchSessionsService,
observability: ObservabilityProvider,
// compareImages: CompareImagesProvider,
actions: ActionsServiceProvider,
cases: CasesServiceProvider,
aiops: AiopsProvider,
sampleData: SampleDataServiceProvider,
};

View file

@ -630,39 +630,5 @@ export function MachineLearningTestResourcesProvider(
async clearAdvancedSettingProperty(propertyName: string) {
await kibanaServer.uiSettings.unset(propertyName);
},
async installKibanaSampleData(sampleDataId: 'ecommerce' | 'flights' | 'logs') {
log.debug(`Installing Kibana sample data '${sampleDataId}'`);
const { body, status } = await supertest
.post(`/api/sample_data/${sampleDataId}`)
.set(COMMON_REQUEST_HEADERS);
mlApi.assertResponseStatusCode(200, status, body);
log.debug(` > Installed`);
},
async removeKibanaSampleData(sampleDataId: 'ecommerce' | 'flights' | 'logs') {
log.debug(`Removing Kibana sample data '${sampleDataId}'`);
const { body, status } = await supertest
.delete(`/api/sample_data/${sampleDataId}`)
.set(COMMON_REQUEST_HEADERS);
mlApi.assertResponseStatusCode(204, status, body);
log.debug(` > Removed`);
},
async installAllKibanaSampleData() {
await this.installKibanaSampleData('ecommerce');
await this.installKibanaSampleData('flights');
await this.installKibanaSampleData('logs');
},
async removeAllKibanaSampleData() {
await this.removeKibanaSampleData('ecommerce');
await this.removeKibanaSampleData('flights');
await this.removeKibanaSampleData('logs');
},
};
}

View file

@ -0,0 +1,15 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { FtrProviderContext } from '../../ftr_provider_context';
import { SampleDataTestResourcesServiceProvider } from './test_resources';
export function SampleDataServiceProvider(context: FtrProviderContext) {
return {
testResources: SampleDataTestResourcesServiceProvider(context),
};
}

View file

@ -0,0 +1,37 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { FtrProviderContext } from '../../ftr_provider_context';
export function SampleDataTestResourcesServiceProvider({ getService }: FtrProviderContext) {
const supertest = getService('supertest');
return {
async installKibanaSampleData(sampleDataId: 'ecommerce' | 'flights' | 'logs') {
await supertest.post(`/api/sample_data/${sampleDataId}`).set('kbn-xsrf', 'true').expect(200);
},
async removeKibanaSampleData(sampleDataId: 'ecommerce' | 'flights' | 'logs') {
await supertest
.delete(`/api/sample_data/${sampleDataId}`)
.set('kbn-xsrf', 'true')
.expect(204);
},
async installAllKibanaSampleData() {
await this.installKibanaSampleData('ecommerce');
await this.installKibanaSampleData('flights');
await this.installKibanaSampleData('logs');
},
async removeAllKibanaSampleData() {
await this.removeKibanaSampleData('ecommerce');
await this.removeKibanaSampleData('flights');
await this.removeKibanaSampleData('logs');
},
};
}

View file

@ -14,13 +14,14 @@ export const LOGS_INDEX_PATTERN = 'kibana_sample_data_logs';
export default function ({ getPageObject, getService, loadTestFile }: FtrProviderContext) {
const browser = getService('browser');
const ml = getService('ml');
const sampleData = getService('sampleData');
const securityPage = getPageObject('security');
describe('machine learning docs', function () {
this.tags(['ml']);
before(async () => {
await ml.testResources.installAllKibanaSampleData();
await sampleData.testResources.installAllKibanaSampleData();
await ml.testResources.setKibanaTimeZoneToUTC();
await ml.testResources.disableKibanaAnnouncements();
await browser.setWindowSize(1920, 1080);
@ -28,7 +29,7 @@ export default function ({ getPageObject, getService, loadTestFile }: FtrProvide
after(async () => {
await securityPage.forceLogout();
await ml.testResources.removeAllKibanaSampleData();
await sampleData.testResources.removeAllKibanaSampleData();
await ml.testResources.resetKibanaTimeZone();
await ml.testResources.resetKibanaAnnouncements();
});

View file

@ -15,13 +15,14 @@ export const LOGS_INDEX_PATTERN = 'kibana_sample_data_logs';
export default function ({ getPageObject, getService, loadTestFile }: FtrProviderContext) {
const browser = getService('browser');
const ml = getService('ml');
const sampleData = getService('sampleData');
const securityPage = getPageObject('security');
describe('response ops docs', function () {
this.tags(['responseOps']);
before(async () => {
await ml.testResources.installAllKibanaSampleData();
await sampleData.testResources.installAllKibanaSampleData();
await ml.testResources.setKibanaTimeZoneToUTC();
await ml.testResources.disableKibanaAnnouncements();
await browser.setWindowSize(1920, 1080);
@ -33,11 +34,12 @@ export default function ({ getPageObject, getService, loadTestFile }: FtrProvide
after(async () => {
await securityPage.forceLogout();
await ml.testResources.removeAllKibanaSampleData();
await sampleData.testResources.removeAllKibanaSampleData();
await ml.testResources.resetKibanaTimeZone();
await ml.testResources.resetKibanaAnnouncements();
});
loadTestFile(require.resolve('./stack_alerting'));
loadTestFile(require.resolve('./stack_cases'));
loadTestFile(require.resolve('./observability_cases'));
});

View file

@ -0,0 +1,14 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { FtrProviderContext } from '../../../ftr_provider_context';
export default function ({ loadTestFile }: FtrProviderContext) {
describe('stack alerting', function () {
loadTestFile(require.resolve('./list_view'));
});
}

View file

@ -0,0 +1,48 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { FtrProviderContext } from '../../../ftr_provider_context';
export default function ({ getService, getPageObjects }: FtrProviderContext) {
const commonScreenshots = getService('commonScreenshots');
const screenshotDirectories = ['response_ops_docs', 'stack_alerting'];
const pageObjects = getPageObjects(['common', 'header']);
const actions = getService('actions');
describe('list view', function () {
let serverLogConnectorId: string;
before(async () => {
const connectorName = `server-log-connector`;
({ id: serverLogConnectorId } = await createServerLogConnector(connectorName));
});
after(async () => {
await actions.api.deleteConnector(serverLogConnectorId);
});
it('connectors list screenshot', async () => {
await pageObjects.common.navigateToApp('connectors');
await pageObjects.header.waitUntilLoadingHasFinished();
await commonScreenshots.takeScreenshot(
'connector-listing',
screenshotDirectories,
1400,
1024
);
});
});
const createServerLogConnector = async (name: string) => {
return actions.api.createConnector({
name,
config: {},
secrets: {},
connectorTypeId: '.server-log',
});
};
}

View file

@ -7,7 +7,7 @@
import { GenericFtrProviderContext } from '@kbn/test';
import { pageObjects } from '../functional/page_objects';
import { pageObjects } from './page_objects';
import { services } from './services';
export type FtrProviderContext = GenericFtrProviderContext<typeof services, typeof pageObjects>;

View file

@ -0,0 +1,16 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { pageObjects as xpackFunctionalPageObjects } from '../../functional/page_objects';
import { TriggersActionsPageProvider } from '../../functional_with_es_ssl/page_objects/triggers_actions_ui_page';
import { RuleDetailsPageProvider } from '../../functional_with_es_ssl/page_objects/rule_details';
export const pageObjects = {
...xpackFunctionalPageObjects,
triggersActionsUI: TriggersActionsPageProvider,
ruleDetailsUI: RuleDetailsPageProvider,
};