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

LMBQ-453: Fixing casing in TestMediaOperationsAsync(), adding the option to set don't check frontend in TestBasicOrchardFeaturesExceptSetupAsync(), DRY-ing MediaOperationsTestingUITestContextExtensions.cs #461

Merged
merged 12 commits into from
Feb 18, 2025
Merged
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public static async Task TestBasicOrchardFeaturesAsync(
Func<UITestContext, Task> customPageHeaderCheckAsync = null)
{
await context.TestSetupWithInvalidAndValidDataAsync(setupParameters);
await context.TestBasicOrchardFeaturesExceptSetupAsync(customPageHeaderCheckAsync);
await context.TestBasicOrchardFeaturesExceptSetupAsync(customPageHeaderCheckAsync: customPageHeaderCheckAsync);
}

/// <summary>
Expand Down Expand Up @@ -128,24 +128,40 @@ public static async Task TestBasicOrchardFeaturesExceptRegistrationAsync(
/// The custom page header check logic to locate and/or check the header's text. This ultimately gets passed to
/// TestContentOperationsAsync().
/// </param>
/// <param name="dontCheckFrontend">Boolean to decide whether to check content on frontend.</param>>
/// <returns>The same <see cref="UITestContext"/> instance.</returns>
public static async Task TestBasicOrchardFeaturesExceptSetupAsync(
this UITestContext context,
bool dontCheckFrontend,
Func<UITestContext, Task> customPageHeaderCheckAsync = null)
{
await context.TestRegistrationWithInvalidDataAsync();
await context.TestRegistrationAsync();
await context.TestRegistrationWithAlreadyRegisteredEmailAsync();
await context.TestLoginWithInvalidDataAsync();
await context.TestLoginAsync();
await context.TestContentOperationsAsync(customPageHeaderCheckAsync: customPageHeaderCheckAsync);
await context.TestContentOperationsAsync(dontCheckFrontend: dontCheckFrontend, customPageHeaderCheckAsync: customPageHeaderCheckAsync);
await context.TestTurningFeatureOnAndOffAsync();
await context.TestMediaOperationsAsync();
await context.TestAuditTrailAsync();
await context.TestWorkflowsAsync();
await context.TestLogoutAsync();
}

/// <summary>
/// <para>Tests all the basic Orchard features except for setup.</para>
/// <para>The test method assumes that the site is set up.</para>
/// </summary>
/// <param name="customPageHeaderCheckAsync">
/// The custom page header check logic to locate and/or check the header's text. This ultimately gets passed to
/// TestContentOperationsAsync().
/// </param>
/// <returns>The same <see cref="UITestContext"/> instance.</returns>
public static Task TestBasicOrchardFeaturesExceptSetupAsync(
this UITestContext context,
Func<UITestContext, Task> customPageHeaderCheckAsync = null) =>
context.TestBasicOrchardFeaturesExceptSetupAsync(dontCheckFrontend: false, customPageHeaderCheckAsync: customPageHeaderCheckAsync);

/// <summary>
/// <para>Tests all the basic Orchard features except for setup and registration.</para>
/// <para>The test method assumes that the site is set up.</para>
Expand All @@ -170,6 +186,7 @@ public static async Task TestBasicOrchardFeaturesExceptSetupAndRegistrationAsync
await context.TestLoginAsync();
await context.TestContentOperationsAsync(dontCheckFrontend, customPageHeaderCheckAsync: customPageHeaderCheckAsync);
await context.TestTurningFeatureOnAndOffAsync();
await context.TestMediaOperationsAsync();
await context.TestAuditTrailAsync();
await context.TestWorkflowsAsync();
await context.TestLogoutAsync();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ await context
context.WaitForPageLoad();
await context.GoToAdminRelativeUrlAsync(mediaPath);

context.Missing(By.XPath("//span[text()=' Image.png ' and @class='break-word']"));
context.Missing(By.XPath($"//span[text()=' {imageName} ' and @class='break-word']"));

var deleteFolderButton =
context.Get(By.CssSelector("#folder-tree li.selected div.btn-group.folder-actions .svg-inline--fa.fa-trash"));
Expand Down
8 changes: 4 additions & 4 deletions Lombiq.Tests.UI/Helpers/FileUploadHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ public static class FileUploadHelper
{
private static readonly string BasePath = Path.Combine(Environment.CurrentDirectory, "SampleUploadFiles");

public static readonly string SamplePdfFileName = "Document.pdf";
public static readonly string SamplePngFileName = "Image.png";
public static readonly string SampleDocxFileName = "UploadingTestFileDOCX.docx";
public static readonly string SampleXlsxFileName = "UploadingTestFileXLSX.xlsx";
public static readonly string SamplePdfFileName = "document.pdf";
public static readonly string SamplePngFileName = "image.png";
public static readonly string SampleDocxFileName = "uploadingtestfiledocx.docx"; // #spell-check-ignore-line
public static readonly string SampleXlsxFileName = "uploadingtestfilexlsx.xlsx"; // #spell-check-ignore-line

public static readonly string SamplePdfPath = Path.Combine(BasePath, SamplePdfFileName);
public static readonly string SamplePngPath = Path.Combine(BasePath, SamplePngFileName);
Expand Down
Loading