Skip to content

aem-design/geb-aem-testing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GEB AEM Testing - AEM Parent Project

This is a parent project for GEB AEM Testing.

Starting Testing Stack

To start the testing stack run followgin command:

docker-compose up

Running Tests using Docker Compose

To run tests, run following command in gebaemtesting-testing directory:

./test-spec

Running Tests using Local Maven

To run tests, run following command in gebaemtesting-testing directory:

./test-spec -TEST_USING_MAVEN

Additional Usage

Using Powershell 7 execute selected tests run following command:

.\test-spec.ps1 -TEST_SPECS TextA*

On Linux you can do following command:

./test-spec --tests TextA*

Above commands will only execute TextAuthorSpec.

Update test-list with test you want to run without specifying parameters, this should be a complete list of test you want to run.

.\test-spec.ps1 

To only test specific viewports specify TEST_VIEWPORTS param

.\test-spec -TEST_VIEWPORTS "XLG,SM"

This will test only XLG and SM view ports

Development Setup

All of this software is going to make your life awesome!

Before you start make sure you have the following software setup:

  • Update to Windows 10 20H2 - this will give your windows updates to run WSL2 and install needed applications. You will need to update your windows machine to at least version 20H2 preferred, use Windows Update and click "Check for updates Available at Microsoft"

You will need to have the following software installed to ensure you can contribute to development of this codebase:

You can now prepare your AEM and project for testing

Update your Docker memory usage

Create a file called .wslconfig in your home directory with following content, update as needed:

[wsl2]
memory=32GB

Run AEM in Docker

Back to Prerequisites

To start a fresh copy of AEM running in Docker Container run following in project root:

docker-compose up

Add your normal user to Docker Users Group

Back to Prerequisites

Run the following command in an elevated powershell prompt:

Add-LocalGroupMember -Group "docker-users" -Member "<YOUR USER NAME>"

Enable Windows 10 Long File Names

Back to Prerequisites

To check if your registry entry value for long filenames support:

reg query HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\FileSystem /v LongPathsEnabled

To enable Windows 10 long filename run following command in elevated powershell and restart your computer:

reg add HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\FileSystem /v LongPathsEnabled /t REG_DWORD /d 0x1 /f 

To enable git to use long filename run following command in elevated powershell and restart your computer:

git config --global core.longpaths true

Add Git Path Windows Path

Back to Prerequisites

You need to add following paths to your System Path environment variable:

  • C:\Program Files\Git\bin - this contains main git
  • C:\Program Files\Git\usr\bin - this contains helpers that are available on linux

Report Output

Test execution will generate sub-directory in the project with test run results. This is done so that you can run multiple test cycles at the same time with different parameters.

  • remote-seleniumhub-chrome - will be named as per driver name passed as parameter TEST_DRIVER_NAME
    • generated-docs - as the Ascii docs output of the final report
    • spock-reports - has the json and Markdown generated results after execution
    • surefire-reports - has the content for report run output
    • test-classes - has the compiled tests
    • test-reports - has the outputs of the component execution HTML and images

Base screenshots

When executing Screenshot test they will be saved in src/test/screenshots first time the spec is ran. You can commit these files to git, and they will be used as a reference source for next run.

Reference Documentation

AEM Authoring Guides

GEB Info

Maven Reports

ASCII Doc Reports

Adding screenshots to Test Steps is done by detecting a text string in code block and then adding picking a screenshot to show. Update the following line in spect-template.ad:

    def codeCheckFileGen = /[\t ]*report|designRef|takeScreenshot.*/

For multi-screenshot print check following block to ensure columns are printed.

    if (filePathFull.endsWith(pathCheckEndImage)) {
        if (filePathFull.startsWith(pathCheckStartSource)) {
            blockScreenshots = blockScreenshots << """ .Source\n"""
        } else if (filePathFull.endsWith(pathCheckEndDiff)) {
            blockScreenshots = blockScreenshots << """ a| .Diff\n"""
        } else if (!filePathFull.startsWith(pathCheckStartSpec)) {
            if (it.files.size() > 1) {
                blockScreenshots = blockScreenshots << """ a| """
            }
            blockScreenshots = blockScreenshots << """ .Current\n"""
        }

If HTML report are not showing expected result check base templates in spock-reports/.ad these are converted to html.

Driver Specific Parameters

BrowserStack Variables

You can pass following variable via command line to specify browserstack parameters.

For more information please see following reference site https://www.browserstack.com/automate/capabilities

Internal Name Command Line Param Browserstack Variable
GEB_BROWSERSTACK_USERNAME geb.browserstack.username
GEB_BROWSERSTACK_AUTHKEY geb.browserstack.authkey
GEB_BROWSERSTACK_SCHEMA geb.browserstack.schema
GEB_BROWSERSTACK_HOST geb.browserstack.host
GEB_BROWSERSTACK_URL "SCHEMA://USERNAME:AUTHKEY@HOST"
GEB_BROWSERSTACK_BROWSER geb.browserstack.browser browser
GEB_BROWSERSTACK_BROSWER_VERSION geb.browserstack.browserversion browser_version
GEB_BROWSERSTACK_BUILD geb.browserstack.build build
GEB_BROWSERSTACK_OS geb.browserstack.os os
GEB_BROWSERSTACK_OS_VERSION geb.browserstack.osversion os_version
GEB_BROWSERSTACK_DEBUG geb.browserstack.debug browserstack.debug
GEB_BROWSERSTACK_DEVICE geb.browserstack.device device
GEB_BROWSERSTACK_REALMOBILE geb.browserstack.device realMobile
GEB_BROWSERSTACK_RESOLUTION geb.browserstack.resolution resolution
GEB_BROWSERSTACK_LOCAL geb.browserstack.local browserstack.local
GEB_BROWSERSTACK_LOCALID geb.browserstack.localIdentifier browserstack.localIdentifier
GEB_BROWSERSTACK_PROJECT geb.browserstack.project project
GEB_BROWSERSTACK_ACCESPTSSL geb.browserstack.acceptSslCerts acceptSslCerts
GEB_BROWSERSTACK_PLATFORM geb.browserstack.platform platform
GEB_BROWSERSTACK_SELENIUMVERSION geb.browserstack.selenium_version selenium_version
GEB_BROWSERSTACK_NAME geb.browserstack.name name
GEB_BROWSERSTACK_CONSOLE geb.browserstack.console browserstack.console
GEB_BROWSERSTACK_VIDEO geb.browserstack.video browserstack.video
GEB_BROWSERSTACK_NETWORKLOGS geb.browserstack.networkLogs browserstack.networkLogs
GEB_BROWSERSTACK_TIMEZONE geb.browserstack.timezone browserstack.timezone
GEB_BROWSERSTACK_GEOLOCATION geb.browserstack.geoLocation browserstack.geoLocation
GEB_BROWSERSTACK_NETWORKSPEED geb.browserstack.customNetwork browserstack.customNetwork
GEB_BROWSERSTACK_DEVICEORIENTATION geb.browserstack.deviceOrientation deviceOrientation