[TSVB] [AT] new markdown tests (#38545)

* perform new markdown tests
This commit is contained in:
Vitali Haradkou 2019-06-12 14:25:36 +03:00 committed by GitHub
parent c308048f04
commit a7abe1999d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 44 additions and 10 deletions

View file

@ -112,6 +112,23 @@ export default function({ getPageObjects }: FtrProviderContext) {
await cleanupMarkdownData(VARIABLE, VARIABLE);
});
it('series length should be 2 after cloning', async () => {
await visualBuilder.markdownSwitchSubTab('data');
await visualBuilder.cloneSeries();
const seriesLength = (await visualBuilder.getSeries()).length;
expect(seriesLength).to.be.equal(2);
});
it('aggregation length should be 2 after cloning', async () => {
await visualBuilder.markdownSwitchSubTab('data');
await visualBuilder.createNewAgg();
const aggregationLength = await visualBuilder.getAggregationCount();
expect(aggregationLength).to.be.equal(2);
});
});
});
}

View file

@ -22,7 +22,6 @@ import { WebElementWrapper } from '../services/lib/web_element_wrapper';
export function VisualBuilderPageProvider({ getService, getPageObjects }: FtrProviderContext) {
const find = getService('find');
const retry = getService('retry');
const log = getService('log');
const browser = getService('browser');
const testSubjects = getService('testSubjects');
@ -289,15 +288,13 @@ export function VisualBuilderPageProvider({ getService, getPageObjects }: FtrPro
}
public async createNewAgg(nth = 0) {
return await retry.try(async () => {
const elements = await testSubjects.findAll('addMetricAddBtn');
await elements[nth].click();
await PageObjects.header.waitUntilLoadingHasFinished();
const aggs = await testSubjects.findAll('aggSelector');
if (aggs.length < 2) {
throw new Error('there should be atleast 2 aggSelectors');
}
});
const elements = await testSubjects.findAll('addMetricAddBtn');
await elements[nth].click();
await PageObjects.header.waitUntilLoadingHasFinished();
const aggs = await testSubjects.findAll('aggSelector');
if (aggs.length < 2) {
throw new Error('there should be atleast 2 aggSelectors');
}
}
public async selectAggType(value: string, nth = 0) {
@ -438,6 +435,26 @@ export function VisualBuilderPageProvider({ getService, getPageObjects }: FtrPro
await PageObjects.visualize.waitForRenderingCount(prevRenderingCount + 1);
}
/**
* Get aggregation count for the current series
*
* @param {number} [nth=0] series
* @returns {Promise<number>}
* @memberof VisualBuilderPage
*/
public async getAggregationCount(nth: number = 0): Promise<number> {
const series = await this.getSeries();
const aggregation = await series[nth].findAllByCssSelector('[data-test-subj="draggable"]');
return aggregation.length;
}
public async deleteSeries(nth: number = 0): Promise<void> {
const prevRenderingCount = await PageObjects.visualize.getVisualizationRenderingCount();
const cloneBtnArray = await testSubjects.findAll('AddDeleteBtn');
await cloneBtnArray[nth].click();
await PageObjects.visualize.waitForRenderingCount(prevRenderingCount + 1);
}
public async getLegentItems(): Promise<WebElementWrapper[]> {
return await testSubjects.findAll('tsvbLegendItem');
}