mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
* Use render counter to fix timing issue with click events not being applied by the time a pie slice is clicked. * use testSubjects.moveMouseTo function It has built in safety checks for stale element refs * remove sleep * Remove extra test suite runs, passed enough times
This commit is contained in:
parent
7ef2bc3a79
commit
15fadeda2d
3 changed files with 25 additions and 3 deletions
|
@ -75,7 +75,7 @@ export default function ({ getService, getPageObjects }) {
|
|||
await dashboardExpect.pieSliceCount(0);
|
||||
});
|
||||
|
||||
describe.skip('filters', async function () {
|
||||
describe('filters', async function () {
|
||||
before(async () => {
|
||||
await PageObjects.dashboard.gotoDashboardLandingPage();
|
||||
await PageObjects.dashboard.clickNewDashboard();
|
||||
|
@ -88,6 +88,10 @@ export default function ({ getService, getPageObjects }) {
|
|||
|
||||
it('are added when a pie chart slice is clicked', async function () {
|
||||
await PageObjects.dashboard.addVisualizations([PIE_CHART_VIS_NAME]);
|
||||
// Click events not added until visualization is finished rendering.
|
||||
// See https://github.com/elastic/kibana/issues/15480#issuecomment-350195245 for more info on why
|
||||
// this is necessary.
|
||||
await PageObjects.dashboard.waitForRenderCounter(2);
|
||||
await PageObjects.dashboard.filterOnPieSlice();
|
||||
const filters = await PageObjects.dashboard.getFilters();
|
||||
expect(filters.length).to.equal(1);
|
||||
|
|
|
@ -579,6 +579,25 @@ export function DashboardPageProvider({ getService, getPageObjects }) {
|
|||
throw new Error('no element');
|
||||
}
|
||||
|
||||
async waitForRenderCounter(count) {
|
||||
await retry.try(async () => {
|
||||
const sharedItems = await find.allByCssSelector('[data-shared-item]');
|
||||
const renderCounters = await Promise.all(sharedItems.map(async sharedItem => {
|
||||
return await sharedItem.getAttribute('render-counter');
|
||||
}));
|
||||
if (renderCounters.length !== sharedItems.length) {
|
||||
throw new Error('Some shared items dont have render counter attribute');
|
||||
}
|
||||
let totalCount = 0;
|
||||
renderCounters.forEach(counter => {
|
||||
totalCount += counter;
|
||||
});
|
||||
if (totalCount < count) {
|
||||
throw new Error('Still waiting on more visualizations to finish rendering');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
async getPanelSharedItemData() {
|
||||
log.debug('in getPanelSharedItemData');
|
||||
const sharedItems = await find.allByCssSelector('[data-shared-item]');
|
||||
|
|
|
@ -247,8 +247,7 @@ export function DiscoverPageProvider({ getService, getPageObjects }) {
|
|||
}
|
||||
|
||||
async clickFieldListItemAdd(field) {
|
||||
const listEntry = await testSubjects.find(`field-${field}`);
|
||||
await getRemote().moveMouseTo(listEntry);
|
||||
await testSubjects.moveMouseTo(`field-${field}`);
|
||||
await testSubjects.click(`fieldToggle-${field}`);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue