I'm trying to get Xamarin Forms working with UITest and I cannot seem to get the StyleId property to be set in iOS (I'm don't have licensing for Android).
I've followed all of the documentation and these are the steps I've taken thus far:
AppDelegate:
static readonly IntPtr setAccessibilityIdentifier_Handle = Selector.GetHandle("setAccessibilityIdentifier:");
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
Forms.Init();
Forms.ViewInitialized += (object sender, ViewInitializedEventArgs e) => {
// http://developer.xamarin.com/recipes/testcloud/set-accessibilityidentifier-ios/
if (null != e.View.StyleId) {
e.NativeView.AccessibilityIdentifier = e.View.StyleId;
Console.WriteLine("Set AccessibilityIdentifier: " + e.View.StyleId);
}
};
...
#if DEBUG
Xamarin.Calabash.Start();
#endif
...
}
XAML ContentPage:
<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
x:Class="Ignite.Abacus.Mobile.OptionsView"
Title="Options">
<ContentPage.Content>
<StackLayout>
<Label Text="Test" StyleId="Test" />
</StackLayout>
</ContentPage.Content>
</ContentPage>
Now, here's the kicker:
If I debug the application I can clearly see the StyleId is getting set because the Console.WriteLine
call in the Forms.ViewInitialized
handler in AppDelegate
is writing to the application output. But if I debug the unit test I have and query it from the REPL it does not appear to be wiring up the StyleId property because app.Query(c => c.Marked("Test"))
returns zero results.
I'd love to see the console output of the application when running it under test scope - but it does not appear to output anything to the Application Output window or the Test Results window (with output toggled on)...
Any ideas as to what I am missing?