TSVB: functional test for color picker, preview disable and series clone (#37186)

* [visualize/_tsvb_chart] test for color picker, changing  preview and cloning series
This commit is contained in:
Dmitry Lemeshko 2019-05-28 14:44:46 +02:00 committed by GitHub
parent 7d21cb1c14
commit 7c556ca337
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 55 additions and 3 deletions

View file

@ -109,7 +109,7 @@ class ColorPickerUI extends Component {
);
}
return (
<div className="tvbColorPicker">
<div className="tvbColorPicker" data-test-subj="tvbColorPicker">
{ swatch }
{ clear }
{

View file

@ -82,7 +82,7 @@ class CustomColorPickerUI extends Component {
});
return (
<div className="tvbColorPickerPopUp">
<div className="tvbColorPickerPopUp" data-test-subj="tvbColorPickerPopUp">
<div className="tvbColorPickerPopUp__saturation">
<Saturation
style={styles.Saturation}

View file

@ -62,6 +62,22 @@ export default function({ getService, getPageObjects }: FtrProviderContext) {
const actualCount = await PageObjects.visualBuilder.getRhythmChartLegendValue();
expect(actualCount).to.be('53');
});
it('should open color picker, deactivate panel and clone series', async () => {
await PageObjects.visualBuilder.clickColorPicker();
await PageObjects.visualBuilder.checkColorPickerPopUpIsPresent();
await PageObjects.visualBuilder.clickColorPicker();
await PageObjects.visualBuilder.changePanelPreview();
await PageObjects.visualBuilder.checkPreviewIsDisabled();
await PageObjects.visualBuilder.changePanelPreview();
await PageObjects.visualBuilder.cloneSeries();
const legend = await PageObjects.visualBuilder.getLegentItems();
const series = await PageObjects.visualBuilder.getSeries();
expect(legend.length).to.be(2);
expect(series.length).to.be(2);
});
});
describe('metric', () => {

View file

@ -339,7 +339,7 @@ export function VisualBuilderPageProvider({ getService, getPageObjects }: FtrPro
const isDataExists = await testSubjects.exists('tableView');
log.debug(`data is already rendered: ${isDataExists}`);
if (!isDataExists) {
await testSubjects.existOrFail('noTSVBDataMessage');
await this.checkPreviewIsDisabled();
}
}
@ -369,6 +369,42 @@ export function VisualBuilderPageProvider({ getService, getPageObjects }: FtrPro
const fieldEl = (await label.findAllByCssSelector('[data-test-subj = "comboBoxInput"]'))[1];
await comboBox.setElement(fieldEl, field);
}
public async clickColorPicker(): Promise<void> {
await testSubjects.click('tvbColorPicker');
}
public async checkColorPickerPopUpIsPresent(): Promise<void> {
log.debug(`Check color picker popup is present`);
await testSubjects.existOrFail('tvbColorPickerPopUp', { timeout: 5000 });
}
public async changePanelPreview(nth: number = 0): Promise<void> {
const prevRenderingCount = await PageObjects.visualize.getVisualizationRenderingCount();
const changePreviewBtnArray = await testSubjects.findAll('AddActivatePanelBtn');
await changePreviewBtnArray[nth].click();
await PageObjects.visualize.waitForRenderingCount(prevRenderingCount + 1);
}
public async checkPreviewIsDisabled(): Promise<void> {
log.debug(`Check no data message is present`);
await testSubjects.existOrFail('noTSVBDataMessage', { timeout: 5000 });
}
public async cloneSeries(nth: number = 0): Promise<void> {
const prevRenderingCount = await PageObjects.visualize.getVisualizationRenderingCount();
const cloneBtnArray = await testSubjects.findAll('AddCloneBtn');
await cloneBtnArray[nth].click();
await PageObjects.visualize.waitForRenderingCount(prevRenderingCount + 1);
}
public async getLegentItems(): Promise<WebElementWrapper[]> {
return await testSubjects.findAll('tsvbLegendItem');
}
public async getSeries(): Promise<WebElementWrapper[]> {
return await find.allByCssSelector('.tvbSeriesEditor');
}
}
return new VisualBuilderPage();