6351d51f6d
* WIP - Replace tagcloud with es-charts wordcloud * Cleanup and add unit tests * Fix interpreter test * Update all tagcloud snapshots * Partial fix tagcloud test * Fix some other functional tests, add migration script, update sample data * Replace getColor with getCategorixalColor * Fix functional test * Apply clickhandler event for filtering by clicking the word * Fix weight calculation * Add a unit test and fix functional * Change the cursor to pointer Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
47 lines
1.9 KiB
TypeScript
47 lines
1.9 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
|
|
* 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.
|
|
*/
|
|
|
|
import { FtrService } from '../ftr_provider_context';
|
|
import { WebElementWrapper } from '../services/lib/web_element_wrapper';
|
|
|
|
export class TagCloudPageObject extends FtrService {
|
|
private readonly find = this.ctx.getService('find');
|
|
private readonly header = this.ctx.getPageObject('header');
|
|
private readonly visChart = this.ctx.getPageObject('visChart');
|
|
|
|
public async selectTagCloudTag(tagDisplayText: string) {
|
|
const elements = await this.find.allByCssSelector('text');
|
|
const targetElement = elements.find(
|
|
async (element) => (await element.getVisibleText()) === tagDisplayText
|
|
);
|
|
await targetElement?.click();
|
|
await this.header.waitUntilLoadingHasFinished();
|
|
}
|
|
|
|
public async getTextTagByElement(webElement: WebElementWrapper) {
|
|
await this.visChart.waitForVisualization();
|
|
const elements = await webElement.findAllByCssSelector('text');
|
|
return await Promise.all(elements.map(async (element) => await element.getVisibleText()));
|
|
}
|
|
|
|
public async getTextTag() {
|
|
await this.visChart.waitForVisualization();
|
|
const elements = await this.find.allByCssSelector('text');
|
|
return await Promise.all(elements.map(async (element) => await element.getVisibleText()));
|
|
}
|
|
|
|
public async getTextSizes() {
|
|
const tags = await this.find.allByCssSelector('text');
|
|
async function returnTagSize(tag: WebElementWrapper) {
|
|
const style = await tag.getAttribute('style');
|
|
const fontSize = style.match(/font-size: ([^;]*);/);
|
|
return fontSize ? fontSize[1] : '';
|
|
}
|
|
return await Promise.all(tags.map(returnTagSize));
|
|
}
|
|
}
|