-
Notifications
You must be signed in to change notification settings - Fork 558
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
35 changed files
with
4,569 additions
and
4,959 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
secret |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,64 +1,30 @@ | ||
# Copyright 2020 Adobe Systems Incorporated | ||
# Copyright 2023 Adobe Systems Incorporated | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
# | ||
# DO NOT MODIFY | ||
# | ||
FROM node:lts-slim | ||
FROM cypress/included:13.5.1 | ||
|
||
ENV APP_PATH /usr/src/app | ||
ENV SELENIUM_STARTUP_TIMEOUT 60 | ||
|
||
# Begin CloudManager Convention >>> | ||
## Environment variables | ||
ENV SELENIUM_BASE_URL http://localhost:4444 | ||
ENV SELENIUM_BROWSER chrome | ||
ENV REPORTS_PATH reports | ||
ENV AEM_AUTHOR_URL http://localhost:4502 | ||
ENV AEM_AUTHOR_USERNAME admin | ||
ENV AEM_AUTHOR_PASSWORD admin | ||
ENV AEM_PUBLISH_URL http://localhost:4503 | ||
ENV AEM_PUBLISH_USERNAME admin | ||
ENV AEM_PUBLISH_PASSWORD admin | ||
# Following convention variables are null by default | ||
# ENV SHARED_FOLDER | ||
# ENV UPLOAD_URL | ||
|
||
## Install dependencies for wait_for_grid script | ||
RUN apt -qqy update \ | ||
# Generic dependencies | ||
&& apt -qqy --no-install-recommends install \ | ||
python \ | ||
build-essential \ | ||
# for wait_for_grid script | ||
&& apt -qqy --no-install-recommends install \ | ||
curl \ | ||
jq | ||
# <<< End CloudManager Convention | ||
build-essential | ||
|
||
# Set Application Environment | ||
WORKDIR ${APP_PATH} | ||
COPY ./test-module ./ | ||
RUN npm install | ||
# no need to wait for selenium | ||
ENTRYPOINT ["bash","run.sh"] | ||
|
||
# Copy + Install WDIO project | ||
ENV TEST_RUN_COMMAND "npm run test-cloud" | ||
COPY test-module/ ./ | ||
RUN npm ci | ||
|
||
# Begin CloudManager Convention >>> | ||
## Copy helper to wait on Selenium readiness | ||
COPY wait-for-grid.sh . | ||
RUN chmod 555 wait-for-grid.sh | ||
|
||
CMD ./wait-for-grid.sh ${TEST_RUN_COMMAND} | ||
# <<< End CloudManager Convention |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,106 +1,80 @@ | ||
|
||
UI Testing module for your AEM application | ||
UI Testing module for WKND.stie | ||
=== | ||
|
||
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). | ||
|
||
## Structure | ||
|
||
* `test-module/` The test project (add your tests there) | ||
|
||
**Do not modify following files** | ||
* `pom.xml` Builds and executes the test Docker image | ||
* `Dockerfile` Builds test Docker image compatible with AEMaaCS | ||
* `wait-for-grid.sh` Bash script helper to check Selenium readiness in the Docker image | ||
* `docker-compose-wdio-*.yaml` Docker compose files to demo the Docker image with Selenium Docker images | ||
* `assembly-ui-test-docker-context.xml` Packages test project for AEMaaCS | ||
|
||
|
||
## Requirements | ||
|
||
* Maven | ||
* Latest version of Chrome and/or Firefox browser installed locally in default location | ||
* An AEM author instance running at http://localhost:4502 | ||
* Sample application deployed on your AEM author instance (see [../README.md](../README.md)) | ||
Note: this set of tests are intended to be used on AEMCS and have only been verified using a Cloud instance | ||
|
||
## Structure | ||
|
||
## Run Tests | ||
- `Dockerfile` commands to assemble the image | ||
- `pom.xml` defines project dependencies and build configuration which will be used by Cloud Manager to build the test module image | ||
- `/test-module` The test project (add your tests there) | ||
|
||
``` | ||
mvn verify -Pui-tests-local-execution | ||
``` | ||
### Dockerfile | ||
|
||
#### Remarks | ||
* After execution, reports and logs are available in `target/reports` folder | ||
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. | ||
|
||
### Parameters | ||
### xvfb setup | ||
|
||
| Parameter | Required | Default| Description | | ||
| --- | --- | --- | --- | | ||
| `AEM_AUTHOR_URL` | false | `http://localhost:4502` | URL of the author instance | | ||
| `AEM_AUTHOR_USERNAME` | false | `admin` | Username used to access the author instance | | ||
| `AEM_AUTHOR_PASSWORD` | false | `admin` | Password used to access the author instance | | ||
| `AEM_PUBLISH_URL` | false | - | URL of the publish instance | | ||
| `AEM_PUBLISH_USERNAME` | false | `admin` | Username used to access the publish instance | | ||
| `AEM_PUBLISH_PASSWORD` | false | `admin` | Password used to access the publish instance | | ||
| `SELENIUM_BROWSER` | false | `chrome` | Browser used in the tests (`chrome` **_or_** `firefox`) | | ||
| `HEADLESS_BROWSER` | false | `false` | Set [headless mode](https://en.wikipedia.org/wiki/Headless_browser) of the browser | | ||
>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. | ||
#### Example | ||
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. | ||
|
||
Run tests on <span style="color:green">local</span> <span style="color:orange">headless</span> <span style="color:purple">firefox</span>, targeting a <span style="color:blue">custom AEM author instance</span>: | ||
## Execute test module | ||
|
||
<PRE> | ||
mvn test \ | ||
<span style="color:green">-Plocal-execution</span> \ | ||
<span style="color:orange">-DHEADLESS_BROWSER=true</span> \ | ||
<span style="color:purple">-DSELENIUM_BROWSER=firefox</span> \ | ||
<span style="color:blue">-DAEM_AUTHOR_URL=http://my-aem-author-instance.com</span> \ | ||
<span style="color:blue">-DAEM_AUTHOR_USERNAME=testuser</span> \ | ||
<span style="color:blue">-DAEM_AUTHOR_PASSWORD=aVVe5om3</span> | ||
</PRE> | ||
### Locally (standalone) | ||
|
||
Refer to [test-module/README.md](test-module/README.md). | ||
|
||
## Docker execution | ||
### Using the test image | ||
|
||
This project also provides Maven profiles to build and execute the tests using Docker | ||
In the Cloud Manager pipeline the test image will be build and executed, this behaviour can also be recreated. | ||
|
||
### Requirements | ||
#### Requirements | ||
|
||
* Maven | ||
* Docker and `docker-compose` | ||
* An AEM author instance running at http://localhost:4502 | ||
|
||
### Build test image | ||
|
||
``` | ||
mvn clean install -Pui-tests-docker-build | ||
``` | ||
|
||
will build Docker image `com.adobe.aem.guides-aem-guides-wknd.ui.tests/ui.tests` locally | ||
|
||
### Run Tests | ||
|
||
**Remarks** | ||
* Following commands will start a Docker service with both the cloud tests and a Selenium server (using official Docker images) | ||
* Parameters described above also apply for Docker use case | ||
|
||
#### Target a local AEM author instance | ||
|
||
Example, your instance is available at http://localhost:4502): | ||
|
||
``` | ||
mvn verify -Pui-tests-docker-execution -DAEM_AUTHOR_URL=http://host.docker.internal:4502 | ||
``` | ||
|
||
> `host.docker.internal` is a Docker convention, do not change it! | ||
#### Target a remote AEM author instance | ||
|
||
Example, you have an [AEM as a Cloud Service](https://docs.adobe.com/content/help/en/experience-manager-cloud-service/overview/introduction.html) deployment with author instance available at https://author.my-deployment.com: | ||
|
||
|
||
``` | ||
mvn verify -Pui-tests-docker-execution -DAEM_AUTHOR_URL=https://author.my-deployment.com | ||
``` | ||
|
||
> **⚠ Default tests provided in this module require sample content (module `ui.content`) to be installed in your AEMaaCS deployment!** | ||
* 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 | ||
the AEM instance defined via environment variables. The test results will be stored in the `./target/reports` directory. | ||
|
||
The following environment variables (AEM UI test convention) can be passed | ||
|
||
| envvar | default | | ||
| --- | --- | | ||
| AEM_AUTHOR_URL | https://author-p***-e***.adobeaemcloud.com | | ||
| AEM_AUTHOR_USERNAME | `admin` | | ||
| AEM_AUTHOR_PASSWORD | `admin` | | ||
| 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) | ||
``` | ||
mvn verify -Pui-tests-docker-execution \ | ||
-DAEM_AUTHOR_URL=${AEM_AUTHOR_URL} \ | ||
-DAEM_AUTHOR_USERNAME=${AEM_AUTHOR_USERNAME} \ | ||
-DAEM_AUTHOR_PASSWORD=${AEM_AUTHOR_PASSWORD} \ | ||
-DAEM_PUBLISH_URL=${AEM_PUBLISH_URL} \ | ||
-DAEM_PUBLISH_USERNAME=${AEM_PUBLISH_USERNAME} \ | ||
-DAEM_PUBLISH_PASSWORD=${AEM_PUBLISH_PASSWORD} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.