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

WALMA-144: Fixing PermissionExistsAsync parallelization problem #357

Merged
merged 9 commits into from
Apr 27, 2024
16 changes: 12 additions & 4 deletions Lombiq.Tests.UI/Extensions/ShortcutsUITestContextExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -646,10 +646,18 @@ private static bool IsAdminTheme(IManifestInfo manifest) =>
manifest.Tags.Any(tag => tag.EqualsOrdinalIgnoreCase(value: ManifestConstants.AdminTag));

private static async Task<bool> PermissionExistsAsync(
IEnumerable<IPermissionProvider> permissionProviders, string permissionName) =>
(await Task.WhenAll(permissionProviders.Select(provider => provider.GetPermissionsAsync())))
.SelectMany(permissions => permissions)
.Any(permission => permission.Name == permissionName);
IEnumerable<IPermissionProvider> permissionProviders, string permissionName)
DemeSzabolcs marked this conversation as resolved.
Show resolved Hide resolved
{
var permissions = permissionProviders.ToAsyncEnumerable();
await foreach (var provider in permissions)
{
var providerPermissions = await provider.GetPermissionsAsync();
if (providerPermissions.Any(permission => permission.Name == permissionName))
return true;
}

return false;
}

private static Task UsingScopeAsync(
UITestContext context,
Expand Down