Skip to content

Commit 84fb1f4

Browse files
nhudinh0309NguyenThuyLanLanThuyNguyenandr317c
authored
Extension Registry: QA Added acceptance tests for readOnlyGuards rule, entity action and custom property editor (#19939)
* Added tests for readOnlyGuard rules * Added backoffice override files for readOnlyGuard tests * Bumped version * Added project for ExtensionRegistry tests in playwright configs * Updated nightly E2E test pipelines to run Extension Registry tests * Updated nightly E2E test pipeline * Updated nightly E2E test pipeline * Updated playwright configs * Updated nightly E2E test pipeline * Add test for Entity Action Extension to retrieve entityType and unique (#20020) * Add entity action test to get unique and entity type * update test entity action --------- Co-authored-by: Lan Nguyen Thuy <[email protected]> * Added job to run the Extension Registry tests in the nightly pipeline * Cleaned up * Restructure AdditionSetup folder for extension registry * Updated yaml file for nightly E2E pipeline * Updated json file for lock action * Skip test for content delivery API * Updated port * Comment out others to run only extension registry tests * Updated port * Remove retrieve action folder to test * Reverted nightly E2E test pipeline * Reverted * Updated umbraco package json * Reverted * Renamed AdditionalSetup folder * Renamed folder * Added appsetting.json file * Updated appsettings.json * Updated appsettings.json * Added debug step * Added step to build backoffice * Reverted * Only spec.ts file run in the extension registry project * Property Editor: Add tests for create and using custom property editor (#20213) * Property Editor: tests for create and using custom property editor * Update tests/Umbraco.Tests.AcceptanceTest/tests/ExtensionRegistry/PropertyEditorTest.spec.ts Co-authored-by: Nhu Dinh <[email protected]> * Update tests/Umbraco.Tests.AcceptanceTest/tests/ExtensionRegistry/PropertyEditorTest.spec.ts Co-authored-by: Nhu Dinh <[email protected]> * Update tests/Umbraco.Tests.AcceptanceTest/tests/ExtensionRegistry/PropertyEditorTest.spec.ts Co-authored-by: Nhu Dinh <[email protected]> * update review from Nhu * Update tests/Umbraco.Tests.AcceptanceTest/tests/ExtensionRegistry/CustomPropertyEditor.spec.ts Co-authored-by: Nhu Dinh <[email protected]> * Update tests/Umbraco.Tests.AcceptanceTest/tests/ExtensionRegistry/CustomPropertyEditor.spec.ts Co-authored-by: Nhu Dinh <[email protected]> * fix comment from Nhu --------- Co-authored-by: Lan Nguyen Thuy <[email protected]> Co-authored-by: Nhu Dinh <[email protected]> * Format code * Fixed * Format code * Format code * Format code * Updated indentation * Fixed comments * change the name of test --------- Co-authored-by: NguyenThuyLan <[email protected]> Co-authored-by: Lan Nguyen Thuy <[email protected]> Co-authored-by: Andreas Zerbst <[email protected]>
1 parent e7fde8c commit 84fb1f4

File tree

16 files changed

+496
-3
lines changed

16 files changed

+496
-3
lines changed

build/nightly-E2E-test-pipelines.yml

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,6 +526,23 @@ stages:
526526
CONNECTIONSTRINGS__UMBRACODBDSN: Data Source=(localdb)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\Umbraco.mdf;Integrated Security=True
527527
CONNECTIONSTRINGS__UMBRACODBDSN_PROVIDERNAME: Microsoft.Data.SqlClient
528528
additionalEnvironmentVariables: true
529+
# ExtensionRegistry
530+
WindowsExtensionRegistry:
531+
vmImage: "windows-latest"
532+
testFolder: "ExtensionRegistry"
533+
port: ''
534+
testCommand: "npx playwright test --project=extensionRegistry"
535+
CONNECTIONSTRINGS__UMBRACODBDSN: Data Source=(localdb)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\Umbraco.mdf;Integrated Security=True
536+
CONNECTIONSTRINGS__UMBRACODBDSN_PROVIDERNAME: Microsoft.Data.SqlClient
537+
additionalEnvironmentVariables: false
538+
LinuxExtensionRegistry:
539+
vmImage: "ubuntu-latest"
540+
testFolder: "ExtensionRegistry"
541+
port: ''
542+
testCommand: "npx playwright test --project=extensionRegistry"
543+
CONNECTIONSTRINGS__UMBRACODBDSN: Server=(local);Database=Umbraco;User Id=sa;Password=$(SA_PASSWORD);Encrypt=True;TrustServerCertificate=True
544+
CONNECTIONSTRINGS__UMBRACODBDSN_PROVIDERNAME: Microsoft.Data.SqlClient
545+
additionalEnvironmentVariables: false
529546
pool:
530547
vmImage: $(vmImage)
531548
steps:
@@ -657,4 +674,4 @@ stages:
657674
--data "$PAYLOAD" \
658675
"$SLACK_WEBHOOK_URL"
659676
env:
660-
SLACK_WEBHOOK_URL: $(E2ESLACKWEBHOOKURL)
677+
SLACK_WEBHOOK_URL: $(E2ESLACKWEBHOOKURL)

tests/Umbraco.Tests.AcceptanceTest/playwright.config.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,17 @@ export default defineConfig({
5454
storageState: STORAGE_STATE
5555
}
5656
},
57+
{
58+
name: 'extensionRegistry',
59+
testMatch: 'ExtensionRegistry/*.spec.ts',
60+
dependencies: ['setup'],
61+
use: {
62+
...devices['Desktop Chrome'],
63+
// Use prepared auth state.
64+
ignoreHTTPSErrors: true,
65+
storageState: STORAGE_STATE
66+
}
67+
},
5768
{
5869
name: 'deliveryApi',
5970
testMatch: 'DeliveryApi/**',
@@ -63,7 +74,7 @@ export default defineConfig({
6374
// Use prepared auth state.
6475
ignoreHTTPSErrors: true,
6576
storageState: STORAGE_STATE
66-
},
77+
}
6778
},
6879
{
6980
name: 'externalLoginAzureADB2C',

tests/Umbraco.Tests.AcceptanceTest/tests/DeliveryApi/DeliveryApi.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import {expect} from '@playwright/test';
22
import {AliasHelper, test} from '@umbraco/playwright-testhelpers';
33

4-
test('can get content from delivery api', async ({umbracoApi}) => {
4+
test.skip('can get content from delivery api', async ({umbracoApi}) => {
55
// Arrange
66
const documentTypeName = 'TestDocumentType';
77
const contentName = 'TestContent';

tests/Umbraco.Tests.AcceptanceTest/tests/ExtensionRegistry/AdditionalSetup/App_Plugins/custom-property-editor/dist/customtexteditor.js

Lines changed: 100 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/Umbraco.Tests.AcceptanceTest/tests/ExtensionRegistry/AdditionalSetup/App_Plugins/custom-property-editor/dist/customtexteditor.js.map

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{
2+
"$schema": "../../umbraco-package-schema.json",
3+
"name": "My.Extension",
4+
"extensions": [
5+
{
6+
"type": "propertyEditorUi",
7+
"alias": "Custom.TextEditor",
8+
"name": "Custom Text Editor",
9+
"element": "/App_Plugins/custom-property-editor/dist/customtexteditor.js",
10+
"meta": {
11+
"label": "Custom Text Editor",
12+
"propertyEditorSchemaAlias": "Umbraco.TextBox",
13+
"icon": "icon-edit",
14+
"group": "Custom"
15+
}
16+
}
17+
]
18+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
import { UMB_DOCUMENT_WORKSPACE_CONTEXT } from '@umbraco-cms/backoffice/document';
2+
import { UmbVariantId } from '@umbraco-cms/backoffice/variant';
3+
import { UmbEntityActionBase } from '@umbraco-cms/backoffice/entity-action';
4+
5+
export class UmbDocumentLockEntityAction extends UmbEntityActionBase {
6+
async execute() {
7+
const context = await this.getContext(UMB_DOCUMENT_WORKSPACE_CONTEXT);
8+
const ruleUnique = 'lock';
9+
10+
const myRule = {
11+
unique: ruleUnique,
12+
UmbVariantId: new UmbVariantId(),
13+
};
14+
15+
const hasRule = context?.readOnlyGuard.getRules().find((rule) => rule.unique === ruleUnique);
16+
17+
if (hasRule) {
18+
context?.readOnlyGuard.removeRule(ruleUnique);
19+
} else {
20+
context?.readOnlyGuard.addRule(myRule);
21+
}
22+
}
23+
}
24+
25+
export { UmbDocumentLockEntityAction as api };
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import { UMB_DOCUMENT_ENTITY_TYPE } from '@umbraco-cms/backoffice/document';
2+
3+
export const manifests = [
4+
{
5+
type: 'entityAction',
6+
kind: 'default',
7+
alias: 'Umb.EntityAction.Document.Lock',
8+
name: 'Lock Document Entity Action',
9+
forEntityTypes: [UMB_DOCUMENT_ENTITY_TYPE],
10+
api: () => import('./lock-action.api.js'),
11+
weight: 200,
12+
meta: {
13+
label: 'Lock it',
14+
icon: 'icon-lock',
15+
}
16+
}
17+
]
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"name": "E2E Test Package",
3+
"version": "1.0.0",
4+
"extensions": [
5+
{
6+
"type": "bundle",
7+
"alias": "E2E.Package.Bundle",
8+
"name": "E2E Test Package Bundle",
9+
"js": "/App_Plugins/lock-action/lock-action.manifests.js"
10+
}
11+
]
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { UmbEntityActionBase } from '@umbraco-cms/backoffice/entity-action';
2+
import { UMB_NOTIFICATION_CONTEXT } from '@umbraco-cms/backoffice/notification';
3+
4+
export class RetrieveAction extends UmbEntityActionBase {
5+
6+
async execute() {
7+
const { entityType, unique } = this.args;
8+
const message = `${entityType}_${unique}`;
9+
const notificationContext = await this.getContext(UMB_NOTIFICATION_CONTEXT);
10+
notificationContext?.peek('positive', {
11+
data: {
12+
headline: '',
13+
message: message,
14+
},
15+
});
16+
}
17+
}
18+
export { RetrieveAction as api };

0 commit comments

Comments
 (0)