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

NEST-282: Adding extension method #200

Merged
merged 6 commits into from
Sep 28, 2022
Merged
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
42 changes: 42 additions & 0 deletions Lombiq.Tests.UI/Extensions/TenantsUITestContextExtensions.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using Lombiq.Tests.UI.Services;
using OpenQA.Selenium;
using System.Threading.Tasks;

namespace Lombiq.Tests.UI.Extensions;

public static class TenantsUITestContextExtensions
{
public static async Task CreateNewTenantManuallyAsync(
this UITestContext context,
string name,
string urlPrefix = "",
string urlHost = "",
string featureProfile = "",
bool navigate = true)
{
if (navigate)
{
await context.GoToRelativeUrlAsync("/admin/tenants");
}

await context.ClickReliablyOnAsync(By.LinkText("Add Tenant"));
await context.ClickAndFillInWithRetriesAsync(By.Id("Name"), name);

if (!string.IsNullOrEmpty(urlPrefix))
{
await context.ClickAndFillInWithRetriesAsync(By.Id("RequestUrlPrefix"), urlPrefix);
}

if (!string.IsNullOrEmpty(urlHost))
{
await context.ClickAndFillInWithRetriesAsync(By.Id("RequestUrlHost"), urlHost);
}

if (!string.IsNullOrEmpty(featureProfile))
{
await context.SetDropdownByTextAsync("FeatureProfile", featureProfile);
}

await context.ClickReliablyOnAsync(By.XPath("//button[contains(., 'Create')]"));
}
}