Skip to content

Commit

Permalink
Merge pull request #357 from Lombiq/issue/WALMA-144
Browse files Browse the repository at this point in the history
WALMA-144: Fixing PermissionExistsAsync parallelization problem
  • Loading branch information
dministro authored Apr 27, 2024
2 parents 43eba31 + b2110c9 commit f109d4d
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions Lombiq.Tests.UI/Extensions/ShortcutsUITestContextExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -646,10 +646,19 @@ 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)
{
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

0 comments on commit f109d4d

Please sign in to comment.