Skip to content

Commit 4054b99

Browse files
committed
Adding UI test for Lucide icon picker
1 parent efded5e commit 4054b99

File tree

2 files changed

+87
-0
lines changed

2 files changed

+87
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
using Lombiq.Tests.UI.Extensions;
2+
using Lombiq.Tests.UI.Services;
3+
using OpenQA.Selenium;
4+
using Shouldly;
5+
using System.Threading.Tasks;
6+
7+
namespace Lombiq.HelpfulExtensions.Tests.UI.Extensions;
8+
9+
public static class LucideTestCaseUITestContextExtensions
10+
{
11+
/// <summary>
12+
/// Tests the Lombiq Helpful Extensions - Lucide feature.
13+
/// </summary>
14+
public static async Task TestLucideFeatureAsync(this UITestContext context)
15+
{
16+
const string iconName = "camera";
17+
18+
await context.SignInDirectlyAsync();
19+
20+
await context.EnableFeatureDirectlyAsync(FeatureIds.Lucide);
21+
await context.ExecuteRecipeDirectlyAsync("Lombiq.HelpfulExtensions.Tests.UI.Lucide.Tests");
22+
await context.CreateNewContentItemAsync("LucidePickerTest", onlyIfNotAlreadyThere: false);
23+
24+
await context.ClickReliablyOnAsync(By.CssSelector("[data-lucide-toggle]"));
25+
await context.ClickAndFillInWithRetriesAsync(By.CssSelector("[data-lucide-search]"), iconName);
26+
await context.ClickReliablyOnAsync(By.CssSelector($"[data-lucide-icon='{iconName}']"));
27+
28+
var selectedIcon = context.ExecuteScript("return document.querySelector(arguments[0])?.dataset.lucideIcon ?? '';", $"[data-lucide-icon='{iconName}'].active") as string;
29+
selectedIcon.ShouldBe(iconName);
30+
context.Get(By.CssSelector($"[data-lucide-preview] [data-lucide='{iconName}']"));
31+
}
32+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
"name": "Lombiq.HelpfulExtensions.Tests.UI.Lucide.Tests",
3+
"displayName": "Lombiq Helpful Extensions - Lucide test recipe",
4+
"description": "Creates a simple content type for testing the Lucide icon picker editor.",
5+
"author": "Lombiq Technologies",
6+
"website": "https://github.com/Lombiq/Helpful-Extensions",
7+
"version": "1.0",
8+
"issetuprecipe": false,
9+
"categories": [],
10+
"tags": [],
11+
"steps": [
12+
{
13+
"name": "ContentDefinition",
14+
"ContentTypes": [
15+
{
16+
"Name": "LucidePickerTest",
17+
"DisplayName": "Lucide Picker Test",
18+
"Settings": {
19+
"ContentTypeSettings": {
20+
"Creatable": true,
21+
"Listable": true,
22+
"Draftable": true,
23+
"Versionable": true
24+
}
25+
},
26+
"ContentTypePartDefinitionRecords": [
27+
{
28+
"PartName": "LucidePickerTest",
29+
"Name": "LucidePickerTest",
30+
"Settings": {}
31+
}
32+
]
33+
}
34+
],
35+
"ContentParts": [
36+
{
37+
"Name": "LucidePickerTest",
38+
"Settings": {},
39+
"ContentPartFieldDefinitionRecords": [
40+
{
41+
"FieldName": "TextField",
42+
"Name": "Icon",
43+
"Settings": {
44+
"ContentPartFieldSettings": {
45+
"DisplayName": "Icon",
46+
"Editor": "LucideIconPicker"
47+
}
48+
}
49+
}
50+
]
51+
}
52+
]
53+
}
54+
]
55+
}

0 commit comments

Comments
 (0)