You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[MWES-3564] Further updates to e2e testing infrastructure
Final changes to e2e testing infrastructure to put us in a better place to capture everything as a Jenkins pipeline script.
Additionally I have updated the project documentation to help people run the tests and now only mention the Docker supported development experience.
Copy file name to clipboardExpand all lines: _tests/e2e/README.md
+23-25Lines changed: 23 additions & 25 deletions
Original file line number
Diff line number
Diff line change
@@ -1,15 +1,18 @@
1
-
RHDP Site End-to-end Testing
1
+
developers.redhat.com End-to-End (e2e) Testing
2
2
=============================
3
3
4
4
### Summary
5
5
6
-
This directory contains the UI Tests for the developers.redhat.com website, these tests are written in nodejs using [mocha](https://mochajs.org/) test framework and [webdriverio](http://webdriver.io/) as a driver to mimic real user interactions.
6
+
This directory contains the end-to-end tests for the developers.redhat.com website. These tests are written in NodeJS using [mocha](https://mochajs.org/) test framework and [webdriver.io](http://webdriver.io/) as a driver to mimic real user interactions.
7
7
8
-
## What types of tests we execute in our local/PR environment?
8
+
These tests are executed each time a pull request is raised on the developers.redhat.com Git repository. Branch protection rules mean that it is not possible to merge your pull request until the tests are passing, so if you are making changes to the site,
9
+
you should not neglect these tests.
9
10
10
-
* js-e2e-tests
11
-
* js-mobile-e2e-tests
12
-
* js-drupal-e2e-tests
11
+
The tests are split into three major sections:
12
+
13
+
* Key site functionality
14
+
* Key site functionality on a mobile device
15
+
* Key Drupal functionality
13
16
14
17
## What is e2e testing?
15
18
@@ -20,22 +23,18 @@ We try to minimise the number of e2e tests that we have, as by nature these are
* RHEL advanced linux cheatsheet (Download Manager, Keycloak login)
27
30
* Keycloak pages (site navigation bar navigates users to login/register pages)
28
31
* Home and Blog pages contain unique string for site monitoring.
29
32
* 404 pages
30
33
31
-
## What do we test on drupal site?
32
-
* Admin succesful login
34
+
## What do we test for key Drupal functionality?
35
+
* Admin can succesfully login after changes have been applied
33
36
* All configuration changes are successfully imported after `drush cim` has been executed
34
37
35
-
## Testing of pull-requests
36
-
The pull request pipeline consists of desktop and mobile end-to-end tests. The desktop tests execute in a chrome browser, and the mobile tests use a mobile enulated browser (currently iPhone X). Additionally the desktop tests perform some
37
-
sanity checks around Drupal configuration status to make sure that any changes to our Drupal configuration in your pull request are applied cleanly.
38
-
39
38
## Retry strategy
40
39
As we're not mocking and using live services, test sometimes fail. In an attempt to combat this we decided to add retry logic to tests.
41
40
@@ -53,6 +52,9 @@ describe('my flaky test', function () {
53
52
```
54
53
55
54
## Test failure(s) - what should I do?
55
+
56
+
You should investigate the failure.
57
+
56
58
A lot of time has been spent on focusing on flaky tests, unfortunately failures do occur which could be related to one or more issues. For example it could be your changes to the UI (css selectors/new functionality), environmental issues (kc, download-manager, dcp), or our build machine has issues (out of memory). Testing downloads as a real user would is also difficult, and has proved to be flaky. Despite adding retry functionality false positives do occur. If in doubt, discuss it with the rest of the team.
57
59
58
60
Fundamentally: **pull requests should not be merged if the tests are failing** and the branch protection rules on GitHub will prevent you from doing this.
@@ -69,7 +71,7 @@ You need to ensure you have the following installed locally:
69
71
70
72
### Running the tests
71
73
72
-
You can, and **should** test your changes locally before raising a PR. Please ensure you have a local build running and `https://localhost` is accessible in a browser.
74
+
You can, and **should** test your changes locally before raising a PR. Please ensure you have Drupal running and `https://localhost` is accessible in your browser.
73
75
74
76
Next you need to ensure that you have the following environment variables set:
75
77
@@ -84,7 +86,8 @@ So as an example, you will need to run the following commands on your terminal b
84
86
export RHD_KEYCLOAK_ADMIN_USERNAME=rblake
85
87
```
86
88
87
-
Please note that currently the tests use the legacy Drupal log in mechanism and as such the Drupal user password should match what is in the database for Drupal.
89
+
Please note that currently the tests use the legacy Drupal log in mechanism and as such the Drupal user password should match what is in the database for Drupal. All Drupal passwords are sanitized in the local development environment,
90
+
so ask the rest of the development team for the sanitized password.
88
91
89
92
Once you have set the required environment variables, in the root of the project directory execute the following command:
90
93
@@ -98,6 +101,8 @@ You can alternatively run the individual components of the test suite using the
98
101
*`npm run e2e:local-desktop` - Runs only the Desktop tests
99
102
*`npm run e2e:local-mobile` - Runs only the mobile tests
100
103
104
+
**Note:** The Download tests are currently excluded from local runs due to https://issues.jboss.org/browse/DEVELOPER-5938
105
+
101
106
102
107
## Run Single feature, or test
103
108
Add a unique tag to the test(s) `it.` description, for example to execute the following scenario:
@@ -122,20 +127,13 @@ Add a unique tag to the test(s) `it.` description, for example to execute the fo
122
127
});
123
128
```
124
129
125
-
Would be: **`npm run e2e:local -- --mochaOpts.grep=@wip`**
130
+
You can then run this single test with: **`npm run e2e:local -- --mochaOpts.grep=@wip`**
126
131
127
132
## Override the default (local) url:
128
133
129
-
The default baseUrl when running tests locally is set to `http://docker:8888`. To override this, you can execute:
134
+
The default baseUrl when running tests locally is set to `https://localhost`. To override this, you can execute:
130
135
131
-
npm run e2e -- --base-url=https://developers.redhat.com --mochaOpts.grep=@wip
132
-
133
-
## Run tests inside docker using docker-selenium (build scripts - same as Jenkins)
134
-
135
-
The below command will execute both the desktop and mobile full-suite of tests (*at the time of writing this takes around 4 minutes in total*).
136
-
137
-
In the root of the project directory execute the following command:
138
-
136
+
npm run e2e:local -- --base-url=https://developers.redhat.com
0 commit comments