From 049ea6dca528ce1d0ffe689edd806e391efa2eb2 Mon Sep 17 00:00:00 2001 From: Ronald Barendse Date: Mon, 10 Oct 2022 09:09:59 +0200 Subject: [PATCH 1/6] Publish E2E application logs (#13128) * Publish E2E application logs * Stop app after running E2E tests * Update GenerateAppsettingsSchema task * Enable console logging in Release mode * Cleanup variables and enable logging in Linux docker * Remove --yes from npx commands * Set custom Umbraco settings (disable keep-alive, health checks, etc.) * Update Docker image tags/versions * Change PowerShell@2 task to pwsh and write results to artifact staging directory * Ignore Playwright .env file --- .gitignore | 5 +- build/azure-pipelines.yml | 151 ++++++++---------- src/Umbraco.Cms/Umbraco.Cms.csproj | 2 +- .../misc/umbraco-linux.docker | 19 ++- 4 files changed, 82 insertions(+), 95 deletions(-) diff --git a/.gitignore b/.gitignore index 94c804dd4a..a9d9c8e501 100644 --- a/.gitignore +++ b/.gitignore @@ -90,10 +90,7 @@ preserve.belle /src/Umbraco.Web.UI/appsettings.Local.json # Tests -cypress.env.json -/tests/Umbraco.Tests.AcceptanceTest/cypress/screenshots/ -/tests/Umbraco.Tests.AcceptanceTest/cypress/support/chainable.ts -/tests/Umbraco.Tests.AcceptanceTest/cypress/videos/ +/tests/Umbraco.Tests.AcceptanceTest/.env /tests/Umbraco.Tests.Integration.SqlCe/DatabaseContextTests.sdf /tests/Umbraco.Tests.Integration.SqlCe/[Uu]mbraco/[Dd]ata/TEMP/ /tests/Umbraco.Tests.Integration/appsettings.Tests.Local.json diff --git a/build/azure-pipelines.yml b/build/azure-pipelines.yml index d90a9bb30e..8dc3a611ab 100644 --- a/build/azure-pipelines.yml +++ b/build/azure-pipelines.yml @@ -349,24 +349,10 @@ stages: - job: displayName: E2E Tests variables: - - name: Umbraco__CMS__Unattended__InstallUnattended # Windows only - value: true - - name: Umbraco__CMS__Unattended__UnattendedUserName # Windows only - value: Playwright Test - - name: Umbraco__CMS__Unattended__UnattendedUserEmail # Windows only - value: playwright@umbraco.com - - name: Umbraco__CMS__Unattended__UnattendedUserPassword # Windows only - value: UmbracoAcceptance123! - - name: Umbraco__CMS__Global__InstallMissingDatabase # Windows only - value: true - - name: UmbracoDatabaseServer # Windows only - value: (LocalDB)\MSSQLLocalDB - - name: UmbracoDatabaseName # Windows only - value: Playwright - - name: ConnectionStrings__umbracoDbDSN # Windows only - value: Server=$(UmbracoDatabaseServer);Database=$(UmbracoDatabaseName);Integrated Security=true; - - name: PLAYWRIGHT_BASE_URL - value: https://localhost:8443 + Umbraco__CMS__Unattended__UnattendedUserName: Playwright Test + Umbraco__CMS__Unattended__UnattendedUserPassword: UmbracoAcceptance123! + Umbraco__CMS__Unattended__UnattendedUserEmail: playwright@umbraco.com + ASPNETCORE_URLS: https://localhost:8443 strategy: matrix: Linux: @@ -375,6 +361,20 @@ stages: dockerImageName: umbraco-linux Windows: vmImage: 'windows-latest' + # Enable console logging in Release mode + Serilog__WriteTo__0__Name: Async + Serilog__WriteTo__0__Args__configure__0__Name: Console + # Set unattended install settings + Umbraco__CMS__Unattended__InstallUnattended: true + Umbraco__CMS__Global__InstallMissingDatabase: true + UmbracoDatabaseServer: (LocalDB)\MSSQLLocalDB + UmbracoDatabaseName: Playwright + ConnectionStrings__umbracoDbDSN: Server=$(UmbracoDatabaseServer);Database=$(UmbracoDatabaseName);Integrated Security=true; + # Custom Umbraco settings + Umbraco__CMS__Global__VersionCheckPeriod: 0 + Umbraco__CMS__Global__UseHttps: true + Umbraco__CMS__HealthChecks__Notification__Enabled: false + Umbraco__CMS__KeepAlive__DisableKeepAliveTask: true pool: vmImage: $(vmImage) steps: @@ -395,22 +395,19 @@ stages: "npm_e2e" | "$(Agent.OS)" "npm_e2e" path: $(npm_config_cache) - - task: PowerShell@2 + - pwsh: | + New-Item -Path "." -Name ".env" -ItemType "file" -Value "UMBRACO_USER_LOGIN=$(Umbraco__CMS__Unattended__UnattendedUserEmail) + UMBRACO_USER_PASSWORD=$(Umbraco__CMS__Unattended__UnattendedUserPassword) + URL=$(ASPNETCORE_URLS)" displayName: Generate .env - inputs: - targetType: inline - workingDirectory: $(Build.SourcesDirectory)/tests/Umbraco.Tests.AcceptanceTest/ - script: | - New-Item -Path "." -Name ".env" -ItemType "file" -Value "UMBRACO_USER_LOGIN=$(Umbraco__CMS__Unattended__UnattendedUserEmail) - UMBRACO_USER_PASSWORD=$(Umbraco__CMS__Unattended__UnattendedUserPassword) - URL=$(PLAYWRIGHT_BASE_URL)" + workingDirectory: $(Build.SourcesDirectory)/tests/Umbraco.Tests.AcceptanceTest/ - script: npm ci --no-fund --no-audit --prefer-offline workingDirectory: $(Build.SourcesDirectory)/tests/Umbraco.Tests.AcceptanceTest/ displayName: Run npm ci - - powershell: sqllocaldb start mssqllocaldb + - pwsh: sqllocaldb start mssqllocaldb displayName: Start localdb (Windows only) condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT')) - - powershell: Invoke-Sqlcmd -Query "CREATE DATABASE $env:UmbracoDatabaseName" -ServerInstance $env:UmbracoDatabaseServer + - pwsh: Invoke-Sqlcmd -Query "CREATE DATABASE $env:UmbracoDatabaseName" -ServerInstance $env:UmbracoDatabaseServer displayName: Create database (Windows only) condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT')) - task: UseDotNet@2 @@ -419,72 +416,52 @@ stages: version: $(dotnetVersion) performMultiLevelLookup: true includePreviewVersions: $(dotnetIncludePreviewVersions) - # Linux containers smooth - - task: PowerShell@2 + - pwsh: | + $sha = 'g$(Build.SourceVersion)'.substring(0, 8) + docker build -t $(dockerImageName):$sha -f $(dockerfile) . + mkdir -p $(Build.ArtifactStagingDirectory)/docker-images + docker save -o $(Build.ArtifactStagingDirectory)/docker-images/$(dockerImageName).$sha.tar $(dockerImageName):$sha + dotnet dev-certs https -ep ${HOME}/.aspnet/https/aspnetapp.pfx -p $(Umbraco__CMS__Unattended__UnattendedUserPassword) + docker run --name $(dockerImageName) -dp 8080:5000 -dp 8443:5001 -e UMBRACO__CMS__GLOBAL__ID=$(UMBRACO__CMS__GLOBAL__ID) -e ASPNETCORE_Kestrel__Certificates__Default__Password="$(Umbraco__CMS__Unattended__UnattendedUserPassword)" -e ASPNETCORE_Kestrel__Certificates__Default__Path=/https/aspnetapp.pfx -v ${HOME}/.aspnet/https:/https/ $(dockerImageName):$sha + docker ps condition: and(succeeded(), eq(variables['Agent.OS'], 'Linux')) - displayName: Build & run container (Linux only) - inputs: - workingDirectory: tests/Umbraco.Tests.AcceptanceTest/misc - targetType: inline - script: | - $sha = 'g$(Build.SourceVersion)'.substring(0, 8) - docker build -t $(dockerImageName):$sha -f $(dockerfile) . - mkdir -p $(Build.ArtifactStagingDirectory)/docker-images - docker save -o $(Build.ArtifactStagingDirectory)/docker-images/$(dockerImageName).$sha.tar $(dockerImageName):$sha - dotnet dev-certs https -ep ${HOME}/.aspnet/https/aspnetapp.pfx -p UmbracoAcceptance123! - docker run --name $(dockerImageName) -dp 8080:5000 -dp 8443:5001 -e UMBRACO__CMS__GLOBAL__ID=$(UMBRACO__CMS__GLOBAL__ID) -e ASPNETCORE_Kestrel__Certificates__Default__Password="UmbracoAcceptance123!" -e ASPNETCORE_Kestrel__Certificates__Default__Path=/https/aspnetapp.pfx -v ${HOME}/.aspnet/https:/https/ $(dockerImageName):$sha - docker ps - # Urls matching docker setup. - - task: PowerShell@2 + displayName: Build and run container (Linux only) + workingDirectory: tests/Umbraco.Tests.AcceptanceTest/misc + - pwsh: | + dotnet new --install ./nupkg/Umbraco.Templates.*.nupkg + dotnet new umbraco --name Playwright --no-restore --output . + dotnet restore --configfile ./nuget.config + dotnet build --configuration $(buildConfiguration) --no-restore + dotnet dev-certs https + $process = Start-Process -FilePath "dotnet" -ArgumentList "run --configuration $(buildConfiguration) --no-build --no-launch-profile 2>&1" -PassThru -RedirectStandardOutput $(Build.ArtifactStagingDirectory)/playwright.log + Write-Host "##vso[task.setvariable variable=AcceptanceTestProcessId]$($process.Id)" condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT')) - displayName: Build & run app (Windows only) - inputs: - workingDirectory: tests/Umbraco.Tests.AcceptanceTest/misc - targetType: inline - script: | - dotnet new --install ./nupkg/Umbraco.Templates.*.nupkg - dotnet new umbraco --name Playwright --no-restore --output . - dotnet restore --configfile ./nuget.config - dotnet build --configuration $(buildConfiguration) --no-restore - dotnet dev-certs https - Start-Process -FilePath "dotnet" -ArgumentList "run --configuration $(buildConfiguration) --no-build --no-launch-profile --urls $(PLAYWRIGHT_BASE_URL)" - - task: PowerShell@2 + displayName: Build and run app (Windows only) + workingDirectory: tests/Umbraco.Tests.AcceptanceTest/misc + - pwsh: npx wait-on -v --interval 1000 --timeout 120000 $(ASPNETCORE_URLS) displayName: Wait for app - inputs: - targetType: inline - workingDirectory: tests/Umbraco.Tests.AcceptanceTest - script: | - npm i -g wait-on - wait-on -v --interval 1000 --timeout 120000 $(PLAYWRIGHT_BASE_URL) - - task: PowerShell@2 + workingDirectory: tests/Umbraco.Tests.AcceptanceTest + - pwsh: npx playwright install --with-deps displayName: Install Playwright - inputs: - targetType: inline - workingDirectory: tests/Umbraco.Tests.AcceptanceTest - script: npx playwright install - - task: PowerShell@2 + workingDirectory: tests/Umbraco.Tests.AcceptanceTest + - pwsh: npm run test --ignore-certificate-errors --output $(Build.ArtifactStagingDirectory)\test-results displayName: Run Playwright (Desktop) continueOnError: true - inputs: - targetType: inline - workingDirectory: tests/Umbraco.Tests.AcceptanceTest - script: 'npm run test --ignore-certificate-errors' - - task: PowerShell@2 - displayName: Check if artifacts folder exists - inputs: - targetType: inline - script: | - $MyVariable = Test-Path -Path $(Build.SourcesDirectory)/tests/Umbraco.Tests.AcceptanceTest/results - Write-Host "##vso[task.setvariable variable=resultFolderExists;]$MyVariable" - - task: CopyFiles@2 - displayName: Prepare artifacts - condition: eq(variables.resultFolderExists, 'True') - inputs: - sourceFolder: $(Build.SourcesDirectory)/tests/Umbraco.Tests.AcceptanceTest/results/ - targetFolder: $(Build.ArtifactStagingDirectory)/playwright + workingDirectory: tests/Umbraco.Tests.AcceptanceTest + env: + CI: true + PLAYWRIGHT_HTML_REPORT: $(Build.ArtifactStagingDirectory)\playwright-report + - pwsh: | + docker logs $(dockerImageName) > $(Build.ArtifactStagingDirectory)/playwright.log 2>&1 + docker stop $(dockerImageName) + condition: eq(variables['Agent.OS'], 'Linux') + displayName: Stop app (Linux only) + - pwsh: Stop-Process $env:AcceptanceTestProcessId + condition: eq(variables['Agent.OS'], 'Windows_NT') + displayName: Stop app (Windows only) - task: PublishPipelineArtifact@1 - displayName: "Publish test artifacts" - condition: eq(variables.resultFolderExists, 'True') + condition: always() + displayName: Publish test artifacts inputs: targetPath: $(Build.ArtifactStagingDirectory) artifact: 'E2E artifacts - $(Agent.OS) - Attempt #$(System.JobAttempt)' diff --git a/src/Umbraco.Cms/Umbraco.Cms.csproj b/src/Umbraco.Cms/Umbraco.Cms.csproj index 0ed27081a8..14804cae57 100644 --- a/src/Umbraco.Cms/Umbraco.Cms.csproj +++ b/src/Umbraco.Cms/Umbraco.Cms.csproj @@ -26,6 +26,6 @@ - + diff --git a/tests/Umbraco.Tests.AcceptanceTest/misc/umbraco-linux.docker b/tests/Umbraco.Tests.AcceptanceTest/misc/umbraco-linux.docker index 2e549a5312..90b0b96ad2 100644 --- a/tests/Umbraco.Tests.AcceptanceTest/misc/umbraco-linux.docker +++ b/tests/Umbraco.Tests.AcceptanceTest/misc/umbraco-linux.docker @@ -2,7 +2,7 @@ ## Build ############################################ -FROM mcr.microsoft.com/dotnet/sdk:6.0.300 AS build +FROM mcr.microsoft.com/dotnet/sdk:6.0.401 AS build COPY nuget.config . @@ -20,12 +20,16 @@ RUN dotnet publish --configuration Release --no-build --output /dist ## Run ############################################ -FROM mcr.microsoft.com/dotnet/aspnet:6.0.5 AS run +FROM mcr.microsoft.com/dotnet/aspnet:6.0.9 AS run WORKDIR /app COPY --from=build dist . -ENV ASPNETCORE_URLS="http://0.0.0.0:5000;https://0.0.0.0:5001" +# Enable console logging in Release mode +ENV Serilog__WriteTo__0__Name=Async +ENV Serilog__WriteTo__0__Args__configure__0__Name=Console + +# Set unattended install settings ENV ConnectionStrings__umbracoDbDSN_ProviderName="Microsoft.Data.Sqlite" ENV ConnectionStrings__umbracoDbDSN="Data Source=|DataDirectory|/Umbraco.sqlite.db;Cache=Shared;Foreign Keys=True;Pooling=True" ENV Umbraco__CMS__Unattended__InstallUnattended="true" @@ -33,4 +37,13 @@ ENV Umbraco__CMS__Unattended__UnattendedUserName="Playwright Test" ENV Umbraco__CMS__Unattended__UnattendedUserEmail="playwright@umbraco.com" ENV Umbraco__CMS__Unattended__UnattendedUserPassword="UmbracoAcceptance123!" +# Custom Umbraco settings +ENV Umbraco__CMS__Global__VersionCheckPeriod="0" +ENV Umbraco__CMS__Global__UseHttps="true" +ENV Umbraco__CMS__HealthChecks__Notification__Enabled="false" +ENV Umbraco__CMS__KeepAlive__DisableKeepAliveTask="true" + +# Set application URL +ENV ASPNETCORE_URLS="http://0.0.0.0:5000;https://0.0.0.0:5001" + CMD dotnet Playwright.dll From 9897208838f1e564abb00a34d24ac36e8418399e Mon Sep 17 00:00:00 2001 From: Kenn Jacobsen Date: Mon, 10 Oct 2022 12:58:50 +0200 Subject: [PATCH 2/6] Fix broken selectable state for list view items (#13148) --- .../src/views/content/apps/listview/listview.controller.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/views/content/apps/listview/listview.controller.js b/src/Umbraco.Web.UI.Client/src/views/content/apps/listview/listview.controller.js index 5dd205790c..3114d0d1ce 100644 --- a/src/Umbraco.Web.UI.Client/src/views/content/apps/listview/listview.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/content/apps/listview/listview.controller.js @@ -9,9 +9,9 @@ function propertyEditorReadonly () { // check for permission to update - return !(typeof $scope.variantContent !== 'undefined' && $scope.variantContent.allowedActions.includes('A')); + return $scope.variantContent && !$scope.variantContent.allowedActions.includes('A'); } - + } angular.module("umbraco").controller("Umbraco.Editors.Content.Apps.ListViewController", ContentAppListViewController); From 51968f3fba0677b8839d3f902d79c7aae51487c5 Mon Sep 17 00:00:00 2001 From: Nikolaj Geisle <70372949+Zeegaan@users.noreply.github.com> Date: Mon, 10 Oct 2022 16:15:53 +0200 Subject: [PATCH 3/6] Pass the node property to umb-property & umb-property-editor (#13151) Co-authored-by: Zeegaan --- .../src/views/components/content/umb-tabbed-content.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Umbraco.Web.UI.Client/src/views/components/content/umb-tabbed-content.html b/src/Umbraco.Web.UI.Client/src/views/components/content/umb-tabbed-content.html index f161c76ee0..8215c66691 100644 --- a/src/Umbraco.Web.UI.Client/src/views/components/content/umb-tabbed-content.html +++ b/src/Umbraco.Web.UI.Client/src/views/components/content/umb-tabbed-content.html @@ -11,17 +11,19 @@ data-element="property-{{property.alias}}" ng-repeat="property in tab.properties track by property.alias" property="property" + node="contentNodeModel" show-inherit="contentNodeModel.variants.length > 1 && property.variation !== 'CultureAndSegment'" inherits-from="defaultVariant.displayName"> - + From 0d290c1ab33ef8e664e1b9994bdf598875bd7b2c Mon Sep 17 00:00:00 2001 From: Andreas Zerbst <73799582+andr317c@users.noreply.github.com> Date: Tue, 11 Oct 2022 13:53:45 +0200 Subject: [PATCH 4/6] Updated: added more time to waitForTimeout so the pipelines have time to load (#13164) --- .../tests/DefaultConfig/Media/mediaSection.spec.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Media/mediaSection.spec.ts b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Media/mediaSection.spec.ts index 424b1310fb..e41e18e053 100644 --- a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Media/mediaSection.spec.ts +++ b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Media/mediaSection.spec.ts @@ -29,7 +29,7 @@ test.describe('Media', () => { {fileTypeNames: imageName}, {fileTypeNames: vectorGraphicsName}, {fileTypeNames: videoName} - ] + ]; await umbracoApi.media.deleteAllFiles(articleName,audioName,fileName,folderName,imageName,vectorGraphicsName,videoName); await umbracoApi.media.ensureNameNotExists(folderToMoveTooName); @@ -54,7 +54,8 @@ test.describe('Media', () => { await page.locator('[label-key="general_submit"]').click(); // Assert - await page.waitForTimeout(500); + // Needs to wait before refreshing the media tree, otherwise the media files wont be moved to the folder yet + await page.waitForTimeout(1000); await umbracoUi.refreshMediaTree(); await page.locator('[data-element="tree-item-' + folderToMoveTooName + '"]').click(); for (const names of mediaFileTypes) { From 4deceb43eb8ed269db56e1783d3289e71b78d536 Mon Sep 17 00:00:00 2001 From: Nikolaj Geisle <70372949+Zeegaan@users.noreply.github.com> Date: Tue, 11 Oct 2022 15:57:01 +0200 Subject: [PATCH 5/6] V10: 13099 fix validation error (#13170) * Add validation error message to Viewpicker * Add help-inline class to make validation-text red Co-authored-by: Zeegaan --- .../views/dataTypes/views/datatype.settings.html | 8 ++++---- .../macros/views/macro.settings.controller.js | 8 ++++---- .../src/views/macros/views/settings.html | 15 ++++++++++----- 3 files changed, 18 insertions(+), 13 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/views/dataTypes/views/datatype.settings.html b/src/Umbraco.Web.UI.Client/src/views/dataTypes/views/datatype.settings.html index b4422dc49e..f0eb5b535b 100644 --- a/src/Umbraco.Web.UI.Client/src/views/dataTypes/views/datatype.settings.html +++ b/src/Umbraco.Web.UI.Client/src/views/dataTypes/views/datatype.settings.html @@ -8,9 +8,9 @@ -
@@ -23,7 +23,7 @@ ng-click="vm.openPropertyEditorPicker()"> -
+
Required diff --git a/src/Umbraco.Web.UI.Client/src/views/macros/views/macro.settings.controller.js b/src/Umbraco.Web.UI.Client/src/views/macros/views/macro.settings.controller.js index 5f633a6e4b..fd7889a7a6 100644 --- a/src/Umbraco.Web.UI.Client/src/views/macros/views/macro.settings.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/macros/views/macro.settings.controller.js @@ -14,11 +14,11 @@ function MacrosSettingsController($scope, editorService, localizationService) { //vm.removeMacroView = removeMacroView; $scope.model.openViewPicker = openViewPicker; $scope.model.removeMacroView = removeMacroView; - var labels = {}; - + vm.macroPartialViewPickerProperty = { alias : "macroPartialViewPickerProperty", description: "", label: "Macro partial view", validation: {mandatory : true}} localizationService.localizeMany(["macro_selectViewFile"]).then(function(data) { labels.selectViewFile = data[0]; + vm.macroPartialViewPickerProperty.description = data[0]; }); function openViewPicker() { @@ -45,7 +45,7 @@ function MacrosSettingsController($scope, editorService, localizationService) { name: $scope.model.macro.view }; - //$scope.model.submit($scope.model); + //$scope.model.submit($scope.model); editorService.close(); }, @@ -63,7 +63,7 @@ function MacrosSettingsController($scope, editorService, localizationService) { } function init() { - + } init(); diff --git a/src/Umbraco.Web.UI.Client/src/views/macros/views/settings.html b/src/Umbraco.Web.UI.Client/src/views/macros/views/settings.html index c152c33193..9b79061654 100644 --- a/src/Umbraco.Web.UI.Client/src/views/macros/views/settings.html +++ b/src/Umbraco.Web.UI.Client/src/views/macros/views/settings.html @@ -5,10 +5,9 @@
- - - + + - + - +
+ + Required + +
+ +
From 3a08ab9b0b4a78f08b7bfc2a20fa0833afd02208 Mon Sep 17 00:00:00 2001 From: Nikolaj Date: Wed, 12 Oct 2022 10:29:46 +0200 Subject: [PATCH 6/6] Re-add IsPackable to Umbraco.Tests.Integration --- tests/Umbraco.Tests.Integration/Umbraco.Tests.Integration.csproj | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/Umbraco.Tests.Integration/Umbraco.Tests.Integration.csproj b/tests/Umbraco.Tests.Integration/Umbraco.Tests.Integration.csproj index 10424d2c14..76f030d6bc 100644 --- a/tests/Umbraco.Tests.Integration/Umbraco.Tests.Integration.csproj +++ b/tests/Umbraco.Tests.Integration/Umbraco.Tests.Integration.csproj @@ -3,6 +3,7 @@ Umbraco.Cms.Tests.Integration Umbraco CMS - Integration tests Contains helper classes for integration tests with Umbraco CMS, including all internal integration tests. + true true Umbraco.Cms.Tests.Integration