Skip to content

Commit

Permalink
update edit link text
Browse files Browse the repository at this point in the history
  • Loading branch information
shahzad31 committed Feb 21, 2023
1 parent 86f0743 commit 303ad26
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,34 @@
import { journey, step, expect, before } from '@elastic/synthetics';
import { assertText, byTestId, TIMEOUT_60_SEC } from '@kbn/observability-plugin/e2e/utils';
import { recordVideo } from '@kbn/observability-plugin/e2e/record_video';
import { cleanTestMonitors } from '../../synthetics/services/add_monitor';
import { monitorManagementPageProvider } from '../../../page_objects/uptime/monitor_management';

journey('AddPrivateLocationMonitor', async ({ page, params: { kibanaUrl } }) => {
journey('AddPrivateLocationMonitor', async ({ page, params }) => {
recordVideo(page);

page.setDefaultTimeout(TIMEOUT_60_SEC.timeout);
const kibanaUrl = params.kibanaUrl;

const uptime = monitorManagementPageProvider({ page, kibanaUrl });

let monitorId: string;

before(async () => {
await uptime.waitForLoadingToFinish();
await cleanTestMonitors(params);
page.on('request', (evt) => {
if (
evt.resourceType() === 'fetch' &&
evt.url().includes('/internal/uptime/service/monitors?preserve_namespace=true')
) {
evt
.response()
?.then((res) => res?.json())
.then((res) => {
monitorId = res.id;
});
}
});
});

step('Go to monitor-management', async () => {
Expand All @@ -39,7 +58,7 @@ journey('AddPrivateLocationMonitor', async ({ page, params: { kibanaUrl } }) =>

await page.click('input[name="name"]');
await page.fill('input[name="name"]', 'Private location monitor');
await page.click('label:has-text("Test private location Private")', TIMEOUT_60_SEC);
await page.click('label:has-text("Test private location Private")');
await page.selectOption('select', 'http');
await page.click(byTestId('syntheticsUrlField'));
await page.fill(byTestId('syntheticsUrlField'), 'https://www.google.com');
Expand All @@ -66,7 +85,9 @@ journey('AddPrivateLocationMonitor', async ({ page, params: { kibanaUrl } }) =>
step('Click text=Edit Elastic Synthetics integration', async () => {
await assertText({ page, text: 'This table contains 1 rows out of 1 rows; Page 1 of 1.' });
await page.click('[data-test-subj="integrationNameLink"]');
await page.click('text=Edit in uptime');
const btn = await page.locator(byTestId('syntheticsEditMonitorButton'));
expect(await btn.getAttribute('href')).toBe(`/app/synthetics/edit-monitor/${monitorId}`);
await btn.click();
await page.click('text=Private location monitor');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ export const SyntheticsPolicyEditExtensionWrapper = memo<PackagePolicyEditExtens
<p>{EDIT_IN_SYNTHETICS_DESC}</p>
{/* TODO Add a link to exact monitor*/}
<EuiButton
data-test-subj="syntheticsEditMonitorButton"
href={`${http?.basePath.get()}/app/synthetics/edit-monitor/${
defaultConfig[ConfigKey.CONFIG_ID]
}`}
Expand Down

0 comments on commit 303ad26

Please sign in to comment.