Remove Playwright e2e test from Observability (#153934)

This commit is contained in:
Coen Warmer 2023-03-29 17:01:35 +02:00 committed by GitHub
parent 5b179310b8
commit 0ee23684e3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
71 changed files with 592 additions and 455 deletions

View file

@ -55,7 +55,6 @@ disabled:
- x-pack/plugins/synthetics/e2e/config.ts
- x-pack/plugins/synthetics/e2e/synthetics_run.ts
- x-pack/plugins/ux/e2e/synthetics_run.ts
- x-pack/plugins/observability/e2e/synthetics_run.ts
- x-pack/plugins/exploratory_view/e2e/synthetics_run.ts
# Configs that exist but weren't running in CI when this file was introduced

View file

@ -1,15 +0,0 @@
steps:
- command: .buildkite/scripts/steps/functional/observability_plugin.sh
label: 'Observability @elastic/synthetics Tests'
agents:
queue: n2-4-spot
depends_on: build
timeout_in_minutes: 120
artifact_paths:
- 'x-pack/plugins/observability/e2e/.journeys/**/*'
retry:
automatic:
- exit_status: '-1'
limit: 3
- exit_status: '*'
limit: 1

View file

@ -137,10 +137,6 @@ const uploadPipeline = (pipelineContent: string | object) => {
pipeline.push(getPipeline('.buildkite/pipelines/pull_request/osquery_cypress.yml'));
}
if (await doAnyChangesMatch([/^x-pack\/plugins\/observability/])) {
pipeline.push(getPipeline('.buildkite/pipelines/pull_request/observability_plugin.yml'));
}
if (await doAnyChangesMatch([/^x-pack\/plugins\/exploratory_view/])) {
pipeline.push(getPipeline('.buildkite/pipelines/pull_request/exploratory_view_plugin.yml'));
}
@ -148,20 +144,13 @@ const uploadPipeline = (pipelineContent: string | object) => {
if (
await doAnyChangesMatch([
/^x-pack\/plugins\/synthetics/,
/^x-pack\/plugins\/observability\/public\/components\/shared\/exploratory_view/,
/^x-pack\/plugins\/exploratory_view/,
])
) {
pipeline.push(getPipeline('.buildkite/pipelines/pull_request/synthetics_plugin.yml'));
}
if (
await doAnyChangesMatch([
/^x-pack\/plugins\/ux/,
/^x-pack\/plugins\/observability\/public\/components\/shared\/exploratory_view/,
/^x-pack\/plugins\/exploratory_view/,
])
) {
if (await doAnyChangesMatch([/^x-pack\/plugins\/ux/, /^x-pack\/plugins\/exploratory_view/])) {
pipeline.push(getPipeline('.buildkite/pipelines/pull_request/ux_plugin_e2e.yml'));
}

View file

@ -21,7 +21,6 @@ export const TS_PROJECTS = TsProject.loadAll({
'x-pack/plugins/synthetics/e2e/tsconfig.json',
'x-pack/plugins/ux/e2e/tsconfig.json',
'x-pack/plugins/observability/e2e/tsconfig.json',
'x-pack/plugins/exploratory_view/e2e/tsconfig.json',
'x-pack/plugins/threat_intelligence/cypress/tsconfig.json',
],

View file

@ -1,15 +0,0 @@
## How to run these tests
These tests rely on the Kibana functional test runner. There is a Kibana config in this directory, and a dedicated
script for standing up the test server.
### Start the server
From `~/x-pack/plugins/observability/scripts`, run `node e2e.js --server`. Wait for the server to startup. It will provide you
with an example run command when it finishes.
### Run the tests
From this directory, `~/x-pack/plugins/observability/e2e`, you can now run `node ../../../../scripts/functional_test_runner --config synthetics_run.ts`.
In addition to the usual flags like `--grep`, you can also specify `--no-headless` in order to view your tests as you debug/develop.

View file

@ -1,108 +0,0 @@
/*
* 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, before } from '@elastic/synthetics';
import { recordVideo } from '../record_video';
import { createExploratoryViewUrl } from '../../public/components/shared/exploratory_view/configurations/exploratory_view_url';
import { loginToKibana, TIMEOUT_60_SEC, waitForLoadingToFinish } from '../utils';
journey('Exploratory view', async ({ page, params }) => {
recordVideo(page);
before(async () => {
await waitForLoadingToFinish({ page });
});
const expUrl = createExploratoryViewUrl({
reportType: 'kpi-over-time',
allSeries: [
{
name: 'Elastic page views',
time: {
from: '2021-01-18T12:20:01.682Z',
to: '2021-01-18T12:25:27.484Z',
},
selectedMetricField: '___records___',
reportDefinitions: { 'service.name': [] },
dataType: 'ux',
},
],
});
const baseUrl = `${params.kibanaUrl}${expUrl}`;
step('Go to Exploratory view', async () => {
await page.goto(baseUrl, {
waitUntil: 'networkidle',
});
await loginToKibana({
page,
user: { username: 'elastic', password: 'changeme' },
});
});
step('renders as expected', async () => {
await Promise.all([page.waitForNavigation(TIMEOUT_60_SEC), page.click('text=Explore data')]);
await page.click('text=User experience (RUM)');
await page.click('[aria-label="Toggle series information"] >> text=Page views', TIMEOUT_60_SEC);
await page.click('[aria-label="Edit series"]', TIMEOUT_60_SEC);
await page.click('button:has-text("No breakdown")');
await page.click('button[role="option"]:has-text("Operating system")', TIMEOUT_60_SEC);
await page.click('button:has-text("Apply changes")');
await page.click('text=Chrome OS');
await page.click('text=iOS');
await page.click('text=iOS');
await page.click('text=Chrome OS');
await page.click('text=Ubuntu');
await page.click('text=Android');
await page.click('text=Linux');
await page.click('text=Mac OS X');
await page.click('text=Windows');
await page.click('h1:has-text("Explore data")');
});
step('Edit and change the series to distribution', async () => {
await page.click('[aria-label="View series actions"]');
await page.click('[aria-label="Remove series"]');
await page.click('button:has-text("KPI over time")');
await page.click('button[role="option"]:has-text("Performance distribution")');
await page.click('button:has-text("Add series")');
await page.click('button:has-text("Select data type")');
await page.click('button:has-text("User experience (RUM)")');
await page.click('button:has-text("Select report metric")');
await page.click('button:has-text("Page load time")');
await page.click('.euiComboBox__inputWrap');
await page.click('[aria-label="Date quick select"]');
await page.click('text=Last 1 year');
await page.click('[aria-label="Date quick select"]');
await page.click('[aria-label="Time value"]');
await page.fill('[aria-label="Time value"]', '010');
await page.selectOption('[aria-label="Time unit"]', 'y');
await page.click('div[role="dialog"] button:has-text("Apply")');
await page.click('.euiComboBox__inputWrap');
await page.click('button[role="option"]:has-text("elastic-co-frontend")');
await page.click('button:has-text("Apply changes")');
await page.click('text=ux-series-1');
await page.click('text=User experience (RUM)');
await page.click('text=Page load time');
await page.click('text=Pages loaded');
await page.click('button:has-text("95th")');
await page.click('button:has-text("90th")');
await page.click('button:has-text("99th")');
await page.click('[aria-label="Edit series"]');
await page.click('button:has-text("No breakdown")');
await page.click('button[role="option"]:has-text("Browser family")');
await page.click('button:has-text("Apply changes")');
await page.click('text=Edge');
await page.click('text=Opera');
await page.click('text=Safari');
await page.click('text=HeadlessChrome');
await page.click('[aria-label="Firefox; Activate to hide series in graph"]');
});
});

View file

@ -1,10 +0,0 @@
/*
* 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 * from './exploratory_view';
export * from './step_duration.journey';
// export * from './single_metric.journey';

View file

@ -1,65 +0,0 @@
/*
* 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, before } from '@elastic/synthetics';
import { recordVideo } from '../record_video';
import { createExploratoryViewUrl } from '../../public/components/shared/exploratory_view/configurations/exploratory_view_url';
import { loginToKibana, TIMEOUT_60_SEC, waitForLoadingToFinish } from '../utils';
journey('SingleMetric', async ({ page, params }) => {
recordVideo(page);
before(async () => {
await waitForLoadingToFinish({ page });
});
const expUrl = createExploratoryViewUrl({
reportType: 'single-metric',
allSeries: [
{
dataType: 'synthetics',
time: {
from: 'now-1y/d',
to: 'now',
},
name: 'synthetics-series-1',
selectedMetricField: 'monitor_availability',
reportDefinitions: {
'monitor.name': ['test-monitor - inline'],
'url.full': ['https://www.elastic.co/'],
},
},
],
});
const baseUrl = `${params.kibanaUrl}${expUrl}`;
step('Go to Exploratory view', async () => {
await page.goto(baseUrl, {
waitUntil: 'networkidle',
});
await loginToKibana({
page,
user: { username: 'elastic', password: 'changeme' },
});
});
step('Open exploratory view with single metric', async () => {
await Promise.all([
page.waitForNavigation(TIMEOUT_60_SEC),
page.click('text=Explore data', TIMEOUT_60_SEC),
]);
await waitForLoadingToFinish({ page });
await page.click('text=0.0%', TIMEOUT_60_SEC);
await page.click('text=0.0%Availability');
await page.click(
'text=Explore data Last Updated: a few seconds agoRefreshHide chart0.0%AvailabilityRep'
);
});
});

View file

@ -1,96 +0,0 @@
/*
* 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, before, after } from '@elastic/synthetics';
import moment from 'moment';
import { recordVideo } from '../record_video';
import { createExploratoryViewUrl } from '../../public/components/shared/exploratory_view/configurations/exploratory_view_url';
import { loginToKibana, TIMEOUT_60_SEC, waitForLoadingToFinish } from '../utils';
journey('Exploratory view', async ({ page, params }) => {
recordVideo(page);
before(async () => {
await waitForLoadingToFinish({ page });
});
after(async () => {
// eslint-disable-next-line no-console
console.log(await page.video()?.path());
});
const expUrl = createExploratoryViewUrl({
reportType: 'kpi-over-time',
allSeries: [
{
dataType: 'uptime',
time: {
from: moment().subtract(10, 'y').toISOString(),
to: moment().toISOString(),
},
name: 'synthetics-series-1',
breakdown: 'monitor.type',
selectedMetricField: 'monitor.duration.us',
reportDefinitions: {
'url.full': ['ALL_VALUES'],
},
},
],
});
const baseUrl = `${params.kibanaUrl}${expUrl}`;
step('Go to Exploratory view', async () => {
await page.goto(baseUrl, {
waitUntil: 'networkidle',
});
await loginToKibana({
page,
user: { username: 'elastic', password: 'changeme' },
});
});
step('Open exploratory view with monitor duration', async () => {
await page.waitForNavigation(TIMEOUT_60_SEC);
await waitForLoadingToFinish({ page });
await page.click('text=browser', TIMEOUT_60_SEC);
await page.click('text=http');
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('button[data-test-subj="seriesBreakdown"]:has-text("Monitor type")');
await page.click('button[role="option"]:has-text("Step name")');
await page.click('.euiComboBox__inputWrap');
await page.click(
'text=Search Monitor nameCombo box. Selected. Combo box input. Search Monitor name. Ty'
);
await page.click('button[role="option"]:has-text("test-monitor - inline")');
await page.click('button:has-text("Apply changes")');
await waitForLoadingToFinish({ page });
await page.click('[aria-label="series color: #54b399"]');
await page.click('[aria-label="series color: #6092c0"]');
await page.click('[aria-label="series color: #d36086"] path');
await page.click('[aria-label="series color: #9170b8"]');
await page.click('[aria-label="series color: #ca8eae"]');
await page.click('[aria-label="series color: #d6bf57"]');
await page.click('text=load homepage');
await page.click('text=load homepage');
await page.click('text=load github');
await page.click('text=load github');
await page.click('text=load google');
await page.click('text=load google');
await page.click('text=hover over products menu');
await page.click('text=hover over products menu');
await page.click('text=load homepage 1');
await page.click('text=load homepage 1');
await page.click('text=load homepage 2');
await page.click('text=load homepage 2');
});
});

View file

@ -1,45 +0,0 @@
/*
* 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 { FtrConfigProviderContext } from '@kbn/test';
import path from 'path';
import { SyntheticsRunner } from './synthetics_runner';
import { argv } from './parse_args_params';
const { headless, grep, bail: pauseOnError } = argv;
async function runE2ETests({ readConfigFile }: FtrConfigProviderContext) {
const kibanaConfig = await readConfigFile(require.resolve('@kbn/synthetics-plugin/e2e/config'));
return {
...kibanaConfig.getAll(),
testRunner: async ({ getService }: any) => {
const syntheticsRunner = new SyntheticsRunner(getService, {
headless,
match: grep,
pauseOnError,
});
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/'),
['full_heartbeat', 'browser']
);
await syntheticsRunner.loadTestFiles(async () => {
require(path.join(__dirname, './journeys'));
});
await syntheticsRunner.run();
},
};
}
// eslint-disable-next-line import/no-default-export
export default runE2ETests;

View file

@ -1,9 +0,0 @@
{
"extends": "../../../../tsconfig.base.json",
"exclude": ["tmp", "target/**/*"],
"include": ["./**/*"],
"compilerOptions": {
"outDir": "target/types",
"types": [ "node"],
},
}

View file

@ -6,8 +6,8 @@
*/
import { FtrConfigProviderContext } from '@kbn/test';
import { argv } from '@kbn/observability-plugin/e2e/parse_args_params';
import { CA_CERT_PATH } from '@kbn/dev-utils';
import { argv } from './helpers/parse_args_params';
import { readKibanaConfig } from './tasks/read_kibana_config';
const MANIFEST_KEY = 'xpack.uptime.service.manifestUrl';
const SERVICE_PASSWORD = 'xpack.uptime.service.password';

View file

@ -13,7 +13,7 @@ import { PromiseType } from 'utility-types';
import { createApmUsers } from '@kbn/apm-plugin/server/test_helpers/create_apm_users/create_apm_users';
import { EsArchiver } from '@kbn/es-archiver';
import { esArchiverUnload } from './tasks/es_archiver';
import { esArchiverUnload } from '../tasks/es_archiver';
import { TestReporter } from './test_reporter';
export interface ArgParams {

View file

@ -6,7 +6,7 @@
*/
import { v4 as uuidv4 } from 'uuid';
import { journey, step, expect, Page } from '@elastic/synthetics';
import { recordVideo } from '@kbn/observability-plugin/e2e/record_video';
import { recordVideo } from '../../helpers/record_video';
import { FormMonitorType } from '../../../common/runtime_types';
import { syntheticsAppPageProvider } from '../../page_objects/synthetics/synthetics_app';

View file

@ -9,7 +9,7 @@ import { journey, step, before, after, expect } from '@elastic/synthetics';
import { byTestId } from '@kbn/ux-plugin/e2e/journeys/utils';
import { RetryService } from '@kbn/ftr-common-functional-services';
import { v4 as uuidv4 } from 'uuid';
import { recordVideo } from '@kbn/observability-plugin/e2e/record_video';
import { recordVideo } from '../../../helpers/record_video';
import { getReasonMessage } from '../../../../server/legacy_uptime/lib/alerts/status_check';
import { syntheticsAppPageProvider } from '../../../page_objects/synthetics/synthetics_app';
import { SyntheticsServices } from '../services/synthetics_services';

View file

@ -6,8 +6,8 @@
*/
import { journey, step, expect, before, after } from '@elastic/synthetics';
import { byTestId } from '@kbn/observability-plugin/e2e/utils';
import { recordVideo } from '@kbn/observability-plugin/e2e/record_video';
import { byTestId } from '../../helpers/utils';
import { recordVideo } from '../../helpers/record_video';
import { syntheticsAppPageProvider } from '../../page_objects/synthetics/synthetics_app';
import { cleanSettings } from './services/settings';

View file

@ -6,9 +6,9 @@
*/
import { journey, step, expect, Page } from '@elastic/synthetics';
import { assertText, byTestId } from '@kbn/observability-plugin/e2e/utils';
import { RetryService } from '@kbn/ftr-common-functional-services';
import { recordVideo } from '@kbn/observability-plugin/e2e/record_video';
import { byTestId, assertText } from '../../helpers/utils';
import { recordVideo } from '../../helpers/record_video';
import { syntheticsAppPageProvider } from '../../page_objects/synthetics/synthetics_app';
let page1: Page;

View file

@ -6,7 +6,7 @@
*/
import { expect, journey, step } from '@elastic/synthetics';
import { recordVideo } from '@kbn/observability-plugin/e2e/record_video';
import { recordVideo } from '../../helpers/record_video';
import { syntheticsAppPageProvider } from '../../page_objects/synthetics/synthetics_app';
journey('TestMonitorDetailFlyout', async ({ page, params }) => {

View file

@ -6,7 +6,7 @@
*/
import { journey, step, expect, before, Page } from '@elastic/synthetics';
import { recordVideo } from '@kbn/observability-plugin/e2e/record_video';
import { recordVideo } from '../../helpers/record_video';
import { syntheticsAppPageProvider } from '../../page_objects/synthetics/synthetics_app';
import { cleanTestMonitors } from './services/add_monitor';

View file

@ -6,8 +6,8 @@
*/
import { journey, step, before, after, expect } from '@elastic/synthetics';
import { recordVideo } from '@kbn/observability-plugin/e2e/record_video';
import { byTestId } from '@kbn/observability-plugin/e2e/utils';
import { byTestId } from '../../helpers/utils';
import { recordVideo } from '../../helpers/record_video';
import { cleanTestParams } from './services/add_monitor';
import { syntheticsAppPageProvider } from '../../page_objects/synthetics/synthetics_app';

View file

@ -6,8 +6,8 @@
*/
import { journey, step, expect, before, after } from '@elastic/synthetics';
import { recordVideo } from '@kbn/observability-plugin/e2e/record_video';
import { byTestId } from '@kbn/ux-plugin/e2e/journeys/utils';
import { byTestId } from '../../helpers/utils';
import { recordVideo } from '../../helpers/record_video';
import {
addTestMonitor,
cleanTestMonitors,

View file

@ -8,8 +8,8 @@
import { journey, step, before, after } from '@elastic/synthetics';
import { byTestId } from '@kbn/ux-plugin/e2e/journeys/utils';
import { RetryService } from '@kbn/ftr-common-functional-services';
import { recordVideo } from '@kbn/observability-plugin/e2e/record_video';
import moment from 'moment';
import { recordVideo } from '../../../helpers/record_video';
import { syntheticsAppPageProvider } from '../../../page_objects/synthetics/synthetics_app';
import { SyntheticsServices } from '../services/synthetics_services';

View file

@ -6,8 +6,8 @@
*/
import { journey, step, expect, before, after } from '@elastic/synthetics';
import { recordVideo } from '@kbn/observability-plugin/e2e/record_video';
import { byTestId } from '@kbn/observability-plugin/e2e/utils';
import { byTestId } from '../../helpers/utils';
import { recordVideo } from '../../helpers/record_video';
import {
addTestMonitor,
cleanTestMonitors,

View file

@ -6,8 +6,8 @@
*/
import { before, after, expect, journey, step } from '@elastic/synthetics';
import { recordVideo } from '@kbn/observability-plugin/e2e/record_video';
import { RetryService } from '@kbn/ftr-common-functional-services';
import { recordVideo } from '../../helpers/record_video';
import {
addTestMonitor,
cleanTestMonitors,

View file

@ -6,8 +6,8 @@
*/
import { before, expect, journey, step } from '@elastic/synthetics';
import { recordVideo } from '@kbn/observability-plugin/e2e/record_video';
import { RetryService } from '@kbn/ftr-common-functional-services';
import { recordVideo } from '../../helpers/record_video';
import {
addTestMonitor,
cleanTestMonitors,

View file

@ -6,7 +6,7 @@
*/
import { before, expect, journey, step } from '@elastic/synthetics';
import { recordVideo } from '@kbn/observability-plugin/e2e/record_video';
import { recordVideo } from '../../helpers/record_video';
import {
addTestMonitor,
cleanTestMonitors,

View file

@ -6,9 +6,9 @@
*/
import { journey, step, before, after, expect } from '@elastic/synthetics';
import { byTestId } from '@kbn/observability-plugin/e2e/utils';
import { waitForLoadingToFinish } from '@kbn/ux-plugin/e2e/journeys/utils';
import { recordVideo } from '@kbn/observability-plugin/e2e/record_video';
import { byTestId } from '../../helpers/utils';
import { recordVideo } from '../../helpers/record_video';
import {
addTestMonitor,
cleanPrivateLocations,

View file

@ -6,7 +6,7 @@
*/
import { journey, step, expect, before } from '@elastic/synthetics';
import { recordVideo } from '@kbn/observability-plugin/e2e/record_video';
import { recordVideo } from '../../helpers/record_video';
journey('ProjectAPIKeys', async ({ page }) => {
recordVideo(page);

View file

@ -6,7 +6,7 @@
*/
import { after, before, expect, journey, step } from '@elastic/synthetics';
import { recordVideo } from '@kbn/observability-plugin/e2e/record_video';
import { recordVideo } from '../../helpers/record_video';
import { cleanTestMonitors, enableMonitorManagedViaApi } from './services/add_monitor';
import { getMonitor } from './services/get_monitor';
import { addTestMonitorProject } from './services/add_monitor_project';

View file

@ -6,7 +6,7 @@
*/
import { journey, step, before, after } from '@elastic/synthetics';
import { recordVideo } from '@kbn/observability-plugin/e2e/record_video';
import { recordVideo } from '../../helpers/record_video';
import { syntheticsAppPageProvider } from '../../page_objects/synthetics/synthetics_app';
import { SyntheticsServices } from './services/synthetics_services';

View file

@ -7,8 +7,8 @@
import { journey, step, before, after, expect } from '@elastic/synthetics';
import { RetryService } from '@kbn/ftr-common-functional-services';
import { recordVideo } from '@kbn/observability-plugin/e2e/record_video';
import { byTestId } from '@kbn/observability-plugin/e2e/utils';
import { byTestId } from '../../helpers/utils';
import { recordVideo } from '../../helpers/record_video';
import { syntheticsAppPageProvider } from '../../page_objects/synthetics/synthetics_app';
import { SyntheticsServices } from './services/synthetics_services';

View file

@ -6,8 +6,8 @@
*/
import { journey, step, before, after } from '@elastic/synthetics';
import { byTestId } from '@kbn/ux-plugin/e2e/journeys/utils';
import { recordVideo } from '@kbn/observability-plugin/e2e/record_video';
import { byTestId } from '../../helpers/utils';
import { recordVideo } from '../../helpers/record_video';
import { syntheticsAppPageProvider } from '../../page_objects/synthetics/synthetics_app';
import { SyntheticsServices } from './services/synthetics_services';

View file

@ -13,13 +13,14 @@
*/
import { journey, step, before } from '@elastic/synthetics';
import {
assertNotText,
assertText,
byTestId,
assertText,
waitForLoadingToFinish,
} from '@kbn/observability-plugin/e2e/utils';
import { recordVideo } from '@kbn/observability-plugin/e2e/record_video';
} from '../../../helpers/utils';
import { recordVideo } from '../../../helpers/record_video';
import { settingsPageProvider } from '../../../page_objects/uptime/settings';
journey('DefaultEmailSettings', async ({ page, params }) => {

View file

@ -6,9 +6,9 @@
*/
import { journey, step, expect, before } from '@elastic/synthetics';
import { assertText, byTestId, waitForLoadingToFinish } from '@kbn/observability-plugin/e2e/utils';
import { RetryService } from '@kbn/ftr-common-functional-services';
import { recordVideo } from '@kbn/observability-plugin/e2e/record_video';
import { byTestId, assertText, waitForLoadingToFinish } from '../../../helpers/utils';
import { recordVideo } from '../../../helpers/record_video';
import { loginPageProvider } from '../../../page_objects/login';
journey('StatusFlyoutInAlertingApp', async ({ page, params }) => {

View file

@ -6,8 +6,8 @@
*/
import { journey, step, before, expect } from '@elastic/synthetics';
import { assertText, byTestId, waitForLoadingToFinish } from '@kbn/observability-plugin/e2e/utils';
import { recordVideo } from '@kbn/observability-plugin/e2e/record_video';
import { byTestId, assertText, waitForLoadingToFinish } from '../../../helpers/utils';
import { recordVideo } from '../../../helpers/record_video';
import { loginPageProvider } from '../../../page_objects/login';
journey('TlsFlyoutInAlertingApp', async ({ page, params }) => {

View file

@ -6,13 +6,9 @@
*/
import { journey, step, expect, before } from '@elastic/synthetics';
import {
byTestId,
TIMEOUT_60_SEC,
waitForLoadingToFinish,
} from '@kbn/observability-plugin/e2e/utils';
import { callKibana } from '@kbn/apm-plugin/server/test_helpers/create_apm_users/helpers/call_kibana';
import { recordVideo } from '@kbn/observability-plugin/e2e/record_video';
import { byTestId, TIMEOUT_60_SEC, waitForLoadingToFinish } from '../../helpers/utils';
import { recordVideo } from '../../helpers/record_video';
import { loginPageProvider } from '../../page_objects/login';
journey('DataViewPermissions', async ({ page, params }) => {

View file

@ -6,7 +6,7 @@
*/
import { journey, step, before, Page } from '@elastic/synthetics';
import { recordVideo } from '@kbn/observability-plugin/e2e/record_video';
import { recordVideo } from '../../../helpers/record_video';
import { makeChecksWithStatus } from '../../../helpers/make_checks';
import { monitorDetailsPageProvider } from '../../../page_objects/uptime/monitor_details';

View file

@ -7,7 +7,7 @@
import { v4 as uuidv4 } from 'uuid';
import { journey, step, expect, after, Page } from '@elastic/synthetics';
import { recordVideo } from '@kbn/observability-plugin/e2e/record_video';
import { recordVideo } from '../../helpers/record_video';
import { monitorManagementPageProvider } from '../../page_objects/uptime/monitor_management';
journey('MonitorDetails', async ({ page, params }: { page: Page; params: any }) => {

View file

@ -7,8 +7,8 @@
import { journey, step, expect, before, Page } from '@elastic/synthetics';
import { noop } from 'lodash';
import { byTestId, delay } from '@kbn/observability-plugin/e2e/utils';
import { recordVideo } from '@kbn/observability-plugin/e2e/record_video';
import { byTestId, delay } from '../../../helpers/utils';
import { recordVideo } from '../../../helpers/record_video';
import { monitorDetailsPageProvider } from '../../../page_objects/uptime/monitor_details';
const dateRangeStart = '2019-09-10T12:40:08.078Z';

View file

@ -6,8 +6,8 @@
*/
import { journey, step, before, Page } from '@elastic/synthetics';
import { byTestId } from '@kbn/observability-plugin/e2e/utils';
import { recordVideo } from '@kbn/observability-plugin/e2e/record_video';
import { byTestId } from '../../../helpers/utils';
import { recordVideo } from '../../../helpers/record_video';
import { monitorDetailsPageProvider } from '../../../page_objects/uptime/monitor_details';
const dateRangeStart = '2019-09-10T12:40:08.078Z';

View file

@ -6,8 +6,8 @@
*/
import { journey, step, expect, before, Page } from '@elastic/synthetics';
import { byTestId, delay } from '@kbn/observability-plugin/e2e/utils';
import { recordVideo } from '@kbn/observability-plugin/e2e/record_video';
import { byTestId, delay } from '../../../helpers/utils';
import { recordVideo } from '../../../helpers/record_video';
import { makeChecksWithStatus } from '../../../helpers/make_checks';
import { monitorDetailsPageProvider } from '../../../page_objects/uptime/monitor_details';

View file

@ -7,8 +7,8 @@
import { v4 as uuidv4 } from 'uuid';
import { journey, step, expect, after, Page } from '@elastic/synthetics';
import { byTestId } from '@kbn/observability-plugin/e2e/utils';
import { recordVideo } from '@kbn/observability-plugin/e2e/record_video';
import { byTestId } from '../../helpers/utils';
import { recordVideo } from '../../helpers/record_video';
import { monitorManagementPageProvider } from '../../page_objects/uptime/monitor_management';
import { DataStream } from '../../../common/runtime_types/monitor_management';

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { journey, step, expect, after, Page } from '@elastic/synthetics';
import { recordVideo } from '@kbn/observability-plugin/e2e/record_video';
import { recordVideo } from '../../helpers/record_video';
import { monitorManagementPageProvider } from '../../page_objects/uptime/monitor_management';
journey(

View file

@ -6,8 +6,8 @@
*/
import { v4 as uuidv4 } from 'uuid';
import { journey, step, expect, Page } from '@elastic/synthetics';
import { byTestId } from '@kbn/observability-plugin/e2e/utils';
import { recordVideo } from '@kbn/observability-plugin/e2e/record_video';
import { byTestId } from '../../helpers/utils';
import { recordVideo } from '../../helpers/record_video';
import { monitorManagementPageProvider } from '../../page_objects/uptime/monitor_management';
journey(`MonitorName`, async ({ page, params }: { page: Page; params: any }) => {

View file

@ -6,8 +6,8 @@
*/
import { v4 as uuidv4 } from 'uuid';
import { journey, step, expect, before } from '@elastic/synthetics';
import { byTestId, TIMEOUT_60_SEC } from '@kbn/observability-plugin/e2e/utils';
import { recordVideo } from '@kbn/observability-plugin/e2e/record_video';
import { TIMEOUT_60_SEC, byTestId } from '../../../helpers/utils';
import { recordVideo } from '../../../helpers/record_video';
import { cleanTestMonitors } from '../../synthetics/services/add_monitor';
import { monitorManagementPageProvider } from '../../../page_objects/uptime/monitor_management';

View file

@ -5,8 +5,8 @@
* 2.0.
*/
import { journey, step, expect } from '@elastic/synthetics';
import { byTestId, TIMEOUT_60_SEC } from '@kbn/observability-plugin/e2e/utils';
import { recordVideo } from '@kbn/observability-plugin/e2e/record_video';
import { byTestId, TIMEOUT_60_SEC } from '../../../helpers/utils';
import { recordVideo } from '../../../helpers/record_video';
import { monitorManagementPageProvider } from '../../../page_objects/uptime/monitor_management';
journey('ManagePrivateLocation', async ({ page, params: { kibanaUrl } }) => {

View file

@ -6,8 +6,8 @@
*/
import { expect, journey, Page, step } from '@elastic/synthetics';
import { byTestId } from '@kbn/observability-plugin/e2e/utils';
import { recordVideo } from '@kbn/observability-plugin/e2e/record_video';
import { byTestId } from '../../../helpers/utils';
import { recordVideo } from '../../../helpers/record_video';
import { monitorManagementPageProvider } from '../../../page_objects/uptime/monitor_management';
journey(

View file

@ -6,8 +6,8 @@
*/
import { journey, step, expect } from '@elastic/synthetics';
import { recordVideo } from '@kbn/observability-plugin/e2e/record_video';
import { RetryService } from '@kbn/ftr-common-functional-services';
import { recordVideo } from '../../helpers/record_video';
import { loginPageProvider } from '../../page_objects/login';
journey('StepsDuration', async ({ page, params }) => {

View file

@ -6,8 +6,8 @@
*/
import { journey, step, before } from '@elastic/synthetics';
import { byTestId, waitForLoadingToFinish } from '@kbn/observability-plugin/e2e/utils';
import { recordVideo } from '@kbn/observability-plugin/e2e/record_video';
import { byTestId, waitForLoadingToFinish } from '../../helpers/utils';
import { recordVideo } from '../../helpers/record_video';
journey('uptime', ({ page, params }) => {
recordVideo(page);

View file

@ -6,7 +6,7 @@
*/
import { Page } from '@elastic/synthetics';
import { byTestId, delay } from '@kbn/observability-plugin/e2e/utils';
import { byTestId, delay } from '../../helpers/utils';
import { monitorManagementPageProvider } from './monitor_management';
interface AlertType {

View file

@ -5,7 +5,7 @@
* 2.0.
*/
import { expect, Page } from '@elastic/synthetics';
import { getQuerystring, TIMEOUT_60_SEC } from '@kbn/observability-plugin/e2e/utils';
import { getQuerystring, TIMEOUT_60_SEC } from '../../helpers/utils';
import { DataStream } from '../../../common/runtime_types/monitor_management';
import { loginPageProvider } from '../login';
import { utilsPageProvider } from '../utils';

View file

@ -6,7 +6,7 @@
*/
import { expect, Page } from '@elastic/synthetics';
import { byTestId } from '@kbn/observability-plugin/e2e/utils';
import { byTestId } from '../../helpers/utils';
import { loginPageProvider } from '../login';
import { utilsPageProvider } from '../utils';

View file

@ -6,8 +6,8 @@
*/
import { FtrConfigProviderContext } from '@kbn/test';
import path from 'path';
import { argv } from '@kbn/observability-plugin/e2e/parse_args_params';
import { SyntheticsRunner } from '@kbn/observability-plugin/e2e/synthetics_runner';
import { argv } from './helpers/parse_args_params';
import { SyntheticsRunner } from './helpers/synthetics_runner';
const { headless, grep, bail: pauseOnError } = argv;

View file

@ -0,0 +1,33 @@
/*
* 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 yargs from 'yargs';
const { argv } = yargs(process.argv.slice(2))
.option('headless', {
default: true,
type: 'boolean',
description: 'Start in headless mode',
})
.option('bail', {
default: false,
type: 'boolean',
description: 'Pause on error',
})
.option('watch', {
default: false,
type: 'boolean',
description: 'Runs the server in watch mode, restarting on changes',
})
.option('grep', {
default: undefined,
type: 'string',
description: 'run only journeys with a name or tags that matches the glob',
})
.help();
export { argv };

View file

@ -0,0 +1,36 @@
/*
* 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 fs from 'fs';
import Runner from '@elastic/synthetics/dist/core/runner';
import { after, Page } from '@elastic/synthetics';
const SYNTHETICS_RUNNER = Symbol.for('SYNTHETICS_RUNNER');
// @ts-ignore
export const runner: Runner = global[SYNTHETICS_RUNNER];
export const recordVideo = (page: Page, postfix = '') => {
after(async () => {
try {
const videoFilePath = await page.video()?.path();
const pathToVideo = videoFilePath
?.replace('.journeys/videos/', '')
.replace('.webm', '');
const newVideoPath = videoFilePath?.replace(
pathToVideo!,
postfix
? runner.currentJourney!.name + `-${postfix}`
: runner.currentJourney!.name
);
fs.renameSync(videoFilePath!, newVideoPath!);
} catch (e) {
// eslint-disable-next-line no-console
console.log('Error while renaming video file', e);
}
});
};

View file

@ -0,0 +1,164 @@
/*
* 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.
*/
/* eslint-disable no-console */
import Url from 'url';
import { run as syntheticsRun } from '@elastic/synthetics';
import { PromiseType } from 'utility-types';
import { createApmUsers } from '@kbn/apm-plugin/server/test_helpers/create_apm_users/create_apm_users';
import { EsArchiver } from '@kbn/es-archiver';
import { esArchiverUnload } from '../tasks/es_archiver';
import { TestReporter } from './test_reporter';
export interface ArgParams {
headless: boolean;
match?: string;
pauseOnError: boolean;
}
export class SyntheticsRunner {
public getService: any;
public kibanaUrl: string;
private elasticsearchUrl: string;
public testFilesLoaded: boolean = false;
public params: ArgParams;
private loadTestFilesCallback?: (reload?: boolean) => Promise<void>;
constructor(getService: any, params: ArgParams) {
this.getService = getService;
this.kibanaUrl = this.getKibanaUrl();
this.elasticsearchUrl = this.getElasticsearchUrl();
this.params = params;
}
async setup() {
await this.createTestUsers();
}
async createTestUsers() {
await createApmUsers({
elasticsearch: {
node: this.elasticsearchUrl,
username: 'elastic',
password: 'changeme',
},
kibana: { hostname: this.kibanaUrl },
});
}
async loadTestFiles(
callback: (reload?: boolean) => Promise<void>,
reload = false
) {
console.log('Loading test files');
await callback(reload);
this.loadTestFilesCallback = callback;
this.testFilesLoaded = true;
console.log('Successfully loaded test files');
}
async loadTestData(e2eDir: string, dataArchives: string[]) {
try {
console.log('Loading esArchiver...');
const esArchiver: EsArchiver = this.getService('esArchiver');
const promises = dataArchives.map((archive) => {
if (archive === 'synthetics_data') {
return esArchiver.load(e2eDir + archive, {
docsOnly: true,
skipExisting: true,
});
}
return esArchiver.load(e2eDir + archive, { skipExisting: true });
});
await Promise.all([...promises]);
} catch (e) {
console.log(e);
}
}
getKibanaUrl() {
const config = this.getService('config');
return Url.format({
protocol: config.get('servers.kibana.protocol'),
hostname: config.get('servers.kibana.hostname'),
port: config.get('servers.kibana.port'),
});
}
getElasticsearchUrl() {
const config = this.getService('config');
return Url.format({
protocol: config.get('servers.elasticsearch.protocol'),
hostname: config.get('servers.elasticsearch.hostname'),
port: config.get('servers.elasticsearch.port'),
});
}
async run() {
if (!this.testFilesLoaded) {
throw new Error('Test files not loaded');
}
const { headless, match, pauseOnError } = this.params;
const noOfRuns = process.env.NO_OF_RUNS
? Number(process.env.NO_OF_RUNS)
: 1;
console.log(`Running ${noOfRuns} times`);
let results: PromiseType<ReturnType<typeof syntheticsRun>> = {};
for (let i = 0; i < noOfRuns; i++) {
results = await syntheticsRun({
params: { kibanaUrl: this.kibanaUrl, getService: this.getService },
playwrightOptions: {
headless,
chromiumSandbox: false,
timeout: 60 * 1000,
viewport: {
height: 900,
width: 1600,
},
recordVideo: {
dir: '.journeys/videos',
},
},
match: match === 'undefined' ? '' : match,
pauseOnError,
screenshots: 'only-on-failure',
reporter: TestReporter,
});
if (noOfRuns > 1) {
// need to reload again since runner resets the journeys
await this.loadTestFiles(this.loadTestFilesCallback!, true);
}
}
await this.assertResults(results);
}
assertResults(results: PromiseType<ReturnType<typeof syntheticsRun>>) {
Object.entries(results).forEach(([_journey, result]) => {
if (result.status !== 'succeeded') {
process.exitCode = 1;
process.exit();
}
});
}
cleanUp() {
console.log('Removing esArchiver...');
esArchiverUnload('full_heartbeat');
esArchiverUnload('browser');
}
}

View file

@ -0,0 +1,246 @@
/*
* 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 } from '@elastic/synthetics/dist/dsl';
import { Reporter, ReporterOptions } from '@elastic/synthetics';
import {
JourneyEndResult,
JourneyStartResult,
StepEndResult,
} from '@elastic/synthetics/dist/common_types';
import { yellow, green, cyan, red, bold } from 'chalk';
// eslint-disable-next-line no-console
const log = console.log;
import { performance } from 'perf_hooks';
import * as fs from 'fs';
import { gatherScreenshots } from '@elastic/synthetics/dist/reporters/json';
import { CACHE_PATH } from '@elastic/synthetics/dist/helpers';
import { join } from 'path';
function renderError(error: any) {
let output = '';
const outer = indent('');
const inner = indent(outer);
const container = outer + '---\n';
output += container;
let stack = error.stack;
if (stack) {
output += inner + 'stack: |-\n';
stack = rewriteErrorStack(stack, findPWLogsIndexes(stack));
const lines = String(stack).split('\n');
for (const line of lines) {
output += inner + ' ' + line + '\n';
}
}
output += container;
return red(output);
}
function renderDuration(durationMs: number) {
return Number(durationMs).toFixed(0);
}
export class TestReporter implements Reporter {
metrics = {
succeeded: 0,
failed: 0,
skipped: 0,
};
journeys: Map<string, Array<StepEndResult & { name: string }>> = new Map();
constructor(options: ReporterOptions = {}) {}
onJourneyStart(journey: Journey, {}: JourneyStartResult) {
if (process.env.CI) {
this.write(`\n--- Journey: ${journey.name}`);
} else {
this.write(bold(`\n Journey: ${journey.name}`));
}
}
onStepEnd(journey: Journey, step: Step, result: StepEndResult) {
const { status, end, start, error } = result;
const message = `${symbols[status]} Step: '${
step.name
}' ${status} (${renderDuration((end - start) * 1000)} ms)`;
this.write(indent(message));
if (error) {
this.write(renderError(error));
}
this.metrics[status]++;
if (!this.journeys.has(journey.name)) {
this.journeys.set(journey.name, []);
}
this.journeys.get(journey.name)?.push({ name: step.name, ...result });
}
async onJourneyEnd(
journey: Journey,
{ error, start, end, status }: JourneyEndResult
) {
const { failed, succeeded, skipped } = this.metrics;
const total = failed + succeeded + skipped;
if (total === 0 && error) {
this.write(renderError(error));
}
const message = `${symbols[status]} Took (${renderDuration(
end - start
)} seconds)`;
this.write(message);
await fs.promises.mkdir('.journeys/failed_steps', { recursive: true });
await gatherScreenshots(
join(CACHE_PATH, 'screenshots'),
async (screenshot) => {
const { data, step } = screenshot;
if (status === 'failed') {
await (async () => {
await fs.promises.writeFile(
join('.journeys/failed_steps/', `${step.name}.jpg`),
data,
{
encoding: 'base64',
}
);
})();
}
}
);
}
onEnd() {
const failedJourneys = Array.from(this.journeys.entries()).filter(
([, steps]) => steps.some((step) => step.status === 'failed')
);
if (failedJourneys.length > 0) {
failedJourneys.forEach(([journeyName, steps]) => {
if (process.env.CI) {
const name = red(`Journey: ${journeyName} 🥵`);
this.write(`\n+++ ${name}`);
steps.forEach((stepResult) => {
const { status, end, start, error, name: stepName } = stepResult;
const message = `${
symbols[status]
} Step: '${stepName}' ${status} (${renderDuration(
(end - start) * 1000
)} ms)`;
this.write(indent(message));
if (error) {
this.write(renderError(error));
}
});
}
});
}
const successfulJourneys = Array.from(this.journeys.entries()).filter(
([, steps]) => steps.every((step) => step.status === 'succeeded')
);
successfulJourneys.forEach(([journeyName, steps]) => {
try {
fs.unlinkSync('.journeys/videos/' + journeyName + '.webm');
} catch (e) {
// eslint-disable-next-line no-console
console.log(
'Failed to delete video file for path ' +
'.journeys/videos/' +
journeyName +
'.webm'
);
}
});
const { failed, succeeded, skipped } = this.metrics;
const total = failed + succeeded + skipped;
let message = '\n';
if (total === 0) {
message = 'No tests found!';
message += ` (${renderDuration(now())} ms) \n`;
this.write(message);
return;
}
message += succeeded > 0 ? green(` ${succeeded} passed`) : '';
message += failed > 0 ? red(` ${failed} failed`) : '';
message += skipped > 0 ? cyan(` ${skipped} skipped`) : '';
message += ` (${renderDuration(now() / 1000)} seconds) \n`;
this.write(message);
}
write(message: any) {
if (typeof message === 'object') {
message = JSON.stringify(message);
}
log(message + '\n');
}
}
const SEPARATOR = '\n';
function indent(lines: string, tab = ' ') {
return lines.replace(/^/gm, tab);
}
const NO_UTF8_SUPPORT = process.platform === 'win32';
const symbols = {
warning: yellow(NO_UTF8_SUPPORT ? '!' : '⚠'),
skipped: cyan('-'),
progress: cyan('>'),
succeeded: green(NO_UTF8_SUPPORT ? 'ok' : '✓'),
failed: red(NO_UTF8_SUPPORT ? 'x' : '✖'),
};
function now() {
return performance.now();
}
function findPWLogsIndexes(msgOrStack: string): [number, number] {
let startIndex = 0;
let endIndex = 0;
if (!msgOrStack) {
return [startIndex, endIndex];
}
const lines = String(msgOrStack).split(SEPARATOR);
const logStart = /[=]{3,} logs [=]{3,}/;
const logEnd = /[=]{10,}/;
lines.forEach((line, index) => {
if (logStart.test(line)) {
startIndex = index;
} else if (logEnd.test(line)) {
endIndex = index;
}
});
return [startIndex, endIndex];
}
function rewriteErrorStack(stack: string, indexes: [number, number]) {
const [start, end] = indexes;
/**
* Do not rewrite if its not a playwright error
*/
if (start === 0 && end === 0) {
return stack;
}
const linesToKeep = start + 3;
if (start > 0 && linesToKeep < end) {
const lines = stack.split(SEPARATOR);
return lines
.slice(0, linesToKeep)
.concat(...lines.slice(end))
.join(SEPARATOR);
}
return stack;
}

View file

@ -6,7 +6,7 @@
*/
import { journey, step, expect, before } from '@elastic/synthetics';
import { recordVideo } from '@kbn/observability-plugin/e2e/record_video';
import { recordVideo } from '../helpers/record_video';
import { UXDashboardDatePicker } from '../page_objects/date_picker';
import { loginToKibana, waitForLoadingToFinish } from './utils';

View file

@ -6,7 +6,7 @@
*/
import { journey, step, expect, before } from '@elastic/synthetics';
import { recordVideo } from '@kbn/observability-plugin/e2e/record_video';
import { recordVideo } from '../helpers/record_video';
import { UXDashboardDatePicker } from '../page_objects/date_picker';
import { byTestId, loginToKibana, waitForLoadingToFinish } from './utils';

View file

@ -6,7 +6,7 @@
*/
import { journey, step, expect, before } from '@elastic/synthetics';
import { recordVideo } from '@kbn/observability-plugin/e2e/record_video';
import { recordVideo } from '../helpers/record_video';
import { UXDashboardDatePicker } from '../page_objects/date_picker';
import { byTestId, loginToKibana, waitForLoadingToFinish } from './utils';

View file

@ -6,7 +6,7 @@
*/
import { journey, step, expect, before } from '@elastic/synthetics';
import { recordVideo } from '@kbn/observability-plugin/e2e/record_video';
import { recordVideo } from '../helpers/record_video';
import { UXDashboardDatePicker } from '../page_objects/date_picker';
import { byTestId, loginToKibana, waitForLoadingToFinish } from './utils';

View file

@ -6,7 +6,7 @@
*/
import { journey, step, expect, before } from '@elastic/synthetics';
import { recordVideo } from '@kbn/observability-plugin/e2e/record_video';
import { recordVideo } from '../helpers/record_video';
import { UXDashboardDatePicker } from '../page_objects/date_picker';
import { byTestId, loginToKibana, waitForLoadingToFinish } from './utils';

View file

@ -6,7 +6,7 @@
*/
import { journey, step, before, expect } from '@elastic/synthetics';
import { recordVideo } from '@kbn/observability-plugin/e2e/record_video';
import { recordVideo } from '../helpers/record_video';
import { UXDashboardDatePicker } from '../page_objects/date_picker';
import { byTestId, loginToKibana, waitForLoadingToFinish } from './utils';

View file

@ -6,7 +6,7 @@
*/
import { journey, step, before } from '@elastic/synthetics';
import { recordVideo } from '@kbn/observability-plugin/e2e/record_video';
import { recordVideo } from '../helpers/record_video';
import { UXDashboardDatePicker } from '../page_objects/date_picker';
import { byLensTestId, loginToKibana, waitForLoadingToFinish } from './utils';

View file

@ -5,9 +5,9 @@
* 2.0.
*/
import { FtrConfigProviderContext } from '@kbn/test';
import { argv } from '@kbn/observability-plugin/e2e/parse_args_params';
import path from 'path';
import { SyntheticsRunner } from '@kbn/observability-plugin/e2e/synthetics_runner';
import { argv } from './helpers/parse_args_params';
import { SyntheticsRunner } from './helpers/synthetics_runner';
const { headless, grep, bail: pauseOnError } = argv;

View file

@ -0,0 +1,37 @@
/*
* 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 Path from 'path';
import { execSync } from 'child_process';
const ES_ARCHIVE_DIR = './fixtures/es_archiver';
// Otherwise execSync would inject NODE_TLS_REJECT_UNAUTHORIZED=0 and node would abort if used over https
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`,
{ 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`,
{ env: { ...process.env, NODE_TLS_REJECT_UNAUTHORIZED }, stdio: 'inherit' }
);
};