kibana/x-pack/test/functional/page_objects/infra_home_page.ts
Phillip Burch 4bdd31e9c9
[Metrics + Logs UI] Add test for logs and metrics telemetry (#70858)
* Add test for logs and metrics telemetry

* wait before you go

* Remove kubenetes

* Fix type check

* Add back kubernetes test

* Remove kubernetes

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
2020-07-13 08:57:42 -05:00

105 lines
3.1 KiB
TypeScript

/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import testSubjSelector from '@kbn/test-subj-selector';
import { FtrProviderContext } from '../ftr_provider_context';
export function InfraHomePageProvider({ getService }: FtrProviderContext) {
const testSubjects = getService('testSubjects');
const retry = getService('retry');
const find = getService('find');
const browser = getService('browser');
return {
async goToTime(time: string) {
const datePickerInput = await find.byCssSelector(
`${testSubjSelector('waffleDatePicker')} .euiDatePicker.euiFieldText`
);
await datePickerInput.clearValueWithKeyboard({ charByChar: true });
await datePickerInput.type([time, browser.keys.RETURN]);
},
async getWaffleMap() {
await retry.try(async () => {
const element = await testSubjects.find('waffleMap');
if (!element) {
throw new Error();
}
});
return await testSubjects.find('waffleMap');
},
async openInvenotrySwitcher() {
await testSubjects.click('openInventorySwitcher');
return await testSubjects.find('goToHost');
},
async goToHost() {
await testSubjects.click('openInventorySwitcher');
await testSubjects.find('goToHost');
return await testSubjects.click('goToHost');
},
async goToPods() {
await testSubjects.click('openInventorySwitcher');
await testSubjects.find('goToHost');
return await testSubjects.click('goToPods');
},
async goToDocker() {
await testSubjects.click('openInventorySwitcher');
await testSubjects.find('goToHost');
return await testSubjects.click('goToDocker');
},
async goToMetricExplorer() {
return await testSubjects.click('infrastructureNavLink_/infrastructure/metrics-explorer');
},
async getSaveViewButton() {
return await testSubjects.find('openSaveViewModal');
},
async getLoadViewsButton() {
return await testSubjects.find('loadViews');
},
async openSaveViewsFlyout() {
return await testSubjects.click('loadViews');
},
async closeSavedViewFlyout() {
return await testSubjects.click('cancelSavedViewModal');
},
async openCreateSaveViewModal() {
return await testSubjects.click('openSaveViewModal');
},
async openEnterViewNameAndSave() {
await testSubjects.setValue('savedViewViweName', 'View1');
await testSubjects.click('createSavedViewButton');
},
async getNoMetricsIndicesPrompt() {
return await testSubjects.find('noMetricsIndicesPrompt');
},
async getNoMetricsDataPrompt() {
return await testSubjects.find('noMetricsDataPrompt');
},
async openSourceConfigurationFlyout() {
await testSubjects.click('configureSourceButton');
await testSubjects.exists('sourceConfigurationFlyout');
},
async waitForLoading() {
await testSubjects.missingOrFail('loadingMessage', { timeout: 20000 });
},
};
}