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

OSOE-661: UI test is flaky, randomly failing with "stale element not found" in Lombiq.BaseTheme #82

Merged
merged 11 commits into from
Jul 25, 2023
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,8 @@ public static async Task TestBaseThemeSiteSettingsAsync(
await context.GoToAdminRelativeUrlAsync("/Lombiq.BaseTheme/Admin/Index");
await context.SetCheckboxValueAsync(By.Id("HideMenu"), isChecked: true);

var byDeleteButton = By.CssSelector("#Editor .delete-button").OfAnyVisibility();
while (context.Exists(byDeleteButton.Safely())) await context.ClickReliablyOnAsync(byDeleteButton);
await context.ClickReliablyOnAsync(By.XPath("//div[contains(@class, 'thumb-container')]"));
await context.ClickReliablyOnAsync(By.CssSelector("#Editor .delete-button").OfAnyVisibility());

selectFromMediaLibraryAsync ??= async () =>
{
Expand All @@ -109,6 +109,9 @@ await context.ClickReliablyOnAsync(By.XPath(
};
byIcon ??= By.CssSelector("head link[href*='/media/Icons/oc-favicon.ico'][rel='shortcut icon'][type='image/x-icon']");

// We are saving the settings, so we leave some time for the editor button to appear, without using
// Task.Delay().
await context.ClickReliablyOnSubmitAsync();
await context.ClickReliablyOnAsync(By.CssSelector("#Editor .btn-group .btn-secondary:not([disabled]):not(.disabled)"));
await selectFromMediaLibraryAsync();

Expand Down