Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
3f4e0e0
Add tests for property presest value
LanThuyNguyen Jan 8, 2026
eb941e2
Merge branch 'main' of https://github.com/umbraco/Umbraco-CMS into v1…
LanThuyNguyen Jan 8, 2026
4eb0131
Merge branch 'main' of https://github.com/umbraco/Umbraco-CMS into v1…
LanThuyNguyen Jan 21, 2026
81ecf53
Merge branch 'main' of https://github.com/umbraco/Umbraco-CMS into v1…
LanThuyNguyen Jan 21, 2026
59ec7bc
save method'
LanThuyNguyen Jan 22, 2026
64fd9fc
Merge branch 'main' of https://github.com/umbraco/Umbraco-CMS into v1…
LanThuyNguyen Jan 23, 2026
cd8974c
update accepntance test
LanThuyNguyen Jan 23, 2026
e3459ef
Merge branch 'main' of https://github.com/umbraco/Umbraco-CMS into v1…
LanThuyNguyen Jan 23, 2026
f560d81
ad timeout to preset value test
LanThuyNguyen Jan 23, 2026
0261028
Updated yaml file to copy all .cs files but still keep folder structure
nhudinh0309 Jan 23, 2026
d1b0121
Merge branch 'main' into v17/QA/preset-property-value
nhudinh0309 Jan 23, 2026
5bc2366
Merge branch 'v17/QA/preset-property-value' of https://github.com/umb…
nhudinh0309 Jan 23, 2026
478a041
remove timeout from preset value test
LanThuyNguyen Jan 23, 2026
84c1c2c
Merge branch 'v17/QA/preset-property-value' of https://github.com/umb…
LanThuyNguyen Jan 23, 2026
b132e6b
Merge branch 'main' of https://github.com/umbraco/Umbraco-CMS into v1…
LanThuyNguyen Jan 26, 2026
e25e3fe
adding time wait to tests
LanThuyNguyen Jan 26, 2026
7ee546b
adding more timeout
LanThuyNguyen Jan 26, 2026
9cadbe0
Adding slow test
LanThuyNguyen Jan 27, 2026
05948a8
Merge branch 'main' into v17/QA/preset-property-value
NguyenThuyLan Feb 4, 2026
8fb4478
Merge branch 'main' into v17/QA/preset-property-value
NguyenThuyLan Feb 5, 2026
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
12 changes: 9 additions & 3 deletions build/nightly-E2E-build-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,17 @@ steps:
- pwsh: |
$sourcePath = "$(Build.SourcesDirectory)/tests/Umbraco.Tests.AcceptanceTest/tests/${{ parameters.testFolder }}/AdditionalSetup"
$destinationPath = "UmbracoProject"
$csharpFiles = Get-ChildItem -Path $sourcePath -Filter "*.cs"
$csharpFiles = Get-ChildItem -Path $sourcePath -Filter "*.cs" -Recurse
if ($csharpFiles) {
$csharpFiles | ForEach-Object {
Write-Host "Copying: $($_.FullName)"
Copy-Item -Path $_.FullName -Destination $destinationPath -Force
$relativePath = $_.FullName.Substring($sourcePath.Length + 1)
$targetPath = Join-Path -Path $destinationPath -ChildPath $relativePath
$targetDir = Split-Path -Path $targetPath -Parent
if (-not (Test-Path -Path $targetDir)) {
New-Item -ItemType Directory -Path $targetDir -Force | Out-Null
}
Write-Host "Copying: $($_.FullName) -> $targetPath"
Copy-Item -Path $_.FullName -Destination $targetPath -Force
}
} else {
Write-Host "No C# files found."
Expand Down

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

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

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

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

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

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

Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "Preset Text Value",
"version": "1.0.0",
"extensions": [
{
"type": "propertyValuePreset",
"alias": "presettextvalue",
"name": "Preset Text Value",
"api": "/App_Plugins/property-preset-value/property-preset-value.js",
"forPropertyEditorUiAlias": "Umb.PropertyEditorUi.TextBox"
},
{
"type": "propertyValuePreset",
"alias": "presetvalueforpropertyschema",
"name": "Preset Value for Property Schema alias",
"api": "/App_Plugins/property-preset-value/preset-value-schema-alias.js",
"forPropertyEditorSchemaAlias": "Umbraco.TextArea"
},
{
"type": "propertyValuePreset",
"alias": "presetvaluefornopropertyeditor",
"name": "Preset Value for No Property Editor",
"api": "/App_Plugins/property-preset-value/preset-value-no-property.js"
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
using Umbraco.Cms.Core;
using Umbraco.Cms.Core.Composing;
using Umbraco.Cms.Core.Configuration.Models;
using Umbraco.Cms.Core.Models;
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Core.Services.OperationStatus;

public class MySegmentService : ISegmentService
{
// define a collection of segments to use
private readonly Segment[] _segments =
[
new Segment { Alias = "vip-members", Name = "VIP members" }
];

public Task<Attempt<PagedModel<Segment>?, SegmentOperationStatus>> GetPagedSegmentsAsync(int skip = 0, int take = 100) => Task.FromResult
(
Attempt.SucceedWithStatus<PagedModel<Segment>?, SegmentOperationStatus>
(
SegmentOperationStatus.Success,
new PagedModel<Segment> { Total = _segments.Length, Items = _segments.Skip(skip).Take(take) }
)
);
}

public class MySegmentComposer : IComposer
{
public void Compose(IUmbracoBuilder builder)
{
// register the custom segment service in place of the Umbraco core implementation
builder.Services.AddUnique<ISegmentService, MySegmentService>();

// update segment configuration so segments are enabled (in the client)
builder.Services.Configure<SegmentSettings>(settings => settings.Enabled = true);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
import {ConstantHelper, test} from '@umbraco/playwright-testhelpers';
import {expect} from "@playwright/test";

// Content
const contentName = 'TestContent';
const secondContentName = 'Test indhold';
const textContent = 'Some text content';
// DocumentType
const documentTypeName = 'TestDocumentTypeForContent';
// DataType
const dataTypeName = 'Textstring';
const textAreaDataTypeName = 'Textarea';
// Initial Preset Value
const initialPresetValue = 'Preset value';
const initialVariantPresetValue = 'Preset value varies by culture:';
const varyBySegmentText = ' varies by segment:';
const initialAreaPresetValue = 'Preset value for property editor schema alias';
// Second language
const secondLanguageName = 'Danish';
// Segments
const vipMemberSegment = 'VIP members';
const vipMemberSegmentAlias = 'vip-members';

test.afterEach(async ({ umbracoApi }) => {
await umbracoApi.document.ensureNameNotExists(contentName);
await umbracoApi.document.ensureNameNotExists(secondContentName);
await umbracoApi.document.ensureNameNotExists(vipMemberSegment);
await umbracoApi.documentType.ensureNameNotExists(documentTypeName);
await umbracoApi.language.ensureNameNotExists(secondLanguageName);
});

test('can insert specific preset values into text box and text area properties', async ({umbracoApi, umbracoUi}) => {
// Arrange
const dataTypeData = await umbracoApi.dataType.getByName(dataTypeName);
const areaDataType = await umbracoApi.dataType.getByName(textAreaDataTypeName);
await umbracoApi.documentType.createDocumentTypeWithTwoPropertyEditors(documentTypeName, dataTypeName, dataTypeData.id, textAreaDataTypeName, areaDataType.id, 'test group');
await umbracoUi.goToBackOffice();
await umbracoUi.content.goToSection(ConstantHelper.sections.content);

// Act
await umbracoUi.content.clickActionsMenuAtRoot();
await umbracoUi.content.clickCreateActionMenuOption();
await umbracoUi.content.chooseDocumentType(documentTypeName);
await umbracoUi.content.enterContentName(contentName);

// Assert
await umbracoUi.content.doesTextStringHaveExpectedValue(initialPresetValue);
await umbracoUi.content.doesTextAreaHaveExpectedValue(initialAreaPresetValue);
await umbracoUi.content.clickSaveButtonAndWaitForContentToBeCreated();
expect(await umbracoApi.document.doesNameExist(contentName)).toBeTruthy();
const contentData = await umbracoApi.document.getByName(contentName);
expect(contentData.values.find(item => item.editorAlias === dataTypeData.editorAlias).value).toBe(initialPresetValue);
expect(contentData.values.find(item => item.editorAlias === areaDataType.editorAlias).value).toBe(initialAreaPresetValue);
});

test('can insert preset value into textstring property that vary by culture in second language', async ({umbracoApi, umbracoUi}) => {
test.slow();
// Arrange
const languageId = await umbracoApi.language.createDanishLanguage();
const languageData = await umbracoApi.language.get(languageId);
const variantPresetValue = initialVariantPresetValue + ' ' + languageData.isoCode;
const dataTypeData = await umbracoApi.dataType.getByName(dataTypeName);
const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, dataTypeName, dataTypeData.id, 'Test group', true, true);
await umbracoApi.document.createDocumentWithEnglishCultureAndTextContent(contentName, documentTypeId, textContent, dataTypeName, true);
await umbracoUi.goToBackOffice();
await umbracoUi.content.goToSection(ConstantHelper.sections.content);

// Act
await umbracoUi.content.goToContentWithName(contentName);
await umbracoUi.content.clickSelectVariantButton();
await umbracoUi.content.clickVariantAddModeButtonForLanguageName(secondLanguageName);
await umbracoUi.content.enterContentName(secondContentName);

// Assert
await umbracoUi.content.doesTextStringHaveExpectedValue(variantPresetValue);
await umbracoUi.content.clickSaveButtonForContent();
await umbracoUi.waitForTimeout(ConstantHelper.wait.short);
await umbracoUi.content.clickSaveModalButtonAndWaitForContentToBeUpdated();
await umbracoUi.waitForTimeout(ConstantHelper.wait.short);
expect(await umbracoApi.document.doesNameExist(secondContentName)).toBeTruthy();
const contentData = await umbracoApi.document.getByName(secondContentName);
expect(contentData.values.find(item=>item.culture === languageData.isoCode).value).toBe(variantPresetValue);
});

test('can insert preset value into textstring property that shared across segments in content that is enabled vary by segment', async ({umbracoApi, umbracoUi}) => {
// Arrange
const dataTypeData = await umbracoApi.dataType.getByName(dataTypeName);
const documentTypeVaryByCulture = false;
const propertyVaryByCulture = false;
const documentTypeVaryBySegment = true;
const propertyVaryBySegment = false;
await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, dataTypeName, dataTypeData.id, 'Test group', documentTypeVaryByCulture, propertyVaryByCulture, false, documentTypeVaryBySegment, propertyVaryBySegment);
await umbracoUi.goToBackOffice();
await umbracoUi.content.goToSection(ConstantHelper.sections.content);

// Act
await umbracoUi.content.clickActionsMenuAtRoot();
await umbracoUi.content.clickCreateActionMenuOption();
await umbracoUi.content.chooseDocumentType(documentTypeName);
await umbracoUi.content.enterContentName(contentName);
await umbracoUi.content.clickSaveButtonAndWaitForContentToBeCreated();
await umbracoUi.waitForTimeout(ConstantHelper.wait.short);
await umbracoUi.content.clickSelectVariantButton();
await umbracoUi.content.clickVariantAddModeButtonForLanguageName(vipMemberSegment);
await umbracoUi.content.clickSaveButtonAndWaitForContentToBeUpdated();

// Assert
await umbracoUi.content.doesTextStringHaveExpectedValue(initialPresetValue);
});

test('can insert preset value in textstring property that vary by segment in content that is enabled vary by segment', async ({umbracoApi, umbracoUi}) => {
// Arrange
const dataTypeData = await umbracoApi.dataType.getByName(dataTypeName);
const documentTypeVaryByCulture = false;
const propertyVaryByCulture = false;
const documentTypeVaryBySegment = true;
const propertyVaryBySegment = true;
const expectedString = initialPresetValue + varyBySegmentText + ' ' + vipMemberSegmentAlias;
await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, dataTypeName, dataTypeData.id, 'Test group', documentTypeVaryByCulture, propertyVaryByCulture, false, documentTypeVaryBySegment, propertyVaryBySegment);
await umbracoUi.goToBackOffice();
await umbracoUi.content.goToSection(ConstantHelper.sections.content);

// Act
await umbracoUi.content.clickActionsMenuAtRoot();
await umbracoUi.content.clickCreateActionMenuOption();
await umbracoUi.content.chooseDocumentType(documentTypeName);
await umbracoUi.content.enterContentName(contentName);
await umbracoUi.content.clickSaveButtonAndWaitForContentToBeCreated();
await umbracoUi.waitForTimeout(ConstantHelper.wait.short);
await umbracoUi.content.clickSelectVariantButton();
await umbracoUi.content.clickVariantAddModeButtonForLanguageName(vipMemberSegment);
// Assert
await umbracoUi.content.doesTextStringHaveExpectedValue(expectedString);
await umbracoUi.content.clickSaveButtonAndWaitForContentToBeUpdated();
const contentData = await umbracoApi.document.getByName(contentName);
expect(contentData.values.find(item => item.segment === vipMemberSegmentAlias).value).toBe(expectedString);
});
Loading
Loading