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

SITE-62: Deleting not needed recipe execution #39

Merged
merged 16 commits into from
Jan 26, 2024
Merged
Show file tree
Hide file tree
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
9 changes: 9 additions & 0 deletions DotNest.Core.SDK.sln
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{
.github\workflows\validate-pull-request.yml = .github\workflows\validate-pull-request.yml
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{7BE78863-16CE-4AA3-8C46-7761183142DB}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DotNest.Core.SDK.Tests.UI", "test\DotNest.Core.SDK.Tests.UI\DotNest.Core.SDK.Tests.UI.csproj", "{13764086-2125-4C44-AFC2-665AC3C89AC0}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand All @@ -41,6 +45,10 @@ Global
{2A65FF2E-0C9C-4FEF-9136-B575141355AE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{2A65FF2E-0C9C-4FEF-9136-B575141355AE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{2A65FF2E-0C9C-4FEF-9136-B575141355AE}.Release|Any CPU.Build.0 = Release|Any CPU
{13764086-2125-4C44-AFC2-665AC3C89AC0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{13764086-2125-4C44-AFC2-665AC3C89AC0}.Debug|Any CPU.Build.0 = Debug|Any CPU
{13764086-2125-4C44-AFC2-665AC3C89AC0}.Release|Any CPU.ActiveCfg = Release|Any CPU
{13764086-2125-4C44-AFC2-665AC3C89AC0}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand All @@ -50,6 +58,7 @@ Global
{4415DF94-4550-45C4-85DA-2741284D2C01} = {C0E663BB-B9D0-49AA-BBEB-ECA748632007}
{2A65FF2E-0C9C-4FEF-9136-B575141355AE} = {4415DF94-4550-45C4-85DA-2741284D2C01}
{190B979E-A5AB-42A4-85CE-8A94044706DF} = {7E3915D4-E24A-45FD-887C-3CB4F445C30B}
{13764086-2125-4C44-AFC2-665AC3C89AC0} = {7BE78863-16CE-4AA3-8C46-7761183142DB}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {3E281D9A-C9FF-49D6-A7E7-192EB8DC0074}
Expand Down
1 change: 1 addition & 0 deletions src/DotNest.Core.SDK.Web/DotNest.Core.SDK.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
<PackageReference Include="Lombiq.SetupExtensions" Version="5.0.0" />
<PackageReference Include="Lombiq.Hosting.MediaTheme" Version="5.0.1-alpha.1.osoe-775" />
<PackageReference Include="Lombiq.Hosting.MediaTheme.Bridge" Version="5.0.1-alpha.1.osoe-775" />
<PackageReference Include="Lombiq.Tests.UI.Shortcuts" Version="8.2.1-alpha.6.osoe-351" />
<PackageReference Include="Lombiq.Walkthroughs" Version="1.0.0-alpha.1.lmbq-113" />
</ItemGroup>

Expand Down
13 changes: 13 additions & 0 deletions src/DotNest.Core.SDK.Web/Program.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using Lombiq.Hosting.Tenants.Management.Extensions;
using OrchardCore.Logging;
using System.Diagnostics.CodeAnalysis;

var builder = WebApplication.CreateBuilder(args);

Expand Down Expand Up @@ -29,3 +30,15 @@
app.UseStaticFiles();
app.UseOrchardCore();
app.Run();

[SuppressMessage(
"Design",
"CA1050: Declare types in namespaces",
Justification = "As described here: https://docs.microsoft.com/en-us/aspnet/core/test/integration-tests.")]
public partial class Program
{
protected Program()
{
// Nothing to do here.
}
}
2 changes: 1 addition & 1 deletion src/Themes/Sample.Theme/Manifest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
Version = "0.0.1",
Website = "https://github.com/Lombiq/DotNest-Core-SDK",
Description = "A sample DotNest theme for local development. It must be packaged and used as a Media Theme on DotNest.",
BaseTheme = "Lombiq.BaseTheme",
BaseTheme = "TheTheme",
Piedone marked this conversation as resolved.
Show resolved Hide resolved
Dependencies = new[]
{
FeatureNames.MediaThemeBridge
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"name": "DotNest.Core.SDK.MediaTheme",
"displayName": "Media Theme",
"description": "A recipe created with the media-theme-deployment tool.",
"author": "",
"website": "",
"author": "Lombiq Technologies",
"website": "https://github.com/Lombiq/DotNest-Core-SDK",
"version": "",
"issetuprecipe": false,
"categories": [],
Expand Down Expand Up @@ -47,4 +47,4 @@
]
}
]
}
}
77 changes: 60 additions & 17 deletions src/Themes/Sample.Theme/Recipes/DotNest.Core.SDK.Setup.recipe.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@
"name": "DotNest.Core.SDK.Setup",
"displayName": "DotNest Core SDK - Setup",
"description": "Settings and features required only for development.",
"author": "DotNestCoreSDK",
"website": "https://www.dotnestcoresdk.com",
"author": "Lombiq Technologies",
"website": "https://github.com/Lombiq/DotNest-Core-SDK",
"version": "1.0",
"issetuprecipe": true,
"categories": [ "dotnestcoresdk" ],
"tags": [],

"variables": {
"homeContentItemId": "[js:uuid()]",
"now": "[js: new Date().toISOString()]"
},
"steps": [
{
"name": "feature",
Expand Down Expand Up @@ -121,39 +124,79 @@
"Lombiq.Hosting.Tenants.Admin.Login.SubTenant",
"Lombiq.Hosting.Tenants.Management.ForbiddenTenantNames",
"Lombiq.Hosting.MediaTheme",
"Lombiq.Privacy",
"Lombiq.Privacy.ConsentBanner",
"Lombiq.Privacy.FormConsent",
"Lombiq.Privacy.RegistrationConsent",

// Themes
"TheAdmin",
"TheTheme",
"Lombiq.BaseTheme",
"Sample.Theme"
]
},
{
"name": "themes",
"admin": "TheAdmin",
"site": "Sample.Theme"
"site": "TheTheme"
},
{
"name": "Content",
"data": [
{
"ContentItemId": "[js: variables('homeContentItemId')]",
"ContentItemVersionId": "[js: uuid()]",
"ContentType": "Page",
"DisplayText": "This is DotNest Core SDK",
"Latest": true,
"Published": true,
"ModifiedUtc": "[js: variables('now')]",
"PublishedUtc": "[js: variables('now')]",
"CreatedUtc": "[js: variables('now')]",
"Owner": "[js: parameters('AdminUserId')]",
"Author": "[js: parameters('AdminUsername')]",
"TitlePart": {
"Title": "This is DotNest Core SDK"
},
"AutoroutePart": {
"Path": "this-is-dotnest-core-sdk",
"SetHomepage": true,
"Disabled": false,
"RouteContainedItems": false,
"Absolute": false
},
"FlowPart": {
"Widgets": []
}
}
]
},
{
"name": "Settings",
"HomeRoute": {
"Area": "OrchardCore.Contents",
"Controller": "Item",
"Action": "Display",
"contentItemId": "[js: variables('homeContentItemId')]"
}
},
{
"name": "Roles",
"Roles": [
{
"Name": "Anonymous",
"Description": "Anonymous role",
"Permissions": [
"ViewContent"
]
}
]
},
{
"name": "recipes",
"Values": [
{
"executionid": "DotNest.Core.SDK.Web",
"name": "Lombiq.BaseTheme.LayersAndZones"
},
Piedone marked this conversation as resolved.
Show resolved Hide resolved
{
"executionid": "DotNest.Core.SDK.Web",
"name": "DotNest.Core.SDK.MediaTheme"
}
]
},
{
"name": "mediatheme",
"ClearMediaThemeFolder": false,
"BaseThemeId": "Lombiq.BaseTheme"
}
]
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% zone "Header" %}
{% zone "Messages" %}

<p>This is a template rendered from your custom theme. Once deployed to the Media Theme, it'll be hosted from there.</p>
<p>Below is an image also stored in the theme's wwwroot folder. Note that the URL of the image starts with <code>/mediatheme</code>.
Expand Down
3 changes: 1 addition & 2 deletions src/Themes/Sample.Theme/Sample.Theme.csproj
Piedone marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
<PackageReference Include="OrchardCore.ContentManagement" Version="1.7.0" />
<PackageReference Include="OrchardCore.DisplayManagement" Version="1.7.0" />
<PackageReference Include="OrchardCore.ResourceManagement" Version="1.7.0" />
<PackageReference Include="Lombiq.BaseTheme" Version="5.0.0" />
<PackageReference Include="Lombiq.Hosting.MediaTheme" Version="5.0.1-alpha.1.osoe-775" />
<PackageReference Include="Lombiq.Hosting.MediaTheme.Targets" Version="5.0.1-alpha.1.osoe-775" />
</ItemGroup>
Expand All @@ -26,7 +25,7 @@

<PropertyGroup>
<!-- This must be defined after the Lombiq.Hosting.MediaTheme.Targets import to override property. -->
<MediaThemeBaseId>Lombiq.BaseTheme</MediaThemeBaseId>
<MediaThemeBaseId>TheTheme</MediaThemeBaseId>
</PropertyGroup>

</Project>
12 changes: 0 additions & 12 deletions src/Themes/Sample.Theme/Views/Widget-LayoutInjection.liquid

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{% zone "Header" %}
{% zone "Messages" %}

<p>This is a template rendered from your custom theme. Once deployed to the Media Theme, it'll be hosted from there.</p>
<p>Below is an image also stored in the theme's wwwroot folder. Note that the URL of the image starts with <code>/mediatheme</code>.
Expand Down
6 changes: 6 additions & 0 deletions test/DotNest.Core.SDK.Tests.UI/Constants/Recipes.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
namespace DotNest.Core.SDK.Tests.UI.Constants;

public static class Recipes
{
public const string DefaultRecipeId = "DotNest.Core.SDK.Tests.Default";
}
25 changes: 25 additions & 0 deletions test/DotNest.Core.SDK.Tests.UI/DotNest.Core.SDK.Tests.UI.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net6.0</TargetFramework>
<IsPackable>false</IsPackable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.3.2" />
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.5" />
<PackageReference Include="Lombiq.Tests.UI" Version="8.2.1-alpha.6.osoe-351" />
<PackageReference Include="Lombiq.Analyzers" Version="3.3.0" />
</ItemGroup>

<ItemGroup>
<Content Include="Recipes\*.Tests*.recipe.json">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="xunit.runner.json" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\src\DotNest.Core.SDK.Web\DotNest.Core.SDK.Web.csproj" />
</ItemGroup>
</Project>
28 changes: 28 additions & 0 deletions test/DotNest.Core.SDK.Tests.UI/Helpers/SetupHelpers.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
using DotNest.Core.SDK.Tests.UI.Constants;
using Lombiq.Tests.UI.Extensions;
using Lombiq.Tests.UI.Pages;
using Lombiq.Tests.UI.Services;
using OpenQA.Selenium;
using Shouldly;
using System;
using System.Threading.Tasks;

namespace DotNest.Core.SDK.Tests.UI.Helpers;

public static class SetupHelpers
{
public static async Task<Uri> RunSetupAsync(UITestContext context)
{
var homepageUri = await context.GoToSetupPageAndSetupOrchardCoreAsync(
new OrchardCoreSetupParameters(context)
{
SiteName = "DotNest Core SDK",
RecipeId = Recipes.DefaultRecipeId,
SiteTimeZoneValue = "Europe/Budapest",
});

context.Get(By.ClassName("navbar-brand")).Text.ShouldBe("DotNest Core SDK");

return homepageUri;
}
}
5 changes: 5 additions & 0 deletions test/DotNest.Core.SDK.Tests.UI/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# DotNest Core SDK UI Tests

## Overview

This project contains a sample UI test for the DotNest Core SDK, which ensures that basic functionality is working. You can use it as a starting point for your own UI tests. The project uses the [Lombiq UI Testing Toolbox for Orchard Core project](https://github.com/Lombiq/UI-Testing-Toolbox) which gives you a framework for writing UI tests. For more info please check out its documentation. For more UI test examples see the [`Lombiq.Tests.UI.Samples` repository](https://github.com/Lombiq/UI-Testing-Toolbox/blob/dev/Lombiq.Tests.UI.Samples/Readme.md).
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"name": "DotNest.Core.SDK.Tests.Configuration.Tests",
"displayName": "TEST: DotNest Core SDK - Configuration Tests",
"description": "Common configuration necessary for UI tests.",
"author": "Lombiq Technologies",
"website": "https://github.com/Lombiq/DotNest-Core-SDK",
"version": "1.0",
"issetuprecipe": false,
"categories": [ "test" ],
"tags": [ "test", "HideFromSetupScreen" ],

"steps": [
{
"name": "feature",
"enable": [
"OrchardCore.Localization"
]
},
{
"name": "settings",
// To make sure that e.g. numbers and dates are formatted the same way on all machines we have to specify the
// culture too.
"UseCdn": false,
"SmtpSettings": {
"DefaultSender": "sender@example.com"
},
"LocalizationSettings": {
"DefaultCulture": "en-US",
"SupportedCultures": [
"en-US"
]
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "DotNest.Core.SDK.Tests.Default",
"displayName": "TEST: DotNest Core SDK - Default tenant",
"description": "Setup recipe for the default tenant of DotNest Tenants SDK, for automated UI test execution.",
"author": "Lombiq Technologies",
Piedone marked this conversation as resolved.
Show resolved Hide resolved
"website": "https://github.com/Lombiq/DotNest-Core-SDK",
"version": "1.0",
"issetuprecipe": true,
"categories": [ "developer" ],
"tags": [ "dotnest", "test", "HideFromSetupScreen" ],

"steps": [
{
"name": "recipes",
"Values": [
{
"executionid": "DotNest.Core.SDK.Tests.UI",
"name": "DotNest.Core.SDK.Setup"
},
{
"executionid": "DotNest.Core.SDK.Tests.UI",
"name": "DotNest.Core.SDK.Tests.Configuration.Tests"
}
]
}
]
}
20 changes: 20 additions & 0 deletions test/DotNest.Core.SDK.Tests.UI/Tests/BasicOrchardFeaturesTests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using DotNest.Core.SDK.Tests.UI.Constants;
using Lombiq.Tests.UI.Extensions;
using System.Threading.Tasks;
using Xunit;
using Xunit.Abstractions;

namespace DotNest.Core.SDK.Tests.UI.Tests;

public class BasicOrchardFeaturesTests : UITestBase
{
public BasicOrchardFeaturesTests(ITestOutputHelper testOutputHelper)
: base(testOutputHelper)
{
}

[Fact]
public Task BasicOrchardFeaturesShouldWork() =>
ExecuteTestAsync(
context => context.TestBasicOrchardFeaturesExceptRegistrationAsync(Recipes.DefaultRecipeId));
}
Loading
Loading