Skip to content
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
34 changes: 34 additions & 0 deletions build/nightly-E2E-test-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -581,6 +581,15 @@ stages:
CONNECTIONSTRINGS__UMBRACODBDSN: Server=(local);Database=Umbraco;User Id=sa;Password=$(SA_PASSWORD);Encrypt=True;TrustServerCertificate=True
CONNECTIONSTRINGS__UMBRACODBDSN_PROVIDERNAME: Microsoft.Data.SqlClient
additionalEnvironmentVariables: false
# SMTP
LinuxSMTP:
vmImage: "ubuntu-latest"
testFolder: "SMTP"
port: ''
testCommand: "npx playwright test --project=smtp"
CONNECTIONSTRINGS__UMBRACODBDSN: Server=(local);Database=Umbraco;User Id=sa;Password=$(SA_PASSWORD);Encrypt=True;TrustServerCertificate=True
CONNECTIONSTRINGS__UMBRACODBDSN_PROVIDERNAME: Microsoft.Data.SqlClient
additionalEnvironmentVariables: false
pool:
vmImage: $(vmImage)
steps:
Expand Down Expand Up @@ -658,6 +667,23 @@ stages:
AZUREADB2CCLIENTID: $(AZUREB2CCLIENTID)
AZUREADB2CCLIENTSECRET: $(AZUREB2CCLIENTSECRET)

# Start SMTP4dev via Docker for SMTP tests
- bash: |
echo "Starting SMTP4dev container..."
docker run -d --name smtp4dev -p 5000:80 -p 25:25 rnwood/smtp4dev

echo "Waiting for SMTP4dev to be ready..."
for i in {1..30}; do
if curl -s http://localhost:5000/api/messages > /dev/null; then
echo "SMTP4dev is ready"
break
fi
echo "Attempt $i: Waiting for SMTP4dev..."
sleep 2
done
displayName: Start SMTP4dev Docker container (Linux)
condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'), contains(variables['testFolder'], 'SMTP'))

# Run tests Template
- template: nightly-E2E-run-tests-template.yml
parameters:
Expand All @@ -667,6 +693,14 @@ stages:
AZUREB2CTESTUSEREMAIL: $(AZUREB2CTESTUSEREMAIL)
AZUREB2CTESTUSERPASSWORD: $(AZUREB2CTESTUSERPASSWORD)
DatabaseType: ${{ variables.DatabaseType }}

# Stop SMTP4dev container
- bash: |
echo "Stopping SMTP4dev container..."
docker stop smtp4dev
docker rm smtp4dev
displayName: Stop SMTP4dev Docker container
condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'), contains(variables['testFolder'], 'SMTP'))

- stage: NotifySlackBot
displayName: Notify Slack on Failure
Expand Down
11 changes: 11 additions & 0 deletions tests/Umbraco.Tests.AcceptanceTest/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,17 @@ export default defineConfig({
use: {
...devices['Desktop Chrome']
}
},
{
name: 'smtp',
testMatch: 'SMTP/*.spec.ts',
dependencies: ['setup'],
use: {
...devices['Desktop Chrome'],
// Use prepared auth state.
ignoreHTTPSErrors: true,
storageState: STORAGE_STATE
}
}
],
});
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {ConstantHelper, NotificationConstantHelper, test} from "@umbraco/playwright-testhelpers";

Check notice on line 1 in tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Users/Permissions/UserGroup/DefaultPermissionsInContent.spec.ts

View check run for this annotation

CodeScene Delta Analysis / CodeScene Code Health Review (main)

✅ Getting better: Code Duplication

reduced similar code in: 'can not create notifications with notification permission disabled'. Avoid duplicated, aka copy-pasted, code inside the module. More duplication lowers the code health.
import {expect} from "@playwright/test";

// Document Type
Expand Down Expand Up @@ -221,20 +221,29 @@
await umbracoUi.content.isActionsMenuForNameVisible(rootDocumentName, false);
});

test.fixme('can create notifications with notification permission enabled', async ({umbracoApi, umbracoUi}) => {
test('can set up notifications with notification permission enabled', async ({umbracoApi, umbracoUi}) => {
// Arrange
const notificationActionIds = ['Umb.Document.Delete', 'Umb.Document.Publish'];
userGroupId = await umbracoApi.userGroup.createUserGroupWithNotificationsPermission(userGroupName);
await umbracoApi.user.setUserPermissions(testUser.name, testUser.email, testUser.password, userGroupId);
testUserCookieAndToken = await umbracoApi.user.loginToUser(testUser.name, testUser.email, testUser.password);
await umbracoUi.goToBackOffice();

// Act
await umbracoUi.content.goToSection(ConstantHelper.sections.content, false);
// TODO: Implement it later
// Setup SMTP server to test notifications, do this when we test appsettings.json
await umbracoUi.content.clickActionsMenuForContent(rootDocumentName);
await umbracoUi.content.clickNotificationsActionMenuOption();
await umbracoUi.content.clickDocumentNotificationOptionWithName(notificationActionIds[0]);
await umbracoUi.content.clickDocumentNotificationOptionWithName(notificationActionIds[1]);
await umbracoUi.content.clickSaveModalButton();

// Assert
await umbracoUi.content.isSuccessNotificationVisible();
expect(await umbracoApi.document.doesNotificationExist(rootDocumentId, notificationActionIds[0])).toBeTruthy();
expect(await umbracoApi.document.doesNotificationExist(rootDocumentId, notificationActionIds[1])).toBeTruthy();
});

test('can not create notifications with notification permission disabled', async ({umbracoApi, umbracoUi}) => {
test('can not set up notifications with notification permission disabled', async ({umbracoApi, umbracoUi}) => {
// Arrange
userGroupId = await umbracoApi.userGroup.createUserGroupWithNotificationsPermission(userGroupName, false);
await umbracoApi.user.setUserPermissions(testUser.name, testUser.email, testUser.password, userGroupId);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
{
"$schema": "appsettings-schema.json",
"Serilog": {
"MinimumLevel": {
"Default": "Information",
"Override": {
"Microsoft": "Warning",
"Microsoft.Hosting.Lifetime": "Information",
"System": "Warning"
}
},
"WriteTo": [
{
"Name": "Async",
"Args": {
"Configure": [
{
"Name": "Console"
}
]
}
}
]
},
"Umbraco": {
"CMS": {
"Unattended": {
"InstallUnattended": true,
"UnattendedUserName": "Playwright Test",
"UnattendedUserEmail": "playwright@umbraco.com",
"UnattendedUserPassword": "UmbracoAcceptance123!"
},
"Content": {
"ContentVersionCleanupPolicy": {
"EnableCleanup": false
}
},
"Global": {
"DisableElectionForSingleServer": true,
"InstallMissingDatabase": true,
"Id": "00000000-0000-0000-0000-000000000042",
"VersionCheckPeriod": 0,
"UseHttps": true,
"Smtp": {
"From": "no-reply@localhost.test",
"Host": "localhost",
"Port": 25,
"SecureSocketOptions": "None"
}
},
"HealthChecks": {
"Notification": {
"Enabled": true
}
},
"KeepAlive": {
"DisableKeepAliveTask": true
},
"WebRouting": {
"UmbracoApplicationUrl": "https://localhost:44331/"
}
}
}
}
Loading
Loading