Skip to content

Commit 3264d58

Browse files
authored
V15 QA acceptance tests with appsettings (#19550)
* Start of appsetting * Updated setup of playwright * Adjusted the pipeline * Updated appsetting * Added install test * Added comments * Updated pipeline * Updated development app settings * Commented tests out * comment * Added if statement * Updated pipeline * Fixed condition * Changed to production * Added a log * Updated copy item * Added * Updated app settings * Updated pipeline * Moved playwright login * Updated pipeline * Updated app setting * Updated nightly * Updated appsettings * Updated get * Updated wait on * Updated appsettings * Updated connection string * Updates * Skips code * Updated variable * Updated pipeline * We want to always retain the trace, to see if the test runs as expected on the pipeline * Added a temporary wait till port is open * Fixed condition * Added missing tcp for wait on * Updated URL env * Updated setup * Fixed string * Updated locator * Split tests into SQLite and SQLServer * Updated pipeline to run all tests * Retain trace on failure * Added testFolder var * Added appsettings and program for delivery api tests * Updated playwright config * Split test runners into defaultconfig and different app settings * Added delivery api tests * Cleaned up tests * Bumped version * Updated pipeline * Small fixes * Added password * Updated connection string * Fixed * Removed quotes * Removed unnecessary connection string * Added missing password * Cleaned up * Cleaned up * Cleaned up * Updated to use helpers * Bumped version * Updated helper usage * Added password to variables and a condition * Added check * Indented value * Fixed condition * More updates * Updated variable
1 parent b6be468 commit 3264d58

File tree

11 files changed

+708
-53
lines changed

11 files changed

+708
-53
lines changed

build/nightly-E2E-test-pipelines.yml

Lines changed: 379 additions & 44 deletions
Large diffs are not rendered by default.

tests/Umbraco.Tests.AcceptanceTest/package-lock.json

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

tests/Umbraco.Tests.AcceptanceTest/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
},
2222
"dependencies": {
2323
"@umbraco/json-models-builders": "^2.0.33",
24-
"@umbraco/playwright-testhelpers": "^15.0.52",
24+
"@umbraco/playwright-testhelpers": "^15.0.54",
2525
"camelize": "^1.0.0",
2626
"dotenv": "^16.3.1",
2727
"node-fetch": "^2.6.7"

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

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,34 @@ export default defineConfig({
4343
testMatch: '**/*.setup.ts',
4444
},
4545
{
46-
name: 'chromium',
46+
name: 'defaultConfig',
47+
testMatch: 'DefaultConfig/**',
4748
dependencies: ['setup'],
4849
use: {
4950
...devices['Desktop Chrome'],
5051
// Use prepared auth state.
5152
ignoreHTTPSErrors: true,
52-
storageState: STORAGE_STATE,
53-
},
53+
storageState: STORAGE_STATE
54+
}
5455
},
56+
{
57+
name: 'deliveryApi',
58+
testMatch: 'DeliveryApi/**',
59+
dependencies: ['setup'],
60+
use: {
61+
...devices['Desktop Chrome'],
62+
// Use prepared auth state.
63+
ignoreHTTPSErrors: true,
64+
storageState: STORAGE_STATE
65+
}
66+
},
67+
// This project is used to test the install steps, for that we do not need to authenticate.
68+
{
69+
name: 'unattendedInstallConfig',
70+
testMatch: 'UnattendedInstallConfig/**',
71+
use: {
72+
...devices['Desktop Chrome']
73+
}
74+
}
5575
],
5676
});
Lines changed: 58 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,58 @@
1-
{}
1+
{
2+
"$schema": "appsettings-schema.json",
3+
"Serilog": {
4+
"MinimumLevel": {
5+
"Default": "Information",
6+
"Override": {
7+
"Microsoft": "Warning",
8+
"Microsoft.Hosting.Lifetime": "Information",
9+
"System": "Warning"
10+
}
11+
},
12+
"WriteTo": [
13+
{
14+
"Name": "Async",
15+
"Args": {
16+
"Configure": [
17+
{
18+
"Name": "Console"
19+
}
20+
]
21+
}
22+
}
23+
]
24+
},
25+
"Umbraco": {
26+
"CMS": {
27+
"Unattended": {
28+
"InstallUnattended": true,
29+
"UnattendedUserName": "Playwright Test",
30+
"UnattendedUserEmail": "[email protected]",
31+
"UnattendedUserPassword": "UmbracoAcceptance123!"
32+
},
33+
"Content": {
34+
"ContentVersionCleanupPolicy": {
35+
"EnableCleanup": false
36+
}
37+
},
38+
"Global": {
39+
"DisableElectionForSingleServer": true,
40+
"InstallMissingDatabase": true,
41+
"Id": "00000000-0000-0000-0000-000000000042",
42+
"VersionCheckPeriod": 0,
43+
"UseHttps": true
44+
},
45+
"HealthChecks": {
46+
"Notification": {
47+
"Enabled": false
48+
}
49+
},
50+
"KeepAlive": {
51+
"DisableKeepAliveTask": true
52+
},
53+
"WebRouting": {
54+
"UmbracoApplicationUrl": "https://localhost:44331/"
55+
}
56+
}
57+
}
58+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import {expect} from '@playwright/test';
2+
import {AliasHelper, test} from '@umbraco/playwright-testhelpers';
3+
4+
test('can get content from delivery api', async ({umbracoApi}) => {
5+
// Arrange
6+
const documentTypeName = 'TestDocumentType';
7+
const contentName = 'TestContent';
8+
const dataTypeName = 'Textstring';
9+
const textStringValue = 'This is a test text string value';
10+
await umbracoApi.documentType.ensureNameNotExists(documentTypeName);
11+
const dataType = await umbracoApi.dataType.getByName(dataTypeName);
12+
const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, dataTypeName, dataType.id, 'TestGroup');
13+
const documentId = await umbracoApi.document.createDocumentWithTextContent(contentName, documentTypeId, textStringValue, dataTypeName);
14+
const propertyValue = {
15+
dataTypeName: AliasHelper.toAlias(dataTypeName),
16+
dataTypeValue: textStringValue
17+
}
18+
19+
// Act
20+
await umbracoApi.document.publish(documentId);
21+
22+
// Assert
23+
expect(await umbracoApi.deliveryApi.doesContentItemWithIdContainValues(documentId, contentName, AliasHelper.toAlias(documentTypeName), [propertyValue])).toBeTruthy();
24+
25+
// Clean
26+
await umbracoApi.documentType.ensureNameNotExists(documentTypeName);
27+
});
28+
29+
test('can get media image from delivery api', async ({umbracoApi}) => {
30+
// Arrange
31+
const mediaName = 'TestMedia';
32+
const mediaTypeName = 'File';
33+
await umbracoApi.media.ensureNameNotExists(mediaName);
34+
const mediaId = await umbracoApi.media.createDefaultMediaFile(mediaName);
35+
const mediaUrl = await umbracoApi.media.getMediaUrlById(mediaId);
36+
37+
// Assert
38+
expect(await umbracoApi.deliveryApi.doesMediaItemWithIdContainValues(mediaId, mediaName, mediaTypeName, mediaUrl)).toBeTruthy();
39+
40+
// Clean
41+
await umbracoApi.media.ensureNameNotExists(mediaName);
42+
});
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// TODO: Consider refactoring the initialization process to improve readability or simplify the builder configuration.
2+
WebApplicationBuilder builder = WebApplication.CreateBuilder(args);
3+
4+
builder.CreateUmbracoBuilder()
5+
.AddBackOffice()
6+
.AddWebsite()
7+
.AddDeliveryApi()
8+
.AddComposers()
9+
.Build();
10+
11+
WebApplication app = builder.Build();
12+
13+
await app.BootUmbracoAsync();
14+
15+
16+
app.UseUmbraco()
17+
.WithMiddleware(u =>
18+
{
19+
u.UseBackOffice();
20+
u.UseWebsite();
21+
})
22+
.WithEndpoints(u =>
23+
{
24+
u.UseBackOfficeEndpoints();
25+
u.UseWebsiteEndpoints();
26+
});
27+
28+
await app.RunAsync();
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
{
2+
"$schema": "appsettings-schema.json",
3+
"Serilog": {
4+
"MinimumLevel": {
5+
"Default": "Information",
6+
"Override": {
7+
"Microsoft": "Warning",
8+
"Microsoft.Hosting.Lifetime": "Information",
9+
"System": "Warning"
10+
}
11+
},
12+
"WriteTo": [
13+
{
14+
"Name": "Async",
15+
"Args": {
16+
"Configure": [
17+
{
18+
"Name": "Console"
19+
}
20+
]
21+
}
22+
}
23+
]
24+
},
25+
"Umbraco": {
26+
"CMS": {
27+
"DeliveryApi": {
28+
"Enabled": true,
29+
"Media": {
30+
"Enabled": true
31+
}
32+
},
33+
"Unattended": {
34+
"InstallUnattended": true,
35+
"UnattendedUserName": "Playwright Test",
36+
"UnattendedUserEmail": "[email protected]",
37+
"UnattendedUserPassword": "UmbracoAcceptance123!"
38+
},
39+
"Content": {
40+
"ContentVersionCleanupPolicy": {
41+
"EnableCleanup": false
42+
}
43+
},
44+
"Global": {
45+
"DisableElectionForSingleServer": true,
46+
"InstallMissingDatabase": true,
47+
"Id": "00000000-0000-0000-0000-000000000042",
48+
"VersionCheckPeriod": 0,
49+
"UseHttps": true
50+
},
51+
"HealthChecks": {
52+
"Notification": {
53+
"Enabled": false
54+
}
55+
},
56+
"KeepAlive": {
57+
"DisableKeepAliveTask": true
58+
},
59+
"WebRouting": {
60+
"UmbracoApplicationUrl": "https://localhost:44331/"
61+
}
62+
}
63+
}
64+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
// To be able to test different databases, we need to set an additional UnattendedInstallConfig up because we would have to start from scratch, otherwise we would be using the same database.
2+
import {ConstantHelper, test} from '@umbraco/playwright-testhelpers';
3+
4+
const name = 'TestName';
5+
const email = process.env.UMBRACO_USER_LOGIN;
6+
const password = process.env.UMBRACO_USER_PASSWORD;
7+
8+
test('Install Umbraco using SQLServer Express', async ({umbracoUi}) => {
9+
test.slow();
10+
// Arrange
11+
await umbracoUi.install.goToInstallPage();
12+
13+
// Act
14+
await umbracoUi.install.enterName(name);
15+
await umbracoUi.install.enterEmail(email);
16+
await umbracoUi.install.enterPassword(password);
17+
await umbracoUi.install.clickNextButton();
18+
await umbracoUi.install.clickNextButton();
19+
await umbracoUi.install.setDatabaseType('SQL Server Express LocalDB');
20+
await umbracoUi.install.doesDatabaseHaveType('SQL Server Express LocalDB');
21+
await umbracoUi.install.clickInstallButton();
22+
23+
// Assert
24+
await umbracoUi.login.enterEmail(email);
25+
await umbracoUi.login.enterPassword(password);
26+
await umbracoUi.login.clickLoginButton();
27+
await umbracoUi.content.goToSection(ConstantHelper.sections.content);
28+
});
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// To be able to test different databases, we need to set an additional UnattendedInstallConfig up because we would have to start from scratch, otherwise we would be using the same database.
2+
import {ConstantHelper, test} from '@umbraco/playwright-testhelpers';
3+
4+
const name = 'TestName';
5+
const email = process.env.UMBRACO_USER_LOGIN;
6+
const password = process.env.UMBRACO_USER_PASSWORD;
7+
8+
test('Install Umbraco using SQLite', async ({umbracoUi}) => {
9+
test.slow();
10+
// Arrange
11+
await umbracoUi.install.goToInstallPage();
12+
13+
// Act
14+
await umbracoUi.install.enterName(name);
15+
await umbracoUi.install.enterEmail(email);
16+
await umbracoUi.install.enterPassword(password);
17+
await umbracoUi.install.clickNextButton();
18+
await umbracoUi.install.clickNextButton();
19+
await umbracoUi.install.doesDatabaseHaveType('SQLite');
20+
await umbracoUi.install.clickInstallButton();
21+
22+
// Assert
23+
await umbracoUi.login.enterEmail(email);
24+
await umbracoUi.login.enterPassword(password);
25+
await umbracoUi.login.clickLoginButton();
26+
await umbracoUi.content.goToSection(ConstantHelper.sections.content);
27+
});

0 commit comments

Comments
 (0)