From 3d05f74cfdb1cf1083a90bbebf61094772fe3417 Mon Sep 17 00:00:00 2001 From: Carlos Crespo Date: Tue, 27 Jun 2023 09:54:20 +0200 Subject: [PATCH] [Infrastructure UI] Metrics Explorer Saved View flaky test fix (#160504) closes [#156513](https://github.com/elastic/kibana/issues/156513) ## Summary Fix flaky Metrics Explorer Saved Views functional test. Based on the [screenshot](https://buildkiteartifacts.com/e0f3970e-3a75-4621-919f-e6c773e2bb12/b1106efc-ba5e-4e90-a857-11c4a899c05d/0188e3a3-7b0a-4a2b-b305-41f088a36c7b/0188e3a5-5e7d-4cac-9ca2-ad049aa86341/x-pack/test/functional/screenshots/failure/InfraOps%20App%20Metrics%20UI%20Metrics%20Explorer%20Saved%20Views%20should%20update%20the%20current%20s-548c19241effa693af1bdaa2945c1bb8f7a0de0759993758d705b60a14e17c8d.png?response-content-type=image%2Fpng&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIAQPCP3C7LZDIHP4OQ%2F20230626%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20230626T100738Z&X-Amz-Expires=600&X-Amz-Security-Token=IQoJb3JpZ2luX2VjENf%2F%2F%2F%2F%2F%2F%2F%2F%2F%2FwEaCXVzLWVhc3QtMSJHMEUCIQCWRh%2Bz%2BuUkCNazAWmBVuDmsKyUAOlJ%2F71ynwSjXcFzGwIgBwzs5UgxrUrkki2Bl7ucYrIa0ldQYroVGWCAyxTTGLMq8QMIQBAAGgwwMzIzNzk3MDUzMDMiDMeqhNGm7I4CeupKPyrOA4mOkzowrCIJ9q06o%2B0LNAadRLnRcoUyBFNpVdOOZ0Mz8PCIQv8PxnVFC9c9b0o7zzxXhhIssuWjMG4bjR9PVgAL1xIMwVp9qmsfGELZ4Ctc5Py18PZ6Nsp0IYU9dj58bxyronawXCypdqG%2BaAfcETMYhr7IwusqJQKtJr0XvuWHAABjQp8KLfzU04sKG5XjZtaj%2F9i8ma2ubesispDhEjdsZYr9cy5dLqkHHEBfIi0WHc6wsdlrFge5LVQSe0Cppf7FhKubL39v2FcbPA58ftR075YDIFfgTh4jMaC502WmUBDEI1HhBNPBtGKJQz7gN6iYIlIfW8q1rXPW5KiLU3D%2ByjU0gWAO6xyBb8ShIwxJ8fCRFrpT4487g5VFrJCDwAmhuCpKWu4GtgsWvMr0VNB4M%2BKJKR7%2FicDIEjo6HIDJen1%2FvEwAWRQQOumf5Fpqt3tYYaEtf5BcnFM2EU1q5KQvcaBLvNeXiOBD8qYqfkiDlOc8Zl8C%2F%2FVd%2Fs6LusnDjzrCR%2BiM504i0p6dcjdpIsWQ9HSZKtqAGzJ9%2B34vND8hha%2BXOcuGHTY6TSflpToAv60114tLLfCekIgGhf4397Cgun2HpEB3oHO2hQRuHjDX7%2BSkBjqlAbuJIlwQmjnxEgUXwKpASBJ7B8zgesS8cANKA4i%2FO7g0to4%2FUAhICFkVy1G%2BNLUUrVX2PAMYTAH7iMU8lWxfUcIBMmg%2BCWbL4O4CKUydbwfgojalAN8KksHf%2F3IAHJkH9OrQqG3jQxGlVDUv%2B%2B1WLYwECWczrombRpDVxBl4oX3%2Baq6pvEJdERYNgMU8zfEoOXkV8kfFx7R3utq5vt9lcnB2VDR32w%3D%3D&X-Amz-SignedHeaders=host&X-Amz-Signature=f8c04b64d57c9b317c4ccb68a7961d6aa166a61b38c52b457caf5a2f87b72dfb), I suspect that the test tries to click the saved object button when it's still disabled. Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> --- x-pack/test/functional/apps/infra/metrics_explorer.ts | 2 +- .../test/functional/page_objects/infra_saved_views.ts | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/x-pack/test/functional/apps/infra/metrics_explorer.ts b/x-pack/test/functional/apps/infra/metrics_explorer.ts index 0c42e6e2cad9..47f5c9785d39 100644 --- a/x-pack/test/functional/apps/infra/metrics_explorer.ts +++ b/x-pack/test/functional/apps/infra/metrics_explorer.ts @@ -132,7 +132,7 @@ export default ({ getPageObjects, getService }: FtrProviderContext) => { await pageObjects.infraSavedViews.ensureViewIsLoaded('view1'); }); - it('should laod a clicked view from the manage views section', async () => { + it('should load a clicked view from the manage views section', async () => { const views = await pageObjects.infraSavedViews.getManageViewsEntries(); await views[0].click(); await pageObjects.infraSavedViews.ensureViewIsLoaded('Default view'); diff --git a/x-pack/test/functional/page_objects/infra_saved_views.ts b/x-pack/test/functional/page_objects/infra_saved_views.ts index a9cdc8ffdab4..56c6e0d1354f 100644 --- a/x-pack/test/functional/page_objects/infra_saved_views.ts +++ b/x-pack/test/functional/page_objects/infra_saved_views.ts @@ -15,8 +15,15 @@ export function InfraSavedViewsProvider({ getService }: FtrProviderContext) { const browser = getService('browser'); return { - clickSavedViewsButton() { - return testSubjects.click('savedViews-openPopover'); + async clickSavedViewsButton() { + const button = await testSubjects.find('savedViews-openPopover'); + + await retry.waitFor('Wait for button to be enabled', async () => { + const isDisabled = Boolean(await button.getAttribute('disabled')); + return !isDisabled; + }); + + return button.click(); }, pressEsc() { return browser.pressKeys([Key.ESCAPE]);