Skip to content

Commit

Permalink
Daily test #1 (#1126)
Browse files Browse the repository at this point in the history
* Daily test #1

* More tests

* More tests

* More tests

* Retry tests.

* Fix rename.

* More tests

* PII permission and frontend fixes.

* Fix pager.

* Fix tests

* Make tests more stable.

* Improve tests.

* Improve tests.

* Tests

* Fix count update.
  • Loading branch information
SebastianStehle authored Sep 22, 2024
1 parent 9807037 commit ef2b4e2
Show file tree
Hide file tree
Showing 90 changed files with 1,220 additions and 362 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ jobs:
working-directory: './tools/e2e'

- name: Test - Run Playwright Tests
run: npx playwright test
run: npx playwright test --retries=3
working-directory: './tools/e2e'
env:
BASE__URL: http://localhost:8080
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ jobs:
working-directory: './tools/e2e'

- name: Test - Run Playwright Tests
run: npx playwright test
run: npx playwright test --retries=3
working-directory: './tools/e2e'
env:
BASE__URL: http://localhost:8080
Expand Down
3 changes: 3 additions & 0 deletions backend/i18n/frontend_en.json
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@
"clients.connectWizard.step0Title": "Setup client",
"clients.connectWizard.step1Title": "Choose connection method",
"clients.connectWizard.step2Title": "Connect",
"clients.copyClientId": "Copy Client ID",
"clients.copyClientSecret": "Copy Client Secret",
"clients.deleteConfirmText": "Do you really want to revoke the client?",
"clients.deleteConfirmTitle": "Revoke client",
"clients.empty": "No client created yet.",
Expand All @@ -194,6 +196,7 @@
"comments.follow": "Follow",
"comments.title": "Comments",
"common.actions": "Actions",
"common.add": "Add",
"common.administration": "Administration",
"common.administrationPageTitle": "Administration",
"common.api": "API",
Expand Down
3 changes: 3 additions & 0 deletions backend/i18n/frontend_fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@
"clients.connectWizard.step0Title": "Configurer le client",
"clients.connectWizard.step1Title": "Choisissez la méthode de connexion",
"clients.connectWizard.step2Title": "Connecter",
"clients.copyClientId": "Copy Client ID",
"clients.copyClientSecret": "Copy Client Secret",
"clients.deleteConfirmText": "Voulez-vous vraiment révoquer le client\u00A0?",
"clients.deleteConfirmTitle": "Révoquer le client",
"clients.empty": "Aucun client créé pour le moment.",
Expand All @@ -194,6 +196,7 @@
"comments.follow": "Suivre",
"comments.title": "commentaires",
"common.actions": "Actions",
"common.add": "Add",
"common.administration": "Administration",
"common.administrationPageTitle": "Administration",
"common.api": "API",
Expand Down
3 changes: 3 additions & 0 deletions backend/i18n/frontend_it.json
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@
"clients.connectWizard.step0Title": "Setup client",
"clients.connectWizard.step1Title": "Scegli la tipologia di connessione",
"clients.connectWizard.step2Title": "Collega",
"clients.copyClientId": "Copy Client ID",
"clients.copyClientSecret": "Copy Client Secret",
"clients.deleteConfirmText": "Sei sicuro di voler rimuovere il client?",
"clients.deleteConfirmTitle": "Rimuovere il client",
"clients.empty": "Nessun client ancora creato.",
Expand All @@ -194,6 +196,7 @@
"comments.follow": "Segui",
"comments.title": "Commenti",
"common.actions": "Azioni",
"common.add": "Add",
"common.administration": "Amministrazione",
"common.administrationPageTitle": "Amministrazione",
"common.api": "API",
Expand Down
3 changes: 3 additions & 0 deletions backend/i18n/frontend_nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@
"clients.connectWizard.step0Title": "Client instellen",
"clients.connectWizard.step1Title": "Kies verbindingsmethode",
"clients.connectWizard.step2Title": "Verbinden",
"clients.copyClientId": "Copy Client ID",
"clients.copyClientSecret": "Copy Client Secret",
"clients.deleteConfirmText": "Wil je de client echt intrekken?",
"clients.deleteConfirmTitle": "Client intrekken",
"clients.empty": "Nog geen client aangemaakt.",
Expand All @@ -194,6 +196,7 @@
"comments.follow": "Volgen",
"comments.title": "Reacties",
"common.actions": "Acties",
"common.add": "Add",
"common.administration": "Administratie",
"common.administrationPageTitle": "Administratie",
"common.api": "API",
Expand Down
3 changes: 3 additions & 0 deletions backend/i18n/frontend_pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@
"clients.connectWizard.step0Title": "Cliente de configuração",
"clients.connectWizard.step1Title": "Escolha o método de ligação",
"clients.connectWizard.step2Title": "Ligar",
"clients.copyClientId": "Copy Client ID",
"clients.copyClientSecret": "Copy Client Secret",
"clients.deleteConfirmText": "Quer mesmo revogar o cliente?",
"clients.deleteConfirmTitle": "Revogar cliente",
"clients.empty": "Nenhum cliente foi criado ainda.",
Expand All @@ -194,6 +196,7 @@
"comments.follow": "Seguir",
"comments.title": "Comentários",
"common.actions": "Ações",
"common.add": "Add",
"common.administration": "Administração",
"common.administrationPageTitle": "Administração",
"common.api": "API",
Expand Down
3 changes: 3 additions & 0 deletions backend/i18n/frontend_zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@
"clients.connectWizard.step0Title": "设置客户端",
"clients.connectWizard.step1Title": "选择连接方式",
"clients.connectWizard.step2Title": "连接",
"clients.copyClientId": "Copy Client ID",
"clients.copyClientSecret": "Copy Client Secret",
"clients.deleteConfirmText": "你真的要撤销客户端吗?",
"clients.deleteConfirmTitle": "撤销客户端",
"clients.empty": "尚未创建客户端。",
Expand All @@ -194,6 +196,7 @@
"comments.follow": "关注",
"comments.title": "评论",
"common.actions": "动作",
"common.add": "Add",
"common.administration": "管理",
"common.administrationPageTitle": "管理",
"common.api": "API",
Expand Down
3 changes: 3 additions & 0 deletions backend/i18n/source/frontend_en.json
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,8 @@
"clients.connectWizard.step0Title": "Setup client",
"clients.connectWizard.step1Title": "Choose connection method",
"clients.connectWizard.step2Title": "Connect",
"clients.copyClientId": "Copy Client ID",
"clients.copyClientSecret": "Copy Client Secret",
"clients.deleteConfirmText": "Do you really want to revoke the client?",
"clients.deleteConfirmTitle": "Revoke client",
"clients.empty": "No client created yet.",
Expand All @@ -194,6 +196,7 @@
"comments.follow": "Follow",
"comments.title": "Comments",
"common.actions": "Actions",
"common.add": "Add",
"common.administration": "Administration",
"common.administrationPageTitle": "Administration",
"common.api": "API",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,9 @@ private async Task<long> RefreshTotalAsync(string key, long cachedCount, Func<Ca

await Collection.UpdateOneAsync(x => x.Key == key,
Update
.Set(x => x.Key, key)
.SetOnInsert(x => x.Count, actualCount)
.SetOnInsert(x => x.Created, now),
.SetOnInsert(x => x.Key, key)
.Set(x => x.Count, actualCount)
.Set(x => x.Created, now),
Upsert, ct);

return actualCount;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using Squidex.Domain.Apps.Entities.Contents.GraphQL.Cache;
using Squidex.Domain.Apps.Entities.Contents.Queries;
using Squidex.Infrastructure;
using Squidex.Shared;
using Squidex.Shared.Users;

namespace Squidex.Domain.Apps.Entities.Contents.GraphQL;
Expand All @@ -28,6 +29,8 @@ public sealed class GraphQLExecutionContext : QueryExecutionContext

public override Context Context { get; }

public bool CanExposePII { get; }

public GraphQLExecutionContext(
IDataLoaderContextAccessor dataLoaders,
IAssetQueryService assetQuery,
Expand Down Expand Up @@ -58,6 +61,8 @@ public GraphQLExecutionContext(
{
batchSize = Math.Max(MinBatchSize, Math.Min(MaxBatchSize, batchSize));
}

CanExposePII = Context.UserPermissions.Allows(PermissionIds.ForApp(PermissionIds.AppPii, context.App.Name));
}

public async ValueTask<IUser?> FindUserAsync(RefToken refToken,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,15 +35,15 @@ public UserGraphType()
AddField(new FieldType
{
Name = "displayName",
Resolver = Resolve(x => x.Claims.DisplayName()),
Resolver = ResolveOrHide(x => x.Claims.DisplayName()),
ResolvedType = Scalars.String,
Description = FieldDescriptions.UserDisplayName
});

AddField(new FieldType
{
Name = "email",
Resolver = Resolve(x => x.Email),
Resolver = ResolveOrHide(x => x.Email),
ResolvedType = Scalars.String,
Description = FieldDescriptions.UserEmail
});
Expand All @@ -55,4 +55,17 @@ private static IFieldResolver Resolve<T>(Func<IUser, T> resolver)
{
return Resolvers.Sync(resolver);
}

private static IFieldResolver ResolveOrHide(Func<IUser, string?> resolver)
{
return Resolvers.Sync<IUser, string?>((source, _, context) =>
{
if (context.CanExposePII)
{
return resolver(source);
}
return "Hidden";
});
}
}
3 changes: 3 additions & 0 deletions backend/src/Squidex.Shared/PermissionIds.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ public static class PermissionIds
// App Usage
public const string AppUsage = "squidex.apps.{app}.usage";

// App Expose Users
public const string AppPii = "squidex.apps.{app}.pii";

// App Comments
public const string AppComments = "squidex.apps.{app}.comments";
public const string AppCommentsRead = "squidex.apps.{app}.comments.read";
Expand Down
2 changes: 1 addition & 1 deletion backend/src/Squidex/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@
"hideDateTimeModeButton": false,

// Show the exposed values as information on the apps overview page.
"showInfo": false,
"showInfo": true,

// The number of content items for dropdown selector.
"referencesDropdownItemCount": 100
Expand Down
2 changes: 1 addition & 1 deletion backend/src/Squidex/wwwroot/editor/squidex-editor.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit ef2b4e2

Please sign in to comment.