Skip to content

Commit

Permalink
fix: flaky test (#1225)
Browse files Browse the repository at this point in the history
  • Loading branch information
kazo0 authored Aug 18, 2024
1 parent dc760b8 commit a5f5bbd
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,8 @@
Background="{ThemeResource ApplicationPageBackgroundThemeBrush}">

<StackPanel x:Name="sp">
<Button x:Name="loadButton" Click="OnLoadButtonClick">Load</Button>
<Button x:Name="unloadButton" Click="OnUnloadButtonClick">Unload</Button>

<Button x:Name="reloadButton" Click="OnReload">Reload</Button>
<TextBlock x:Name="testStatus" Text="Not Run" />
<utu:ShadowContainer x:Name="shadowContainer">
<utu:ShadowContainer.Shadows>
<utu:ShadowCollection>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
using Microsoft.UI.Xaml.Input;
using Microsoft.UI.Xaml.Media;
using Microsoft.UI.Xaml.Navigation;
using System.Threading.Tasks;

namespace Uno.Toolkit.Samples.Content.TestPages
{
Expand All @@ -31,14 +32,21 @@ public ShadowContainerTestPage2()
this.InitializeComponent();
}

private void OnLoadButtonClick(object sender, RoutedEventArgs e)
private void OnReload(object sender, RoutedEventArgs e)
{
sp.Children.Add(shadowContainer);
}
testStatus.Text = "Running test...";

private void OnUnloadButtonClick(object sender, RoutedEventArgs e)
{
sp.Children.Remove(shadowContainer);
try
{
sp.Children.Remove(shadowContainer);
sp.Children.Add(shadowContainer);
sp.Children.Remove(shadowContainer);
sp.Children.Add(shadowContainer);
}
finally
{
testStatus.Text = "Completed";
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,10 @@ public void When_Unloaded_Then_Loaded()
{
using var screenshot1 = TakeScreenshot("initial");

var loadButton = App.MarkedAnywhere("loadButton");
var unloadButton = App.MarkedAnywhere("unloadButton");
var testStatus = App.MarkedAnywhere("testStatus");
var loadButton = App.MarkedAnywhere("reloadButton").FastTap();

unloadButton.FastTap();
App.Wait(TimeSpan.FromSeconds(0.25));
loadButton.FastTap();
App.Wait(TimeSpan.FromSeconds(0.25));
unloadButton.FastTap();
App.Wait(TimeSpan.FromSeconds(0.25));
loadButton.FastTap();
App.Wait(TimeSpan.FromSeconds(0.25));
App.WaitForDependencyPropertyValue(testStatus, "Text", "Completed");

using var screenshot2 = TakeScreenshot("reloaded");

Expand Down

0 comments on commit a5f5bbd

Please sign in to comment.