From 79f75e4aaae5e330b21fe6a5cf3bd0f951c44b4d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Tue, 25 Apr 2023 20:24:17 +0200 Subject: [PATCH 01/23] Upgrading to OC 1.6 --- .../Lombiq.BaseTheme.Samples.csproj | 6 +++--- .../Lombiq.BaseTheme.Tests.UI.csproj | 2 +- Lombiq.BaseTheme/Lombiq.BaseTheme.csproj | 14 +++++++------- Lombiq.BaseTheme/pnpm-lock.yaml | 2 +- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/Lombiq.BaseTheme.Samples/Lombiq.BaseTheme.Samples.csproj b/Lombiq.BaseTheme.Samples/Lombiq.BaseTheme.Samples.csproj index 059542e..90d6f9a 100644 --- a/Lombiq.BaseTheme.Samples/Lombiq.BaseTheme.Samples.csproj +++ b/Lombiq.BaseTheme.Samples/Lombiq.BaseTheme.Samples.csproj @@ -26,8 +26,8 @@ - - + + @@ -39,7 +39,7 @@ - + diff --git a/Lombiq.BaseTheme.Tests.UI/Lombiq.BaseTheme.Tests.UI.csproj b/Lombiq.BaseTheme.Tests.UI/Lombiq.BaseTheme.Tests.UI.csproj index 30c42a6..43b8a6a 100644 --- a/Lombiq.BaseTheme.Tests.UI/Lombiq.BaseTheme.Tests.UI.csproj +++ b/Lombiq.BaseTheme.Tests.UI/Lombiq.BaseTheme.Tests.UI.csproj @@ -25,7 +25,7 @@ - + diff --git a/Lombiq.BaseTheme/Lombiq.BaseTheme.csproj b/Lombiq.BaseTheme/Lombiq.BaseTheme.csproj index 7a7f146..4e1f765 100644 --- a/Lombiq.BaseTheme/Lombiq.BaseTheme.csproj +++ b/Lombiq.BaseTheme/Lombiq.BaseTheme.csproj @@ -32,10 +32,10 @@ - - - - + + + + @@ -45,9 +45,9 @@ - - - + + + true diff --git a/Lombiq.BaseTheme/pnpm-lock.yaml b/Lombiq.BaseTheme/pnpm-lock.yaml index 9bfc284..3fd2faf 100644 --- a/Lombiq.BaseTheme/pnpm-lock.yaml +++ b/Lombiq.BaseTheme/pnpm-lock.yaml @@ -1,4 +1,4 @@ -lockfileVersion: 5.4 +lockfileVersion: 5.3 specifiers: bootstrap: 5.2.3 From 855956ae8c5feef1e7877039ab9869eb599ee7f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Fri, 28 Apr 2023 20:23:35 +0200 Subject: [PATCH 02/23] Reverting pnpm lock. --- Lombiq.BaseTheme/pnpm-lock.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lombiq.BaseTheme/pnpm-lock.yaml b/Lombiq.BaseTheme/pnpm-lock.yaml index 3fd2faf..9bfc284 100644 --- a/Lombiq.BaseTheme/pnpm-lock.yaml +++ b/Lombiq.BaseTheme/pnpm-lock.yaml @@ -1,4 +1,4 @@ -lockfileVersion: 5.3 +lockfileVersion: 5.4 specifiers: bootstrap: 5.2.3 From 420342332e06ac3bfd753c83fa4e8c5d743be768 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Fri, 12 May 2023 09:56:39 +0200 Subject: [PATCH 03/23] Removing AddDataMigration workaround. --- .../MigrationServiceCollectionExtensions.cs | 17 ----------------- Lombiq.BaseTheme/Startup.cs | 2 +- 2 files changed, 1 insertion(+), 18 deletions(-) delete mode 100644 Lombiq.BaseTheme/Extensions/MigrationServiceCollectionExtensions.cs diff --git a/Lombiq.BaseTheme/Extensions/MigrationServiceCollectionExtensions.cs b/Lombiq.BaseTheme/Extensions/MigrationServiceCollectionExtensions.cs deleted file mode 100644 index 8f450d9..0000000 --- a/Lombiq.BaseTheme/Extensions/MigrationServiceCollectionExtensions.cs +++ /dev/null @@ -1,17 +0,0 @@ -using Microsoft.Extensions.DependencyInjection; -using OrchardCore.Data.Migration; - -namespace Lombiq.BaseTheme.Extensions; - -// We need to use this until the Orchard Core upgrade so we don't have to upgrade submodules to nightly versions. This -// is the same method as what is in the 1.6 nightly version of Orchard Core. During the upgrade, this can be removed and -// use the Orchard Core method for data migrations. - -/// -/// Provides extension methods for to add YesSql migration . -/// -public static class MigrationServiceCollectionExtensions -{ - public static IServiceCollection AddDataMigration(this IServiceCollection services) - where TDataMigration : class, IDataMigration => services.AddScoped(); -} diff --git a/Lombiq.BaseTheme/Startup.cs b/Lombiq.BaseTheme/Startup.cs index d48a1be..47326de 100644 --- a/Lombiq.BaseTheme/Startup.cs +++ b/Lombiq.BaseTheme/Startup.cs @@ -1,4 +1,3 @@ -using Lombiq.BaseTheme.Extensions; using Lombiq.BaseTheme.Middlewares; using Lombiq.BaseTheme.Migrations; using Lombiq.BaseTheme.Services; @@ -9,6 +8,7 @@ using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Options; +using OrchardCore.Data.Migration; using OrchardCore.Modules; using OrchardCore.ResourceManagement; using System; From e4600be3b879f9e484aee95cad2924a140001a84 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Sat, 20 May 2023 13:00:55 +0200 Subject: [PATCH 04/23] Upgrading Lombiq.ChartJs.Tests.UI package. --- Lombiq.BaseTheme.Tests.UI/Lombiq.BaseTheme.Tests.UI.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lombiq.BaseTheme.Tests.UI/Lombiq.BaseTheme.Tests.UI.csproj b/Lombiq.BaseTheme.Tests.UI/Lombiq.BaseTheme.Tests.UI.csproj index 43b8a6a..b854a41 100644 --- a/Lombiq.BaseTheme.Tests.UI/Lombiq.BaseTheme.Tests.UI.csproj +++ b/Lombiq.BaseTheme.Tests.UI/Lombiq.BaseTheme.Tests.UI.csproj @@ -25,7 +25,7 @@ - + From 3521876fddc93274bb9425f2a6b0668aa099595a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Mon, 22 May 2023 17:28:47 +0200 Subject: [PATCH 05/23] Updating to latest Lombiq alpha releases. --- Lombiq.BaseTheme.Samples/Lombiq.BaseTheme.Samples.csproj | 2 +- Lombiq.BaseTheme/Lombiq.BaseTheme.csproj | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Lombiq.BaseTheme.Samples/Lombiq.BaseTheme.Samples.csproj b/Lombiq.BaseTheme.Samples/Lombiq.BaseTheme.Samples.csproj index 226e216..af41085 100644 --- a/Lombiq.BaseTheme.Samples/Lombiq.BaseTheme.Samples.csproj +++ b/Lombiq.BaseTheme.Samples/Lombiq.BaseTheme.Samples.csproj @@ -39,7 +39,7 @@ - + diff --git a/Lombiq.BaseTheme/Lombiq.BaseTheme.csproj b/Lombiq.BaseTheme/Lombiq.BaseTheme.csproj index 53366d9..8d703df 100644 --- a/Lombiq.BaseTheme/Lombiq.BaseTheme.csproj +++ b/Lombiq.BaseTheme/Lombiq.BaseTheme.csproj @@ -45,9 +45,9 @@ - - - + + + true From 0b71f082ba6b25017d9f40e928382c95f5c7ff00 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Mon, 22 May 2023 18:03:49 +0200 Subject: [PATCH 06/23] Removing mistakenly included "v" from versions. --- Lombiq.BaseTheme.Samples/Lombiq.BaseTheme.Samples.csproj | 2 +- Lombiq.BaseTheme/Lombiq.BaseTheme.csproj | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Lombiq.BaseTheme.Samples/Lombiq.BaseTheme.Samples.csproj b/Lombiq.BaseTheme.Samples/Lombiq.BaseTheme.Samples.csproj index af41085..00d3ebb 100644 --- a/Lombiq.BaseTheme.Samples/Lombiq.BaseTheme.Samples.csproj +++ b/Lombiq.BaseTheme.Samples/Lombiq.BaseTheme.Samples.csproj @@ -39,7 +39,7 @@ - + diff --git a/Lombiq.BaseTheme/Lombiq.BaseTheme.csproj b/Lombiq.BaseTheme/Lombiq.BaseTheme.csproj index 8d703df..0a30592 100644 --- a/Lombiq.BaseTheme/Lombiq.BaseTheme.csproj +++ b/Lombiq.BaseTheme/Lombiq.BaseTheme.csproj @@ -45,9 +45,9 @@ - - - + + + true From 869a9b18e4f19d870615fbf46b885867067d570a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Roland=20M=C3=A1rkus?= Date: Mon, 22 May 2023 19:07:25 +0200 Subject: [PATCH 07/23] Updating to latest Lombiq.Tests.UI alpha release. --- Lombiq.BaseTheme.Tests.UI/Lombiq.BaseTheme.Tests.UI.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lombiq.BaseTheme.Tests.UI/Lombiq.BaseTheme.Tests.UI.csproj b/Lombiq.BaseTheme.Tests.UI/Lombiq.BaseTheme.Tests.UI.csproj index b854a41..2a9384d 100644 --- a/Lombiq.BaseTheme.Tests.UI/Lombiq.BaseTheme.Tests.UI.csproj +++ b/Lombiq.BaseTheme.Tests.UI/Lombiq.BaseTheme.Tests.UI.csproj @@ -25,7 +25,7 @@ - + From f9f51fce3bb864791ebdc73acb7c88092f1b88c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3zsef=20Horv=C3=A1th?= Date: Fri, 9 Jun 2023 17:44:10 +0200 Subject: [PATCH 08/23] Upgrading Lombiq.HelpfulLibraries.* package reference version Upgrading Lombiq.Tests.UI.* package reference version Upgrading Lombiq.HelpfulExtensions.* package reference version --- Lombiq.BaseTheme.Tests.UI/Lombiq.BaseTheme.Tests.UI.csproj | 2 +- Lombiq.BaseTheme/Lombiq.BaseTheme.csproj | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Lombiq.BaseTheme.Tests.UI/Lombiq.BaseTheme.Tests.UI.csproj b/Lombiq.BaseTheme.Tests.UI/Lombiq.BaseTheme.Tests.UI.csproj index 2a9384d..d43c1f6 100644 --- a/Lombiq.BaseTheme.Tests.UI/Lombiq.BaseTheme.Tests.UI.csproj +++ b/Lombiq.BaseTheme.Tests.UI/Lombiq.BaseTheme.Tests.UI.csproj @@ -25,7 +25,7 @@ - + diff --git a/Lombiq.BaseTheme/Lombiq.BaseTheme.csproj b/Lombiq.BaseTheme/Lombiq.BaseTheme.csproj index 0a30592..1d1b878 100644 --- a/Lombiq.BaseTheme/Lombiq.BaseTheme.csproj +++ b/Lombiq.BaseTheme/Lombiq.BaseTheme.csproj @@ -45,8 +45,8 @@ - - + + From 4d3070252dc42283a13ba67136322292a4e7ec30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Sun, 11 Jun 2023 20:19:12 +0200 Subject: [PATCH 09/23] Updating Lombiq.NodeJs.Extensions NuGet to latest alpha --- Lombiq.BaseTheme.Samples/Lombiq.BaseTheme.Samples.csproj | 2 +- Lombiq.BaseTheme/Lombiq.BaseTheme.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Lombiq.BaseTheme.Samples/Lombiq.BaseTheme.Samples.csproj b/Lombiq.BaseTheme.Samples/Lombiq.BaseTheme.Samples.csproj index 00d3ebb..2c200dd 100644 --- a/Lombiq.BaseTheme.Samples/Lombiq.BaseTheme.Samples.csproj +++ b/Lombiq.BaseTheme.Samples/Lombiq.BaseTheme.Samples.csproj @@ -39,7 +39,7 @@ - + diff --git a/Lombiq.BaseTheme/Lombiq.BaseTheme.csproj b/Lombiq.BaseTheme/Lombiq.BaseTheme.csproj index 1d1b878..a64e7fb 100644 --- a/Lombiq.BaseTheme/Lombiq.BaseTheme.csproj +++ b/Lombiq.BaseTheme/Lombiq.BaseTheme.csproj @@ -47,7 +47,7 @@ - + true From f2d609bd126536563e2df5e2bfadcaf0e8850b5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Fri, 16 Jun 2023 13:55:24 +0200 Subject: [PATCH 10/23] Updating Lombiq.HelpfulLibraries NuGet reference to latest alpha --- Lombiq.BaseTheme/Lombiq.BaseTheme.csproj | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Lombiq.BaseTheme/Lombiq.BaseTheme.csproj b/Lombiq.BaseTheme/Lombiq.BaseTheme.csproj index 3b90787..191b524 100644 --- a/Lombiq.BaseTheme/Lombiq.BaseTheme.csproj +++ b/Lombiq.BaseTheme/Lombiq.BaseTheme.csproj @@ -46,7 +46,7 @@ - + @@ -63,9 +63,7 @@ - + From 4fe6e1995b5b6e9fcbf1405497f572e0922b5438 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20El-Saig?= Date: Fri, 16 Jun 2023 15:42:25 +0200 Subject: [PATCH 11/23] Fix menu address pointing to admin. --- Lombiq.BaseTheme/Services/MainMenuNavigationProvider.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Lombiq.BaseTheme/Services/MainMenuNavigationProvider.cs b/Lombiq.BaseTheme/Services/MainMenuNavigationProvider.cs index 9f2816f..a345ceb 100644 --- a/Lombiq.BaseTheme/Services/MainMenuNavigationProvider.cs +++ b/Lombiq.BaseTheme/Services/MainMenuNavigationProvider.cs @@ -58,7 +58,9 @@ private async Task AddAsync(NavigationBuilder builder, ContentItem menuItem) if (menuItem.As() is { } linkMenuItemPart) { - builder.Add(text, menu => menu.Url(linkMenuItemPart.Url)); + var urlHelper = _urlHelperFactory.GetUrlHelper(_actionContextAccessor.ActionContext!); + var absoluteUri = urlHelper.Content(linkMenuItemPart.Url); + builder.Add(text, menu => menu.Url(absoluteUri)); } else if (menuItem.As() is { } contentMenuItemPart) { From 93d3228da66cd3abca86cb9089be5dc40ab42003 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20El-Saig?= Date: Fri, 16 Jun 2023 18:29:33 +0200 Subject: [PATCH 12/23] Add UI test. --- .../Services/MainMenuNavigationProvider.cs | 29 +++++++++++-------- 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/Lombiq.BaseTheme/Services/MainMenuNavigationProvider.cs b/Lombiq.BaseTheme/Services/MainMenuNavigationProvider.cs index a345ceb..0c28ea0 100644 --- a/Lombiq.BaseTheme/Services/MainMenuNavigationProvider.cs +++ b/Lombiq.BaseTheme/Services/MainMenuNavigationProvider.cs @@ -2,6 +2,7 @@ using AngleSharp.Html.Parser; using Lombiq.HelpfulLibraries.OrchardCore.Navigation; using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.Infrastructure; using Microsoft.AspNetCore.Mvc.Routing; using Microsoft.Extensions.Localization; @@ -9,6 +10,7 @@ using OrchardCore.ContentManagement; using OrchardCore.Menu.Models; using OrchardCore.Navigation; +using System; using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; @@ -19,8 +21,8 @@ public class MainMenuNavigationProvider : MainMenuNavigationProviderBase { private readonly IContentHandleManager _contentHandleManager; private readonly IContentManager _contentManager; - private readonly IUrlHelperFactory _urlHelperFactory; - private readonly IActionContextAccessor _actionContextAccessor; + + private readonly Lazy _urlHelperLazy; public MainMenuNavigationProvider( IHttpContextAccessor hca, @@ -33,8 +35,8 @@ public MainMenuNavigationProvider( { _contentHandleManager = contentHandleManager; _contentManager = contentManager; - _urlHelperFactory = urlHelperFactory; - _actionContextAccessor = actionContextAccessor; + + _urlHelperLazy = new(() => urlHelperFactory.GetUrlHelper(actionContextAccessor.ActionContext!)); } protected override async Task BuildAsync(NavigationBuilder builder) @@ -58,9 +60,7 @@ private async Task AddAsync(NavigationBuilder builder, ContentItem menuItem) if (menuItem.As() is { } linkMenuItemPart) { - var urlHelper = _urlHelperFactory.GetUrlHelper(_actionContextAccessor.ActionContext!); - var absoluteUri = urlHelper.Content(linkMenuItemPart.Url); - builder.Add(text, menu => menu.Url(absoluteUri)); + builder.Add(text, menu => menu.Url(GetUrl(linkMenuItemPart.Url))); } else if (menuItem.As() is { } contentMenuItemPart) { @@ -75,7 +75,9 @@ private async Task AddAsync(NavigationBuilder builder, ContentItem menuItem) { var nodeList = new HtmlParser().ParseFragment($"
{htmlMenuItemPart.Html}
", contextElement: null!); var textContent = string.Concat(nodeList.Select(x => x.Text())); - builder.Add(new LocalizedString(textContent, textContent), menu => menu.Url("#").LocalNav()); + var url = string.IsNullOrEmpty(htmlMenuItemPart.Url) ? "#" : GetUrl(htmlMenuItemPart.Url); + + builder.Add(new LocalizedString(textContent, textContent), menu => menu.Url(url).LocalNav()); } else if (menuItem.As() is { } menuItemsListPart) { @@ -87,13 +89,11 @@ await builder.AddAsync(text, menu => private async Task AddContentMenuItemPartAsync(NavigationBuilder builder, LocalizedString text, IEnumerable ids) { var contentItems = (await _contentManager.GetAsync(ids)).AsList(); - var urlHelper = _urlHelperFactory.GetUrlHelper(_actionContextAccessor.ActionContext!); - if (contentItems.Count == 1) { var contentItem = contentItems.Single(); if (string.IsNullOrEmpty(text.Value)) text = GetTitle(contentItem); - builder.Add(text, menu => menu.Url(urlHelper.DisplayContentItem(contentItem))); + builder.Add(text, menu => UseDisplayUrl(menu, contentItem)); } else { @@ -101,12 +101,17 @@ private async Task AddContentMenuItemPartAsync(NavigationBuilder builder, Locali { foreach (var contentItem in contentItems) { - menu.Add(GetTitle(contentItem), child => child.Url(urlHelper.DisplayContentItem(contentItem))); + menu.Add(GetTitle(contentItem), child => UseDisplayUrl(child, contentItem)); } }); } } + private string GetUrl(string contentPath) => _urlHelperLazy.Value.Content(contentPath); + + private void UseDisplayUrl(NavigationItemBuilder menu, IContent content) => + menu.Url(_urlHelperLazy.Value.DisplayContentItem(content)); + private static LocalizedString GetTitle(ContentItem contentItem) => new(contentItem.DisplayText, contentItem.DisplayText); } From 874cfd7dda943c69f8bcf571679f6923ae7187e4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20El-Saig?= Date: Sat, 17 Jun 2023 13:24:59 +0200 Subject: [PATCH 13/23] use string localizer --- Lombiq.BaseTheme/Services/MainMenuNavigationProvider.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lombiq.BaseTheme/Services/MainMenuNavigationProvider.cs b/Lombiq.BaseTheme/Services/MainMenuNavigationProvider.cs index 0c28ea0..6a9d7b4 100644 --- a/Lombiq.BaseTheme/Services/MainMenuNavigationProvider.cs +++ b/Lombiq.BaseTheme/Services/MainMenuNavigationProvider.cs @@ -77,7 +77,7 @@ private async Task AddAsync(NavigationBuilder builder, ContentItem menuItem) var textContent = string.Concat(nodeList.Select(x => x.Text())); var url = string.IsNullOrEmpty(htmlMenuItemPart.Url) ? "#" : GetUrl(htmlMenuItemPart.Url); - builder.Add(new LocalizedString(textContent, textContent), menu => menu.Url(url).LocalNav()); + builder.Add(T[textContent], menu => menu.Url(url).LocalNav()); } else if (menuItem.As() is { } menuItemsListPart) { From 6e741ffad6e12f54df7f5446bfc1d3109ad9d612 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20El-Saig?= Date: Sat, 17 Jun 2023 15:52:53 +0200 Subject: [PATCH 14/23] Extract base theme dependency verification. --- .../Extensions/TestCaseUITestContextExtensions.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Lombiq.BaseTheme.Tests.UI/Extensions/TestCaseUITestContextExtensions.cs b/Lombiq.BaseTheme.Tests.UI/Extensions/TestCaseUITestContextExtensions.cs index 78972bf..5f4c155 100644 --- a/Lombiq.BaseTheme.Tests.UI/Extensions/TestCaseUITestContextExtensions.cs +++ b/Lombiq.BaseTheme.Tests.UI/Extensions/TestCaseUITestContextExtensions.cs @@ -43,4 +43,11 @@ await context.DoWithRetriesOrFailAsync(() => await context.ClickMainMenuPathAsync("Log In"); context.Exists(By.XPath("//form[@action = '/Login']/*[starts-with(name(), 'h') and contains(., 'Log in')]")); } + + public static async Task BaseThemeDependencyShouldBeEnabled(this UITestContext context) + { + await context.GoToAdminRelativeUrlAsync("/Features"); + await context.ClickAndFillInWithRetriesAsync(By.Id("search-box"), "Helpful Widgets"); + context.Exists(By.Id("btn-disable-Lombiq_HelpfulExtensions_Widgets")); + } } From 98e1713235e21fee7448724fdd7b08efdb5af2e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20El-Saig?= Date: Sat, 17 Jun 2023 16:19:33 +0200 Subject: [PATCH 15/23] Add missing Async suffix. --- .../Extensions/TestCaseUITestContextExtensions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lombiq.BaseTheme.Tests.UI/Extensions/TestCaseUITestContextExtensions.cs b/Lombiq.BaseTheme.Tests.UI/Extensions/TestCaseUITestContextExtensions.cs index 5f4c155..6b510ce 100644 --- a/Lombiq.BaseTheme.Tests.UI/Extensions/TestCaseUITestContextExtensions.cs +++ b/Lombiq.BaseTheme.Tests.UI/Extensions/TestCaseUITestContextExtensions.cs @@ -44,7 +44,7 @@ await context.DoWithRetriesOrFailAsync(() => context.Exists(By.XPath("//form[@action = '/Login']/*[starts-with(name(), 'h') and contains(., 'Log in')]")); } - public static async Task BaseThemeDependencyShouldBeEnabled(this UITestContext context) + public static async Task BaseThemeDependencyShouldBeEnabledAsync(this UITestContext context) { await context.GoToAdminRelativeUrlAsync("/Features"); await context.ClickAndFillInWithRetriesAsync(By.Id("search-box"), "Helpful Widgets"); From 0e64106b89c5dba041d1bb026c4e48c4997a347e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20El-Saig?= Date: Sat, 17 Jun 2023 22:59:41 +0200 Subject: [PATCH 16/23] Code cleanup. --- .../TestCaseUITestContextExtensions.cs | 36 +++++++++++++++++-- 1 file changed, 34 insertions(+), 2 deletions(-) diff --git a/Lombiq.BaseTheme.Tests.UI/Extensions/TestCaseUITestContextExtensions.cs b/Lombiq.BaseTheme.Tests.UI/Extensions/TestCaseUITestContextExtensions.cs index 6b510ce..4355c62 100644 --- a/Lombiq.BaseTheme.Tests.UI/Extensions/TestCaseUITestContextExtensions.cs +++ b/Lombiq.BaseTheme.Tests.UI/Extensions/TestCaseUITestContextExtensions.cs @@ -44,10 +44,42 @@ await context.DoWithRetriesOrFailAsync(() => context.Exists(By.XPath("//form[@action = '/Login']/*[starts-with(name(), 'h') and contains(., 'Log in')]")); } - public static async Task BaseThemeDependencyShouldBeEnabledAsync(this UITestContext context) + public static async Task TestBaseThemeDependencyIsEnabledAsync(this UITestContext context) { await context.GoToAdminRelativeUrlAsync("/Features"); - await context.ClickAndFillInWithRetriesAsync(By.Id("search-box"), "Helpful Widgets"); context.Exists(By.Id("btn-disable-Lombiq_HelpfulExtensions_Widgets")); } + + public static void TestBlogRecipeMenuItemsAddedToMainMenu(this UITestContext context) + { + context.Get(By.CssSelector(".menuWidget__content .nav-link[href='/']")).Text.Trim().ShouldBe("Home"); + context.Get(By.CssSelector(".menuWidget__content .nav-link[href='/about']")).Text.Trim().ShouldBe("About"); + } + + public static async Task TestAddingMenuItemToBlogMainMenu(this UITestContext context) + { + await context.GoToAdminRelativeUrlAsync("/Contents/ContentItems/Menu"); + await context.ClickReliablyOnAsync(By.ClassName("edit")); + + await context.ClickReliablyOnAsync(By.XPath("//button[contains(., 'Add Menu Item')]")); + await context.ClickReliablyOnAsync(By.XPath( + "//div[contains(@class, 'card') and .//h4[contains(., 'Content Menu Item')]]//div[contains(@class, 'card-footer')]//a")); + await context.ClickAndFillInWithRetriesAsync(By.Id("ContentMenuItemPart_Name"), "My Content"); + + await context.SetContentPickerByDisplayTextAsync( + "ContentMenuItemPart", + "SelectedContentItem", + "Man must explore, and this is exploration at its greatest"); + + await context.ClickPublishAsync(); + await context.ClickPublishAsync(); + context.ShouldBeSuccess(); + + await context.GoToHomePageAsync(); + context + .Get(By.XPath("id('navigation')//li[contains(@class, 'menuWidget__topLevel')]/a[@href='/blog/post-1']")) + .Text + .Trim() + .ShouldBe("My Content"); + } } From deba7119fcfe4ded5df6517db9106613c9988047 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20El-Saig?= Date: Sat, 17 Jun 2023 23:08:47 +0200 Subject: [PATCH 17/23] Add missing async suffix. --- .../Extensions/TestCaseUITestContextExtensions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lombiq.BaseTheme.Tests.UI/Extensions/TestCaseUITestContextExtensions.cs b/Lombiq.BaseTheme.Tests.UI/Extensions/TestCaseUITestContextExtensions.cs index 4355c62..486aa99 100644 --- a/Lombiq.BaseTheme.Tests.UI/Extensions/TestCaseUITestContextExtensions.cs +++ b/Lombiq.BaseTheme.Tests.UI/Extensions/TestCaseUITestContextExtensions.cs @@ -56,7 +56,7 @@ public static void TestBlogRecipeMenuItemsAddedToMainMenu(this UITestContext con context.Get(By.CssSelector(".menuWidget__content .nav-link[href='/about']")).Text.Trim().ShouldBe("About"); } - public static async Task TestAddingMenuItemToBlogMainMenu(this UITestContext context) + public static async Task TestAddingMenuItemToBlogMainMenuAsync(this UITestContext context) { await context.GoToAdminRelativeUrlAsync("/Contents/ContentItems/Menu"); await context.ClickReliablyOnAsync(By.ClassName("edit")); From 6fe9ab64d75071f3485c9dbb5e1f53ff90c9f6ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20El-Saig?= Date: Sun, 18 Jun 2023 17:02:20 +0200 Subject: [PATCH 18/23] Add comment. --- .../Extensions/TestCaseUITestContextExtensions.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Lombiq.BaseTheme.Tests.UI/Extensions/TestCaseUITestContextExtensions.cs b/Lombiq.BaseTheme.Tests.UI/Extensions/TestCaseUITestContextExtensions.cs index 486aa99..a7abbab 100644 --- a/Lombiq.BaseTheme.Tests.UI/Extensions/TestCaseUITestContextExtensions.cs +++ b/Lombiq.BaseTheme.Tests.UI/Extensions/TestCaseUITestContextExtensions.cs @@ -58,6 +58,9 @@ public static void TestBlogRecipeMenuItemsAddedToMainMenu(this UITestContext con public static async Task TestAddingMenuItemToBlogMainMenuAsync(this UITestContext context) { + // The menu item has to be added through the admin by editing the menu like this because it can't be added through a recipe. The setup recipe + // in OSOCE executes the Blog recipe which already creates a menu with the "main-menu" alias. As it uses a random UUID for Content Item ID, it + // can't be updated from another recipe (if attempted the setup will throw "ValidationException: Your alias is already in use." exception). await context.GoToAdminRelativeUrlAsync("/Contents/ContentItems/Menu"); await context.ClickReliablyOnAsync(By.ClassName("edit")); From ec6b1226624c43796b6e0da61cc5454ecda6c3f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Sun, 18 Jun 2023 20:53:47 +0200 Subject: [PATCH 19/23] Code styling --- .../Extensions/TestCaseUITestContextExtensions.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Lombiq.BaseTheme.Tests.UI/Extensions/TestCaseUITestContextExtensions.cs b/Lombiq.BaseTheme.Tests.UI/Extensions/TestCaseUITestContextExtensions.cs index a7abbab..8f85a29 100644 --- a/Lombiq.BaseTheme.Tests.UI/Extensions/TestCaseUITestContextExtensions.cs +++ b/Lombiq.BaseTheme.Tests.UI/Extensions/TestCaseUITestContextExtensions.cs @@ -58,9 +58,10 @@ public static void TestBlogRecipeMenuItemsAddedToMainMenu(this UITestContext con public static async Task TestAddingMenuItemToBlogMainMenuAsync(this UITestContext context) { - // The menu item has to be added through the admin by editing the menu like this because it can't be added through a recipe. The setup recipe - // in OSOCE executes the Blog recipe which already creates a menu with the "main-menu" alias. As it uses a random UUID for Content Item ID, it - // can't be updated from another recipe (if attempted the setup will throw "ValidationException: Your alias is already in use." exception). + // The menu item has to be added through the admin by editing the menu like this because it can't be added + // through a recipe. The setup recipe in OSOCE executes the Blog recipe which already creates a menu with the + // "main-menu" alias. As it uses a random UUID for Content Item ID, it can't be updated from another recipe (if + // attempted the setup will throw "ValidationException: Your alias is already in use." exception). await context.GoToAdminRelativeUrlAsync("/Contents/ContentItems/Menu"); await context.ClickReliablyOnAsync(By.ClassName("edit")); From 9dc48bfe6c19f910793dc366633360e2fdb02af8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Sun, 18 Jun 2023 20:56:40 +0200 Subject: [PATCH 20/23] Adding link to GitHub issue --- .../Extensions/TestCaseUITestContextExtensions.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Lombiq.BaseTheme.Tests.UI/Extensions/TestCaseUITestContextExtensions.cs b/Lombiq.BaseTheme.Tests.UI/Extensions/TestCaseUITestContextExtensions.cs index 8f85a29..b7e4ce9 100644 --- a/Lombiq.BaseTheme.Tests.UI/Extensions/TestCaseUITestContextExtensions.cs +++ b/Lombiq.BaseTheme.Tests.UI/Extensions/TestCaseUITestContextExtensions.cs @@ -62,6 +62,7 @@ public static async Task TestAddingMenuItemToBlogMainMenuAsync(this UITestContex // through a recipe. The setup recipe in OSOCE executes the Blog recipe which already creates a menu with the // "main-menu" alias. As it uses a random UUID for Content Item ID, it can't be updated from another recipe (if // attempted the setup will throw "ValidationException: Your alias is already in use." exception). + // See https://github.com/Lombiq/Helpful-Libraries/issues/199 for a possible solution. await context.GoToAdminRelativeUrlAsync("/Contents/ContentItems/Menu"); await context.ClickReliablyOnAsync(By.ClassName("edit")); From e0b25c13df4802bee525d8140a1f0be8a5395134 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Sun, 18 Jun 2023 21:29:13 +0200 Subject: [PATCH 21/23] Updating newly added OC package to 1.6 --- Lombiq.BaseTheme/Lombiq.BaseTheme.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lombiq.BaseTheme/Lombiq.BaseTheme.csproj b/Lombiq.BaseTheme/Lombiq.BaseTheme.csproj index 191b524..0d897f5 100644 --- a/Lombiq.BaseTheme/Lombiq.BaseTheme.csproj +++ b/Lombiq.BaseTheme/Lombiq.BaseTheme.csproj @@ -33,7 +33,7 @@ - + From ace7090677aadf37d8154ef0f067bb4224788192 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Sun, 18 Jun 2023 22:36:17 +0200 Subject: [PATCH 22/23] Updating Lombiq NuGet references --- Lombiq.BaseTheme.Tests.UI/Lombiq.BaseTheme.Tests.UI.csproj | 2 +- Lombiq.BaseTheme/Lombiq.BaseTheme.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Lombiq.BaseTheme.Tests.UI/Lombiq.BaseTheme.Tests.UI.csproj b/Lombiq.BaseTheme.Tests.UI/Lombiq.BaseTheme.Tests.UI.csproj index d43c1f6..cbbcd9b 100644 --- a/Lombiq.BaseTheme.Tests.UI/Lombiq.BaseTheme.Tests.UI.csproj +++ b/Lombiq.BaseTheme.Tests.UI/Lombiq.BaseTheme.Tests.UI.csproj @@ -25,7 +25,7 @@ - + diff --git a/Lombiq.BaseTheme/Lombiq.BaseTheme.csproj b/Lombiq.BaseTheme/Lombiq.BaseTheme.csproj index 0d897f5..0d24a67 100644 --- a/Lombiq.BaseTheme/Lombiq.BaseTheme.csproj +++ b/Lombiq.BaseTheme/Lombiq.BaseTheme.csproj @@ -47,7 +47,7 @@ - + From 84bbf15b9acebf01ea2999819a1b1fa1186179a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?= Date: Mon, 19 Jun 2023 01:12:45 +0200 Subject: [PATCH 23/23] Updating Lombiq NuGet references to release versions --- Lombiq.BaseTheme.Samples/Lombiq.BaseTheme.Samples.csproj | 2 +- Lombiq.BaseTheme.Tests.UI/Lombiq.BaseTheme.Tests.UI.csproj | 2 +- Lombiq.BaseTheme/Lombiq.BaseTheme.csproj | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Lombiq.BaseTheme.Samples/Lombiq.BaseTheme.Samples.csproj b/Lombiq.BaseTheme.Samples/Lombiq.BaseTheme.Samples.csproj index 2c200dd..eadbe89 100644 --- a/Lombiq.BaseTheme.Samples/Lombiq.BaseTheme.Samples.csproj +++ b/Lombiq.BaseTheme.Samples/Lombiq.BaseTheme.Samples.csproj @@ -39,7 +39,7 @@ - + diff --git a/Lombiq.BaseTheme.Tests.UI/Lombiq.BaseTheme.Tests.UI.csproj b/Lombiq.BaseTheme.Tests.UI/Lombiq.BaseTheme.Tests.UI.csproj index cbbcd9b..32947da 100644 --- a/Lombiq.BaseTheme.Tests.UI/Lombiq.BaseTheme.Tests.UI.csproj +++ b/Lombiq.BaseTheme.Tests.UI/Lombiq.BaseTheme.Tests.UI.csproj @@ -25,7 +25,7 @@ - + diff --git a/Lombiq.BaseTheme/Lombiq.BaseTheme.csproj b/Lombiq.BaseTheme/Lombiq.BaseTheme.csproj index 0d24a67..999001e 100644 --- a/Lombiq.BaseTheme/Lombiq.BaseTheme.csproj +++ b/Lombiq.BaseTheme/Lombiq.BaseTheme.csproj @@ -46,9 +46,9 @@ - - - + + + true