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-835: Add GetTenantOptionsAsync() #366

Merged
merged 4 commits into from
May 18, 2024
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
23 changes: 23 additions & 0 deletions Lombiq.Tests.UI/Extensions/ShortcutsUITestContextExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using OpenQA.Selenium;
using OrchardCore.Abstractions.Setup;
using OrchardCore.Admin;
Expand Down Expand Up @@ -602,6 +603,28 @@ await UsingScopeAsync(
return eventUrl;
}

/// <summary>
/// Retrieves the options of the given type from the current tenant's shell scope.
/// </summary>
public static async Task<IOptions<T>> GetTenantOptionsAsync<T>(
this UITestContext context,
string tenant = null,
bool activateShell = true)
where T : class
{
IOptions<T> options = null;
await UsingScopeAsync(
context,
serviceProvider =>
{
options = serviceProvider.GetRequiredService<IOptions<T>>();
return Task.CompletedTask;
},
tenant,
activateShell);
return options;
}

/// <summary>
/// Switches to an interactive mode where control from the test is handed over and you can use the web app as an
/// ordinary user from the browser or access its web APIs. To switch back to the test, click the button
Expand Down
Loading