57 lines
2.1 KiB
C#
57 lines
2.1 KiB
C#
using JdeScoping.Ui.Tests.Helpers;
|
|
|
|
namespace JdeScoping.Ui.Tests.Support;
|
|
|
|
public abstract class SearchFlowTestBase(PlaywrightFixture fixture) : UiTestBase(fixture)
|
|
{
|
|
private static bool StrictMode =>
|
|
string.Equals(Environment.GetEnvironmentVariable("JDESCOPING_UI_STRICT"), "true", StringComparison.OrdinalIgnoreCase);
|
|
|
|
protected Task RunSearchSubmissionAsync(
|
|
string searchType,
|
|
string testName,
|
|
string? minDate = null,
|
|
string? maxDate = null,
|
|
(string PanelHeader, string Value)[]? autocompleteItems = null,
|
|
(string PanelHeader, string FileName)[]? uploads = null)
|
|
{
|
|
return RunAsync(async page =>
|
|
{
|
|
await UiNavigationHelper.NavigateToSearchPageAsync(page);
|
|
await UiSearchFormHelper.EnterSearchNameAsync(page, testName);
|
|
await UiSearchFormHelper.SelectSearchTypeAsync(page, searchType);
|
|
await Assertions.Expect(page.Locator(".rz-dropdown-label").First).ToContainTextAsync(searchType);
|
|
|
|
if (!StrictMode)
|
|
{
|
|
// Default mode is smoke-only against local docker where source systems can be offline.
|
|
return;
|
|
}
|
|
|
|
if (!string.IsNullOrWhiteSpace(minDate) && !string.IsNullOrWhiteSpace(maxDate))
|
|
{
|
|
await UiSearchFormHelper.SetDateRangeAsync(page, minDate, maxDate);
|
|
}
|
|
|
|
if (autocompleteItems is not null)
|
|
{
|
|
foreach (var item in autocompleteItems)
|
|
{
|
|
await UiSearchFormHelper.AddAutocompleteItemAsync(page, item.PanelHeader, item.Value);
|
|
}
|
|
}
|
|
|
|
if (uploads is not null)
|
|
{
|
|
foreach (var upload in uploads)
|
|
{
|
|
await UiSearchFormHelper.UploadFileAsync(page, upload.PanelHeader, TestDataPaths.Get(upload.FileName));
|
|
}
|
|
}
|
|
|
|
await UiSearchFormHelper.SubmitSearchAsync(page);
|
|
await UiSearchFormHelper.AssertNoErrorNotificationAsync(page);
|
|
});
|
|
}
|
|
}
|