Environment Setup
More complex testing scenarios may require running multiple types of browsers on multiple types of operating systems and running multiple types of mobile emulators or even real devices.
Assuming Windows 10 with Chocolatey installed.
Self-Signed Certificates
Some services may require special root CA installed. While
on $JAVA_HOME/jre/lib/security
run:
keytool -keystore cacerts -import -alias root_ca.pem
The default password is changeit
.
Selenium
Selenium Grid 4 is required.
See https://www.selenium.dev/documentation/grid/getting_started/
After downloading the apropriate JAR, starting a standalone grid is done via:
java -jar selenium-server-<version>.jar standalone --selenium-manager true
The grid's UI should be available at http://localhost:4444/ui/
Assuming Google Chrome and/or Mozilla Firefox are installed, these will become available for automation via the grid.
Appium
Appium 2 is required.
See https://appium.io/docs/en/2.5/quickstart/install/
choco install -y nodejs
– and restart the console to refresh the env varsnpm --proxy http(s)://<host>:<port> install -g appium
npm --proxy http(s)://<host>:<port> update -g appium
appium
- configuration files will be scanned from working dir upwards
Mobile Testing
Android Emulator
see Known Issues
see also https://gist.github.com/mrk-han/66ac1a724456cadf1c93f4218c6060ae
choco install -y jdk8
– is required for currentandroid-sdk
choco install -y android-sdk
cd %ANDROID_HOME%
.\tools\bin\sdkmanager --no_https --proxy=http --proxy_host=<host> --proxy_port=<port> --install "platform-tools"
.\tools\bin\sdkmanager --no_https --proxy=http --proxy_host=<host> --proxy_port=<port> --install "system-images;android-30;google_apis_playstore;x86_64"
.\tools\bin\avdmanager create avd --name "google_apis_playstore" --package "system-images;android-30;google_apis_playstore;x86_64"
.\tools\emulator @google_apis_playstore
.\platform-tools\adb.exe devices
– should list your devices either real or emulated
Check Android setup by running adb devices
– it should list your device
either real or emulated.
iOS Simulator
Install XCode to get the iOS Simulator.
For hybrid applications, check DOM Inspector connects to application via chrome://inspect/#devices
Windows Applications Testing
Since Selenium 4 it is no longer possible to access WinAppDriver directly, and Appium 2 is required to act as a bridge in between.
- Enable Windows Developer Mode
appium driver install --source=npm appium-windows-driver
appium
- start/restart; should listwindows@2.12.21 (automationName ' Windows')
The endpoint should be available at http://127.0.0.1:4723.
- optional: install Appium Inspector – https://appium.github.io/appium-inspector/latest/quickstart/installation/
- optional: check the setup by starting a session using a profile like this:
{
"appium:automationName": "windows",
"appium:platformName": "windows",
"appium:app": "Microsoft.WindowsCalculator_8wekyb3d8bbwe!App"
}
mvn verify -Ptesting-windows
should lauch the Calculator test.
If remote file access is required, then OpenSSH, or similar, is required:
Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0
Running GUI Tests on a Remote Windows Machine
For running Android Emulators, Web-Browsers, or Windows applications on remote machines there must be an open desktop session:
choco install -y autologon
autologon %USERNAME% $USERDOMAIN% <user-password>
Next: Adding Tests