В настоящее время мы проводим набор из 26 тестов. Однако при работе в App Center мы получаем противоречивые результаты.
Все они работают на одной и той же кодовой базе. И всегда кажется, что это одни и те же тесты, которые иногда не проходят.
Мы используем x.WaitForElement и интервал времени 10 секунд,
ApplicationContext.WaitForElement(x =>
x.Property("Text")
.Contains(element),
timeout: TimeSpan.FromSeconds(10));
Описание ошибки:
System.Exception : Error while performing WaitForElement(Property("Text").Contains("Services"), "Timed out waiting for element...", 00:00:10, null, null)
----> System.TimeoutException : Timed out waiting for element...
at Xamarin.UITest.Utils.ErrorReporting.With[T] (System.Func`1[TResult] func, System.Object[] args, System.String memberName) [0x0005b] in <b407387d5472492e9a5a9fb5ff2a9418>:0
at Xamarin.UITest.Android.AndroidApp.WaitForElement (System.Func`2[T,TResult] query, System.String timeoutMessage, System.Nullable`1[T] timeout, System.Nullable`1[T] retryFrequency, System.Nullable`1[T] postTimeout) [0x00032] in <b407387d5472492e9a5a9fb5ff2a9418>:0
at Cashoo.AutomationTests.Base.BasePage.WaitForAnElementToPresent (System.String element) [0x00036] in <86d386ec5946400cb6c19f52c8ea595c>:0
at Cashoo.AutomationTests.TestsPerPage.DashboardPageTests.ClickOnChooseCashback_ReturnsServicesPage () [0x00016] in <86d386ec5946400cb6c19f52c8ea595c>:0
at (wrapper managed-to-native) System.Reflection.MonoMethod:InternalInvoke (System.Reflection.MonoMethod,object,object[],System.Exception&)
at System.Reflection.MonoMethod.Invoke (System.Object obj, System.Reflection.BindingFlags invokeAttr, System.Reflection.Binder binder, System.Object[] parameters, System.Globalization.CultureInfo culture) [0x00032] in <48b95f3df5804531818f80e28ec60191>:0 --TimeoutException
at Xamarin.UITest.Shared.WaitForHelper.WaitForAny[T] (System.Func`1[TResult] query, System.String timeoutMessage, System.Nullable`1[T] timeout, System.Nullable`1[T] retryFrequency, System.Nullable`1[T] postTimeout) [0x0001d] in <b407387d5472492e9a5a9fb5ff2a9418>:0
at Xamarin.UITest.Android.AndroidApp+<>c__DisplayClass86_0.<WaitForElement>b__0 () [0x00054] in <b407387d5472492e9a5a9fb5ff2a9418>:0
at Xamarin.UITest.Utils.ErrorReporting.With[T] (System.Func`1[TResult] func, System.Object[] args, System.String memberName) [0x0000e] in <b407387d5472492e9a5a9fb5ff2a9418>:0
Любые идеи будут с благодарностью оценены.
Дополнительная информация:
1) Xamarin.UiTest v2.2.5
2) Android v7.1.2
3) Фрагмент кода:
//CTOR
public DashboardPageTests(Platform platform)
{
this.platform = platform;
ApplicationContext = AppInitializer.StartApp(platform);
phoneNumberPage = new PhoneNumberPage();
passwordPage = new PasswordPage();
phoneNumberPage.EnterPhoneNumberAndClick("07510000000");
passwordPage.EnterPasswordAndClickSignIn("A123456a");
}
[Test]
public void ClickOnChooseCashback_ReturnsServicesPage()
{
//Act
ApplicationContext.WaitForElement(x =>
x.Property("Text")
.Contains("Dashboard"),
timeout: TimeSpan.FromSeconds(10));
dashboardPage.ClickOnChooseCashback();
ApplicationContext.WaitForElement(x =>
x.Property("Text")
.Contains("Services"),
timeout: TimeSpan.FromSeconds(10));
var elementPresent = ApplicationContext.Query("Services");
//Assert
Assert.IsTrue(elementPresent.Any(), "Services text is not visible.");
servicesPage.ClickOnBackButton();
}