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

Hardcode fixes for uwp #3280

Closed
wants to merge 1 commit into from
Closed

Hardcode fixes for uwp #3280

wants to merge 1 commit into from

Conversation

nohwnd
Copy link
Member

@nohwnd nohwnd commented Jan 26, 2022

Description

Please add a meaningful description for this change.
Ensure the PR has required unit tests.

Related issue

Kindly link any related issues. E.g. Fixes #xyz.


// If the actual testSources, & input test sources do differ it means that the User(IDE) actually sent a package.
// We are limiting that only one package can be sent per session, so picking the first entry in sources
if (discoveryCriteria.Sources.Except(actualTestSources).Any())
{
discoveryCriteria.Package = discoveryCriteria.Sources.FirstOrDefault();
discoveryCriteria.Package = @"C:\ProgramData\DeveloperTools\WinUI-Samples-UITestsVS.Debug_x64.jajares\UITests.build.appxrecipe"; // discoveryCriteria.Sources.FirstOrDefault();
Copy link
Member Author

Choose a reason for hiding this comment

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

Here the provider provides the local path: "C:\\p\\WinUI-Samples\\x64\\Debug\\UITests\\UITests.build.appxrecipe"; and we send it to the other side in DiscoveryRequest. The recipe path is used to lookup UITests.exe and it cannot find it. So no tests are discovered. If we pass this path (the appxrecipe actuall does not exist on the remote) it allows UITest.exe path to be determined correctly. All tests are discovered but TestWindow can't understand them because they come from an unknown source.

@@ -13,13 +13,13 @@ internal static class DiscoveryCriteriaExtensions
{
public static void UpdateDiscoveryCriteria(this DiscoveryCriteria discoveryCriteria, ITestRuntimeProvider testRuntimeProvider)
{
var actualTestSources = testRuntimeProvider.GetTestSources(discoveryCriteria.Sources);
var actualTestSources = new[] { @"UITests.exe" }; // testRuntimeProvider.GetTestSources(discoveryCriteria.Sources);
Copy link
Member Author

@nohwnd nohwnd Jan 26, 2022

Choose a reason for hiding this comment

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

We get UITests.exe here from the real provider as well.

@@ -37,5 +37,22 @@ private static void UpdateTestSources(IEnumerable<string> sources, Dictionary<st
adapterSourceMap.Clear();
adapterSourceMap.Add(Constants.UnspecifiedAdapterPath, sources);
}

private interface IRemoteSourceProvider
Copy link
Member Author

Choose a reason for hiding this comment

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

Ignore all this.

this.testHostManager = this.proxyOperationManager.TestHostManager;
this.requestData = this.proxyOperationManager.RequestData;
}

this.baseTestDiscoveryEventsHandler = eventHandler;
if (this.testHostManager.GetType().Name.Contains("Uwp"))
Copy link
Member Author

Choose a reason for hiding this comment

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

Ignore all this, it just allows me to special case this for uwp, and change the responses.

}

public void HandleDiscoveredTests(IEnumerable<TestCase> discoveredTestCases)
{
Copy link
Member Author

Choose a reason for hiding this comment

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

Here we get Source that is the actual remote path, and we need to translate it back to the appxrecipe we got originally. So TestWindow can match it back to the correct source.

}
}

private class ReflectionBasedRemoteTestHostManagerAdapter : ITestRuntimeProvider
Copy link
Member Author

Choose a reason for hiding this comment

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

Ignore this class.

@MarcoRossignoli
Copy link
Contributor

/azp run

@azure-pipelines
Copy link

Pull request contains merge conflicts.

@nohwnd nohwnd closed this Feb 14, 2022
@nohwnd
Copy link
Member Author

nohwnd commented Feb 14, 2022

Replaced by #3314

@Haplois Haplois deleted the remote-uwp-execution branch September 7, 2022 08:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants