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
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@
*/

export { makeUpSummary, makeDownSummary } from './src/make_summaries';
export * from './src/e2e';
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*
* 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 { expect, Page } from '@elastic/synthetics';

export async function waitForLoadingToFinish({ page }: { page: Page }) {
while (true) {
if (!(await page.isVisible(byTestId('kbnLoadingMessage'), { timeout: 5000 }))) break;
await page.waitForTimeout(1000);
}
}

export async function loginToKibana({
page,
user,
}: {
page: Page;
user?: { username: string; password: string };
}) {
await page.fill('[data-test-subj=loginUsername]', user?.username ?? 'elastic', {
timeout: 60 * 1000,
});

await page.fill('[data-test-subj=loginPassword]', user?.password ?? 'changeme');

await page.click('[data-test-subj=loginSubmit]');

await waitForLoadingToFinish({ page });
}

export const byTestId = (testId: string) => {
return `[data-test-subj=${testId}]`;
};

export const assertText = async ({ page, text }: { page: Page; text: string }) => {
const element = await page.waitForSelector(`text=${text}`);
expect(await element.isVisible()).toBeTruthy();
};

export const assertNotText = async ({ page, text }: { page: Page; text: string }) => {
expect(await page.$(`text=${text}`)).toBeFalsy();
};

export const getQuerystring = (params: object) => {
return Object.entries(params)
.map(([key, value]) => encodeURIComponent(key) + '=' + encodeURIComponent(value))
.join('&');
};

export const delay = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));

export const TIMEOUT_60_SEC = {
timeout: 60 * 1000,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/*
* 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.
*/

export { recordVideo } from './helpers/record_video';
export { SyntheticsRunner } from './helpers/synthetics_runner';
export { argv } from './helpers/parse_args_params';
export { readKibanaConfig } from './tasks/read_kibana_config';
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

import Path from 'path';
import { execSync } from 'child_process';
import { REPO_ROOT } from '@kbn/repo-info';

const ES_ARCHIVE_DIR = './fixtures/es_archiver';

Expand All @@ -16,22 +17,15 @@ const NODE_TLS_REJECT_UNAUTHORIZED = '1';
export const esArchiverLoad = (folder: string) => {
const path = Path.join(ES_ARCHIVE_DIR, folder);
execSync(
`node ../../../../scripts/es_archiver load "${path}" --config ../../../test/functional/config.base.js`,
`node ${REPO_ROOT}/scripts/es_archiver load "${path}" --config ${REPO_ROOT}/test/functional/config.base.js`,
{ env: { ...process.env, NODE_TLS_REJECT_UNAUTHORIZED }, stdio: 'inherit' }
);
};

export const esArchiverUnload = (folder: string) => {
const path = Path.join(ES_ARCHIVE_DIR, folder);
execSync(
`node ../../../../scripts/es_archiver unload "${path}" --config ../../../test/functional/config.base.js`,
{ env: { ...process.env, NODE_TLS_REJECT_UNAUTHORIZED }, stdio: 'inherit' }
);
};

export const esArchiverResetKibana = () => {
execSync(
`node ../../../../scripts/es_archiver empty-kibana-index --config ../../../test/functional/config.base.js`,
`node ${REPO_ROOT}/scripts/es_archiver unload "${path}" --config ${REPO_ROOT}/test/functional/config.base.js`,
{ env: { ...process.env, NODE_TLS_REJECT_UNAUTHORIZED }, stdio: 'inherit' }
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,8 @@
"target/**/*"
],
"kbn_references": [
"@kbn/apm-plugin",
"@kbn/es-archiver",
"@kbn/repo-info",
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import { journey, step, before } from '@elastic/synthetics';
import { recordVideo } from '../record_video';
import { recordVideo } from '@kbn/observability-synthetics-test-data';
import { createExploratoryViewUrl } from '../../public/components/shared/exploratory_view/configurations/exploratory_view_url';
import { loginToKibana, TIMEOUT_60_SEC, waitForLoadingToFinish } from '../utils';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

import { journey, step, before } from '@elastic/synthetics';
import { recordVideo } from '../record_video';
import { recordVideo } from '@kbn/observability-synthetics-test-data';
import { createExploratoryViewUrl } from '../../public/components/shared/exploratory_view/configurations/exploratory_view_url';
import { loginToKibana, TIMEOUT_60_SEC, waitForLoadingToFinish } from '../utils';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
*/

import { journey, step } from '@elastic/synthetics';
import { recordVideo } from '@kbn/observability-synthetics-test-data';
import moment from 'moment';
import { recordVideo } from '../record_video';
import { createExploratoryViewUrl } from '../../public/components/shared/exploratory_view/configurations/exploratory_view_url';
import { byTestId, loginToKibana, TIMEOUT_60_SEC, waitForLoadingToFinish } from '../utils';
import { loginToKibana, TIMEOUT_60_SEC, waitForLoadingToFinish } from '../utils';

journey('Step Duration series', async ({ page, params }) => {
recordVideo(page);
Expand Down Expand Up @@ -56,7 +56,8 @@ journey('Step Duration series', async ({ page, params }) => {
await page.click('[aria-label="Remove report metric"]');
await page.click('button:has-text("Select report metric")');
await page.click('button:has-text("Step duration")');
await page.click(byTestId('seriesBreakdown'));
await page.waitForSelector('[data-test-subj=seriesBreakdown]');
await page.getByTestId('seriesBreakdown').click();
await page.click('button[role="option"]:has-text("Step name")');
await page.click('.euiComboBox__inputWrap');
await page.click('[role="combobox"][placeholder="Search Monitor name"]');
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
*/
import { FtrConfigProviderContext } from '@kbn/test';
import path from 'path';
import { SyntheticsRunner } from './synthetics_runner';
import { argv } from './parse_args_params';
import { REPO_ROOT } from '@kbn/repo-info';
import { SyntheticsRunner, argv } from '@kbn/observability-synthetics-test-data';

const { headless, grep, bail: pauseOnError } = argv;

Expand All @@ -24,13 +24,12 @@ async function runE2ETests({ readConfigFile }: FtrConfigProviderContext) {
});

await syntheticsRunner.setup();

await syntheticsRunner.loadTestData(path.join(__dirname, '../../ux/e2e/fixtures/'), [
'rum_8.0.0',
'rum_test_data',
]);
await syntheticsRunner.loadTestData(
path.join(__dirname, '../../synthetics/e2e/fixtures/es_archiver/'),
`${REPO_ROOT}/x-pack/plugins/observability_solution/ux/e2e/fixtures/`,
['rum_8.0.0', 'rum_test_data']
);
await syntheticsRunner.loadTestData(
`${REPO_ROOT}/x-pack/plugins/observability_solution/synthetics/e2e/fixtures/es_archiver/`,
['full_heartbeat', 'browser']
);
await syntheticsRunner.loadTestFiles(async () => {
Expand Down
Loading