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

[Xamarin.UITest][net8] System.Exception : file does not exist: {plistPath} #2584

Closed
jeromelaban opened this issue Sep 11, 2023 · 18 comments
Closed
Labels
feature request New feature request test Related to the App Center Test service

Comments

@jeromelaban
Copy link

Using Xamarin.UITest 4.2.0 with .NET 8 Preview 7, testing with Xcode 14.3.1 in the iOS simulator fails with the error below.

The same tests works properly using .NET 7.0.400.

System.Exception : file does not exist: {plistPath}
StackTrace:    at System.RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor)
   at System.Reflection.MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr)
--Exception
   at Xamarin.UITest.iOS.iOSAppLauncher.LaunchAppLocal(IiOSAppConfiguration appConfiguration, HttpClient httpClient, Boolean clearAppData)
   at Xamarin.UITest.iOS.iOSAppLauncher.LaunchApp(IiOSAppConfiguration appConfiguration, HttpClient httpClient, TestCloudiOSAppConfiguration testCloudAppConfiguration, HttpClient testCloudWsClient, HttpClient xtcServicesClient, Boolean testCloudUseDeviceAgent)
   at Xamarin.UITest.iOS.iOSApp..ctor(IiOSAppConfiguration appConfiguration, IExecutor executor)
   at Xamarin.UITest.iOS.iOSApp..ctor(IiOSAppConfiguration appConfiguration)
   at Xamarin.UITest.Configuration.iOSAppConfigurator.StartApp(AppDataMode appDataMode)
@jeromelaban jeromelaban added the feature request New feature request label Sep 11, 2023
@DmitriyKirakosyan DmitriyKirakosyan added the test Related to the App Center Test service label Sep 20, 2023
@IlyaBausovAkvelon
Copy link

Hi @jeromelaban,
For now we don't support .NET 8. I've checked this problem and was able to reproduce it. If we will be implementing Xamarin.UITest support for .NET 8 we will fix it.

@IlyaBausovAkvelon
Copy link

@jeromelaban How do you configure your app? Could you please show me line of code where you call ConfigureApp?

@evgenyvalavin
Copy link

+1

@evgenyvalavin
Copy link

evgenyvalavin commented Dec 1, 2023

@jeromelaban How do you configure your app? Could you please show me line of code where you call ConfigureApp?

@IlyaBausovAkvelon this is how I configure the app

ConfigureApp
    .iOS
    .InstalledApp(_bundleId)
    .DeviceIdentifier(_deviceIdentifier)
    .StartApp(AppDataMode.DoNotClear);

@jeromelaban
Copy link
Author

@IlyaBausovAkvelon apologies for the delay. I'm configuring the app this way.

@IlyaBausovAkvelon
Copy link

@jeromelaban @evgenyvalavin Thank you for sharing this.

@zippo227
Copy link

zippo227 commented Dec 23, 2023

Hi @jeromelaban, For now we don't support .NET 8. I've checked this problem and was able to reproduce it. If we will be implementing Xamarin.UITest support for .NET 8 we will fix it.

@IlyaBausovAkvelon I hope that the team is able to support .net 8. With Xamarin Forms still considered to be in support and Visual Studio for Mac as well, until summer and fall 2024, Xamarin UI Test 8 support would encourage and help other developers like me who are transitioning to Maui.

@IlyaBausovAkvelon
Copy link

@zippo227 for now we are not planning to add support for .NET 8.

@zippo227
Copy link

zippo227 commented Jan 14, 2024

@zippo227 for now we are not planning to add support for .NET 8.

Hi @IlyaBausovAkvelon, I saw your post, and at that time, it made sense. I worked on backporting my application to .NET 7. I was actually able to start a set of unit tests in .NET 7, although I had to search for the simulator myself to be able to see it, and it could only run on iPhone 14. Unfortunately, my iOS tests did not complete. However, fortunately, I have gotten my Android tests to complete. I would just love to be able to run the same set of tests on iOS in .NET 8. For some reason, they cannot complete in .NET 7, and moreover, the MAUI app in .NET 7 looks completely different. I don't know why it would be so different, but it seems the fixes in .NET 8 are so substantial that it is the only platform that currently supports my application. I would just love to be able to run the UI tests in .NET 8 one last time to ensure parity. In search of an alternative, I have glanced at what could be available in Appium. However, there is no support for creating an Appium project. Please, if you could point me in the right direction. I have the automation IDs on my items. Thank you.

@dsmitchell
Copy link

dsmitchell commented Mar 15, 2024

@IlyaBausovAkvelon, please either update for NET8 or open-source the code so that we can better work around issues. Installing an app on a simulator and then launching it is as easy as:

Process.Start("xcrun", $"simctl boot {udid}").WaitForExit();
Process.Start("xcrun", $"simctl install {udid} {appPath}").WaitForExit();
Process.Start("xcrun", $"simctl launch {udid} {bundle}").WaitForExit();

And I wish the .ConnectToApp() method worked, but for some reason after successfully establishing a connection with Calabash on port 37265 the Xamarin.UITest code switches to port 27753 and fails, even with the code below:

var config = ConfigureApp.iOS
    .AppBundle(appPath) // This doesn't help or hurt, but I'm leaving it here for reference
    .Debug()
    .DeviceIdentifier(udid)
    .DeviceIp("127.0.0.1")
    .DevicePort(37265)
    .EnableLocalScreenshots();

iOSApp app = config.ConnectToApp(); // Succeeds on port 37265
Thread.Sleep(2000);
app.Flash(); // Fails on port 27753

@JohnHDev
Copy link

@IlyaBausovAkvelon has Xamarin.UITest been deprecated? I haven't seen an announcement for that, and if not, then why won't .NET 8 be supported? We are using Xamarin.UITest to automate tests on out .NET Maui app, that's on .NET 8 but our test projects need to be .NET 7?

Long term, will Xamarin.UITest be open sourced? Would be very useful if so.

Thanks
John

@jeromelaban
Copy link
Author

For those of you hitting this issue, the breaking change came with .NET 8, where Environment.GetFolderPath(Environment.SpecialFolder.Personal) used to return ~, and now returns ~/Documents.

The effect of this change is that Xamarin.UITest cannot find the device.plist info from the selected simulator.

A possible workaround is as follows, until Xamarin.UITest is fixed:

ln -s ~/Library ~/Documents/Library

This will make the simulator files visible to Xamarin.UITest.

For the Microsoft team (@IlyaBausovAkvelon), the fix is to use Environment.SpecialFolder.UserProfile instead of Environment.SpecialFolder.Personal.

@dsmitchell
Copy link

For those of you hitting this issue, the breaking change came with .NET 8, where Environment.GetFolderPath(Environment.SpecialFolder.Personal) used to return ~, and now returns ~/Documents.

The effect of this change is that Xamarin.UITest cannot find the device.plist info from the selected simulator.

A possible workaround is as follows, until Xamarin.UITest is fixed:

ln -s ~/Library ~/Documents/Library

This will make the simulator files visible to Xamarin.UITest.

For the Microsoft team (@IlyaBausovAkvelon), the fix is to use Environment.SpecialFolder.UserProfile instead of Environment.SpecialFolder.Personal.

Nice find. I will try this tomorrow in our own pipelines.

It's almost as if AppCenter should pay you to do their work...

jeromelaban added a commit to unoplatform/uno that referenced this issue Jun 6, 2024
@IlyaBausovAkvelon
Copy link

Hi all,
We've released Xamarin.UITest 4.3.5 which has a fix for this issue with the simulators so no need to use symlink to the folder mentioned above. For now this version should be working fine with .NET 8 target framework. Thank you all for the patience.

jeromelaban added a commit to unoplatform/Uno.Gallery that referenced this issue Jun 7, 2024
@jeromelaban
Copy link
Author

@IlyaBausovAkvelon This is working for us! Thanks for the new release.

@JohnHDev
Copy link

JohnHDev commented Jun 8, 2024

@IlyaBausovAkvelon I have updated and now getting the following error:
Message "One or more errors occurred. (Failed to launch simulator: An error occurred trying to start process 'idb:' with working directory '/Users/jxxxxx/bin/Debug/net8.0'. No such file or directory)"

The path definitely exists however. Any pointers on what might be wrong?

jeromelaban added a commit to unoplatform/uno that referenced this issue Jun 13, 2024
@IlyaBausovAkvelon
Copy link

@JohnHDev probably it's happening because of idb paths. Could you please try to use OverrideIDBPath when configure iOSApp? The OverrideIDBPath was added to 4.3.7 release.

@DmitriyKirakosyan
Copy link
Contributor

The initial issue was fixed, so I'm closing it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature request test Related to the App Center Test service
Projects
None yet
Development

No branches or pull requests

7 participants