Skip to content

Commit 89a8bd3

Browse files
authored
V16 QA Implement new release tag for E2E tests (#19697)
* Removed this as these tests are covered in other files * Added release tags * Make all tests with @smoke and @Release tags run in the pipeline * Updated npx command * Updated npx command * Updated npx command * Fixed failed tests related to document type folder * Cleaned up * Used grep in yaml file instead of package.json file * Updated yml file * Updated testCommand * Fixed command * Added releaseTest command * Added another job to run regression test in the release build * Fixed comments * Updated name of test job * Make all release tests run in the pipeline * Updated warning message * Reverted npm command
1 parent 9414201 commit 89a8bd3

File tree

75 files changed

+325
-146
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

75 files changed

+325
-146
lines changed

build/azure-pipelines.yml

Lines changed: 174 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -513,9 +513,9 @@ stages:
513513
UMBRACO__CMS__WEBROUTING__UMBRACOAPPLICATIONURL: https://localhost:44331/
514514
ASPNETCORE_URLS: https://localhost:44331
515515
jobs:
516-
# E2E Tests
516+
# E2E Smoke Tests
517517
- job:
518-
displayName: E2E Tests (SQLite)
518+
displayName: E2E Smoke Tests (SQLite)
519519
# currently disabled due to DB locks randomly occuring.
520520
condition: eq(${{parameters.sqliteAcceptanceTests}}, True)
521521
variables:
@@ -678,7 +678,7 @@ stages:
678678
testRunTitle: "$(Agent.JobName)"
679679

680680
- job:
681-
displayName: E2E Tests (SQL Server)
681+
displayName: E2E Smoke Tests (SQL Server)
682682
variables:
683683
# Connection string
684684
CONNECTIONSTRINGS__UMBRACODBDSN: Data Source=(localdb)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\Umbraco.mdf;Integrated Security=True
@@ -862,6 +862,176 @@ stages:
862862
searchFolder: "tests/Umbraco.Tests.AcceptanceTest/results"
863863
testRunTitle: "$(Agent.JobName)"
864864

865+
- job:
866+
displayName: E2E Release Tests (SQL Server)
867+
variables:
868+
# Connection string
869+
CONNECTIONSTRINGS__UMBRACODBDSN: Data Source=(localdb)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\Umbraco.mdf;Integrated Security=True
870+
CONNECTIONSTRINGS__UMBRACODBDSN_PROVIDERNAME: Microsoft.Data.SqlClient
871+
condition: eq(dependencies.Build.outputs['A.build.NBGV_PublicRelease'], 'True')
872+
strategy:
873+
matrix:
874+
WindowsPart1Of3:
875+
vmImage: "windows-latest"
876+
testCommand: "npm run releaseTest -- --shard=1/3"
877+
WindowsPart2Of3:
878+
vmImage: "windows-latest"
879+
testCommand: "npm run releaseTest -- --shard=2/3"
880+
WindowsPart3Of3:
881+
vmImage: "windows-latest"
882+
testCommand: "npm run releaseTest -- --shard=3/3"
883+
pool:
884+
vmImage: $(vmImage)
885+
steps:
886+
# Setup test environment
887+
- task: DownloadPipelineArtifact@2
888+
displayName: Download NuGet artifacts
889+
inputs:
890+
artifact: nupkg
891+
path: $(Agent.BuildDirectory)/app/nupkg
892+
893+
- task: NodeTool@0
894+
displayName: Use Node.js $(nodeVersion)
895+
inputs:
896+
versionSpec: $(nodeVersion)
897+
898+
- task: UseDotNet@2
899+
displayName: Use .NET SDK from global.json
900+
inputs:
901+
useGlobalJson: true
902+
903+
- pwsh: |
904+
"UMBRACO_USER_LOGIN=$(UMBRACO__CMS__UNATTENDED__UNATTENDEDUSEREMAIL)
905+
UMBRACO_USER_PASSWORD=$(UMBRACO__CMS__UNATTENDED__UNATTENDEDUSERPASSWORD)
906+
URL=$(ASPNETCORE_URLS)
907+
STORAGE_STAGE_PATH=$(Build.SourcesDirectory)/tests/Umbraco.Tests.AcceptanceTest/playwright/.auth/user.json
908+
CONSOLE_ERRORS_PATH=$(Build.SourcesDirectory)/tests/Umbraco.Tests.AcceptanceTest/console-errors.json" | Out-File .env
909+
displayName: Generate .env
910+
workingDirectory: $(Build.SourcesDirectory)/tests/Umbraco.Tests.AcceptanceTest
911+
912+
# Cache and restore NPM packages
913+
- task: Cache@2
914+
displayName: Cache NPM packages
915+
inputs:
916+
key: 'npm_e2e | "$(Agent.OS)" | $(Build.SourcesDirectory)/tests/Umbraco.Tests.AcceptanceTest/package-lock.json'
917+
restoreKeys: |
918+
npm_e2e | "$(Agent.OS)"
919+
npm_e2e
920+
path: $(npm_config_cache)
921+
922+
- script: npm ci --no-fund --no-audit --prefer-offline
923+
workingDirectory: $(Build.SourcesDirectory)/tests/Umbraco.Tests.AcceptanceTest
924+
displayName: Restore NPM packages
925+
926+
# Build application
927+
- pwsh: |
928+
$cmsVersion = "$(Build.BuildNumber)" -replace "\+",".g"
929+
dotnet new nugetconfig
930+
dotnet nuget add source ./nupkg --name Local
931+
dotnet new install Umbraco.Templates::$cmsVersion
932+
dotnet new umbraco --name UmbracoProject --version $cmsVersion --exclude-gitignore --no-restore --no-update-check
933+
dotnet restore UmbracoProject
934+
cp $(Build.SourcesDirectory)/tests/Umbraco.Tests.AcceptanceTest.UmbracoProject/*.cs UmbracoProject
935+
dotnet build UmbracoProject --configuration $(buildConfiguration) --no-restore
936+
dotnet dev-certs https
937+
displayName: Build application
938+
workingDirectory: $(Agent.BuildDirectory)/app
939+
940+
# Start SQL Server
941+
- powershell: docker run --name mssql -d -p 1433:1433 -e "ACCEPT_EULA=Y" -e "MSSQL_SA_PASSWORD=$(SA_PASSWORD)" mcr.microsoft.com/mssql/server:2022-latest
942+
displayName: Start SQL Server Docker image (Linux)
943+
condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'))
944+
945+
- pwsh: SqlLocalDB start MSSQLLocalDB
946+
displayName: Start SQL Server LocalDB (Windows)
947+
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
948+
949+
# Run application
950+
- bash: |
951+
nohup dotnet run --project UmbracoProject --configuration $(buildConfiguration) --no-build --no-launch-profile > $(Build.ArtifactStagingDirectory)/playwright.log 2>&1 &
952+
echo "##vso[task.setvariable variable=AcceptanceTestProcessId]$!"
953+
displayName: Run application (Linux)
954+
condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux'))
955+
workingDirectory: $(Agent.BuildDirectory)/app
956+
957+
- pwsh: |
958+
$process = Start-Process dotnet "run --project UmbracoProject --configuration $(buildConfiguration) --no-build --no-launch-profile 2>&1" -PassThru -NoNewWindow -RedirectStandardOutput $(Build.ArtifactStagingDirectory)/playwright.log
959+
Write-Host "##vso[task.setvariable variable=AcceptanceTestProcessId]$($process.Id)"
960+
displayName: Run application (Windows)
961+
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
962+
workingDirectory: $(Agent.BuildDirectory)/app
963+
964+
# Wait for application to start responding to requests
965+
- pwsh: npx wait-on -v --interval 1000 --timeout 120000 $(ASPNETCORE_URLS)
966+
displayName: Wait for application
967+
workingDirectory: tests/Umbraco.Tests.AcceptanceTest
968+
969+
# Install Playwright and dependencies
970+
- pwsh: npx playwright install chromium
971+
displayName: Install Playwright only with Chromium browser
972+
workingDirectory: tests/Umbraco.Tests.AcceptanceTest
973+
974+
# Test
975+
- pwsh: $(testCommand)
976+
displayName: Run Playwright tests
977+
workingDirectory: tests/Umbraco.Tests.AcceptanceTest
978+
env:
979+
CI: true
980+
CommitId: $(Build.SourceVersion)
981+
AgentOs: $(Agent.OS)
982+
983+
# Stop application
984+
- bash: kill -15 $(AcceptanceTestProcessId)
985+
displayName: Stop application (Linux)
986+
condition: and(ne(variables.AcceptanceTestProcessId, ''), eq(variables['Agent.OS'], 'Linux'))
987+
988+
- pwsh: Stop-Process -Id $(AcceptanceTestProcessId)
989+
displayName: Stop application (Windows)
990+
condition: and(ne(variables.AcceptanceTestProcessId, ''), eq(variables['Agent.OS'], 'Windows_NT'))
991+
992+
# Stop SQL Server
993+
- pwsh: docker stop mssql
994+
displayName: Stop SQL Server Docker image (Linux)
995+
condition: eq(variables['Agent.OS'], 'Linux')
996+
997+
- pwsh: SqlLocalDB stop MSSQLLocalDB
998+
displayName: Stop SQL Server LocalDB (Windows)
999+
condition: eq(variables['Agent.OS'], 'Windows_NT')
1000+
1001+
# Copy artifacts
1002+
- pwsh: |
1003+
if (Test-Path tests/Umbraco.Tests.AcceptanceTest/results/*) {
1004+
Copy-Item tests/Umbraco.Tests.AcceptanceTest/results/* $(Build.ArtifactStagingDirectory) -Recurse
1005+
}
1006+
displayName: Copy Playwright results
1007+
condition: succeededOrFailed()
1008+
1009+
# Copy console error log
1010+
- pwsh: |
1011+
if (Test-Path tests/Umbraco.Tests.AcceptanceTest/console-errors.json) {
1012+
Copy-Item tests/Umbraco.Tests.AcceptanceTest/console-errors.json $(Build.ArtifactStagingDirectory)
1013+
}
1014+
displayName: Copy console error log
1015+
condition: succeededOrFailed()
1016+
1017+
# Publish test artifacts
1018+
- task: PublishPipelineArtifact@1
1019+
displayName: Publish test artifacts
1020+
condition: succeededOrFailed()
1021+
inputs:
1022+
targetPath: $(Build.ArtifactStagingDirectory)
1023+
artifact: "Acceptance Test Results - $(Agent.JobName) - Attempt #$(System.JobAttempt)"
1024+
1025+
# Publish test results
1026+
- task: PublishTestResults@2
1027+
displayName: "Publish test results"
1028+
condition: succeededOrFailed()
1029+
inputs:
1030+
testResultsFormat: 'JUnit'
1031+
testResultsFiles: '*.xml'
1032+
searchFolder: "tests/Umbraco.Tests.AcceptanceTest/results"
1033+
testRunTitle: "$(Agent.JobName)"
1034+
8651035
###############################################
8661036
## Release
8671037
###############################################
@@ -1067,4 +1237,4 @@ stages:
10671237
storage: umbracoapidocs
10681238
ContainerName: "$web"
10691239
BlobPrefix: v$(umbracoMajorVersion)/ui-api
1070-
CleanTargetBeforeCopy: true
1240+
CleanTargetBeforeCopy: true

tests/Umbraco.Tests.AcceptanceTest/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
"all": "npx playwright test",
1111
"createTest": "node createTest.js",
1212
"smokeTest": "npx playwright test DefaultConfig --grep \"@smoke\"",
13-
"smokeTestSqlite": "npx playwright test DefaultConfig --grep \"@smoke\" --grep-invert \"Users\""
13+
"smokeTestSqlite": "npx playwright test DefaultConfig --grep \"@smoke\" --grep-invert \"Users\"",
14+
"releaseTest": "npx playwright test DefaultConfig --grep \"@release\""
1415
},
1516
"devDependencies": {
1617
"@playwright/test": "^1.50",
@@ -26,4 +27,4 @@
2627
"dotenv": "^16.3.1",
2728
"node-fetch": "^2.6.7"
2829
}
29-
}
30+
}

tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Content/ContentWithApprovedColor.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ test('can publish content with the approved color data type', async ({umbracoApi
5858
expect(contentData.values).toEqual([]);
5959
});
6060

61-
test('can create content with the custom approved color data type', async ({umbracoApi, umbracoUi}) => {
61+
test('can create content with the custom approved color data type', {tag: '@release'}, async ({umbracoApi, umbracoUi}) => {
6262
// Arrange
6363
const customDataTypeName = 'CustomApprovedColor';
6464
const colorValue = 'd73737';

tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Content/ContentWithCheckboxList.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ test('can create content with the custom checkbox list data type', async ({umbra
8080
expect(contentData.values[0].value).toEqual([optionValues[0]]);
8181
});
8282

83-
test('can not publish a mandatory checkbox list with an empty value', async ({umbracoApi, umbracoUi}) => {
83+
test('can not publish a mandatory checkbox list with an empty value', {tag: '@release'}, async ({umbracoApi, umbracoUi}) => {
8484
// Arrange
8585
const optionValues = ['testOption1', 'testOption2'];
8686
const customDataTypeId = await umbracoApi.dataType.createCheckboxListDataType(customDataTypeName, optionValues);

tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Content/ContentWithCustomDataType.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ test('can create content with the custom data type with slider property editor',
265265
expect(contentData.values).toEqual([]);
266266
});
267267

268-
test('can change slider value in the content section', async ({umbracoApi, umbracoUi}) => {
268+
test('can change slider value in the content section', {tag: '@release'}, async ({umbracoApi, umbracoUi}) => {
269269
// Arrange
270270
customDataTypeName = 'Slider';
271271
const sliderValue = 10;

tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Content/ContentWithDropdown.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ for (const dataTypeName of dataTypeNames) {
8383
});
8484
}
8585

86-
test('can not publish a mandatory dropdown with an empty value', async ({umbracoApi, umbracoUi}) => {
86+
test('can not publish a mandatory dropdown with an empty value', {tag: '@release'}, async ({umbracoApi, umbracoUi}) => {
8787
// Arrange
8888
const optionValues = ['testOption1', 'testOption2', 'testOption3'];
8989
const customDataTypeId = await umbracoApi.dataType.createDropdownDataType(customDataTypeName, false, optionValues);

tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Content/ContentWithImageMediaPicker.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ test.afterEach(async ({umbracoApi}) => {
1818
await umbracoApi.documentType.ensureNameNotExists(documentTypeName);
1919
});
2020

21-
test('can save content with a image media picker', async ({umbracoApi, umbracoUi}) => {
21+
test('can create content with a image media picker', async ({umbracoApi, umbracoUi}) => {
2222
// Arrange
2323
const expectedState = 'Draft';
2424
const dataType = await umbracoApi.dataType.getByName(dataTypeName);
@@ -60,7 +60,7 @@ test('can publish content with a image media picker', async ({umbracoApi, umbrac
6060
expect(contentData.variants[0].state).toBe(expectedState);
6161
});
6262

63-
test('can add an image to the image media picker', async ({umbracoApi, umbracoUi}) => {
63+
test('can add an image to the image media picker', {tag: '@release'}, async ({umbracoApi, umbracoUi}) => {
6464
// Arrange
6565
const dataType = await umbracoApi.dataType.getByName(dataTypeName);
6666
await umbracoApi.media.ensureNameNotExists(mediaName);

tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Content/ContentWithMultiURLPicker.spec.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ test('can create content with the media link', async ({umbracoApi, umbracoUi}) =
170170
await umbracoApi.media.ensureNameNotExists(mediaFileName);
171171
});
172172

173-
test('can add multiple links in the content', async ({umbracoApi, umbracoUi}) => {
173+
test('can add multiple links in the content', {tag: '@release'}, async ({umbracoApi, umbracoUi}) => {
174174
// Arrange
175175
const dataTypeData = await umbracoApi.dataType.getByName(dataTypeName);
176176
const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, dataTypeName, dataTypeData.id);
@@ -190,6 +190,7 @@ test('can add multiple links in the content', async ({umbracoApi, umbracoUi}) =>
190190
await umbracoUi.content.selectMediaWithName(mediaFileName);
191191
await umbracoUi.content.clickChooseModalButton();
192192
await umbracoUi.content.clickAddButton();
193+
await umbracoUi.waitForTimeout(500); // Wait for the media link to be added
193194
// Add external link
194195
await umbracoUi.content.clickAddMultiURLPickerButton();
195196
await umbracoUi.content.clickManualLinkButton();
@@ -267,7 +268,7 @@ test('can edit the URL picker in the content', async ({umbracoApi, umbracoUi}) =
267268
expect(contentData.values[0].value[0].url).toEqual(link);
268269
});
269270

270-
test('cannot submit an empty link', async ({umbracoApi, umbracoUi}) => {
271+
test('cannot submit an empty link', {tag: '@release'}, async ({umbracoApi, umbracoUi}) => {
271272
// Arrange
272273
const dataTypeData = await umbracoApi.dataType.getByName(dataTypeName);
273274
const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, dataTypeName, dataTypeData.id);
@@ -288,7 +289,7 @@ test('cannot submit an empty link', async ({umbracoApi, umbracoUi}) => {
288289
await umbracoUi.content.isTextWithMessageVisible(ConstantHelper.validationMessages.emptyLinkPicker);
289290
});
290291

291-
test('cannot update the URL picker with an empty link', async ({umbracoApi, umbracoUi}) => {
292+
test('cannot update the URL picker with an empty link', {tag: '@release'}, async ({umbracoApi, umbracoUi}) => {
292293
// Arrange
293294
const dataTypeData = await umbracoApi.dataType.getByName(dataTypeName);
294295
const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, dataTypeName, dataTypeData.id);

tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Content/ContentWithMultipleImageMediaPicker.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ test('can publish content with multiple image media picker data type', async ({u
6969
expect(contentData.values).toEqual([]);
7070
});
7171

72-
test('can add multiple images to the multiple image media picker', async ({umbracoApi, umbracoUi}) => {
72+
test('can add multiple images to the multiple image media picker', {tag: '@release'}, async ({umbracoApi, umbracoUi}) => {
7373
// Arrange
7474
const dataTypeData = await umbracoApi.dataType.getByName(dataTypeName);
7575
const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, dataTypeName, dataTypeData.id);

tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Content/ContentWithMultipleMediaPicker.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ test('can add multiple media files to the multiple media picker', async ({umbrac
9797
expect(contentData.values[0].value[1].mediaTypeAlias).toEqual(secondMediaTypeName);
9898
});
9999

100-
test('can remove a media picker in the content', async ({umbracoApi, umbracoUi}) => {
100+
test('can remove a media picker in the content', {tag: '@release'}, async ({umbracoApi, umbracoUi}) => {
101101
// Arrange
102102
const dataTypeData = await umbracoApi.dataType.getByName(dataTypeName);
103103
const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, dataTypeName, dataTypeData.id);

0 commit comments

Comments
 (0)