From 0f406c05768dd18e7c51dbef609301ae43fad32a Mon Sep 17 00:00:00 2001 From: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Date: Sat, 14 Aug 2021 19:01:15 -0400 Subject: [PATCH] Update infra visual test (#108621) (#108635) Co-authored-by: liza-mae --- .../tests/infra/saved_views.js | 58 ++++++++++--------- 1 file changed, 32 insertions(+), 26 deletions(-) diff --git a/x-pack/test/visual_regression/tests/infra/saved_views.js b/x-pack/test/visual_regression/tests/infra/saved_views.js index a9e020b797df1..a2fb3fda206da 100644 --- a/x-pack/test/visual_regression/tests/infra/saved_views.js +++ b/x-pack/test/visual_regression/tests/infra/saved_views.js @@ -9,7 +9,7 @@ import { DATES } from '../../../functional/apps/infra/constants'; const DATE_WITH_DATA = DATES.metricsAndLogs.hosts.withData; export default function ({ getPageObjects, getService }) { - const PageObjects = getPageObjects(['common', 'infraHome', 'infraMetricExplorer']); + const PageObjects = getPageObjects(['common', 'infraHome', 'infraMetricsExplorer']); const visualTesting = getService('visualTesting'); const esArchiver = getService('esArchiver'); @@ -47,34 +47,40 @@ export default function ({ getPageObjects, getService }) { }); }); - describe('Metric Explorer Test save functionality', () => { - it('should have save and load controls', async () => { - await PageObjects.common.navigateToApp('infraOps'); - await PageObjects.infraHome.goToMetricExplorer(); - await PageObjects.infraMetricExplorer.getSaveViewButton(); - await PageObjects.infraMetricExplorer.getLoadViewsButton(); - await visualTesting.snapshot(); - }); - - it('should open flyout list', async () => { - await PageObjects.infraMetricExplorer.openSaveViewsFlyout(); - await visualTesting.snapshot(); - await PageObjects.infraMetricExplorer.closeSavedViewFlyout(); - }); + describe('Metric Explorer Test Saved Views', () => { + before(() => esArchiver.load('x-pack/test/functional/es_archives/infra/metrics_and_logs')); + after(() => esArchiver.unload('x-pack/test/functional/es_archives/infra/metrics_and_logs')); + describe('save functionality', () => { + it('should have saved views component', async () => { + await PageObjects.common.navigateToApp('infraOps'); + await PageObjects.infraHome.goToMetricExplorer(); + await PageObjects.infraSavedViews.getSavedViewsButton(); + await PageObjects.infraSavedViews.ensureViewIsLoaded('Default view'); + await visualTesting.snapshot(); + }); - it('should open saved view modal', async () => { - await PageObjects.infraMetricExplorer.openCreateSaveViewModal(); - await visualTesting.snapshot(); - }); + it('should open popover', async () => { + await PageObjects.infraSavedViews.clickSavedViewsButton(); + await visualTesting.snapshot(); + await PageObjects.infraSavedViews.closeSavedViewsPopover(); + }); - it('should be able to enter a view name', async () => { - await PageObjects.infraMetricExplorer.openEnterViewNameAndSave(); - await visualTesting.snapshot(); - }); + it('should create new saved view and load it', async () => { + await PageObjects.infraSavedViews.clickSavedViewsButton(); + await PageObjects.infraSavedViews.clickSaveNewViewButton(); + await PageObjects.infraSavedViews.getCreateSavedViewModal(); + await PageObjects.infraSavedViews.createNewSavedView('view1'); + await PageObjects.infraSavedViews.ensureViewIsLoaded('view1'); + await visualTesting.snapshot(); + }); - it('should see a saved view in list', async () => { - await PageObjects.infraMetricExplorer.openSaveViewsFlyout(); - await visualTesting.snapshot(); + it('should new views should be listed in the load views list', async () => { + await PageObjects.infraSavedViews.clickSavedViewsButton(); + await PageObjects.infraSavedViews.clickLoadViewButton(); + await PageObjects.infraSavedViews.ensureViewIsLoadable('view1'); + await visualTesting.snapshot(); + await PageObjects.infraSavedViews.closeSavedViewsLoadModal(); + }); }); }); });