Reputation: 4526
My Xamarin.Forms app uses Azure AD B2C for authentication. It works great. I'm trying to build UI automation tests now and I ran into my first blocker. I have been trying to wait for the WebView to come on the screen so I can enter the email and password of a test user into my ui test automation script however the WaitForElement method always times out!
[Test]
public void RegistrationStarts()
{
app.Screenshot("Welcome screen.");
app.WaitForElement(c => c.WebView());
app.Tap(c => c.WebView().Css("input#logonIdentifier"));
app.EnterText("[email protected]");
}
I'm not sure why. I'm only testing in Android. I notice that the Azure AD B2C login web view appears to be inside my app. I can tell this because when I open the Android task switcher I can see Chrome and my app.
Upvotes: 1
Views: 945
Reputation: 21
It seems you are using systembrowser
instead of WebView
.
Change your method of acquiring token with WebView.
AuthenticationResult authResult = await _pca.AcquireTokenInteractive(B2CConstants.Scopes)
.WithUseEmbeddedWebView(true)
.ExecuteAsync();
https://github.com/microsoft/appcenter/issues/287#issuecomment-484151924
Upvotes: 0
Reputation: 1
you can try wait for element with timeout - time in milisecond, second, and min.
app.WaitForElement(x => x.Marked("AutomationID"), timeout:TimeSpan.FromSeconds(90));
or
Upvotes: 0
Reputation: 5119
Is there a reason you used input before the id? If logonIdentifier is your ID of whatever you want to type, it should just be
app.Tap(c => c.WebView().Css("#logonIdentifier"));
Also, if logonIdentifier is the TextBox in which you want to type, enter text should be
_app.EnterText(c => c.WebView().Css("#logonIdentifier"), "[email protected]");
Upvotes: 0