Skip to content

Conversation

pictos
Copy link
Member

@pictos pictos commented Oct 4, 2023

This PR adds the Device test runner to our repo. It's WiP but it's nice to have some visibility of you all. It's working and if you want you can start to add tests. I added two tests to be a guide for you.

I'll need help of someone who knows yaml in order to create a step on our build to run these tests, I know that Maui does that so we can grab for them (?).

Right now these bits are in preview, and uses a private feed, I added a nuget.config file adding the source to the needed packages, I would say it's fine to use it since is the one that .NET MAUI uses and it the team is working in making this stable. Also, using it on our repo is a good way to help them provide early feedback.

@pictos pictos requested a review from a team October 4, 2023 23:49
@pictos
Copy link
Member Author

pictos commented Oct 4, 2023

cc: @mattleibow just in case you have something to add (:

@pictos pictos force-pushed the pj/device-test-runner branch from b8415ae to f818c9d Compare October 4, 2023 23:51
@pictos pictos force-pushed the pj/device-test-runner branch from f818c9d to 5513c8e Compare October 4, 2023 23:54
</ItemGroup>

<ItemGroup>
<MauiXaml Update="Tests\UITests\StatusBarTestPage.xaml">
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can be removed

public class BehaviorTest
{
[Fact]
public void SuccessfulTest()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can be removed

Copy link
Member Author

Choose a reason for hiding this comment

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

Let's make it run on your CI first

@VladislavAntonyuk VladislavAntonyuk added the hacktoberfest-accepted A PR that has been approved during Hacktoberfest label Oct 5, 2023
VladislavAntonyuk and others added 2 commits October 5, 2023 20:21
* Run tests on Android

* fix path

* skip warnings

* install android sdk

* update nuget.config

* fix build

* use x86-x64 android emulator

* use android x64

* ios maccatalyst

* fix path

* fix ios build

* use xcode 14.3.1

* macos-13

* comment android

* Run only on Mac
@ghost ghost added stale The author has not responded in over 30 days help wanted This proposal has been approved and is ready to be implemented labels Nov 17, 2023
@VladislavAntonyuk
Copy link
Collaborator

@pictos can we merge this PR as it is (with comments fixes)?

@TheCodeTraveler TheCodeTraveler removed the stale The author has not responded in over 30 days label Sep 21, 2024
@TheCodeTraveler TheCodeTraveler marked this pull request as draft September 21, 2024 19:21
@bijington
Copy link
Contributor

It looks like it is forcing us to upgrade to Xcode 16 and iOS 18? Is this supported via Azure Pipelines?

@TheCodeTraveler
Copy link
Collaborator

TheCodeTraveler commented Oct 1, 2024

It looks like it is forcing us to upgrade to Xcode 16 and iOS 18? Is this supported via Azure Pipelines?

Yup! You need to do two things to add iOS 18 support to the library:

  1. Update CommunityToolkitLibrary_Xcode_Version to '16'
    CommunityToolkitLibrary_Xcode_Version: '15.4'
  2. Update TOOLKIT_NET_VERSION to 8.0.402

bijington

This comment was marked as outdated.

@dotnet-policy-service dotnet-policy-service bot added the stale The author has not responded in over 30 days label Nov 1, 2024
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 27 out of 42 changed files in this pull request and generated 3 suggestions.

Files not reviewed (15)
  • samples/CommunityToolkit.Maui.Sample.sln: Language not supported
  • src/CommunityToolkit.Maui.DeviceTests/App.xaml: Language not supported
  • src/CommunityToolkit.Maui.DeviceTests/AppShell.xaml: Language not supported
  • src/CommunityToolkit.Maui.DeviceTests/CommunityToolkit.Maui.DeviceTests.csproj: Language not supported
  • src/CommunityToolkit.Maui.DeviceTests/MainPage.xaml: Language not supported
  • src/CommunityToolkit.Maui.DeviceTests/NuGet.config: Language not supported
  • src/CommunityToolkit.Maui.DeviceTests/Platforms/Android/AndroidManifest.xml: Language not supported
  • src/CommunityToolkit.Maui.DeviceTests/Platforms/Android/Resources/values/colors.xml: Language not supported
  • src/CommunityToolkit.Maui.DeviceTests/Platforms/MacCatalyst/Info.plist: Language not supported
  • azure-pipelines.yml: Evaluated as low risk
  • src/CommunityToolkit.Maui.DeviceTests/App.xaml.cs: Evaluated as low risk
  • src/CommunityToolkit.Maui.DeviceTests/AppShell.xaml.cs: Evaluated as low risk
  • src/CommunityToolkit.Maui.DeviceTests/Platforms/Tizen/Main.cs: Evaluated as low risk
  • src/CommunityToolkit.Maui.DeviceTests/Platforms/Android/MainApplication.cs: Evaluated as low risk
  • src/CommunityToolkit.Maui.DeviceTests/Platforms/Android/MainActivity.cs: Evaluated as low risk
Comments skipped due to low confidence (2)

src/CommunityToolkit.Maui.DeviceTests/BaseUITest.cs:25

  • The TaskCompletionSource should specify the type explicitly, e.g., TaskCompletionSource<object?>.
var tcs = new TaskCompletionSource();

src/CommunityToolkit.Maui.DeviceTests/MainPage.xaml.cs:5

  • [nitpick] The variable name 'count' is ambiguous. It should be renamed to 'clickCount' or something more descriptive.
int count = 0;

@bijington bijington removed help wanted This proposal has been approved and is ready to be implemented stale The author has not responded in over 30 days labels Feb 4, 2025
@dotnet-policy-service dotnet-policy-service bot added stale The author has not responded in over 30 days help wanted This proposal has been approved and is ready to be implemented labels Mar 7, 2025
@mattleibow
Copy link

I have been iterating on the repo and I have added some features for running on the cli without xharness. It uses tcp connections.

Once I finish the final ios test runner, then I will ship a version and get it to work with skia as a first dogfooder.

There are some great Android and Apple cli tools from @Redth, so I am using that under the hood.

I also want to make is easier to have a test app and not need all the boilerplate with things like icons and resources. I am hoping to almost emulate a app project with nothing in it except your tests.

This latter idea is maybe for next time I get to it, but hopefully the new cli tool can just replace the xharness way and I can deprecate/remove that dependency.

I see this PR has been here for a while, what has been the main blockers to adding testing support to the toolkit?

@pictos
Copy link
Member Author

pictos commented Jun 13, 2025

I have been iterating on the repo and I have added some features for running on the cli without xharness. It uses tcp connections.

Once I finish the final ios test runner, then I will ship a version and get it to work with skia as a first dogfooder.

There are some great Android and Apple cli tools from @Redth, so I am using that under the hood.

I also want to make is easier to have a test app and not need all the boilerplate with things like icons and resources. I am hoping to almost emulate a app project with nothing in it except your tests.

This latter idea is maybe for next time I get to it, but hopefully the new cli tool can just replace the xharness way and I can deprecate/remove that dependency.

I see this PR has been here for a while, what has been the main blockers to adding testing support to the toolkit?

@mattleibow I was working on this one, and one thing that I can remember was, how to configure it to run on CI.

Other than that I believe everything was working as expected

@mattleibow
Copy link

Ah, nice. OK, so my repo now has workflows (iOS is almost done) and it is pretty simple - especailly with Jon's cool CLI tools to create, start, launch emus and sims.

The workflows are a couple steps long, so you might just be able to copy and make it work.

I really would like this all to be as simple as possible, so if anything is more that 3 chars deep and 2 lines long, let me know and I can try make it a single stop shop.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
hacktoberfest-accepted A PR that has been approved during Hacktoberfest help wanted This proposal has been approved and is ready to be implemented stale The author has not responded in over 30 days
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants