Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[uitests] Work for get appium uitests with CI #14488

Merged
merged 161 commits into from
May 16, 2023
Merged

[uitests] Work for get appium uitests with CI #14488

merged 161 commits into from
May 16, 2023

Conversation

rmarinho
Copy link
Member

@rmarinho rmarinho commented Apr 10, 2023

Description of Change

Initial work to write UITests using Appium as backend. This would run against all platforms iOS, Android, Catalyst and Windows.

CI pipeline here: https://devdiv.visualstudio.com/DevDiv/_build?definitionId=17939&_a=summary

Requisites:

Running from the command line (you can replace ./build.ps1 by dotnet cake)

./build.ps1 --target=dotnet-buildtasks --configuration="Release" --workloads=global

Android

./build.ps1 --target=dotnet-samples --configuration="Release" --workloads=global --android --usenuget=false
./build.ps1 -Script eng/devices/android.cake --target=uitest --project="/Users/ruimarinho/dotnet/maui/src/Controls/tests/UITests/Controls.AppiumTests.csproj" --appproject="/Users/ruimarinho/dotnet/maui/src/Controls/samples/Controls.Sample.UITests/Controls.Sample.UITests.csproj"--device="android-emulator-32_30" --apiversion="30" --configuration="Release"

Windows

./build.ps1 --target=dotnet-samples --configuration="Release" --windows --verbosity=diagnostic --workloads=global --usenuget=false
./build.ps1 -Script eng/devices/windows.cake --target=uitest --project="/Users/ruimarinho/dotnet/maui/src/Controls/tests/UITests/Controls.AppiumTests.csproj" --appproject="/Users/ruimarinho/dotnet/maui/src/Controls/samples/Controls.Sample.UITests/Controls.Sample.UITests.csproj" --device="windows10" --apiversion="10.0.20348" --configuration="Release"

iOS

./build.ps1 --target=dotnet-samples --configuration="Release" --workloads=global --ios --usenuget=false
./build.ps1 -Script  eng/devices/ios.cake --target=uitest --project="/Users/ruimarinho/dotnet/maui/src/Controls/tests/UITests/Controls.AppiumTests.csproj" --appproject="/Users/ruimarinho/dotnet/maui/src/Controls/samples/Controls.Sample.UITests/Controls.Sample.UITests.csproj" --device=ios-simulator-64 --apiversion="16.2" --configuration="Release"

Catalyst

./build.ps1 --target=dotnet-samples --configuration="Release" --catalyst --verbosity=diagnostic --workloads=global --usenuget=false
./build.ps1 -Script eng/devices/catalyst.cake --target=uitest --project="/Users/ruimarinho/dotnet/maui/src/Controls/tests/UITests/Controls.AppiumTests.csproj" --appproject="/Users/ruimarinho/dotnet/maui/src/Controls/samples/Controls.Sample.UITests/Controls.Sample.UITests.csproj" --apiversion="10.13" --configuration="Release" --device=mac

Running from the IDE

  • Deploy the app Control.Sample.UITests to your simulator, device or on your desktop.
  • Build the Controls..AppiumTests.csproj so the tests show up on the Test Explorer
  • Run the tests

fixes #11232

var logDir = (Path.GetDirectoryName(Environment.GetEnvironmentVariable("APPIUM_LOG_FILE")) ?? Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location))!;

var pageSource = Driver?.PageSource!;
File.WriteAllText(Path.Combine(logDir, $"{TestContext.CurrentContext.Test.MethodName}-PageSource.txt"), pageSource);
Copy link
Member

@PureWeen PureWeen May 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Currently only tested on windows via the script:

I think the logDir here always evaluates to / because when the script runs it sets the appium_log_dir to

Setting environment variable: APPIUM_LOG_FILE = '/appium_windows.log'

Should we make sure this gets set to an absolute path from the cake script?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should probably be using BINLOG_DIR instead of BINLOG_ARG when setting that

eng/devices/windows.cake Show resolved Hide resolved
eng/devices/windows.cake Show resolved Hide resolved
@github-actions
Copy link
Contributor

Thank you for your pull request. We are auto-formatting your source code to follow our code guidelines.

@rmarinho
Copy link
Member Author

Created a issue to follow up on the TODOs: #15113

@rmarinho rmarinho enabled auto-merge (squash) May 16, 2023 16:31
@rmarinho rmarinho merged commit dec8b24 into main May 16, 2023
@rmarinho rmarinho deleted the appium branch May 16, 2023 21:34
rmarinho added a commit that referenced this pull request May 30, 2023
* More stuff with query

* Update to Appium 2.0

* Cleanup

* Fix tests

* Add mac tests

* Multiple testcase

* Fixes for  windows

* Deploy as unpackaged app

* Fixes for run UITests on windows

* Cleanup and move to TestUtils projects for Appium and Xamarin.UITest

* Fix references

* Add to mac sln

* Fix sln

* Add uitest yaml

* Fix sln

* Update yml

* more fixes

* again powershell

* fix ident

* Add path and try call cake

* Fix

* Start background

* Start appium on the background

* Just run android for now

* try install app

* try again

* if it fails continue

* fix paths

* appium

* try again

* try again

* fix

* again

* try again

* location of samples

* build samples

* do not skip xcode

* more debug info

* Publish test results

* nUnit tests for now

* try any file

* no retry

* try vstest

* FIX PATH

* install more drivers

* usenuget when building samples

* Move to helpers

* Try run iOS tests

* try build both

* Add ALLTests

* Android folder

* fixes

* try again

* Fix path

* Cleanup android cake

* cleanup iOS cake

* add mac cake

* fix version

* try again

* try again

* upDATE TOOLS

* try again

* fix again

* again

* again

* again

* rollback xharness

* increase timeout

* run with dotnet path

* Fix dir

* Try again

* fix

* Fix

* build and then run tests

* fix platformVersion passed to APPIUM

* Don t do verbosity

* Log for appium

* Try 16.2

* Add platform to appium logs

* Fix

* Start test server

* Wait for server to start

* Fix typo

* Add windows cake

* Set uitests windows yaml

* provision on macos only

* Fix path for app windows

* Rename winui

* Try again

* Make sure to stop and dispose the server

* fix template

* Install windows driver too

* Better appium install drivers

* specify device

* Fix binlog android

* Run device tests in release

* Try no path

* Try with debug configuration

* try build samples just for that platform

* Release

* rename to match platform

* try cleanup

* Add mac uitests

* Build only for catalyst

* Add information

* Version mac

* Fix folder path

* Try build and run windows tests

* more stuff on install script

* Add retry for ios

* run always on xamarin pool

* Fix windows

* Allow to pass configuration to catalyst

* Add bindir info

* Try fix windows build

* Try set env variables before

* [Sample] Clean fields when tapping login button

* Take screenshot before querying text element

* Enable automationmode-without-authentication

* Try using action instead

* Use same machine pool as ios/android for mac

* Change entry to not get autocorrect pop-up and add delay before click

* Disable keyboard completion for catalyst runs

* Auto-format source code

* Update sln

* Fix csproj

* Add Sample UITests

* Fix yaml

* Use the new app uitest sandbox project

* Remove old code

* Cleanup

* Fix Android manifest

* Fix build for tizen

* Rename projects

* Some more renames

* Fix ios for PR's

* Update MainPageTests.cs

* Add to mac slnf

* Try more stuff for the mac

* Try run before

* don t set automation mode

* Try Xcode select and move to ventura

* Fix script

* Dont xcode select

* Bool and not string

* try old appium

* Fix version

* Can we skip provisioning

* We can't skip provisioning

* Dont provision on windows

* Update sln and packages

* Update node

* Configure the windows path to the exe

* Auto-format source code

---------

Co-authored-by: Scott Banning <scoban@microsoft.com>
Co-authored-by: GitHub Actions Autoformatter <autoformat@example.com>
@NickDarvey NickDarvey mentioned this pull request Jun 6, 2023
3 tasks
@github-actions github-actions bot locked and limited conversation to collaborators Dec 12, 2023
@samhouts samhouts added the fixed-in-8.0.0-preview.5.8529 Look for this fix in 8.0.0-preview.5.8529! label Aug 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-infrastructure CI, Maestro / Coherency, upstream dependencies/versions fixed-in-8.0.0-preview.5.8529 Look for this fix in 8.0.0-preview.5.8529!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Setup Appium based project in order to validate Appium based UI Test Strategy
8 participants