-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate existing Cypress tests to Cypress + Cucumber #57299
Changes from 36 commits
3546da9
2151efe
da613e6
29448f8
da484fd
ea1ce45
3fac1c9
a8fc985
51451a7
7ecc7f5
ccafe6e
8ac1821
aa13841
3ce17ca
df48f2d
cb50654
d1b3cf3
5e573fb
a640d1d
c6e6621
ac0252b
29033aa
47b1d90
3677779
d73b62c
66e1656
8bbe470
a729cde
33be793
18ec45d
0885d46
fa992d0
35f1795
c6f6b9d
01f82a5
cac807a
067a7a2
3d48f52
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
cypress/ingest-data/events.json | ||
cypress/screenshots/* | ||
|
||
cypress/test-results |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
# End-To-End (e2e) Test for APM UI | ||
|
||
## Ingest static data into Elasticsearch via APM Server | ||
|
||
1. Start Elasticsearch and APM Server, using [apm-integration-testing](https://github.com/elastic/apm-integration-testing): | ||
|
||
```shell | ||
$ git clone https://github.com/elastic/apm-integration-testing.git | ||
$ cd apm-integration-testing | ||
./scripts/compose.py start master --no-kibana --no-xpack-secure | ||
``` | ||
|
||
2. Download [static data file](https://storage.googleapis.com/apm-ui-e2e-static-data/events.json) | ||
|
||
```shell | ||
$ cd x-pack/legacy/plugins/apm/e2e/cypress/ingest-data | ||
$ curl https://storage.googleapis.com/apm-ui-e2e-static-data/events.json --output events.json | ||
``` | ||
|
||
3. Post to APM Server | ||
|
||
```shell | ||
$ cd x-pack/legacy/plugins/apm/e2e/cypress/ingest-data | ||
$ node replay.js --server-url http://localhost:8200 --secret-token abcd --events ./events.json | ||
``` | ||
>This process will take a few minutes to ingest all data | ||
|
||
4. Start Kibana | ||
|
||
```shell | ||
$ yarn kbn bootstrap | ||
$ yarn start --no-base-path --csp.strict=false | ||
``` | ||
|
||
> Content Security Policy (CSP) Settings: Your Kibana instance must have the `csp.strict: false`. | ||
|
||
## How to run the tests | ||
|
||
_Note: Run the following commands from `kibana/x-pack/legacy/plugins/apm/e2e/cypress`._ | ||
|
||
### Interactive mode | ||
|
||
``` | ||
yarn cypress open | ||
``` | ||
|
||
### Headless mode | ||
|
||
``` | ||
yarn cypress run | ||
``` | ||
|
||
## Reproducing CI builds | ||
|
||
>This process is very slow compared to the local development described above. Consider that the CI must install and configure the build tools and create a Docker image for the project to run tests in a consistent manner. | ||
|
||
The Jenkins CI uses a shell script to prepare Kibana: | ||
|
||
```shell | ||
# Prepare and run Kibana locally | ||
$ x-pack/legacy/plugins/apm/e2e/ci/prepare-kibana.sh | ||
# Build Docker image for Kibana | ||
$ docker build --tag cypress --build-arg NODE_VERSION=$(cat .node-version) x-pack/legacy/plugins/apm/e2e/ci | ||
# Run Docker image | ||
$ docker run --rm -t --user "$(id -u):$(id -g)" \ | ||
-v `pwd`:/app --network="host" \ | ||
--name cypress cypress | ||
Comment on lines
+60
to
+67
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
``` |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
FROM node:12 | ||
ARG NODE_VERSION | ||
FROM node:$NODE_VERSION | ||
|
||
RUN apt-get -qq update \ | ||
&& apt-get -y -qq install xvfb \ | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"baseUrl": "http://localhost:5601", | ||
"video": false, | ||
"trashAssetsBeforeRuns": false, | ||
"fileServerFolder": "../", | ||
"fixturesFolder": "./cypress/fixtures", | ||
"integrationFolder": "./cypress/integration", | ||
"pluginsFile": "./cypress/plugins/index.js", | ||
"screenshotsFolder": "./cypress/screenshots", | ||
"supportFile": "./cypress/support/index.ts", | ||
"videosFolder": "./cypress/videos", | ||
"useRelativeSnapshots": true, | ||
"reporter": "junit", | ||
"reporterOptions": { | ||
"mochaFile": "./cypress/test-results/[hash]-e2e-tests.xml", | ||
"toConsole": false | ||
}, | ||
"testFiles": "**/*.{feature,features}" | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
Feature: APM | ||
|
||
Background: | ||
Given a user browses the APM UI application | ||
When the user inspects the opbeans-go service | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @MadameSheema how do you see having a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi!! Sorry for my late reply, I was a little bit busy. I don't like to use Backgrounds at all. This is because if you have a big file in a feature you can skip it when reading it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A part from what I said in the previous comment. If you only have one scenario, it does not make sense to have a background at all :) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was preparing for future updates... but I agree with you :) I'll send a commit moving the background step to the scenario. Thanks!!! |
||
|
||
Scenario: Transaction duration charts | ||
Then should redirect to correct path with correct params | ||
And should have correct y-axis ticks |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here we capture project's Node version from root directory