generated from Kentico/repo-template
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #57 from Kentico/feat/after-upgrade-automatic-tests
Add automatic tests of results of Kentico.Xperience.UMT.Example.Console
- Loading branch information
Showing
32 changed files
with
1,048 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- File name extension must be .runsettings --> | ||
<RunSettings> | ||
<RunConfiguration> | ||
<EnvironmentVariables> | ||
<BASE_URL>http://localhost:53798</BASE_URL> | ||
<ADMINISTRATION_USER>administrator</ADMINISTRATION_USER> | ||
<ADMINISTRATION_PASSWORD>administrator</ADMINISTRATION_PASSWORD> | ||
</EnvironmentVariables> | ||
</RunConfiguration> | ||
</RunSettings> |
15 changes: 15 additions & 0 deletions
15
tests/Kentico.Xperience.UMT.Tests/Enums/EventLogSeverity.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace TestAfterMigration.Enums | ||
{ | ||
public enum EventLogSeverity | ||
{ | ||
Info, | ||
Warning, | ||
Error | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
tests/Kentico.Xperience.UMT.Tests/Extensions/IEnumerableExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace TestAfterMigration.Extensions | ||
{ | ||
public static class IEnumerableExtensions | ||
{ | ||
public static IEnumerable<T> SelectManyRecursive<T>(this IEnumerable<T> source, Func<T, IEnumerable<T>> selector) | ||
{ | ||
if (source == null) throw new ArgumentNullException("source"); | ||
if (selector == null) throw new ArgumentNullException("selector"); | ||
|
||
return !source.Any() ? source : | ||
source.Concat( | ||
source | ||
.SelectMany(i => selector(i)) | ||
.SelectManyRecursive(selector) | ||
); | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
tests/Kentico.Xperience.UMT.Tests/Extensions/PageTreeItemExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using TestAfterMigration.Helpers; | ||
|
||
namespace TestAfterMigration.Extensions | ||
{ | ||
public static class PageTreeItemExtensions | ||
{ | ||
public static IEnumerable<PageTreeItem> Family(this PageTreeItem item) => [item, ..item.Children.SelectManyRecursive(x => x.Children)]; | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
tests/Kentico.Xperience.UMT.Tests/Extensions/PlaywrightExtensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
using Microsoft.Playwright; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace TestAfterMigration.Extensions | ||
{ | ||
public static class PlaywrightExtensions | ||
{ | ||
public static Task WaitForVisible(this ILocator locator) => locator.Nth(0).WaitForAsync(new LocatorWaitForOptions { State = WaitForSelectorState.Visible }); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using Microsoft.Playwright; | ||
using TestAfterMigration.Extensions; | ||
|
||
namespace TestAfterMigration.Helpers | ||
{ | ||
public class PageTreeItem(IPage page, string nodeID) | ||
{ | ||
public async Task LoadInfo() => Title = (await TitleElement.TextContentAsync())!; | ||
|
||
public string? Title { get; private set; } = null; | ||
public ILocator Locator => page.Locator($"[data-testid-nodeid=\"{nodeID}\"]"); | ||
public IEnumerable<PageTreeItem> Children { get; set; } = []; | ||
public ILocator TitleElement => Locator.GetByTestId("tree-item-title").Nth(0); | ||
public Task ClickAsync() => TitleElement.ClickAsync(); | ||
public async Task WaitBreadcrumbsLoaded() | ||
{ | ||
string pageTitle = (await Locator.GetByTestId("tree-item-title").Nth(0).TextContentAsync())!; | ||
await Locator.Page.GetByTestId("breadcrumbs").GetByText(pageTitle).WaitForVisible(); | ||
} | ||
} | ||
} |
41 changes: 41 additions & 0 deletions
41
tests/Kentico.Xperience.UMT.Tests/Kentico.Xperience.UMT.Tests.csproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<TargetFramework>net8.0</TargetFramework> | ||
<ImplicitUsings>enable</ImplicitUsings> | ||
<Nullable>enable</Nullable> | ||
|
||
<IsPackable>false</IsPackable> | ||
<IsTestProject>true</IsTestProject> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<None Remove="Resources\kentico_brand.png" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Content Include="Resources\kentico_brand.png"> | ||
<CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||
</Content> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="coverlet.collector"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" /> | ||
<PackageReference Include="Microsoft.Playwright.NUnit" /> | ||
<PackageReference Include="NUnit" /> | ||
<PackageReference Include="NUnit.Analyzers"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
<PackageReference Include="NUnit3TestAdapter" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<Using Include="NUnit.Framework" /> | ||
</ItemGroup> | ||
|
||
</Project> |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.