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

chore: Adjust tests for android #2579

Open
wants to merge 1 commit into
base: dev/erli/add-mobile-ui-tests
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public async Task When_SimpleContentDialog(string dialogButton, int delayInSecon
App.WaitElement("DialogsContentDialogsPage");
var screenBefore = TakeScreenshot("When_Dialog_Before");
App.Tap(dialogButton);
await Task.Delay(500); // Make sure the dialog is showing completely
await Task.Delay(1000); // Make sure the dialog is showing completely
var screenAfter = TakeScreenshot("When_Dialog_After");
ImageAssert.AreNotEqual(screenBefore, screenAfter);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public async Task When_FlyoutsButton(string dialogButton, int delayInSeconds, bo
App.WaitElement("DialogsFlyoutsPage");
var screenBefore = TakeScreenshot("When_Dialog_Before");
App.Tap(dialogButton);
await Task.Delay(500); // Make sure the dialog is showing completely
await Task.Delay(1000); // Make sure the dialog is showing completely
var screenAfter = TakeScreenshot("When_Dialog_After");
ImageAssert.AreNotEqual(screenBefore, screenAfter);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<utu:NavigationBar Content="Content Dialogs"
AutomationProperties.AutomationId="DialogsContentDialogsPage" />
<utu:NavigationBar Content="Content Dialogs" AutomationProperties.AutomationId="DialogsContentDialogsPage" />

<ScrollViewer Grid.Row="1">
<StackPanel>
Expand All @@ -41,8 +40,8 @@


<Button AutomationProperties.AutomationId="ComplexDialogSecondPageButton"
uen:Navigation.Request="ContentDialogsSecond"
Content="Complex Dialog - Second Page" />
uen:Navigation.Request="ContentDialogsSecond"
Content="Complex Dialog - Second Page" />
</StackPanel>
</ScrollViewer>
</Grid>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,12 @@ private async void SimpleDialogCodebehindClick(object sender, RoutedEventArgs ar
}
private async void SimpleDialogCodebehindCancelClick(object sender, RoutedEventArgs args)
{
var cancelSource = new CancellationTokenSource(TimeSpan.FromSeconds(2));
#if USE_UITESTS && __ANDROID__
var waitTime = 4;
#else
var waitTime = 2;
#endif
var cancelSource = new CancellationTokenSource(TimeSpan.FromSeconds(waitTime));
var showDialog = await this.Navigator()!.NavigateViewForResultAsync<DialogsSimpleDialog, Widget>(this, Qualifiers.Dialog, cancellation: cancelSource.Token);
if (showDialog is null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,19 +15,18 @@
<RowDefinition Height="Auto" />
<RowDefinition />
</Grid.RowDefinitions>
<utu:NavigationBar Content="Flyouts"
AutomationProperties.AutomationId="DialogsFlyoutsPage" />
<utu:NavigationBar Content="Flyouts" AutomationProperties.AutomationId="DialogsFlyoutsPage" />

<ScrollViewer Grid.Row="1">
<StackPanel>
<Button AutomationProperties.AutomationId="FlyoutDialogXamlButton"
uen:Navigation.Request="!DialogsBasic"
Content="Flyout from Xaml" />
<Button AutomationProperties.AutomationId="FlyoutDialogCodebehindButton"
Content="Flyout from Background Thread"
<Button AutomationProperties.AutomationId="FlyoutDialogCodebehindButton"
Content="Flyout from Background Thread"
Click="FlyoutFromBackgroundClick" />
<Button AutomationProperties.AutomationId="FlyoutDialogCodebehindBackgroundButton"
Content="Flyout from Background Thread requesting data"
<Button AutomationProperties.AutomationId="FlyoutDialogCodebehindBackgroundButton"
Content="Flyout from Background Thread requesting data"
Click="FlyoutFromBackgroundRequestingDataClick" />
<Button AutomationProperties.AutomationId="FlyoutDialogCodebehindWithCancelButton"
Content="Flyout requesting data with cancellation (2s)"
Expand All @@ -37,7 +36,7 @@
uen:Navigation.Data="{Binding FlyoutData, Mode=TwoWay}"
Content="Complex Flyout from Xaml" />


</StackPanel>
</ScrollViewer>
</Grid>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,12 @@ private async void FlyoutFromBackgroundRequestingDataClick(object sender, Routed

private async void FlyoutRequestingDataWithCancelClick(object sender, RoutedEventArgs args)
{
var cancelSource = new CancellationTokenSource(TimeSpan.FromSeconds(2));
#if USE_UITESTS && __ANDROID__
var waitTime = 4;
#else
var waitTime = 2;
#endif
var cancelSource = new CancellationTokenSource(TimeSpan.FromSeconds(waitTime));
var nav = this.Navigator()!;
var result = await nav.NavigateRouteForResultAsync<Widget>(new object(), "!DialogsBasic", cancellation: cancelSource.Token).AsResult();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ protected override void RegisterRoutes(IViewRegistry views, IRouteRegistry route

views.Register(
new ViewMap<ContentDialogsPage>(),
new ViewMap<DialogsSimpleDialog, DialogsSimpleViewModel>(ResultData: typeof(Widget)),
new ViewMap<DialogsBasicFlyout, DialogsBasicViewModel>(ResultData: typeof(Widget)),
new ViewMap<ContentDialogsSecondPage>(),
new ViewMap<DialogsFlyoutsPage, DialogsFlyoutsViewModel>(),
new ViewMap<DialogsComplexDialog>(),
Expand Down Expand Up @@ -68,7 +70,9 @@ protected override void RegisterRoutes(IViewRegistry views, IRouteRegistry route
new RouteMap("DialogsComplexFlyoutSecond", View: views.FindByViewModel<DialogsComplexFlyoutTwoViewModel>(), DependsOn: "DialogsComplexFlyoutFirst")
}),
new RouteMap("Confirm", View: confirmDialog),
new RouteMap("LocalizedConfirm", View: localizedDialog)
new RouteMap("LocalizedConfirm", View: localizedDialog),
new RouteMap("DialogsSimpleDialog", View: views.FindByViewModel<DialogsSimpleViewModel>()),
new RouteMap("DialogsBasic", View: views.FindByViewModel<DialogsBasicViewModel>()),
}));
}

Expand Down