Removing old e2e (#112170)

* removing old e2e

* removing e2e

* removing e2e

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
Cauê Marcondes 2021-09-15 16:33:54 -04:00 committed by GitHub
parent 02de7cca73
commit 2711e7b1cc
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
39 changed files with 0 additions and 1137 deletions

View file

@ -22,7 +22,6 @@ snapshots.js
/src/core/lib/kbn_internal_native_observable
/src/plugins/data/common/es_query/kuery/ast/_generated_/**
/src/plugins/vis_types/timelion/common/_generated_/**
/x-pack/plugins/apm/e2e/tmp/*
/x-pack/plugins/canvas/canvas_plugin
/x-pack/plugins/canvas/shareable_runtime/build
/x-pack/plugins/canvas/storybook/build

2
.github/CODEOWNERS vendored
View file

@ -125,8 +125,6 @@
/x-pack/test/api_integration/apis/uptime @elastic/uptime
# Client Side Monitoring / Uptime (lives in APM directories but owned by Uptime)
/x-pack/plugins/apm/e2e/cypress/support/step_definitions/csm @elastic/uptime
/x-pack/plugins/apm/e2e/cypress/integration/csm_dashboard.feature @elastic/uptime
/x-pack/plugins/apm/public/application/uxApp.tsx @elastic/uptime
/x-pack/plugins/apm/public/components/app/RumDashboard @elastic/uptime
/x-pack/plugins/apm/server/lib/rum_client @elastic/uptime

View file

@ -15,7 +15,6 @@
- "x-pack/test/fleet_api_integration/**/*.*"
- "Team:uptime":
- "x-pack/plugins/uptime/**/*.*"
- "x-pack/plugins/apm/e2e/cypress/support/step_definitions/csm/*.*"
- "x-pack/plugins/apm/public/application/csmApp.tsx"
- "x-pack/plugins/apm/public/components/app/RumDashboard/**/*.*"
- "x-pack/plugins/apm/public/components/app/RumDashboard/*.*"

View file

@ -67,7 +67,6 @@ it('produces the right watch and ignore list', () => {
<absolute path>/x-pack/test/plugin_functional/plugins/resolver_test/docs/**,
<absolute path>/x-pack/plugins/reporting/chromium,
<absolute path>/x-pack/plugins/security_solution/cypress,
<absolute path>/x-pack/plugins/apm/e2e,
<absolute path>/x-pack/plugins/apm/scripts,
<absolute path>/x-pack/plugins/canvas/canvas_plugin_src,
<absolute path>/x-pack/plugins/cases/server/scripts,

View file

@ -58,7 +58,6 @@ export function getServerWatchPaths({ pluginPaths, pluginScanDirs }: Options) {
...pluginInternalDirsIgnore,
fromRoot('x-pack/plugins/reporting/chromium'),
fromRoot('x-pack/plugins/security_solution/cypress'),
fromRoot('x-pack/plugins/apm/e2e'),
fromRoot('x-pack/plugins/apm/scripts'),
fromRoot('x-pack/plugins/canvas/canvas_plugin_src'), // prevents server from restarting twice for Canvas plugin changes,
fromRoot('x-pack/plugins/cases/server/scripts'),

View file

@ -60,7 +60,6 @@ export const IGNORE_FILE_GLOBS = [
// TODO fix file names in APM to remove these
'x-pack/plugins/apm/public/**/*',
'x-pack/plugins/apm/scripts/**/*',
'x-pack/plugins/apm/e2e/**/*',
'x-pack/plugins/maps/server/fonts/**/*',

View file

@ -59,10 +59,6 @@ export const PROJECTS = [
createProject('x-pack/plugins/osquery/cypress/tsconfig.json', {
name: 'osquery/cypress',
}),
createProject('x-pack/plugins/apm/e2e/tsconfig.json', {
name: 'apm/cypress',
disableTypeCheck: true,
}),
createProject('x-pack/plugins/apm/ftr_e2e/tsconfig.json', {
name: 'apm/ftr_e2e',
disableTypeCheck: true,

View file

@ -1,5 +0,0 @@
cypress/screenshots/*
cypress/test-results
cypress/videos/*
/snapshots.js
tmp

View file

@ -1,15 +0,0 @@
# End-To-End (e2e) Test for APM UI
**Run E2E tests**
```sh
# In one terminal
node ./scripts/kibana --no-base-path --dev --no-dev-config --config x-pack/plugins/apm/e2e/ci/kibana.e2e.yml
# In another terminal
x-pack/plugins/apm/e2e/run-e2e.sh
```
Starts kibana, APM Server, Elasticsearch (with sample data) and runs the tests.
If you see errors about not all events being ingested correctly try running `cd kibana/x-pack/plugins/apm/e2e/tmp/apm-integration-testing && docker-compose down -v`

View file

@ -1,31 +0,0 @@
# Kibana
server.port: 5701
xpack.security.encryptionKey: 'something_at_least_32_characters'
csp.strict: false
logging.verbose: true
# Elasticsearch
# Started via apm-integration-testing
# ./scripts/compose.py start master --no-kibana --elasticsearch-port 9201 --apm-server-port 8201
elasticsearch.hosts: http://localhost:9201
elasticsearch.username: 'kibana_system_user'
elasticsearch.password: 'changeme'
# APM index pattern
apm_oss.indexPattern: apm-*
# APM Indices
apm_oss.errorIndices: apm-*-error*
apm_oss.sourcemapIndices: apm-*-sourcemap
apm_oss.transactionIndices: apm-*-transaction*
apm_oss.spanIndices: apm-*-span*
apm_oss.metricsIndices: apm-*-metric*
apm_oss.onboardingIndices: apm-*-onboarding*
# APM options
xpack.apm.enabled: true
xpack.apm.serviceMapEnabled: false
xpack.apm.autocreateApmIndexPattern: true
xpack.apm.ui.enabled: true
xpack.apm.ui.transactionGroupBucketSize: 100
xpack.apm.ui.maxTraceItems: 1000

View file

@ -1,13 +0,0 @@
#!/usr/bin/env bash
set -e
E2E_DIR=x-pack/plugins/apm/e2e
echo "1/2 Install dependencies..."
# shellcheck disable=SC1091
source src/dev/ci_setup/setup_env.sh true
yarn kbn bootstrap
echo "2/2 Start Kibana..."
## Might help to avoid FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory
export NODE_OPTIONS="--max-old-space-size=4096"
nohup node ./scripts/kibana --no-base-path --no-watch --dev --no-dev-config --config ${E2E_DIR}/ci/kibana.e2e.yml > ${E2E_DIR}/kibana.log 2>&1 &

View file

@ -1,11 +0,0 @@
#!/usr/bin/env bash
##
## This is a wrapper to configure the environment with the right tools in the CI
## and run the e2e steps.
##
E2E_DIR="${0%/*}/.."
# shellcheck disable=SC1091
source src/dev/ci_setup/setup_env.sh true
set -ex
"${E2E_DIR}"/run-e2e.sh

View file

@ -1,27 +0,0 @@
{
"nodeVersion": "system",
"baseUrl": "http://localhost:5701",
"trashAssetsBeforeRuns": false,
"fileServerFolder": "../",
"fixturesFolder": "./cypress/fixtures",
"integrationFolder": "./cypress/integration",
"pluginsFile": "./cypress/plugins/index.js",
"screenshotsFolder": "./cypress/screenshots",
"supportFile": "./cypress/support/index.ts",
"video": true,
"videoCompression": false,
"videosFolder": "./cypress/videos",
"useRelativeSnapshots": true,
"reporter": "junit",
"reporterOptions": {
"mochaFile": "./cypress/test-results/[hash]-e2e-tests.xml",
"toConsole": false
},
"testFiles": "**/*.{feature,features}",
"env": {
"elasticsearch_username": "admin",
"elasticsearch_password": "changeme"
},
"viewportWidth": 1920,
"viewportHeight": 1080
}

View file

@ -1,5 +0,0 @@
{
"name": "Using fixtures to represent data",
"email": "hello@cypress.io",
"body": "Fixtures are a great way to mock data for responses to routes"
}

View file

@ -1,34 +0,0 @@
Feature: CSM Dashboard
Scenario: Client metrics
When a user browses the APM UI application for RUM Data
Then should have correct client metrics
Scenario: JS Errors
When a user browses the APM UI application for RUM Data
Then it displays list of relevant js errors
Scenario: Percentile select
When the user changes the selected percentile
Then it displays client metric related to that percentile
Scenario Outline: CSM page filters
When the user filters by "<filterName>"
Then it filters the client metrics "<filterName>"
Examples:
| filterName |
| OS |
| Location |
Scenario: Display CSM Data components
When a user browses the APM UI application for RUM Data
Then should display percentile for page load chart
And should display tooltip on hover
Scenario: Search by url filter focus
When a user clicks inside url search field
Then it displays top pages in the suggestion popover
Scenario: Search by url filter
When a user enters a query in url search field
Then it should filter results based on query

View file

@ -1,36 +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.
*/
const BASE_URL = Cypress.config().baseUrl;
/** The default time in ms to wait for a Cypress command to complete */
export const DEFAULT_TIMEOUT = 60 * 1000;
export function loginAndWaitForPage(
url: string,
dateRange: { to: string; from: string },
selectedService?: string
) {
const username = Cypress.env('elasticsearch_username');
const password = Cypress.env('elasticsearch_password');
cy.log(`Authenticating via ${username} / ${password}`);
let fullUrl = `${BASE_URL}${url}?rangeFrom=${dateRange.from}&rangeTo=${dateRange.to}`;
if (selectedService) {
fullUrl += `&serviceName=${selectedService}`;
}
cy.visit(fullUrl, { auth: { username, password } });
cy.viewport('macbook-15');
// wait for loading spinner to disappear
cy.get('#kbn_loading_message', { timeout: DEFAULT_TIMEOUT }).should(
'not.exist'
);
}

View file

@ -1,3 +0,0 @@
module.exports = {
"__version": "6.8.0"
}

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.
*/
module.exports = {
__version: '4.9.0',
};

View file

@ -1,43 +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.
*/
// ***********************************************************
// This example plugins/index.js can be used to load plugins
//
// You can change the location of this file or turn off loading
// the plugins file with the 'pluginsFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/plugins-guide
// ***********************************************************
// This function is called when a project is opened or re-opened (e.g. due to
// the project's config changing)
// eslint-disable-next-line import/no-extraneous-dependencies
const wp = require('@cypress/webpack-preprocessor');
const fs = require('fs');
module.exports = (on) => {
const options = {
webpackOptions: require('../webpack.config.js'),
};
on('file:preprocessor', wp(options));
// readFileMaybe
on('task', {
// ESLint thinks this is a react component for some reason.
// eslint-disable-next-line react/function-component-definition
readFileMaybe(filename) {
if (fs.existsSync(filename)) {
return fs.readFileSync(filename, 'utf8');
}
return null;
},
});
};

View file

@ -1,32 +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.
*/
// ***********************************************
// This example commands.js shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************
//
//
// -- This is a parent command --
// Cypress.Commands.add("login", (email, password) => { ... })
//
//
// -- This is a child command --
// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This is will overwrite an existing command --
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })

View file

@ -1,28 +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.
*/
// ***********************************************************
// This example support/index.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************
import './commands';
// @ts-expect-error
import { register } from '@cypress/snapshot';
register();

View file

@ -1,43 +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 { Given, When, Then } from 'cypress-cucumber-preprocessor/steps';
import { DEFAULT_TIMEOUT } from './csm_dashboard';
import { waitForLoadingToFinish } from './utils';
/** The default time in ms to wait for a Cypress command to complete */
Given(`a user clicks the page load breakdown filter`, () => {
waitForLoadingToFinish();
cy.get('.euiStat__title-isLoading').should('not.exist');
const breakDownBtn = cy.get(
'[data-test-subj=pldBreakdownFilter]',
DEFAULT_TIMEOUT
);
breakDownBtn.click();
});
When(`the user selected the breakdown`, () => {
cy.get('[id="user_agent.name"]', DEFAULT_TIMEOUT).click();
// click outside popover to close it
cy.get('[data-cy=pageLoadDist]').click();
});
Then(`breakdown series should appear in chart`, () => {
cy.get('.euiLoadingChart').should('not.exist');
cy.get('[data-cy=pageLoadDist]').within(() => {
cy.get('button.echLegendItem__label[title=Chrome] ', DEFAULT_TIMEOUT)
.invoke('text')
.should('eq', 'Chrome');
cy.get('button.echLegendItem__label', DEFAULT_TIMEOUT).should(
'have.text',
'ChromeChrome Mobile WebViewSafariFirefoxMobile SafariChrome MobileChrome Mobile iOSOverall'
);
});
});

View file

@ -1,36 +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 { DEFAULT_TIMEOUT } from './csm_dashboard';
import { waitForLoadingToFinish } from './utils';
/**
* Verifies the behavior of the client metrics component
* @param metrics array of three elements
* @param checkTitleStatus if it's needed to check title elements
*/
export function verifyClientMetrics(
metrics: string[],
checkTitleStatus: boolean
) {
const clientMetricsSelector = '[data-cy=client-metrics] .euiStat__title';
waitForLoadingToFinish();
if (checkTitleStatus) {
cy.get('.euiStat__title', DEFAULT_TIMEOUT).should('be.visible');
cy.get('.euiSelect-isLoading').should('not.exist');
}
cy.get('.euiStat__title-isLoading').should('not.exist');
cy.get(clientMetricsSelector).eq(0).should('have.text', metrics[0]);
cy.get(clientMetricsSelector).eq(1).should('have.text', metrics[1]);
cy.get(clientMetricsSelector).eq(2).should('have.text', metrics[2]);
}

View file

@ -1,77 +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 { Given, Then } from 'cypress-cucumber-preprocessor/steps';
import { loginAndWaitForPage } from '../../../integration/helpers';
import { verifyClientMetrics } from './client_metrics_helper';
import { waitForLoadingToFinish } from './utils';
/** The default time in ms to wait for a Cypress command to complete */
export const DEFAULT_TIMEOUT = { timeout: 60 * 1000 };
Given(`a user browses the APM UI application for RUM Data`, () => {
// Open UX landing page
const RANGE_FROM = 'now-24h';
const RANGE_TO = 'now';
loginAndWaitForPage(
`/app/ux`,
{
from: RANGE_FROM,
to: RANGE_TO,
},
'client'
);
});
Then(`should have correct client metrics`, () => {
const metrics = ['80 ms', '4 ms', '76 ms', '55'];
verifyClientMetrics(metrics, true);
});
Then(`should display percentile for page load chart`, () => {
const pMarkers = '[data-cy=percentile-markers] span';
cy.get('.euiLoadingChart', DEFAULT_TIMEOUT).should('be.visible');
waitForLoadingToFinish();
cy.get('.euiStat__title-isLoading').should('not.exist');
cy.get(pMarkers).eq(0).should('have.text', '50th');
cy.get(pMarkers).eq(1).should('have.text', '75th');
cy.get(pMarkers).eq(2).should('have.text', '90th');
cy.get(pMarkers).eq(3).should('have.text', '95th');
});
Then(`should display chart legend`, () => {
const chartLegend = 'button.echLegendItem__label';
waitForLoadingToFinish();
cy.get('.euiLoadingChart').should('not.exist');
cy.get('[data-cy=pageLoadDist]').within(() => {
cy.get(chartLegend, DEFAULT_TIMEOUT).eq(0).should('have.text', 'Overall');
});
});
Then(`should display tooltip on hover`, () => {
cy.get('.euiLoadingChart').should('not.exist');
const pMarkers = '[data-cy=percentile-markers] span.euiToolTipAnchor';
waitForLoadingToFinish();
cy.get('.euiLoadingChart').should('not.exist');
const marker = cy.get(pMarkers, DEFAULT_TIMEOUT).eq(0);
marker.invoke('show');
marker.trigger('mouseover', { force: true });
cy.get('span[data-cy=percentileTooltipTitle]').should('be.visible');
});

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 { When, Then } from 'cypress-cucumber-preprocessor/steps';
import { DEFAULT_TIMEOUT } from './csm_dashboard';
import { verifyClientMetrics } from './client_metrics_helper';
import { waitForLoadingToFinish } from './utils';
When(/^the user filters by "([^"]*)"$/, (filterName) => {
waitForLoadingToFinish();
cy.get('.euiStat__title-isLoading').should('not.exist');
cy.get(
`button[aria-label="expands filter group for ${filterName} filter"]`
).click();
cy.get(`.euiPopover__panel-isOpen`, DEFAULT_TIMEOUT).within(() => {
if (filterName === 'OS') {
const osItem = cy.get('li.euiSelectableListItem', DEFAULT_TIMEOUT).eq(2);
osItem.should('have.text', 'Mac OS X24 ');
osItem.click();
// sometimes click doesn't work as expected so we need to retry here
osItem.invoke('attr', 'aria-selected').then((val) => {
if (val === 'false') {
cy.get('li.euiSelectableListItem', DEFAULT_TIMEOUT).eq(2).click();
}
});
} else {
const deItem = cy.get('li.euiSelectableListItem', DEFAULT_TIMEOUT).eq(0);
deItem.should('have.text', 'DE84 ');
deItem.click();
// sometimes click doesn't work as expected so we need to retry here
deItem.invoke('attr', 'aria-selected').then((val) => {
if (val === 'false') {
cy.get('li.euiSelectableListItem', DEFAULT_TIMEOUT).eq(0).click();
}
});
}
cy.contains('Apply').click();
});
cy.get(`.globalFilterLabel__value`, DEFAULT_TIMEOUT).contains(
filterName === 'OS' ? 'Mac OS X' : 'DE'
);
});
Then(/^it filters the client metrics "([^"]*)"$/, (filterName) => {
waitForLoadingToFinish();
cy.get('.euiStat__title-isLoading').should('not.exist');
const data =
filterName === 'OS'
? ['82 ms', '5 ms', '77 ms', '8']
: ['75 ms', '4 ms', '71 ms', '28'];
verifyClientMetrics(data, true);
cy.get('[data-cy=clearFilters]', DEFAULT_TIMEOUT).click();
});

View file

@ -1,24 +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 { Then } from 'cypress-cucumber-preprocessor/steps';
import { DEFAULT_TIMEOUT } from './csm_dashboard';
import { getDataTestSubj } from './utils';
Then(`it displays list of relevant js errors`, () => {
cy.get('.euiBasicTable-loading').should('not.exist');
cy.get('.euiStat__title-isLoading').should('not.exist');
getDataTestSubj('uxJsErrorsTotal').should('have.text', 'Total errors112');
getDataTestSubj('uxJsErrorTable').within(() => {
cy.get('tr.euiTableRow', DEFAULT_TIMEOUT)
.eq(0)
.invoke('text')
.should('eq', 'Error messageTest CaptureErrorImpacted page loads100.0 %');
});
});

View file

@ -1,22 +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 { When, Then } from 'cypress-cucumber-preprocessor/steps';
import { verifyClientMetrics } from './client_metrics_helper';
import { getDataTestSubj } from './utils';
When('the user changes the selected percentile', () => {
getDataTestSubj('uxPercentileSelect').select('95');
});
Then(`it displays client metric related to that percentile`, () => {
const metrics = ['165 ms', '14 ms', '151 ms', '55'];
verifyClientMetrics(metrics, false);
getDataTestSubj('uxPercentileSelect').select('50');
});

View file

@ -1,22 +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 { When, Then } from 'cypress-cucumber-preprocessor/steps';
import { verifyClientMetrics } from './client_metrics_helper';
import { DEFAULT_TIMEOUT } from './csm_dashboard';
import { waitForLoadingToFinish } from './utils';
When('the user changes the selected service name', () => {
waitForLoadingToFinish();
cy.get(`[data-cy=serviceNameFilter]`, DEFAULT_TIMEOUT).select('client');
});
Then(`it displays relevant client metrics`, () => {
const metrics = ['80 ms', '4 ms', '76 ms', '55'];
verifyClientMetrics(metrics, false);
});

View file

@ -1,66 +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 { When, Then } from 'cypress-cucumber-preprocessor/steps';
import { DEFAULT_TIMEOUT } from './csm_dashboard';
import { waitForLoadingToFinish } from './utils';
When(`a user clicks inside url search field`, () => {
waitForLoadingToFinish();
cy.get('.euiStat__title-isLoading').should('not.exist');
cy.get('span[data-cy=csmUrlFilter]', DEFAULT_TIMEOUT).within(() => {
cy.get('input.euiFieldSearch').click();
});
});
Then(`it displays top pages in the suggestion popover`, () => {
waitForLoadingToFinish();
cy.get('div.euiPopover__panel-isOpen', DEFAULT_TIMEOUT).within(() => {
const listOfUrls = cy.get('li.euiSelectableListItem');
listOfUrls.should('have.length', 5);
const actualUrlsText = [
'http://opbeans-node:3000/dashboardTotal page views: 17Page load duration: 109 ms (median)',
'http://opbeans-node:3000/ordersTotal page views: 14Page load duration: 72 ms (median)',
];
cy.get('li.euiSelectableListItem')
.eq(0)
.should('have.text', actualUrlsText[0]);
cy.get('li.euiSelectableListItem')
.eq(1)
.should('have.text', actualUrlsText[1]);
});
});
When(`a user enters a query in url search field`, () => {
waitForLoadingToFinish();
cy.get('[data-cy=csmUrlFilter]').within(() => {
cy.get('input.euiSelectableSearch').type('cus');
});
waitForLoadingToFinish();
});
Then(`it should filter results based on query`, () => {
waitForLoadingToFinish();
cy.get('div.euiPopover__panel-isOpen', DEFAULT_TIMEOUT).within(() => {
const listOfUrls = cy.get('li.euiSelectableListItem');
listOfUrls.should('have.length', 1);
const actualUrlsText = [
'http://opbeans-node:3000/customersTotal page views: 10Page load duration: 76 ms (median)',
];
cy.get('li.euiSelectableListItem')
.eq(0)
.should('have.text', actualUrlsText[0]);
});
});

View file

@ -1,18 +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 { DEFAULT_TIMEOUT } from './csm_dashboard';
export function waitForLoadingToFinish() {
cy.get('[data-test-subj=globalLoadingIndicator-hidden]', DEFAULT_TIMEOUT);
}
export function getDataTestSubj(dataTestSubj: string) {
waitForLoadingToFinish();
return cy.get(`[data-test-subj=${dataTestSubj}]`, DEFAULT_TIMEOUT);
}

View file

@ -1,12 +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.
*/
declare namespace Cypress {
interface Chainable<Subject> {
snapshot: () => {};
}
}

View file

@ -1,44 +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.
*/
module.exports = {
resolve: {
extensions: ['.ts', '.js'],
symlinks: false,
},
node: { fs: 'empty', child_process: 'empty', readline: 'empty' },
module: {
rules: [
{
test: /\.ts$/,
exclude: [/node_modules/],
include: [/e2e\/cypress/],
use: [
{
loader: 'ts-loader',
},
],
},
{
test: /\.feature$/,
use: [
{
loader: 'cypress-cucumber-preprocessor/loader',
},
],
},
{
test: /\.features$/,
use: [
{
loader: 'cypress-cucumber-preprocessor/lib/featuresLoader',
},
],
},
],
},
};

View file

@ -1,173 +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.
*/
/* eslint-disable no-console */
/* eslint-disable import/no-extraneous-dependencies */
/**
* This script is useful for ingesting previously generated APM data into Elasticsearch via APM Server
*
* You can either:
* 1. Download a static test data file from: https://storage.googleapis.com/apm-ui-e2e-static-data/events.json
* 2. Or, generate the test data file yourself:
* git clone https://github.com/elastic/apm-integration-testing.git
* ./scripts/compose.py start master --no-kibana --with-opbeans-node --apm-server-record
* docker cp localtesting_8.0.0_apm-server-2:/app/events.json . && cat events.json | wc -l
*
*
*
* Run the script:
*
* node replay.js --server-url <apm server url> --secret-token <apm server secret token> --events ./events.json
*
************/
const { promisify } = require('util');
const fs = require('fs');
const path = require('path');
const axios = require('axios');
const readFile = promisify(fs.readFile);
const pLimit = require('p-limit');
const pRetry = require('p-retry');
const { argv } = require('yargs');
const ora = require('ora');
const userAgents = require('./user_agents');
const userIps = require('./rum_ips');
const APM_SERVER_URL = argv.serverUrl;
const SECRET_TOKEN = argv.secretToken;
const EVENTS_PATH = argv.events;
if (!APM_SERVER_URL) {
console.log('`--server-url` is required');
process.exit(1);
}
if (!EVENTS_PATH) {
console.log('`--events` is required');
process.exit(1);
}
const requestProgress = {
succeeded: 0,
failed: 0,
total: 0,
};
const spinner = ora({ text: 'Warming up...', stream: process.stdout });
function incrementSpinnerCount({ success }) {
success ? requestProgress.succeeded++ : requestProgress.failed++;
const remaining =
requestProgress.total -
(requestProgress.succeeded + requestProgress.failed);
spinner.text = `Remaining: ${remaining}. Succeeded: ${requestProgress.succeeded}. Failed: ${requestProgress.failed}.`;
}
let iterIndex = 0;
function setItemMetaAndHeaders(item) {
const headers = {
'content-type': 'application/x-ndjson',
};
if (SECRET_TOKEN) {
headers.Authorization = `Bearer ${SECRET_TOKEN}`;
}
if (item.url === '/intake/v2/rum/events') {
if (iterIndex === userAgents.length) {
// set some event agent to opbean
setRumAgent(item);
iterIndex = 0;
}
headers['User-Agent'] = userAgents[iterIndex];
headers['X-Forwarded-For'] = userIps[iterIndex];
iterIndex++;
}
return headers;
}
function setRumAgent(item) {
if (item.body) {
item.body = item.body.replace(
'"name":"client"',
'"name":"elastic-frontend"'
);
}
}
async function insertItem(item, headers) {
try {
const url = `${APM_SERVER_URL}${item.url}`;
await axios({
method: item.method,
url,
headers,
data: item.body,
});
} catch (e) {
console.error(
`${e.response ? JSON.stringify(e.response.data) : e.message}`
);
throw e;
}
}
async function init() {
const content = await readFile(path.resolve(EVENTS_PATH));
const items = content
.toString()
.split('\n')
.filter((item) => item)
.map((item) => JSON.parse(item))
.filter((item) => {
return (
item.url === '/intake/v2/events' || item.url === '/intake/v2/rum/events'
);
});
spinner.start();
requestProgress.total = items.length;
const limit = pLimit(20); // number of concurrent requests
await Promise.all(
items.map(async (item) => {
try {
const headers = setItemMetaAndHeaders(item);
// retry 5 times with exponential backoff
await pRetry(() => limit(() => insertItem(item, headers)), {
retries: 5,
});
incrementSpinnerCount({ success: true });
} catch (e) {
incrementSpinnerCount({ success: false });
}
})
);
}
init()
.then(() => {
if (requestProgress.succeeded === requestProgress.total) {
spinner.succeed(
`Successfully ingested ${requestProgress.succeeded} of ${requestProgress.total} events`
);
process.exit(0);
} else {
spinner.fail(
`Ingested ${requestProgress.succeeded} of ${requestProgress.total} events`
);
process.exit(1);
}
})
.catch((e) => {
console.log('An error occurred:', e);
process.exit(1);
});

View file

@ -1,20 +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.
*/
const IPS = [
'89.191.86.214', // check24.de
'167.40.79.24', // canada.ca
'151.101.130.217', // elastic.co
'185.143.68.17',
'151.101.130.217',
'185.143.68.17',
'185.143.68.17',
'151.101.130.217',
'185.143.68.17',
];
module.exports = IPS;

View file

@ -1,24 +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.
*/
/* eslint-disable no-console */
/* eslint-disable import/no-extraneous-dependencies */
const UserAgents = [
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.97 Safari/537.36',
'Mozilla/5.0 (Linux; Android 8.0.0; SM-G960F Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.84 Mobile Safari/537.36',
'Mozilla/5.0 (iPhone; CPU iPhone OS 12_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) CriOS/69.0.3497.105 Mobile/15E148 Safari/605.1',
'Mozilla/5.0 (iPhone; CPU iPhone OS 12_0 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/12.0 Mobile/15E148 Safari/604.1',
'Mozilla/5.0 (Linux; Android 7.0; Pixel C Build/NRD90M; wv) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/52.0.2743.98 Safari/537.36',
'Mozilla/5.0 (X11; CrOS x86_64 8172.45.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/51.0.2704.64 Safari/537.36',
'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/601.3.9 (KHTML, like Gecko) Version/9.0.2 Safari/601.3.9',
'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:15.0) Gecko/20100101 Firefox/15.0.1',
'Mozilla/5.0 (CrKey armv7l 1.5.16041) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.0 Safari/537.36',
];
module.exports = UserAgents;

View file

@ -1,176 +0,0 @@
#!/usr/bin/env bash
# variables
KIBANA_PORT=5701
ELASTICSEARCH_PORT=9201
APM_SERVER_PORT=8201
# ensure Docker is running
docker ps &> /dev/null
if [ $? -ne 0 ]; then
echo "⚠️ Please start Docker"
exit 1
fi
# formatting
bold=$(tput bold)
normal=$(tput sgr0)
# paths
E2E_DIR="${0%/*}"
TMP_DIR="tmp"
APM_IT_DIR="tmp/apm-integration-testing"
WAIT_ON_BIN="../../../../node_modules/.bin/wait-on"
CYPRESS_BIN="../../../../node_modules/.bin/cypress"
cd ${E2E_DIR}
KIBANA_VERSION=$(node -p "require('../../../package.json').version")
#
# Ask user to start Kibana
##################################################
echo "" # newline
echo "${bold}To start Kibana please run the following command:${normal}
node ./scripts/kibana --no-base-path --dev --no-dev-config --config x-pack/plugins/apm/e2e/ci/kibana.e2e.yml"
#
# Create tmp folder
##################################################
echo "" # newline
echo "${bold}Temporary folder${normal}"
echo "Temporary files will be stored in: ${E2E_DIR}${TMP_DIR}"
mkdir -p ${TMP_DIR}
#
# apm-integration-testing
##################################################
echo "" # newline
echo "${bold}apm-integration-testing (logs: ${E2E_DIR}${TMP_DIR}/apm-it.log)${normal}"
# pull if folder already exists
if [ -d ${APM_IT_DIR} ]; then
echo "Pulling from master..."
git -C ${APM_IT_DIR} pull &> ${TMP_DIR}/apm-it.log
# clone if folder does not exists
else
echo "Cloning repository"
git clone "https://github.com/elastic/apm-integration-testing.git" ${APM_IT_DIR} &> ${TMP_DIR}/apm-it.log
fi
# Stop if clone/pull failed
if [ $? -ne 0 ]; then
echo "⚠️ Initializing apm-integration-testing failed."
exit 1
fi
# Start apm-integration-testing
echo "Starting docker-compose"
echo "Using stack version: ${KIBANA_VERSION}"
${APM_IT_DIR}/scripts/compose.py start $KIBANA_VERSION \
--no-kibana \
--elasticsearch-port $ELASTICSEARCH_PORT \
--apm-server-port=$APM_SERVER_PORT \
--elasticsearch-heap 4g \
--apm-server-opt queue.mem.events=8192 \
--apm-server-opt output.elasticsearch.bulk_max_size=4096 \
&> ${TMP_DIR}/apm-it.log
# Stop if apm-integration-testing failed to start correctly
if [ $? -ne 0 ]; then
echo "⚠️ apm-integration-testing could not be started"
echo "" # newline
echo "As a last resort, reset docker with:"
echo "" # newline
echo "cd ${E2E_DIR}${APM_IT_DIR} && scripts/compose.py stop && docker system prune --all --force --volumes"
echo "" # newline
# output logs for excited docker containers
cd ${APM_IT_DIR} && docker-compose ps --filter "status=exited" -q | xargs -L1 docker logs --tail=10 && cd -
echo "" # newline
echo "Find the full logs in ${E2E_DIR}${TMP_DIR}/apm-it.log"
exit 1
fi
#
# Static mock data
##################################################
echo "" # newline
echo "${bold}Static mock data (logs: ${E2E_DIR}${TMP_DIR}/ingest-data.log)${normal}"
STATIC_MOCK_FILENAME='2020-06-12.json'
# Download static data if not already done
if [ ! -e "${TMP_DIR}/${STATIC_MOCK_FILENAME}" ]; then
echo "Downloading ${STATIC_MOCK_FILENAME}..."
curl --silent https://storage.googleapis.com/apm-ui-e2e-static-data/${STATIC_MOCK_FILENAME} --output ${TMP_DIR}/${STATIC_MOCK_FILENAME}
fi
# echo "Deleting existing indices (apm* and .apm*)"
curl --silent --user admin:changeme -XDELETE "localhost:${ELASTICSEARCH_PORT}/.apm*" > /dev/null
curl --silent --user admin:changeme -XDELETE "localhost:${ELASTICSEARCH_PORT}/apm*" > /dev/null
# Ingest data into APM Server
node ingest-data/replay.js --server-url http://localhost:$APM_SERVER_PORT --events ${TMP_DIR}/${STATIC_MOCK_FILENAME} 2>> ${TMP_DIR}/ingest-data.log
# Abort if not all events were ingested correctly
if [ $? -ne 0 ]; then
echo "⚠️ Not all events were ingested correctly. This might affect test tests."
echo "Aborting. Please try again."
echo "" # newline
echo "Full logs in ${E2E_DIR}${TMP_DIR}/ingest-data.log:"
# output logs for excited docker containers
cd ${APM_IT_DIR} && docker-compose ps --filter "status=exited" -q | xargs -L1 docker logs --tail=3 && cd -
# stop docker containers
cd ${APM_IT_DIR} && ./scripts/compose.py stop > /dev/null && cd -
exit 1
fi
# create empty snapshot file if it doesn't exist
SNAPSHOTS_FILE=cypress/integration/snapshots.js
if [ ! -f ${SNAPSHOTS_FILE} ]; then
echo "{}" > ${SNAPSHOTS_FILE}
fi
#
# Wait for Kibana to start
##################################################
echo "" # newline
echo "${bold}Waiting for Kibana to start...${normal}"
echo "Note: you need to start Kibana manually. Find the instructions at the top."
$WAIT_ON_BIN -i 500 -w 500 http-get://admin:changeme@localhost:$KIBANA_PORT/api/status > /dev/null
## Workaround to wait for the http server running
## See: https://github.com/elastic/kibana/issues/66326
if [ -e kibana.log ] ; then
grep -m 1 "Kibana is now available" <(tail -f -n +1 kibana.log)
echo "✅ Kibana server running..."
grep -m 1 "bundles compiled successfully" <(tail -f -n +1 kibana.log)
echo "✅ Kibana bundles have been compiled..."
fi
echo "✅ Setup completed successfully. Running tests..."
#
# run cypress tests
##################################################
$CYPRESS_BIN run --config pageLoadTimeout=100000,watchForFileChanges=true
e2e_status=$?
#
# Run interactively
##################################################
echo "${bold}If you want to run the test interactively, run:${normal}"
echo "" # newline
echo "cd ${E2E_DIR} && ${CYPRESS_BIN} open --config pageLoadTimeout=100000,watchForFileChanges=true"
# Report the e2e status at the very end
if [ $e2e_status -ne 0 ]; then
echo "⚠️ Running tests failed."
exit 1
fi

View file

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

View file

@ -12,7 +12,6 @@ module.exports = {
rootDir: path.resolve(__dirname, '../../..'),
roots: ['<rootDir>/x-pack/plugins/apm'],
setupFiles: ['<rootDir>/x-pack/plugins/apm/.storybook/jest_setup.js'],
testPathIgnorePatterns: ['<rootDir>/x-pack/plugins/apm/e2e/'],
coverageDirectory: '<rootDir>/target/kibana-coverage/jest/x-pack/plugins/apm',
coverageReporters: ['text', 'html'],
collectCoverageFrom: [

View file

@ -7,7 +7,6 @@
],
"exclude": [
"**/__fixtures__/**/*",
"./x-pack/plugins/apm/e2e",
"./x-pack/plugins/apm/ftr_e2e"
],
"compilerOptions": {