2018-05-29 05:06:30 +02:00
|
|
|
/*
|
2021-01-20 02:52:56 +01:00
|
|
|
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
|
|
|
* or more contributor license agreements. Licensed under the Elastic License
|
2021-02-04 03:12:39 +01:00
|
|
|
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
|
|
|
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
|
|
|
* Side Public License, v 1.
|
2018-05-29 05:06:30 +02:00
|
|
|
*/
|
|
|
|
|
2021-06-04 19:17:00 +02:00
|
|
|
import { FtrService } from '../ftr_provider_context';
|
2019-10-10 16:34:33 +02:00
|
|
|
|
2021-06-04 19:17:00 +02:00
|
|
|
export class HomePageObject extends FtrService {
|
|
|
|
private readonly testSubjects = this.ctx.getService('testSubjects');
|
|
|
|
private readonly retry = this.ctx.getService('retry');
|
|
|
|
private readonly find = this.ctx.getService('find');
|
|
|
|
private readonly common = this.ctx.getPageObject('common');
|
2021-10-21 18:20:34 +02:00
|
|
|
private readonly log = this.ctx.getService('log');
|
Kibana Home page - phase two (#14749)
* add tutorial directory and home promo section
* tutorial components
* use KuiCodeEditor for displaying instruction code
* move spec files to server so joi can be used. Fetch via rest API
* Adding more tutorials (#4)
* More edits on the Apache logs tutorial
* Added nginx, mysql, and sytem modules for FB
* Moved apache to apacheLogs and added an apacheMetrics tutorial
* Added mysqlMetrics, nginxMetrics, systemMetrics tutorials
* Reduce duplication in the tutorials
This uses common objects for the install and start steps for Filebeat.
Same can be done for MB.
* fix windows path for config file
* add markdown parsing
* use mustache to replace config.kibana.version with kibana version
* add image preview to tutorial introduction
* fix css class name
* add param types constants
* add docs variables
* [WIP] Logstash Netflow module tutorial (#5)
* First draft of Logstash Netflow module tutorial
* Incorporated writing style suggestions
* pass params to template replace logic
* parameter inputs
* use isReadOnly flag from ui-framework for KuiCodeEditor
* dedemorton commits on netflow
* remove trailing slash from base links
* add config.docs.logstash and fix vertical spacing between Content component and commands
* Use logstash docs config variable
* Starting to add Deb instructions
* Fix Logstash documentation link
* Make commands optional
* Refactor: extract common LS instructions
* Edits for the existing tutorials
* change schema to support three instruction types
* [Netflow tutorial] Simplify OSX instructions
* replace axios with fetch
* pass credentials to tutorial fetch
* display cloud instructions when cloud set
* RadioButtonGroup component
* update copy
* add tutorial component jest tests
* content component test
* load isCloudEnabled in home_app
* add functional test ensuring add data tutorials are fetch and displayed
* rename card btns to 'Add data', fix type in tutorial directory tab, remove 'Set up index pattern from tutorial directory'
* move parameters form to right of instruction set title
* add copy snippet button, remove line numbers from command block
* add breadcrumb to tutorial view
* update tutorial jest snapshot
* use componentDidMount and ignore async results if componenent has been unmounted
* define shape of prop for instructionVariants and params. Create NumberParameter and StringParameter components
* add bread crumb to add data directory page
* Add cloud version of the apache_logs tutorial (#16)
* Add cloud version of the apache_logs tutorial
* Added onprem-cloud version as well
* fix styling broken by EUI rebase
* add artifacts to tutorial schema
* fix styling for code block
* [Tutorials] Netflow: instructions for onPremCloud (#18)
* Extract common on-prem cloud instructions so LS and Beats can share them
* Extracting common instructions; adding onPremCloud instructions
* fix copy bug where copy would only contain previously selected text
* make string parameter input type be text
* Implementing Elastic Cloud tutorial for Netflow module (#19)
* More tutorial edits (#20)
* More tutorial edits
This updates the on prem instructions with a step that installs the GeoIP and
UA plugins in ES. It also makes the on-prem steps more consistent with the cloud
instructions which results in less redundancy in the code.
* Show config step for all variants
* More DRY in the tutorial content
* Updated screenshot for apache_logs
* wrap markdown content in markdown-body class
* use EuiFlexGroup to remove wasted space with 'copy snippet' button and instruction text
* change OSX to macOS, use Computed property names for instruction_variant DISPLAY_MAP, replace /app/kibana with kbnBaseUrl, remove unneeded if check in copy_to_clippboard, put getTutorials mixin on server instead of request
* capitilize 'C' in Elastic Cloud
* remove try/catch from copy_to_clipboard
* Removing unrelated instructions
* Copy editing fixes
* Multiply edits to the Beats tutorials (#21)
* Updated Nginx module
* Updated MySQL logs module
* Updated system logs module
* Correct the on_prem_cloud enable steps
* Updated the Nginx metrics tutorial and added screenshot
* Updated the Apache metrics module + screenshot
* Updated the MySQL metrics module + screenshot
* Updated the system metrics module + screenshot
* prevent 'Copy snippet' button text from wrapping
* [Netflow tutorial] Windows instructions (#22)
* [Netflow tutorial] Adding onPrem instructions for Windows
* Removing unrelated/superfluous instructions
* Adding Windows instructions for onPremElasticCloud and elasticCloud
* use EuiImage so tutorial images are clickable to view in full screen
* fix jest tests
* set fullScreenIconColor and alt options for EuiImage, add space between command block and instruction text
2018-01-10 15:20:38 +01:00
|
|
|
|
2021-06-04 19:17:00 +02:00
|
|
|
async clickSynopsis(title: string) {
|
|
|
|
await this.testSubjects.click(`homeSynopsisLink${title}`);
|
|
|
|
}
|
2017-11-29 22:24:00 +01:00
|
|
|
|
2021-06-04 19:17:00 +02:00
|
|
|
async doesSynopsisExist(title: string) {
|
|
|
|
return await this.testSubjects.exists(`homeSynopsisLink${title}`);
|
|
|
|
}
|
2018-05-24 22:39:07 +02:00
|
|
|
|
2021-06-04 19:17:00 +02:00
|
|
|
async doesSampleDataSetExist(id: string) {
|
|
|
|
return await this.testSubjects.exists(`sampleDataSetCard${id}`);
|
|
|
|
}
|
2018-05-24 22:39:07 +02:00
|
|
|
|
2021-06-04 19:17:00 +02:00
|
|
|
async isSampleDataSetInstalled(id: string) {
|
2021-10-21 18:20:34 +02:00
|
|
|
const sampleDataCard = await this.testSubjects.find(`sampleDataSetCard${id}`);
|
|
|
|
const sampleDataCardInnerHTML = await sampleDataCard.getAttribute('innerHTML');
|
|
|
|
this.log.debug(sampleDataCardInnerHTML);
|
|
|
|
return sampleDataCardInnerHTML.includes('removeSampleDataSet');
|
2021-06-04 19:17:00 +02:00
|
|
|
}
|
2020-09-18 14:54:08 +02:00
|
|
|
|
2021-08-17 21:47:03 +02:00
|
|
|
async isWelcomeInterstitialDisplayed() {
|
|
|
|
return await this.testSubjects.isDisplayed('homeWelcomeInterstitial');
|
|
|
|
}
|
|
|
|
|
2021-06-04 19:17:00 +02:00
|
|
|
async getVisibileSolutions() {
|
|
|
|
const solutionPanels = await this.testSubjects.findAll('~homSolutionPanel', 2000);
|
|
|
|
const panelAttributes = await Promise.all(
|
|
|
|
solutionPanels.map((panel) => panel.getAttribute('data-test-subj'))
|
|
|
|
);
|
|
|
|
return panelAttributes.map((attributeValue) => attributeValue.split('homSolutionPanel_')[1]);
|
|
|
|
}
|
2018-05-24 22:39:07 +02:00
|
|
|
|
2021-06-04 19:17:00 +02:00
|
|
|
async addSampleDataSet(id: string) {
|
|
|
|
const isInstalled = await this.isSampleDataSetInstalled(id);
|
|
|
|
if (!isInstalled) {
|
2021-09-28 20:50:22 +02:00
|
|
|
await this.retry.waitFor('wait until sample data is installed', async () => {
|
|
|
|
await this.testSubjects.click(`addSampleDataSet${id}`);
|
|
|
|
await this._waitForSampleDataLoadingAction(id);
|
|
|
|
return await this.isSampleDataSetInstalled(id);
|
|
|
|
});
|
2018-08-27 19:51:36 +02:00
|
|
|
}
|
2021-06-04 19:17:00 +02:00
|
|
|
}
|
2018-08-27 19:51:36 +02:00
|
|
|
|
2021-06-04 19:17:00 +02:00
|
|
|
async removeSampleDataSet(id: string) {
|
|
|
|
// looks like overkill but we're hitting flaky cases where we click but it doesn't remove
|
|
|
|
await this.testSubjects.waitForEnabled(`removeSampleDataSet${id}`);
|
|
|
|
// https://github.com/elastic/kibana/issues/65949
|
|
|
|
// Even after waiting for the "Remove" button to be enabled we still have failures
|
|
|
|
// where it appears the click just didn't work.
|
|
|
|
await this.common.sleep(1010);
|
|
|
|
await this.testSubjects.click(`removeSampleDataSet${id}`);
|
|
|
|
await this._waitForSampleDataLoadingAction(id);
|
|
|
|
}
|
2018-05-24 22:39:07 +02:00
|
|
|
|
2021-06-04 19:17:00 +02:00
|
|
|
// loading action is either uninstall and install
|
|
|
|
async _waitForSampleDataLoadingAction(id: string) {
|
|
|
|
const sampleDataCard = await this.testSubjects.find(`sampleDataSetCard${id}`);
|
|
|
|
await this.retry.try(async () => {
|
|
|
|
// waitForDeletedByCssSelector needs to be inside retry because it will timeout at least once
|
|
|
|
// before action is complete
|
|
|
|
await sampleDataCard.waitForDeletedByCssSelector('.euiLoadingSpinner');
|
|
|
|
});
|
|
|
|
}
|
2020-02-13 22:45:37 +01:00
|
|
|
|
2021-06-04 19:17:00 +02:00
|
|
|
async launchSampleDashboard(id: string) {
|
|
|
|
await this.launchSampleDataSet(id);
|
|
|
|
await this.find.clickByLinkText('Dashboard');
|
|
|
|
}
|
2018-05-24 22:39:07 +02:00
|
|
|
|
2021-06-04 19:17:00 +02:00
|
|
|
async launchSampleDataSet(id: string) {
|
|
|
|
await this.addSampleDataSet(id);
|
2021-07-21 16:31:23 +02:00
|
|
|
await this.common.closeToastIfExists();
|
2021-06-04 19:17:00 +02:00
|
|
|
await this.testSubjects.click(`launchSampleDataSet${id}`);
|
|
|
|
}
|
2020-04-03 20:29:32 +02:00
|
|
|
|
2021-06-04 19:17:00 +02:00
|
|
|
async clickAllKibanaPlugins() {
|
|
|
|
await this.testSubjects.click('allPlugins');
|
|
|
|
}
|
2020-04-03 20:29:32 +02:00
|
|
|
|
2021-06-04 19:17:00 +02:00
|
|
|
async clickVisualizeExplorePlugins() {
|
|
|
|
await this.testSubjects.click('tab-data');
|
|
|
|
}
|
2020-04-03 20:29:32 +02:00
|
|
|
|
2021-06-04 19:17:00 +02:00
|
|
|
async clickAdminPlugin() {
|
|
|
|
await this.testSubjects.click('tab-admin');
|
|
|
|
}
|
2020-04-03 20:29:32 +02:00
|
|
|
|
2021-06-04 19:17:00 +02:00
|
|
|
async clickOnConsole() {
|
|
|
|
await this.clickSynopsis('console');
|
|
|
|
}
|
|
|
|
async clickOnLogo() {
|
|
|
|
await this.testSubjects.click('logo');
|
|
|
|
}
|
2020-04-03 20:29:32 +02:00
|
|
|
|
2021-06-04 19:17:00 +02:00
|
|
|
async clickOnAddData() {
|
|
|
|
await this.clickSynopsis('home_tutorial_directory');
|
|
|
|
}
|
2020-04-03 20:29:32 +02:00
|
|
|
|
2021-06-04 19:17:00 +02:00
|
|
|
// clicks on Active MQ logs
|
|
|
|
async clickOnLogsTutorial() {
|
|
|
|
await this.clickSynopsis('activemqlogs');
|
|
|
|
}
|
2020-04-03 20:29:32 +02:00
|
|
|
|
2021-06-04 19:17:00 +02:00
|
|
|
// clicks on cloud tutorial link
|
|
|
|
async clickOnCloudTutorial() {
|
|
|
|
await this.testSubjects.click('onCloudTutorial');
|
|
|
|
}
|
2020-08-20 18:40:18 +02:00
|
|
|
|
2021-06-29 21:25:27 +02:00
|
|
|
// click on global nav toggle button
|
|
|
|
async clickToggleGlobalNav() {
|
2021-06-04 19:17:00 +02:00
|
|
|
await this.testSubjects.click('toggleNavButton');
|
|
|
|
}
|
2020-08-20 18:40:18 +02:00
|
|
|
|
2021-06-29 21:25:27 +02:00
|
|
|
async clickGoHome() {
|
|
|
|
await this.openCollapsibleNav();
|
|
|
|
await this.testSubjects.click('homeLink');
|
|
|
|
}
|
|
|
|
|
|
|
|
// open global nav if it's closed
|
|
|
|
async openCollapsibleNav() {
|
|
|
|
if (!(await this.testSubjects.exists('collapsibleNav'))) {
|
|
|
|
await this.clickToggleGlobalNav();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-06-04 19:17:00 +02:00
|
|
|
// collapse the observability side nav details
|
|
|
|
async collapseObservabibilitySideNav() {
|
|
|
|
await this.testSubjects.click('collapsibleNavGroup-observability');
|
|
|
|
}
|
2020-08-20 18:40:18 +02:00
|
|
|
|
2021-06-04 19:17:00 +02:00
|
|
|
async loadSavedObjects() {
|
|
|
|
await this.retry.try(async () => {
|
|
|
|
await this.testSubjects.click('loadSavedObjects');
|
|
|
|
const successMsgExists = await this.testSubjects.exists('loadSavedObjects_success', {
|
|
|
|
timeout: 5000,
|
|
|
|
});
|
|
|
|
if (!successMsgExists) {
|
|
|
|
throw new Error('Failed to load saved objects');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
2017-11-29 22:24:00 +01:00
|
|
|
}
|