Sample framework for automating mobile applications using Appium. Solution contains core framework and test projects and is built on dotnet core.
- Dotnet Core 3.1
- Appium 4.0
- DotNetSeleniumExtras.WaitHelpers 3.11
- NUnit 3.12
These are the latest framework/tooling supported in dotnet core.
- Android device
- Appium Server
- Selenium Grid
- dotnet build
- dotnet test
- Checkout the Integration tests in the tests project. WebTests folder contains tests for mobile browsers. All setting provided in the "fixture setup" can be replaced with an equivalent run settings parameter value.
Useful when connecting multiple devices without usb cable
- adb tcpip
- adb connect
Sample Usage:
adb tcpip 5555
adb connect 192.168.1.46
Launch the app on the device and then fire up the following commands in powershell
- adb shell
- dumpsys window windows | grep -E 'mCurrentFocus'
Sample Usage:
PS C:\Source\MobileAutomation> adb shell
$ dumpsys window windows | grep -E 'mCurrentFocus'
mCurrentFocus=Window{<Application>/<blah-blah>.MainActivity}
Start appium desktop (server) and open inspect tool. Provide the following desired capabilities and start the session.
{
"deviceName": "android",
"platformName": "android",
"udid": "<deviceId>",
"deviceId": "<deviceId>"
}
udid and deviceId can be the same. Run adb devices to get the device Id.
Connect the device. For web app, Navigate to url in chrome (on the device). For hybrid app launch and navigate to appriate page of the app. Now on the desktop open chrome and type in the following:
chrome://inspect/#devices
This will list all the web page /web views open on the connected devices. Select appropriate option from the ones provided for your device and click Inspect.
Be aware of systemPort race conditions, eventhough selectFreePort is selected. This must be specified explicitly to avaid them stepping over each other's foot.
Ensure that you add the DeviceGroup capability in your node config and test files. The capability at a minimum requires platformName(ios/android) and device type (phone/tablet) entries there. These are mandatory and help in running tests against specific devices on the grid and are closely tagged within the framework. Check out integration tests in the tests project for its correct usage.