Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import type { KibanaRole } from '@kbn/scout-oblt';

export const OPBEANS_START_DATE = '2021-10-10T00:00:00.000Z';
export const OPBEANS_END_DATE = '2021-10-10T00:15:00.000Z';
export const BIGGER_TIMEOUT = 45000;

// APM-specific role definitions matching authentication.ts
export const APM_ROLES = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ import { AgentConfigurationsPage } from './page_objects/agent_configurations';
import { AgentExplorerPage } from './page_objects/agent_explorer';
import { AgentKeysPage } from './page_objects/agent_keys';
import { AnomalyDetectionPage } from './page_objects/anomaly_detection';
import { TransactionsOverviewPage } from './page_objects/transactions_overview';
import { APM_ROLES } from './constants';
import { TransactionDetailsPage } from './page_objects/transaction_details';

export interface ApmBrowserAuthFixture extends BrowserAuthFixture {
loginAsApmAllPrivilegesWithoutWriteSettings: () => Promise<void>;
Expand All @@ -42,6 +44,8 @@ export interface ExtendedScoutTestFixtures extends ObltTestFixtures {
agentExplorerPage: AgentExplorerPage;
agentKeysPage: AgentKeysPage;
anomalyDetectionPage: AnomalyDetectionPage;
transactionsOverviewPage: TransactionsOverviewPage;
transactionDetailsPage: TransactionDetailsPage;
};
browserAuth: ApmBrowserAuthFixture;
}
Expand Down Expand Up @@ -70,6 +74,8 @@ export const test = base.extend<ExtendedScoutTestFixtures, ObltWorkerFixtures>({
agentExplorerPage: createLazyPageObject(AgentExplorerPage, page, kbnUrl),
agentKeysPage: createLazyPageObject(AgentKeysPage, page, kbnUrl),
anomalyDetectionPage: createLazyPageObject(AnomalyDetectionPage, page, kbnUrl),
transactionsOverviewPage: createLazyPageObject(TransactionsOverviewPage, page, kbnUrl),
transactionDetailsPage: createLazyPageObject(TransactionDetailsPage, page, kbnUrl),
serviceGroupsPage: createLazyPageObject(ServiceGroupsPage, page, kbnUrl),
};

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* 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 type { ScoutPage } from '@kbn/scout-oblt';
import { BIGGER_TIMEOUT } from './constants';

/**
* Waits for the APM settings header link to be visible.
* This is commonly used to ensure the APM page has fully loaded.
*/
export async function waitForApmSettingsHeaderLink(page: ScoutPage): Promise<void> {
await page
.getByTestId('apmSettingsHeaderLink')
.waitFor({ state: 'visible', timeout: BIGGER_TIMEOUT });
}

/**
* Waits for the APM main container to be visible.
* This is commonly used to ensure the APM page has fully loaded.
*/
export async function waitForApmMainContainer(page: ScoutPage): Promise<void> {
await page.testSubj.waitForSelector('apmMainContainer', { timeout: BIGGER_TIMEOUT });
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,14 @@

import type { KibanaUrl, ScoutPage } from '@kbn/scout-oblt';
import { EuiComboBoxWrapper, EuiFieldTextWrapper } from '@kbn/scout-oblt';
import { waitForApmMainContainer } from '../page_helpers';

export class AgentConfigurationsPage {
constructor(private readonly page: ScoutPage, private readonly kbnUrl: KibanaUrl) {}

async goto() {
await this.page.goto(`${this.kbnUrl.app('apm')}/settings/agent-configuration`);
await this.page.waitForLoadingIndicatorHidden();
await waitForApmMainContainer(this.page);

// Wait for the page content to load
this.page.getByRole('heading', { name: 'Settings', level: 1 });
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
*/

import type { KibanaUrl, ScoutPage } from '@kbn/scout-oblt';
import { waitForApmMainContainer } from '../page_helpers';

export class AgentExplorerPage {
constructor(private readonly page: ScoutPage, private readonly kbnUrl: KibanaUrl) {}
Expand All @@ -16,8 +17,7 @@ export class AgentExplorerPage {
'apm'
)}/settings/agent-explorer?kuery=&agentLanguage=&serviceName=&comparisonEnabled=true&environment=ENVIRONMENT_ALL`
);
await this.page.waitForLoadingIndicatorHidden();
this.page.getByRole('heading', { name: 'Settings', level: 1 });
await waitForApmMainContainer(this.page);

return this.page;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
*/

import type { KibanaUrl, ScoutPage } from '@kbn/scout-oblt';
import { waitForApmSettingsHeaderLink } from '../page_helpers';

export class AgentKeysPage {
constructor(private readonly page: ScoutPage, private readonly kbnUrl: KibanaUrl) {}

async goto() {
await this.page.goto(`${this.kbnUrl.app('apm')}/settings/agent-keys`);
await this.page.waitForLoadingIndicatorHidden();
await waitForApmSettingsHeaderLink(this.page);
this.page.getByRole('heading', { name: 'Settings', level: 1 });

return this.page;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@

import type { KibanaUrl, ScoutPage } from '@kbn/scout-oblt';
import { EuiComboBoxWrapper } from '@kbn/scout-oblt';
import { BIGGER_TIMEOUT } from '../constants';
import { waitForApmMainContainer } from '../page_helpers';

export class AnomalyDetectionPage {
constructor(private readonly page: ScoutPage, private readonly kbnUrl: KibanaUrl) {}

async goto() {
await this.page.goto(`${this.kbnUrl.app('apm')}/settings/anomaly-detection`);
await this.page.waitForLoadingIndicatorHidden();
await waitForApmMainContainer(this.page);

// Wait for the page content to load
this.page.getByRole('heading', { name: 'Settings', level: 1 });
Expand Down Expand Up @@ -41,6 +43,7 @@ export class AnomalyDetectionPage {
async selectEnvironment(environmentName: string) {
const environmentComboBox = new EuiComboBoxWrapper(this.page, { locator: '.euiComboBox' });
await environmentComboBox.setCustomMultiOption(environmentName);
await this.page.keyboard.press('Escape');
}

async clickCreateJobsButton() {
Expand All @@ -55,4 +58,15 @@ export class AnomalyDetectionPage {

this.page.getByText('Anomaly detection jobs created');
}

async deleteMlJob() {
const manageJobsButton = this.page.testSubj.locator('apmMLManageJobsTextLink');
await manageJobsButton.waitFor({ state: 'visible', timeout: BIGGER_TIMEOUT });
await manageJobsButton.click();
const allActionsButton = this.page.getByLabel('All actions, row 1');
await allActionsButton.click();
await this.page.testSubj.locator('mlActionButtonDeleteJob').click();
await this.page.testSubj.locator('mlDeleteJobConfirmModalButton').click();
await expect(this.page.getByText('deleted successfully')).toBeVisible();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import type { KibanaUrl, Locator, ScoutPage } from '@kbn/scout-oblt';
import { expect } from '@kbn/scout-oblt/ui';
import { waitForApmSettingsHeaderLink } from '../page_helpers';

export class CustomLinksPage {
public saveButton: Locator;
Expand All @@ -16,7 +17,7 @@ export class CustomLinksPage {

async goto() {
await this.page.goto(`${this.kbnUrl.app('apm')}/settings/custom-links`);
return this.page.waitForLoadingIndicatorHidden();
return await waitForApmSettingsHeaderLink(this.page);
}

async getCreateCustomLinkButton() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
*/

import type { KibanaUrl, ScoutPage } from '@kbn/scout-oblt';
import { waitForApmSettingsHeaderLink } from '../page_helpers';

export class GeneralSettingsPage {
constructor(private readonly page: ScoutPage, private readonly kbnUrl: KibanaUrl) {}

async goto() {
await this.page.goto(`${this.kbnUrl.app('apm')}/settings/general-settings`);
return this.page.waitForLoadingIndicatorHidden();
return await waitForApmSettingsHeaderLink(this.page);
}

async getInspectEsQueriesButton() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
*/

import type { KibanaUrl, ScoutPage } from '@kbn/scout-oblt';
import { waitForApmSettingsHeaderLink } from '../page_helpers';

export class IndicesPage {
constructor(private readonly page: ScoutPage, private readonly kbnUrl: KibanaUrl) {}

async goto() {
await this.page.goto(`${this.kbnUrl.app('apm')}/settings/apm-indices`);
return this.page.waitForLoadingIndicatorHidden();
return await waitForApmSettingsHeaderLink(this.page);
}

async getErrorIndexInput() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import type { KibanaUrl, ScoutPage } from '@kbn/scout-oblt';
import { expect } from '@kbn/scout-oblt/ui';
import { waitForApmSettingsHeaderLink } from '../page_helpers';

export class ServiceGroupsPage {
constructor(private readonly page: ScoutPage, private readonly kbnUrl: KibanaUrl) {}
Expand All @@ -15,7 +16,7 @@ export class ServiceGroupsPage {
await this.page.goto(
`${this.kbnUrl.app('apm')}/service-groups?&rangeFrom=${start}&rangeTo=${end}`
);
return this.page.waitForLoadingIndicatorHidden();
return await waitForApmSettingsHeaderLink(this.page);
}

async typeInTheSearchBar(text: string) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@
*/

import type { KibanaUrl, ScoutPage } from '@kbn/scout-oblt';
import { BIGGER_TIMEOUT } from '../constants';

export class ServiceInventoryPage {
constructor(private readonly page: ScoutPage, private readonly kbnUrl: KibanaUrl) {}

async gotoDetailedServiceInventoryWithDateSelected(start: string, end: string) {
await this.page.goto(`${this.kbnUrl.app('apm')}/services?&rangeFrom=${start}&rangeTo=${end}`);
return this.page.waitForLoadingIndicatorHidden();
await this.page.testSubj.waitForSelector('apmUnifiedSearchBar', { timeout: BIGGER_TIMEOUT });
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import type { KibanaUrl, Locator, ScoutPage } from '@kbn/scout-oblt';
import { expect } from '@kbn/scout-oblt/ui';
import { waitForApmSettingsHeaderLink } from '../page_helpers';

export class ServiceMapPage {
public serviceMap: Locator;
Expand All @@ -27,7 +28,7 @@ export class ServiceMapPage {
await this.page.goto(
`${this.kbnUrl.app('apm')}/service-map?&rangeFrom=${start}&rangeTo=${end}`
);
return this.page.waitForLoadingIndicatorHidden();
return await waitForApmSettingsHeaderLink(this.page);
}

async gotoDetailedServiceMapWithDateSelected(start: string, end: string) {
Expand All @@ -36,7 +37,7 @@ export class ServiceMapPage {
'apm'
)}/services/opbeans-java/service-map?&rangeFrom=${start}&rangeTo=${end}`
);
return this.page.waitForLoadingIndicatorHidden();
return await waitForApmSettingsHeaderLink(this.page);
}

async getSearchBar() {
Expand Down
Loading