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

fix: flaky test #1225

Merged
merged 1 commit into from
Aug 18, 2024
Merged
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 @@ -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
Loading