Skip to content

Commit

Permalink
Update Readme
Browse files Browse the repository at this point in the history
  • Loading branch information
andresbott committed Dec 14, 2023
1 parent cc3b1c1 commit 4bfb8d9
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 40 deletions.
62 changes: 27 additions & 35 deletions ui.tests/README.md
Original file line number Diff line number Diff line change
@@ -1,20 +1,11 @@
# Cypress sample module

Sample structure for [Cypress](https://www.cypress.io) UI test module which conforms to
AEM Cloud Manager quality gate UI test conventions.
UI Testing module for WKND.stie
===

## Cloud Manager UI test module conventions
This folder contains a set of sample cypress UI tests that following good practices for AEMCS based on the tests
provided in the [archetype](https://github.com/adobe/aem-project-archetype/tree/develop/src/main/archetype/ui.tests.cypress).

AEM provides an integrated suite of Cloud Manager quality gates to ensure smooth updates to custom applications;
UI tests are executed as part of a specific quality gate for each Cloud Manager pipeline with a dedicated Custom UI Testing step.

Within the project structure there is a [specific location](https://github.com/adobe/aem-project-archetype/tree/develop/src/main/archetype/ui.tests)
where the code Custom UI Tests are expected. The code in this folder is used as a Docker build context to produce a docker image
which will be executed during the Custom UI Testing step in the pipeline.

The Cloud Manager UI test module convention defines the expected structure of the test module as well as the environment
variables which will be passed at runtime. This is explained in detail in the [Building UI Tests](https://experienceleague.adobe.com/docs/experience-manager-cloud-service/content/implementing/using-cloud-manager/test-results/functional-testing/ui-testing.html?lang=en#building-ui-tests)
section of the documentation.
Note: this set of tests are intended to be used on AEMCS and have only been verified using a Cloud instance

## Structure

Expand All @@ -24,12 +15,14 @@ section of the documentation.

### Dockerfile

Sample dockerfile is based on the `cypress/included` [image](https://hub.docker.com/r/cypress/included), which provides all the dependencies and the binaries
to run cypress tests.
Sample dockerfile is based on the `cypress/included` [image](https://hub.docker.com/r/cypress/included), which
provides all the dependencies and the binaries to run cypress tests.

### xvfb setup

>When running several Cypress instances in parallel, the spawning of multiple X11 servers at once can cause problems for some of them. In this case, you can separately start a single X11 server and pass the server's address to each Cypress instance using the DISPLAY environment variable.
>When running several Cypress instances in parallel, the spawning of multiple X11 servers at once can cause
> problems for some of them. In this case, you can separately start a single X11 server and pass the server's
> address to each Cypress instance using the DISPLAY environment variable.
The setup described in [the documentation](https://docs.cypress.io/guides/continuous-integration/introduction#In-Docker)
is implemented in `run.sh`, used as the _entrypoint_ to the container.
Expand All @@ -40,7 +33,18 @@ is implemented in `run.sh`, used as the _entrypoint_ to the container.

Refer to [test-module/README.md](test-module/README.md).

### Build and run the test image
### Using the test image

In the Cloud Manager pipeline the test image will be build and executed, this behaviour can also be recreated.

#### Requirements

* Maven
* Docker
* Latest version of Chrome installed locally in default location
* Sample application deployed on your AEMCS environment (Author + Publish)

#### Build and run the test image

The image built from the Dockerfile can be used to execute tests locally against an AEM environment. The `ui-tests-docker-execution`
maven profile will start the docker-compose setup starting Cypress and the test module, executing the tests against
Expand All @@ -50,19 +54,21 @@ The following environment variables (AEM UI test convention) can be passed

| envvar | default |
| --- | --- |
| AEM_AUTHOR_URL | http://localhost:4502 |
| AEM_AUTHOR_URL | https://author-p***-e***.adobeaemcloud.com |
| AEM_AUTHOR_USERNAME | `admin` |
| AEM_AUTHOR_PASSWORD | `admin` |
| AEM_PUBLISH_URL | http://localhost:4503 |
| AEM_PUBLISH_URL | https://publish-p***-e***.adobeaemcloud.com|
| AEM_PUBLISH_USERNAME | `admin` |
| AEM_PUBLISH_PASSWORD | `admin` |
| REPORTS_PATH | `cypress/results` |


1. Build the Docker UI test image with below command
```
mvn clean package -Pui-tests-docker-build
```
2. Run the test (set environment variables accordingly)

2. Run the test (set environment variables accordingly)
```
mvn verify -Pui-tests-docker-execution \
-DAEM_AUTHOR_URL=${AEM_AUTHOR_URL} \
Expand All @@ -72,17 +78,3 @@ The following environment variables (AEM UI test convention) can be passed
-DAEM_PUBLISH_USERNAME=${AEM_PUBLISH_USERNAME} \
-DAEM_PUBLISH_PASSWORD=${AEM_PUBLISH_PASSWORD}
```

## Integrate into your Cloud Manager repository

Follow these steps to use the Cypress tests:

1. Remove all content in the `ui.tests` folder from your Cloud Manager repository.

1. Copy all files located in this folder into the `ui.tests` folder.

1. (Optionally) adjust the file `pom.xml` and set parent as well as artifact information to the desired naming.

1. Commit and push the changes.

During the next pipeline execution, Cloud Manager will use the Cypress tests.
6 changes: 1 addition & 5 deletions ui.tests/test-module/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
This module documents the recommended structure for a Cypress test module and adheres to the Cloud Manager UI test module conventions,
ensuring that tests will be executed and reports generated are stored in the proper location.

Some examples of basic tasks like logging in-out of AEM instances, taking screenshots, logging browser requests are included.


## Usage

### local testing
Expand All @@ -30,7 +27,6 @@ Some examples of basic tasks like logging in-out of AEM instances, taking screen
```shell
npm test # Using default Cypress browser
npm run test-chrome # Using Google Chrome browser
npm run test-firefox # Using Firefox browser
```

- For debugging tests, you may run Cypress with the browser visible and Cypress console
Expand All @@ -43,7 +39,7 @@ Some examples of basic tasks like logging in-out of AEM instances, taking screen
In order to be able to interpret the results of the tests correctly, a summary in JUnit format needs to be
provided. To achieve this, both the `spec` and `mocha-junit-reporter` reporter are configured:

```javascript
```
reporter: 'cypress-multi-reporters',
reporterOptions: {
configFile: 'reporter.config.js',
Expand Down

0 comments on commit 4bfb8d9

Please sign in to comment.