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

Fix cake scripts to work locally #24111

Merged
merged 5 commits into from
Aug 16, 2024
Merged

Fix cake scripts to work locally #24111

merged 5 commits into from
Aug 16, 2024

Conversation

PureWeen
Copy link
Member

@PureWeen PureWeen commented Aug 8, 2024

Description of Change

The UITest scripts aren't really working so well when ran locally. This PR fixes them and attempts to make it so they are overall much easier to run.

I've made comments to the various parts of the changes with thoughts/questions

Basically, this PR gets us to the point where you can do

dotnet cake eng/devices/android.cake --target=uitest-build
dotnet cake eng/devices/android.cake --target=uitest --test-filter="TestCategory=Border"

Additional thoughts

  • I'd like to flatten this out so you could just do this, but it's going to take some additional organizing and this is a good first step.
dotnet cake --target=uitest --android
  • I don't currently know how to get the VerifyScreenshot code to detect the right device when running from test explorer. The Device Name doesn't really get passed up into Appium. A bunch of the capabilities get passed in, so, maybe we can just make sure the viewport and various other values match with what our screenshots are using
    image

@@ -0,0 +1,13 @@
#load "../cake/helpers.cake"

if (!IsCIBuild() && GetBuildVariable("workloads", "notset") == "notset")
Copy link
Member Author

Choose a reason for hiding this comment

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

For UI tests lets just default to global workloads for now. I think we should just make this change everywhere. This isn't really a scenario that most users care about anymore.

var simXH = sims.Where(s => s.Name.Contains(simulatorName) && s.Name.Contains(iosVersionToRun)).FirstOrDefault();
if (simXH == null)
throw new Exception("No simulator was found to run tests on.");
{
// if the device is already installed on this system then xharness won't create a new one
Copy link
Member Author

Choose a reason for hiding this comment

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

This code is a little bit awkward.

I found that if you already have a device that's "iPhone Xs 17.2" installed. Xharness won't create a new device and then this code just fails because it can't find something called "Xharness"

Is there a way to get the UDID from the xharness script above?

@mandel-macaque ?

@jfversluis
Copy link
Member

Just tested this with Android with the commands provided in the OP and it just worked! 🤯

@PureWeen PureWeen marked this pull request as ready for review August 14, 2024 19:58
@PureWeen PureWeen requested a review from a team as a code owner August 14, 2024 19:58
@PureWeen
Copy link
Member Author

/rebase

@mattleibow mattleibow enabled auto-merge (squash) August 16, 2024 11:18
@PureWeen PureWeen disabled auto-merge August 16, 2024 13:14
@PureWeen
Copy link
Member Author

Failing windows device test is unrelated

@PureWeen PureWeen merged commit 0370361 into main Aug 16, 2024
95 of 97 checks passed
@PureWeen PureWeen deleted the fix_local_cake branch August 16, 2024 13:15
@samhouts samhouts added fixed-in-net9.0-nightly This may be available in a nightly release! fixed-in-net8.0-nightly This may be available in a nightly release! labels Aug 27, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Oct 6, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
fixed-in-net8.0-nightly This may be available in a nightly release! fixed-in-net9.0-nightly This may be available in a nightly release!
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants