-
Notifications
You must be signed in to change notification settings - Fork 419
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CQ-4353443: Add cypress ui tests (#1111)
* two ui test frameworks * parametrize ui framework * remove e2e form tests if flag not set * console error cypress test * remove cypress files in selenium module * update READMEs * update READMEs * change ui.tests to be opt-in again * add WDIO back to archetype IT tests --------- Co-authored-by: Alejandro Ramirez <ramirezc@adobe.com> Co-authored-by: Andrei Dulvac <andrei.dulvac@gmail.com>
- Loading branch information
1 parent
ed65877
commit dd01179
Showing
405 changed files
with
2,608 additions
and
30 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
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,32 @@ | ||
# 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. | ||
|
||
FROM cypress/included:12.12.0 | ||
|
||
ENV APP_PATH /usr/src/app | ||
## Install dependencies | ||
RUN apt -qqy update \ | ||
# Generic dependencies | ||
&& apt -qqy --no-install-recommends install \ | ||
python \ | ||
build-essential | ||
# <<< End EAAS Convention \ | ||
|
||
# Set Application Environment | ||
WORKDIR ${APP_PATH} | ||
COPY ./test-module ./ | ||
RUN npm install | ||
# no need to wait for selenium | ||
ENTRYPOINT ["bash","run.sh"] | ||
|
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,68 @@ | ||
UI Testing module (Cypress) for your AEM application | ||
=== | ||
|
||
Sample structure for [Cypress](https://www.cypress.io) UI test module which conforms to | ||
AEM Cloud Manager quality gate UI test conventions. | ||
|
||
## Cloud Manager UI test module conventions | ||
|
||
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. | ||
|
||
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. | ||
|
||
## Structure | ||
|
||
- `/test-module` The test project (add your tests there) | ||
|
||
**Do not modify following files** | ||
- `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 | ||
- `assembly-ui-test-docker-context.xml` Packages test project for AEMaaCS | ||
|
||
### 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. | ||
|
||
### 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 DISPLAY variable. | ||
The setup described in [the documentation](https://docs.cypress.io/guides/continuous-integration/introduction#In-Docker) | ||
is implemented in `run.sh` as is used as entrypoint to the container. | ||
|
||
## Run Tests | ||
|
||
### Locally (standalone) | ||
|
||
Refer to [test-module/README.md](test-module/README.md). | ||
|
||
### Build and run 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 | http://localhost:4502 | | ||
| AEM_AUTHOR_USERNAME | `admin` | | ||
| AEM_AUTHOR_PASSWORD | `admin` | | ||
| AEM_PUBLISH_URL | http://localhost:4503 | | ||
| 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 | ||
``` | ||
mvn verify -Pui-tests-docker-execution -DAEM_AUTHOR_URL=https://author.my-deployment.com -DAEM_AUTHOR_USERNAME=<PASS> -DAEM_AUTHOR_PASSWORD=<PASS> | ||
``` |
43 changes: 43 additions & 0 deletions
43
src/main/archetype/ui.tests.cypress/assembly-ui-test-docker-context.xml
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,43 @@ | ||
<assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd"> | ||
<!-- | ||
| 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 | ||
--> | ||
<id>ui-test-docker-context</id> | ||
<includeBaseDirectory>false</includeBaseDirectory> | ||
<formats> | ||
<format>tar.gz</format> | ||
</formats> | ||
<fileSets> | ||
<fileSet> | ||
<directory>${basedir}</directory> | ||
<includes> | ||
<include>Dockerfile</include> | ||
</includes> | ||
</fileSet> | ||
<fileSet> | ||
<directory>${basedir}/test-module</directory> | ||
<excludes> | ||
<exclude>node_modules/**</exclude> | ||
<exclude>target/**</exclude> | ||
</excludes> | ||
</fileSet> | ||
</fileSets> | ||
</assembly> |
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,189 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
| 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 | ||
--> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<groupId>com.adobe.cq.cloud</groupId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
<artifactId>com.adobe.cq.cloud.testing.ui.cypress.tests</artifactId> | ||
<name>com.adobe.cq.cloud.testing.ui.cypress - UI Tests</name> | ||
<description></description> | ||
|
||
<properties> | ||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> | ||
|
||
<REPORTS_PATH>${project.basedir}/target/reports</REPORTS_PATH> | ||
|
||
<!-- AEMaaCS UI testing convention properties --> | ||
<AEM_AUTHOR_URL>http://localhost:4502</AEM_AUTHOR_URL> | ||
<AEM_AUTHOR_USERNAME>admin</AEM_AUTHOR_USERNAME> | ||
<AEM_AUTHOR_PASSWORD>admin</AEM_AUTHOR_PASSWORD> | ||
<AEM_PUBLISH_URL /> | ||
<AEM_PUBLISH_USERNAME>admin</AEM_PUBLISH_USERNAME> | ||
<AEM_PUBLISH_PASSWORD>admin</AEM_PUBLISH_PASSWORD> | ||
</properties> | ||
|
||
<build> | ||
<pluginManagement> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-clean-plugin</artifactId> | ||
<version>3.1.0</version> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-resources-plugin</artifactId> | ||
<version>3.0.2</version> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-jar-plugin</artifactId> | ||
<version>3.2.0</version> | ||
</plugin> | ||
</plugins> | ||
</pluginManagement> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-jar-plugin</artifactId> | ||
<executions> | ||
<execution> | ||
<id>default-jar</id> | ||
<phase>none</phase> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
<plugin> | ||
<groupId>org.apache.maven.plugins</groupId> | ||
<artifactId>maven-assembly-plugin</artifactId> | ||
<configuration> | ||
<descriptors> | ||
<descriptor>assembly-ui-test-docker-context.xml</descriptor> | ||
</descriptors> | ||
</configuration> | ||
<executions> | ||
<execution> | ||
<id>make-assembly</id> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>single</goal> | ||
</goals> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
|
||
<profiles> | ||
<profile> | ||
<id>ui-tests-docker-build</id> | ||
<activation> | ||
<activeByDefault>false</activeByDefault> | ||
</activation> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>exec-maven-plugin</artifactId> | ||
<version>1.6.0</version> | ||
<executions> | ||
<execution> | ||
<id>docker-build</id> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>exec</goal> | ||
</goals> | ||
<configuration> | ||
<executable>docker</executable> | ||
<workingDirectory>.</workingDirectory> | ||
<arguments> | ||
<argument>build</argument> | ||
<argument>-t</argument> | ||
<argument>${project.groupId}-${project.artifactId}/ui.tests:${project.version}</argument> | ||
<argument>.</argument> | ||
</arguments> | ||
</configuration> | ||
</execution> | ||
<execution> | ||
<id>docker-tag</id> | ||
<phase>package</phase> | ||
<goals> | ||
<goal>exec</goal> | ||
</goals> | ||
<configuration> | ||
<executable>docker</executable> | ||
<workingDirectory>.</workingDirectory> | ||
<arguments> | ||
<argument>tag</argument> | ||
<argument>${project.groupId}-${project.artifactId}/ui.tests:${project.version}</argument> | ||
<argument>${project.groupId}-${project.artifactId}/ui.tests:latest</argument> | ||
</arguments> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</profile> | ||
|
||
<profile> | ||
<id>ui-tests-docker-execution</id> | ||
<activation> | ||
<activeByDefault>false</activeByDefault> | ||
</activation> | ||
<build> | ||
<plugins> | ||
<plugin> | ||
<groupId>org.codehaus.mojo</groupId> | ||
<artifactId>exec-maven-plugin</artifactId> | ||
<version>1.6.0</version> | ||
<executions> | ||
<execution> | ||
<id>docker-run</id> | ||
<phase>test</phase> | ||
<goals> | ||
<goal>exec</goal> | ||
</goals> | ||
<configuration> | ||
<executable>docker</executable> | ||
<workingDirectory>.</workingDirectory> | ||
<arguments> | ||
<argument>run</argument> | ||
<argument>-eAEM_AUTHOR_URL=${AEM_AUTHOR_URL}</argument> | ||
<argument>-eAEM_AUTHOR_USERNAME=${AEM_AUTHOR_USERNAME}</argument> | ||
<argument>-eAEM_AUTHOR_PASSWORD=${AEM_AUTHOR_PASSWORD}</argument> | ||
<argument>-eAEM_PUBLISH_URL=${AEM_PUBLISH_URL}</argument> | ||
<argument>-eAEM_PUBLISH_USERNAME=${AEM_PUBLISH_USERNAME}</argument> | ||
<argument>-eAEM_PUBLISH_PASSWORD=${AEM_PUBLISH_PASSWORD}</argument> | ||
<argument>-eREPORTS_PATH=/tmp/reports</argument> | ||
<argument>-v${REPORTS_PATH}:/tmp/reports</argument> | ||
<argument>${project.groupId}-${project.artifactId}/ui.tests:latest</argument> | ||
</arguments> | ||
</configuration> | ||
</execution> | ||
</executions> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</profile> | ||
</profiles> | ||
|
||
</project> |
Oops, something went wrong.