[8.6] [Synthetics] Fix management list meta data (#146549) (#146624)

# Backport

This will backport the following commits from `main` to `8.6`:
- [[Synthetics] Fix management list meta data
(#146549)](https://github.com/elastic/kibana/pull/146549)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT
[{"author":{"name":"Shahzad","email":"shahzad.muhammad@elastic.co"},"sourceCommit":{"committedDate":"2022-11-29T20:09:57Z","message":"[Synthetics]
Fix management list meta data (#146549)\n\nFixes
https://github.com/elastic/kibana/issues/146074","sha":"d0c5f039a6bdad6eeb61f4b0e4e82e17b0907249","branchLabelMapping":{"^v8.7.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["Team:uptime","release_note:skip","v8.6.0","v8.7.0"],"number":146549,"url":"https://github.com/elastic/kibana/pull/146549","mergeCommit":{"message":"[Synthetics]
Fix management list meta data (#146549)\n\nFixes
https://github.com/elastic/kibana/issues/146074","sha":"d0c5f039a6bdad6eeb61f4b0e4e82e17b0907249"}},"sourceBranch":"main","suggestedTargetBranches":["8.6"],"targetPullRequestStates":[{"branch":"8.6","label":"v8.6.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.7.0","labelRegex":"^v8.7.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/146549","number":146549,"mergeCommit":{"message":"[Synthetics]
Fix management list meta data (#146549)\n\nFixes
https://github.com/elastic/kibana/issues/146074","sha":"d0c5f039a6bdad6eeb61f4b0e4e82e17b0907249"}}]}]
BACKPORT-->

Co-authored-by: Shahzad <shahzad.muhammad@elastic.co>
This commit is contained in:
Kibana Machine 2022-11-29 16:13:42 -05:00 committed by GitHub
parent 3a61b9d74c
commit 8c865fb704
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 94 additions and 2 deletions

View file

@ -8,7 +8,7 @@
export * from './getting_started.journey';
export * from './add_monitor.journey';
export * from './monitor_selector.journey';
export * from './management_list.journey';
export * from './overview_sorting.journey';
// TODO: Fix this test
export * from './overview_scrolling.journey';
export * from './overview_search.journey';

View file

@ -0,0 +1,92 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { journey, step, expect, before, after } from '@elastic/synthetics';
import {
addTestMonitor,
cleanTestMonitors,
enableMonitorManagedViaApi,
} from './services/add_monitor';
import { syntheticsAppPageProvider } from '../../page_objects/synthetics_app';
journey(`MonitorManagementList`, async ({ page, params }) => {
const syntheticsApp = syntheticsAppPageProvider({ page, kibanaUrl: params.kibanaUrl });
const testMonitor1 = 'Test monitor 1';
const testMonitor2 = 'Test monitor 2';
const testMonitor3 = 'Test monitor 3';
page.setDefaultTimeout(60 * 1000);
before(async () => {
await enableMonitorManagedViaApi(params.kibanaUrl);
await cleanTestMonitors(params);
await addTestMonitor(params.kibanaUrl, testMonitor1);
await addTestMonitor(params.kibanaUrl, testMonitor2);
await addTestMonitor(params.kibanaUrl, testMonitor3);
});
after(async () => {
await cleanTestMonitors(params);
});
step('Go to monitor-management', async () => {
await syntheticsApp.navigateToMonitorManagement();
});
step('login to Kibana', async () => {
await syntheticsApp.loginToKibana();
const invalid = await page.locator(`text=Username or password is incorrect. Please try again.`);
expect(await invalid.isVisible()).toBeFalsy();
});
step('shows the count', async () => {
await page.locator('text=Monitors');
await page.click('text=1-3');
});
step(
'Click text=Showing 1-3 of 3 MonitorsSortingThis table contains 3 rows out of 3 rows; Page 1',
async () => {
await page.click(
'text=Showing 1-3 of 3 MonitorsSortingThis table contains 3 rows out of 3 rows; Page 1'
);
await page.click('[aria-label="expands filter group for Type filter"]');
}
);
step(
'Click [aria-label="Use up and down arrows to move focus over options. Enter to select. Escape to collapse options."] >> text=browser',
async () => {
await page.click(
'[aria-label="Use up and down arrows to move focus over options. Enter to select. Escape to collapse options."] >> text=browser'
);
await page.click('[aria-label="Apply the selected filters for Type"]');
expect(page.url()).toBe(
'http://localhost:5620/app/synthetics/monitors?monitorType=%5B%22browser%22%5D'
);
await page.click('[placeholder="Search by name, url, host, tag, project or location"]');
await Promise.all([
page.waitForNavigation({
url: 'http://localhost:5620/app/synthetics/monitors?monitorType=%5B%22browser%22%5D&query=3',
}),
page.fill('[placeholder="Search by name, url, host, tag, project or location"]', '3'),
]);
await page.click('text=1-1');
await page.click(
'text=Showing 1-1 of 1 MonitorSortingThis table contains 1 rows out of 1 rows; Page 1 '
);
}
);
step('when no results appears', async () => {
await page.click('[placeholder="Search by name, url, host, tag, project or location"]');
await page.fill('[placeholder="Search by name, url, host, tag, project or location"]', '5553');
await page.click('text=0-0');
});
});

View file

@ -98,7 +98,7 @@ export const MonitorList = ({
};
const recordRangeLabel = labels.getRecordRangeLabel({
rangeStart: pageSize * pageIndex + 1,
rangeStart: total === 0 ? 0 : pageSize * pageIndex + 1,
rangeEnd: pageSize * pageIndex + pageSize,
total,
});