From 664da17c3932edbe8196991766855e7d48173dfa Mon Sep 17 00:00:00 2001 From: Nhu Dinh <150406148+nhudinh0309@users.noreply.github.com> Date: Fri, 12 Jan 2024 19:32:25 +0700 Subject: [PATCH] V14 QA Fixed the failed acceptance tests (#15527) * Fixed failing tests * Updated tests to use the updated helpers * Clean up tests * Enabled our pipeline for E2E testing * Updated the CMS URl for our E2E tests * Bumped version of our testHelpers * Did some fixing, still a bit more to do * Updated auth tests to use LoginUiHelper * Updated Telemetry tests to use TelemetryUiHelper * Updated LogViewer tests to use LogViewerUiHelper * Updated api tests to apply AAA pattern and fix failed tests * Removed unused import * Fixed comments * Bumped version of test helper * Updated the version to 10 instead of 11 * Updated the package-lock.json file to contain the correct versions * Added a waitForTimeout The reason for this is that this test is failing on the pipeline * Bumped version of testhelpers * Removed TODO * Updated EnsurePathExists so we create the stylesheet and scripts folder * Added a waits for response, otherwise our test would be too fast * Sometimes it reloads before the save is complete * Added timeout for locator * Removed duplicate * Wait until save * This was an actual bug, so we should not use a workaround, we should fix it * Skips the tests for script. * Bug was fixed, so this can be used again --------- Co-authored-by: Andreas Zerbst --- build/azure-pipelines.yml | 288 +++++++++--------- tests/Umbraco.Tests.AcceptanceTest/README.md | 4 +- tests/Umbraco.Tests.AcceptanceTest/config.js | 4 +- .../package-lock.json | 76 ++--- .../Umbraco.Tests.AcceptanceTest/package.json | 2 +- .../ApiTesting/DataType/DataType.spec.ts | 58 ++-- .../DataType/DataTypeFolder.spec.ts | 29 +- .../ApiTesting/Dictionary/Dictionary.spec.ts | 22 +- .../PartialView/PartialView.spec.ts | 19 +- .../PartialView/PartialViewFolder.spec.ts | 49 +-- .../tests/ApiTesting/Script/Script.spec.ts | 18 +- .../ApiTesting/Script/ScriptFolder.spec.ts | 56 ++-- .../ApiTesting/Stylesheet/Stylesheet.spec.ts | 55 ++-- .../Stylesheet/StylesheetFolder.spec.ts | 57 ++-- .../ApiTesting/Template/Template.spec.ts | 32 +- .../TemporaryFile/TemporaryFile.spec.ts | 18 +- .../tests/ApiTesting/User/User.spec.ts | 33 +- .../tests/ApiTesting/User/UserAvatar.spec.ts | 23 +- .../ApiTesting/UserGroup/UserGroup.spec.ts | 26 +- .../DefaultConfig/LogViewer/LogViewer.spec.ts | 136 ++++----- .../Settings/PartialViews.spec.ts | 91 +++--- .../DefaultConfig/Settings/Scripts.spec.ts | 129 ++++---- .../Settings/Stylesheets.spec.ts | 80 ++--- .../DefaultConfig/Settings/Templates.spec.ts | 106 +++---- .../tests/DefaultConfig/Telemetry.spec.ts | 31 +- .../tests/auth.setup.ts | 18 +- 26 files changed, 703 insertions(+), 757 deletions(-) diff --git a/build/azure-pipelines.yml b/build/azure-pipelines.yml index 86dbd4f032..6b87336b74 100644 --- a/build/azure-pipelines.yml +++ b/build/azure-pipelines.yml @@ -434,149 +434,149 @@ stages: Tests__Database__SQLServerMasterConnectionString: $(connectionString) Umbraco__CMS__Global__MainDomLock: 'SqlMainDomLock' -# - stage: E2E -# variables: -# npm_config_cache: $(Pipeline.Workspace)/.npm_e2e -# displayName: E2E Tests -# dependsOn: Build -# jobs: -# # E2E Tests -# - job: -# displayName: E2E Tests -# timeoutInMinutes: 120 -# variables: -# 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: -# vmImage: 'ubuntu-latest' -# dockerfile: umbraco-linux.docker -# dockerImageName: umbraco-linux -# Windows: -# vmImage: 'windows-latest' -# DOTNET_GENERATE_ASPNET_CERTIFICATE: true # Automatically generate HTTPS development certificate on Windows -# # 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: AcceptanceTestDB -# 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: -# - task: DownloadPipelineArtifact@2 -# displayName: Download nupkg -# inputs: -# artifact: nupkg -# path: $(Build.SourcesDirectory)/tests/Umbraco.Tests.AcceptanceTest/misc/nupkg -# - task: NodeTool@0 -# displayName: Use Node.js $(nodeVersion) -# retryCountOnTaskFailure: 3 -# inputs: -# versionSpec: $(nodeVersion) -# - task: Cache@2 -# displayName: Cache node_modules -# inputs: -# key: '"npm_e2e" | "$(Agent.OS)" | $(Build.SourcesDirectory)/tests/Umbraco.Tests.AcceptanceTest/package-lock.json' -# restoreKeys: | -# "npm_e2e" | "$(Agent.OS)" -# "npm_e2e" -# path: $(npm_config_cache) -# - 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 -# 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 -# - pwsh: sqllocaldb start mssqllocaldb -# displayName: Start localdb (Windows only) -# condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT')) -# - 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 -# displayName: Use .NET $(dotnetVersion) -# inputs: -# version: $(dotnetVersion) -# performMultiLevelLookup: true -# includePreviewVersions: $(dotnetIncludePreviewVersions) -# - 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 and run container (Linux only) -# workingDirectory: tests/Umbraco.Tests.AcceptanceTest/misc -# - pwsh: | -# dotnet new --install ./nupkg/Umbraco.Templates.*.nupkg -# dotnet new umbraco --name AcceptanceTestProject --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 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 -# workingDirectory: tests/Umbraco.Tests.AcceptanceTest -# - pwsh: npx playwright install --with-deps -# displayName: Install Playwright -# workingDirectory: tests/Umbraco.Tests.AcceptanceTest -# - pwsh: npm run test --ignore-certificate-errors -# displayName: Run Playwright (Desktop) -# continueOnError: true -# workingDirectory: tests/Umbraco.Tests.AcceptanceTest -# env: -# CI: true -# CommitId: $(Build.SourceVersion) -# AgentOs: $(Agent.OS) -# - 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: 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 -# - task: PublishPipelineArtifact@1 -# condition: always() -# displayName: Publish test artifacts -# inputs: -# targetPath: $(Build.ArtifactStagingDirectory) -# artifact: 'E2E artifacts - $(Agent.OS) - Attempt #$(System.JobAttempt)' + - stage: E2E + variables: + npm_config_cache: $(Pipeline.Workspace)/.npm_e2e + displayName: E2E Tests + dependsOn: Build + jobs: + # E2E Tests + - job: + displayName: E2E Tests + timeoutInMinutes: 120 + variables: + 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: + vmImage: 'ubuntu-latest' + dockerfile: umbraco-linux.docker + dockerImageName: umbraco-linux + Windows: + vmImage: 'windows-latest' + DOTNET_GENERATE_ASPNET_CERTIFICATE: true # Automatically generate HTTPS development certificate on Windows + # 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: AcceptanceTestDB + 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: + - task: DownloadPipelineArtifact@2 + displayName: Download nupkg + inputs: + artifact: nupkg + path: $(Build.SourcesDirectory)/tests/Umbraco.Tests.AcceptanceTest/misc/nupkg + - task: NodeTool@0 + displayName: Use Node.js $(nodeVersion) + retryCountOnTaskFailure: 3 + inputs: + versionSpec: $(nodeVersion) + - task: Cache@2 + displayName: Cache node_modules + inputs: + key: '"npm_e2e" | "$(Agent.OS)" | $(Build.SourcesDirectory)/tests/Umbraco.Tests.AcceptanceTest/package-lock.json' + restoreKeys: | + "npm_e2e" | "$(Agent.OS)" + "npm_e2e" + path: $(npm_config_cache) + - 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 + 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 + - pwsh: sqllocaldb start mssqllocaldb + displayName: Start localdb (Windows only) + condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT')) + - 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 + displayName: Use .NET $(dotnetVersion) + inputs: + version: $(dotnetVersion) + performMultiLevelLookup: true + includePreviewVersions: $(dotnetIncludePreviewVersions) + - 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 and run container (Linux only) + workingDirectory: tests/Umbraco.Tests.AcceptanceTest/misc + - pwsh: | + dotnet new --install ./nupkg/Umbraco.Templates.*.nupkg + dotnet new umbraco --name AcceptanceTestProject --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 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 + workingDirectory: tests/Umbraco.Tests.AcceptanceTest + - pwsh: npx playwright install --with-deps + displayName: Install Playwright + workingDirectory: tests/Umbraco.Tests.AcceptanceTest + - pwsh: npm run test --ignore-certificate-errors + displayName: Run Playwright (Desktop) + continueOnError: true + workingDirectory: tests/Umbraco.Tests.AcceptanceTest + env: + CI: true + CommitId: $(Build.SourceVersion) + AgentOs: $(Agent.OS) + - 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: 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 + - task: PublishPipelineArtifact@1 + condition: always() + displayName: Publish test artifacts + inputs: + targetPath: $(Build.ArtifactStagingDirectory) + artifact: 'E2E artifacts - $(Agent.OS) - Attempt #$(System.JobAttempt)' ############################################### @@ -587,7 +587,7 @@ stages: dependsOn: - Unit - Integration - # - E2E # TODO: Enable when stable. + # - E2E condition: and(succeeded(), or(eq(dependencies.Build.outputs['A.build.NBGV_PublicRelease'], 'True'), ${{parameters.myGetDeploy}})) jobs: - job: diff --git a/tests/Umbraco.Tests.AcceptanceTest/README.md b/tests/Umbraco.Tests.AcceptanceTest/README.md index 9816f49418..52a1e2b7a7 100644 --- a/tests/Umbraco.Tests.AcceptanceTest/README.md +++ b/tests/Umbraco.Tests.AcceptanceTest/README.md @@ -4,7 +4,7 @@ You can watch a video following these instructions [here](https://www.youtube.co ### Prerequisites - NodeJS 16+ -- A running installed Umbraco on url: [https://localhost:44331](https://localhost:44331) (Default development port) +- A running installed Umbraco on url: [https://localhost:44339](https://localhost:44339) (Default development port) - Install using a `SqlServer`/`LocalDb` as the tests execute too fast for `Sqlite` to handle. ### Getting started @@ -54,7 +54,7 @@ The file has the following content: ``` UMBRACO_USER_LOGIN=email for superadmin UMBRACO_USER_PASSWORD=password for superadmin -URL=https://localhost:44331 +URL=https://localhost:44339 ``` You can change this if you like or run the config script to reset the values, type "npm run config" in your terminal. diff --git a/tests/Umbraco.Tests.AcceptanceTest/config.js b/tests/Umbraco.Tests.AcceptanceTest/config.js index b928fef274..f8b88c9d50 100644 --- a/tests/Umbraco.Tests.AcceptanceTest/config.js +++ b/tests/Umbraco.Tests.AcceptanceTest/config.js @@ -14,7 +14,7 @@ const properties = [ required: true }, { - description: 'Enter CMS URL, or leave empty for default(https://localhost:44331)', + description: 'Enter CMS URL, or leave empty for default(https://localhost:44339)', name: 'baseUrl' } ]; @@ -31,7 +31,7 @@ prompt.get(properties, function (error, result) { var fileContent = `UMBRACO_USER_LOGIN=${result.username} UMBRACO_USER_PASSWORD=${result.password} -URL=${result.baseUrl || "https://localhost:44331"}`; +URL=${result.baseUrl || "https://localhost:44339"}`; fs.writeFile(configPath, fileContent, function (error) { if (error) return console.error(error); diff --git a/tests/Umbraco.Tests.AcceptanceTest/package-lock.json b/tests/Umbraco.Tests.AcceptanceTest/package-lock.json index 7a87d0c76c..af8b633bc5 100644 --- a/tests/Umbraco.Tests.AcceptanceTest/package-lock.json +++ b/tests/Umbraco.Tests.AcceptanceTest/package-lock.json @@ -8,7 +8,7 @@ "hasInstallScript": true, "dependencies": { "@umbraco/json-models-builders": "^1.0.6", - "@umbraco/playwright-testhelpers": "^2.0.0-beta.8", + "@umbraco/playwright-testhelpers": "^2.0.0-beta.11", "camelize": "^1.0.0", "dotenv": "^16.3.1", "faker": "^4.1.0", @@ -87,12 +87,12 @@ } }, "node_modules/@playwright/test": { - "version": "1.39.0", - "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.39.0.tgz", - "integrity": "sha512-3u1iFqgzl7zr004bGPYiN/5EZpRUSFddQBra8Rqll5N0/vfpqlP9I9EXqAoGacuAbX6c9Ulg/Cjqglp5VkK6UQ==", + "version": "1.40.1", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.40.1.tgz", + "integrity": "sha512-EaaawMTOeEItCRvfmkI9v6rBkF1svM8wjl/YPRrg2N2Wmp+4qJYkWtJsbew1szfKKDm6fPLy4YAanBhIlf9dWw==", "dev": true, "dependencies": { - "playwright": "1.39.0" + "playwright": "1.40.1" }, "bin": { "playwright": "cli.js" @@ -123,27 +123,27 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.9.0", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.9.0.tgz", - "integrity": "sha512-nekiGu2NDb1BcVofVcEKMIwzlx4NjHlcjhoxxKBNLtz15Y1z7MYf549DFvkHSId02Ax6kGwWntIBPC3l/JZcmw==", + "version": "20.10.7", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.7.tgz", + "integrity": "sha512-fRbIKb8C/Y2lXxB5eVMj4IU7xpdox0Lh8bUPEdtLysaylsml1hOOx1+STloRs/B9nf7C6kPRmmg/V7aQW7usNg==", "dev": true, "dependencies": { "undici-types": "~5.26.4" } }, "node_modules/@umbraco/json-models-builders": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/@umbraco/json-models-builders/-/json-models-builders-1.0.6.tgz", - "integrity": "sha512-bXwfXcpuqG1Ye714L9KJEGXuSzJfckysE/6CuPjdG8FqHWTE1brv28teR2oMw+ih8ca2u2zUboRgdzLEU/1D3Q==", + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/@umbraco/json-models-builders/-/json-models-builders-1.0.7.tgz", + "integrity": "sha512-cN4C4W9sRoAUSa3GsjqAaLRScdbQ2FKKibI7mlo69iTZ6IQ/tPFRAK0BejJ7gw6a+jAvPVdZnVVSVOVmn8qSMg==", "dependencies": { "camelize": "^1.0.0", "faker": "^4.1.0" } }, "node_modules/@umbraco/playwright-testhelpers": { - "version": "2.0.0-beta.8", - "resolved": "https://registry.npmjs.org/@umbraco/playwright-testhelpers/-/playwright-testhelpers-2.0.0-beta.8.tgz", - "integrity": "sha512-YgGfkIwSAJ1PKmciuUlkNyEss4Djzp3XSOOc5rQXxjSa4E1PkBIgI4ZEf/pON/9v84U9gzpKCvs91uBZN+drqg==", + "version": "2.0.0-beta.11", + "resolved": "https://registry.npmjs.org/@umbraco/playwright-testhelpers/-/playwright-testhelpers-2.0.0-beta.11.tgz", + "integrity": "sha512-SwliAxtSIBJGbZGSDgPqanhC7ul/T1Z3OdFTQlll4eHOwEijhPyTjz17IlHJAnuBRtgF7oUxO6Mle2RaedgOAA==", "dependencies": { "@umbraco/json-models-builders": "^1.0.6", "camelize": "^1.0.0", @@ -187,12 +187,12 @@ "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" }, "node_modules/axios": { - "version": "1.6.2", - "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.2.tgz", - "integrity": "sha512-7i24Ri4pmDRfJTR7LDBhsOTtcm+9kjX5WiY1X3wIisx6G9So3pfMkEiU7emUBe46oceVImccTEM3k6C5dbVW8A==", + "version": "1.6.5", + "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.5.tgz", + "integrity": "sha512-Ii012v05KEVuUoFWmMW/UQv9aRIc3ZwkWDcM+h5Il8izZCtRVpDUfwpoFf7eOtajT3QiGR4yDUx7lPqHJULgbg==", "dev": true, "dependencies": { - "follow-redirects": "^1.15.0", + "follow-redirects": "^1.15.4", "form-data": "^4.0.0", "proxy-from-env": "^1.1.0" } @@ -361,9 +361,9 @@ } }, "node_modules/fastq": { - "version": "1.15.0", - "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.15.0.tgz", - "integrity": "sha512-wBrocU2LCXXa+lWBt8RoIRD89Fi8OdABODa/kEnyeyjS5aZO5/GNvI5sEINADqP/h8M29UHTHUb53sUu5Ihqdw==", + "version": "1.16.0", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.16.0.tgz", + "integrity": "sha512-ifCoaXsDrsdkWTtiNJX5uzHDsrck5TzfKKDcuFFTIrrc/BS076qgEIfoIy1VeZqViznfKiysPYTh/QeHtnIsYA==", "dev": true, "dependencies": { "reusify": "^1.0.4" @@ -420,20 +420,6 @@ "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==", "dev": true }, - "node_modules/fsevents": { - "version": "2.3.2", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", - "integrity": "sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA==", - "dev": true, - "hasInstallScript": true, - "optional": true, - "os": [ - "darwin" - ], - "engines": { - "node": "^8.16.0 || ^10.6.0 || >=11.0.0" - } - }, "node_modules/glob": { "version": "7.2.3", "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", @@ -493,9 +479,9 @@ "dev": true }, "node_modules/ignore": { - "version": "5.2.4", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.2.4.tgz", - "integrity": "sha512-MAb38BcSbH0eHNBxn7ql2NH/kX33OkB3lZ1BNdh7ENeRChHTYsTvWrMubiIAMNS2llXEEgZ1MUOBtXChP3kaFQ==", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.3.0.tgz", + "integrity": "sha512-g7dmpshy+gD7mh88OC9NwSGTKoc3kyLAZQRU1mt53Aw/vnvfXnbC+F/7F7QoYVKbV+KNvJx8wArewKy1vXMtlg==", "dev": true, "engines": { "node": ">= 4" @@ -750,12 +736,12 @@ } }, "node_modules/playwright": { - "version": "1.39.0", - "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.39.0.tgz", - "integrity": "sha512-naE5QT11uC/Oiq0BwZ50gDmy8c8WLPRTEWuSSFVG2egBka/1qMoSqYQcROMT9zLwJ86oPofcTH2jBY/5wWOgIw==", + "version": "1.40.1", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.40.1.tgz", + "integrity": "sha512-2eHI7IioIpQ0bS1Ovg/HszsN/XKNwEG1kbzSDDmADpclKc7CyqkHw7Mg2JCz/bbCxg25QUPcjksoMW7JcIFQmw==", "dev": true, "dependencies": { - "playwright-core": "1.39.0" + "playwright-core": "1.40.1" }, "bin": { "playwright": "cli.js" @@ -768,9 +754,9 @@ } }, "node_modules/playwright-core": { - "version": "1.39.0", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.39.0.tgz", - "integrity": "sha512-+k4pdZgs1qiM+OUkSjx96YiKsXsmb59evFoqv8SKO067qBA+Z2s/dCzJij/ZhdQcs2zlTAgRKfeiiLm8PQ2qvw==", + "version": "1.40.1", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.40.1.tgz", + "integrity": "sha512-+hkOycxPiV534c4HhpfX6yrlawqVUzITRKwHAmYfmsVreltEl6fAZJ3DPfLMOODw0H3s1Itd6MDCWmP1fl/QvQ==", "dev": true, "bin": { "playwright-core": "cli.js" diff --git a/tests/Umbraco.Tests.AcceptanceTest/package.json b/tests/Umbraco.Tests.AcceptanceTest/package.json index 5087ae9272..a7330965b8 100644 --- a/tests/Umbraco.Tests.AcceptanceTest/package.json +++ b/tests/Umbraco.Tests.AcceptanceTest/package.json @@ -21,7 +21,7 @@ }, "dependencies": { "@umbraco/json-models-builders": "^1.0.6", - "@umbraco/playwright-testhelpers": "^2.0.0-beta.8", + "@umbraco/playwright-testhelpers": "^2.0.0-beta.11", "camelize": "^1.0.0", "dotenv": "^16.3.1", "faker": "^4.1.0", diff --git a/tests/Umbraco.Tests.AcceptanceTest/tests/ApiTesting/DataType/DataType.spec.ts b/tests/Umbraco.Tests.AcceptanceTest/tests/ApiTesting/DataType/DataType.spec.ts index 013561469a..b4565d00f0 100644 --- a/tests/Umbraco.Tests.AcceptanceTest/tests/ApiTesting/DataType/DataType.spec.ts +++ b/tests/Umbraco.Tests.AcceptanceTest/tests/ApiTesting/DataType/DataType.spec.ts @@ -3,6 +3,7 @@ import {expect} from "@playwright/test"; test.describe('DataType tests', () => { let dataTypeId = ""; + let dataTypeFolderId = ""; const dataTypeName = "TestType"; const propertyEditorAlias = "Umbraco.DateTime"; @@ -13,86 +14,89 @@ test.describe('DataType tests', () => { } ]; - test.beforeEach(async ({page, umbracoApi}) => { + test.beforeEach(async ({umbracoApi}) => { await umbracoApi.dataType.ensureNameNotExistsAtRoot(dataTypeName); }); - test.afterEach(async ({page, umbracoApi}) => { + test.afterEach(async ({umbracoApi}) => { await umbracoApi.dataType.delete(dataTypeId); }); - test('can create dataType', async ({page, umbracoApi, umbracoUi}) => { + test('can create dataType', async ({umbracoApi}) => { + // Act dataTypeId = await umbracoApi.dataType.create(dataTypeName, propertyEditorAlias, dataTypeData); // Assert - await expect(umbracoApi.dataType.exists(dataTypeId)).toBeTruthy(); + expect(umbracoApi.dataType.exists(dataTypeId)).toBeTruthy(); }); - test('can update dataType', async ({page, umbracoApi, umbracoUi}) => { + test('can update dataType', async ({umbracoApi}) => { + // Arrange dataTypeId = await umbracoApi.dataType.create(dataTypeName, propertyEditorAlias, []); - const dataType = await umbracoApi.dataType.get(dataTypeId); - dataType.values = dataTypeData; + + // Act await umbracoApi.dataType.update(dataTypeId, dataType); // Assert // Checks if the data type was updated const updatedDataType = await umbracoApi.dataType.get(dataTypeId); - await expect(updatedDataType.values).toEqual(dataTypeData); + expect(updatedDataType.values).toEqual(dataTypeData); }); - test('can delete dataType', async ({page, umbracoApi, umbracoUi}) => { + test('can delete dataType', async ({umbracoApi}) => { + // Arrange dataTypeId = await umbracoApi.dataType.create(dataTypeName, propertyEditorAlias, dataTypeData); + expect(await umbracoApi.dataType.exists(dataTypeId)).toBeTruthy(); - await expect(await umbracoApi.dataType.exists(dataTypeId)).toBeTruthy(); - + // Act await umbracoApi.dataType.delete(dataTypeId); // Assert - await expect(await umbracoApi.dataType.exists(dataTypeId)).toBeFalsy(); + expect(await umbracoApi.dataType.exists(dataTypeId)).toBeFalsy(); }); - test('can move a dataType to a folder', async ({page, umbracoApi, umbracoUi}) => { + test('can move a dataType to a folder', async ({umbracoApi}) => { + // Arrange const folderName = 'FolderToMoveToo'; - await umbracoApi.dataType.ensureNameNotExistsAtRoot(folderName); - dataTypeId = await umbracoApi.dataType.create(dataTypeName, propertyEditorAlias, dataTypeData); - const dataTypeFolderId = await umbracoApi.dataType.createFolder(folderName); + dataTypeFolderId = await umbracoApi.dataType.createFolder(folderName); + // Act await umbracoApi.dataType.moveToFolder(dataTypeId, dataTypeFolderId); // Assert // Checks if the datatype has the parentId of the folder const dataTypeInFolder = await umbracoApi.dataType.getChildren(dataTypeFolderId); - await expect(dataTypeInFolder.items[0].parentId).toEqual(dataTypeFolderId); + expect(dataTypeInFolder.items[0].parentId).toEqual(dataTypeFolderId); // Clean await umbracoApi.dataType.deleteFolder(dataTypeFolderId); }); - test('can copy a dataType to a folder', async ({page, umbracoApi, umbracoUi}) => { + test('can copy a dataType to a folder', async ({umbracoApi}) => { + // Arrange + let copiedDataTypeId = ""; const folderName = 'FolderToCopyToo'; - await umbracoApi.dataType.ensureNameNotExistsAtRoot(folderName); dataTypeId = await umbracoApi.dataType.create(dataTypeName, propertyEditorAlias, dataTypeData); - const dataTypeFolderId = await umbracoApi.dataType.createFolder(folderName); + dataTypeFolderId = await umbracoApi.dataType.createFolder(folderName); const dataType = await umbracoApi.dataType.get(dataTypeId); const dataTypeFolder = await umbracoApi.dataType.getFolder(dataTypeFolderId); - const copiedDataTypeId = await umbracoApi.dataType.copyToFolder(dataType.id, dataTypeFolder.id); - - const copiedDataType = await umbracoApi.dataType.get(copiedDataTypeId); - - await expect(copiedDataType.name).toEqual(dataTypeName + ' (copy)'); + // Act + copiedDataTypeId = await umbracoApi.dataType.copyToFolder(dataType.id, dataTypeFolder.id); // Assert + const copiedDataType = await umbracoApi.dataType.get(copiedDataTypeId); + expect(copiedDataType.name).toEqual(dataTypeName + ' (copy)'); // Checks if both dataTypes exists - await expect(await umbracoApi.dataType.exists(dataTypeId)).toBeTruthy(); - await expect(await umbracoApi.dataType.exists(copiedDataTypeId)).toBeTruthy(); + expect(await umbracoApi.dataType.exists(dataTypeId)).toBeTruthy(); + expect(await umbracoApi.dataType.exists(copiedDataTypeId)).toBeTruthy(); // Clean await umbracoApi.dataType.deleteFolder(dataTypeFolderId); diff --git a/tests/Umbraco.Tests.AcceptanceTest/tests/ApiTesting/DataType/DataTypeFolder.spec.ts b/tests/Umbraco.Tests.AcceptanceTest/tests/ApiTesting/DataType/DataTypeFolder.spec.ts index f65204d1a1..1990031524 100644 --- a/tests/Umbraco.Tests.AcceptanceTest/tests/ApiTesting/DataType/DataTypeFolder.spec.ts +++ b/tests/Umbraco.Tests.AcceptanceTest/tests/ApiTesting/DataType/DataTypeFolder.spec.ts @@ -5,46 +5,49 @@ test.describe('DataTypeFolder tests', () => { let dataTypeFolderId = ""; const dataTypeFolderName = "TestTypeFolder"; - test.beforeEach(async ({page, umbracoApi}) => { + test.beforeEach(async ({umbracoApi}) => { await umbracoApi.dataType.ensureNameNotExistsAtRoot(dataTypeFolderName); }); - test.afterEach(async ({page, umbracoApi}) => { + test.afterEach(async ({umbracoApi}) => { await umbracoApi.dataType.deleteFolder(dataTypeFolderId); }); - test('can create a dataType folder', async ({page, umbracoApi, umbracoUi}) => { + test('can create a dataType folder', async ({umbracoApi}) => { + // Act dataTypeFolderId = await umbracoApi.dataType.createFolder(dataTypeFolderName); // Assert - await expect(umbracoApi.dataType.folderExists(dataTypeFolderId)).toBeTruthy(); + expect(umbracoApi.dataType.folderExists(dataTypeFolderId)).toBeTruthy(); }); - test('can update a dataType folder', async ({page, umbracoApi, umbracoUi}) => { + test('can update a dataType folder', async ({umbracoApi}) => { + // Arrange const oldDataTypeFolderName = 'Oldie'; dataTypeFolderId = await umbracoApi.dataType.createFolder(oldDataTypeFolderName); const dataTypeFolder = await umbracoApi.dataType.getFolder(dataTypeFolderId); - - // Updates the dataType folder dataTypeFolder.name = dataTypeFolderName; + + // Act await umbracoApi.dataType.updateFolder(dataTypeFolderId, dataTypeFolder); // Assert - await expect(umbracoApi.dataType.folderExists(dataTypeFolderId)).toBeTruthy(); + expect(umbracoApi.dataType.folderExists(dataTypeFolderId)).toBeTruthy(); // Checks if the dataType folder was updated const newDataTypeFolderName = await umbracoApi.dataType.getFolder(dataTypeFolderId); - await expect(newDataTypeFolderName.name).toEqual(dataTypeFolderName); + expect(newDataTypeFolderName.name).toEqual(dataTypeFolderName); }); - test('can delete a dataType folder', async ({page, umbracoApi, umbracoUi}) => { + test('can delete a dataType folder', async ({umbracoApi}) => { + // Arrange await umbracoApi.dataType.createFolder(dataTypeFolderName); + expect(umbracoApi.dataType.folderExists(dataTypeFolderId)).toBeTruthy(); - await expect(umbracoApi.dataType.folderExists(dataTypeFolderId)).toBeTruthy(); - + // Act await umbracoApi.dataType.delete(dataTypeFolderId); // Assert - await expect(await umbracoApi.dataType.folderExists(dataTypeFolderId)).toBeFalsy(); + expect(await umbracoApi.dataType.folderExists(dataTypeFolderId)).toBeFalsy(); }); }); diff --git a/tests/Umbraco.Tests.AcceptanceTest/tests/ApiTesting/Dictionary/Dictionary.spec.ts b/tests/Umbraco.Tests.AcceptanceTest/tests/ApiTesting/Dictionary/Dictionary.spec.ts index a2d901d31e..aaad544c81 100644 --- a/tests/Umbraco.Tests.AcceptanceTest/tests/ApiTesting/Dictionary/Dictionary.spec.ts +++ b/tests/Umbraco.Tests.AcceptanceTest/tests/ApiTesting/Dictionary/Dictionary.spec.ts @@ -5,15 +5,15 @@ test.describe('Dictionary tests', () => { let dictionaryId = ""; const dictionaryName = 'Word' - test.beforeEach(async ({page, umbracoApi}) => { + test.beforeEach(async ({umbracoApi}) => { await umbracoApi.dictionary.ensureNameNotExists(dictionaryName); }); - test.afterEach(async ({page, umbracoApi}) => { + test.afterEach(async ({umbracoApi}) => { await umbracoApi.dictionary.delete(dictionaryId); }) - test('can create a dictionary', async ({page, umbracoApi, umbracoUi}) => { + test('can create a dictionary', async ({umbracoApi}) => { const translationData = [ { 'isoCode': 'en-US', @@ -28,10 +28,10 @@ test.describe('Dictionary tests', () => { dictionaryId = await umbracoApi.dictionary.create(dictionaryName, translationData); // Assert - await expect(umbracoApi.dictionary.exists(dictionaryId)).toBeTruthy(); + await expect(umbracoApi.dictionary.doesExist(dictionaryId)).toBeTruthy(); }); - test('can update a dictionary', async ({page, umbracoApi, umbracoUi}) => { + test('can update a dictionary', async ({umbracoApi}) => { const oldDictionaryName = 'OldWord'; dictionaryId = await umbracoApi.dictionary.create(oldDictionaryName); @@ -47,21 +47,21 @@ test.describe('Dictionary tests', () => { const newDictionary = await umbracoApi.dictionary.get(dictionaryId); await expect(newDictionary.name).toEqual(dictionaryName); - await expect(umbracoApi.dictionary.exists(dictionaryId)).toBeTruthy(); + await expect(umbracoApi.dictionary.doesExist(dictionaryId)).toBeTruthy(); }); - test('can delete a dictionary', async ({page, umbracoApi, umbracoUi}) => { + test('can delete a dictionary', async ({umbracoApi}) => { dictionaryId = await umbracoApi.dictionary.create(dictionaryName); - await expect(umbracoApi.dictionary.exists(dictionaryId)).toBeTruthy(); + await expect(umbracoApi.dictionary.doesExist(dictionaryId)).toBeTruthy(); await umbracoApi.dictionary.delete(dictionaryId); // Assert - await expect(await umbracoApi.dictionary.exists(dictionaryId)).toBeFalsy(); + await expect(await umbracoApi.dictionary.doesExist(dictionaryId)).toBeFalsy(); }); - test('can create a dictionary item in a dictionary', async ({page, umbracoApi, umbracoUi}) => { + test('can create a dictionary item in a dictionary', async ({umbracoApi}) => { const parentDictionaryName = 'Book'; await umbracoApi.dictionary.ensureNameNotExists(parentDictionaryName); @@ -74,6 +74,6 @@ test.describe('Dictionary tests', () => { // Assert // Checks if the parent dictionary contains the child dictionary - await expect(parentDictionaryChildren.items[0].name).toEqual(dictionaryName); + await expect(parentDictionaryChildren[0].name).toEqual(dictionaryName); }); }); diff --git a/tests/Umbraco.Tests.AcceptanceTest/tests/ApiTesting/PartialView/PartialView.spec.ts b/tests/Umbraco.Tests.AcceptanceTest/tests/ApiTesting/PartialView/PartialView.spec.ts index 32562cb96e..51dcc49ce5 100644 --- a/tests/Umbraco.Tests.AcceptanceTest/tests/ApiTesting/PartialView/PartialView.spec.ts +++ b/tests/Umbraco.Tests.AcceptanceTest/tests/ApiTesting/PartialView/PartialView.spec.ts @@ -10,40 +10,41 @@ test.describe('Partial View tests', () => { }); test.afterEach(async ({umbracoApi}) => { - await umbracoApi.partialView.delete(partialViewPath); + await umbracoApi.partialView.ensureNameNotExists(partialViewName); }); test('can create a partial view', async ({umbracoApi}) => { + // Act partialViewPath = await umbracoApi.partialView.create(partialViewName, 'test'); // Assert - await expect(await umbracoApi.partialView.doesExist(partialViewPath)).toBeTruthy(); + expect(await umbracoApi.partialView.doesExist(partialViewPath)).toBeTruthy(); }); test('can update a partial view', async ({umbracoApi}) => { + // Arrange const newContent = 'Howdy'; - partialViewPath = await umbracoApi.partialView.create(partialViewName, 'test'); - const partialView = await umbracoApi.partialView.get(partialViewPath); - partialView.content = newContent; + // Act await umbracoApi.partialView.update(partialView); // Assert const updatedPartialView = await umbracoApi.partialView.get(partialViewPath); - await expect(updatedPartialView.content).toEqual(newContent); + expect(updatedPartialView.content).toEqual(newContent); }); test('can delete a partial view', async ({umbracoApi}) => { + // Arrange partialViewPath = await umbracoApi.partialView.create(partialViewName, 'test'); + expect(await umbracoApi.partialView.doesExist(partialViewPath)).toBeTruthy(); - await expect(await umbracoApi.partialView.doesExist(partialViewPath)).toBeTruthy(); - + // Act await umbracoApi.partialView.delete(partialViewPath); // Assert - await expect(await umbracoApi.partialView.doesExist(partialViewPath)).toBeFalsy(); + expect(await umbracoApi.partialView.doesExist(partialViewPath)).toBeFalsy(); }); }); \ No newline at end of file diff --git a/tests/Umbraco.Tests.AcceptanceTest/tests/ApiTesting/PartialView/PartialViewFolder.spec.ts b/tests/Umbraco.Tests.AcceptanceTest/tests/ApiTesting/PartialView/PartialViewFolder.spec.ts index 2e46106ef1..ed7bccde44 100644 --- a/tests/Umbraco.Tests.AcceptanceTest/tests/ApiTesting/PartialView/PartialViewFolder.spec.ts +++ b/tests/Umbraco.Tests.AcceptanceTest/tests/ApiTesting/PartialView/PartialViewFolder.spec.ts @@ -2,7 +2,6 @@ import {test} from '@umbraco/playwright-testhelpers'; import {expect} from "@playwright/test"; test.describe('Partial View Folder tests', () => { - let partialViewFolderPath = ""; const partialViewFolderName = 'partialViewFolder'; test.beforeEach(async ({umbracoApi}) => { @@ -10,59 +9,63 @@ test.describe('Partial View Folder tests', () => { }); test.afterEach(async ({umbracoApi}) => { - await umbracoApi.partialView.deleteFolder(partialViewFolderPath); + await umbracoApi.partialView.ensureNameNotExists(partialViewFolderName); }); test('can create a partial view folder', async ({umbracoApi}) => { - partialViewFolderPath = await umbracoApi.partialView.createFolder(partialViewFolderName); + // Act + await umbracoApi.partialView.createFolder(partialViewFolderName); // Assert - await expect(await umbracoApi.partialView.doesFolderExist(partialViewFolderPath)).toBeTruthy(); + expect(await umbracoApi.partialView.doesFolderExist(partialViewFolderName)).toBeTruthy(); }); test('can delete a partial view folder', async ({umbracoApi}) => { - partialViewFolderPath = await umbracoApi.partialView.createFolder(partialViewFolderName); + // Arrange + await umbracoApi.partialView.createFolder(partialViewFolderName); + expect(await umbracoApi.partialView.doesFolderExist(partialViewFolderName)).toBeTruthy(); - await expect(await umbracoApi.partialView.doesFolderExist(partialViewFolderPath)).toBeTruthy(); - - await umbracoApi.partialView.deleteFolder(partialViewFolderPath); + // Act + await umbracoApi.partialView.deleteFolder(partialViewFolderName); // Assert - await expect(await umbracoApi.partialView.doesFolderExist(partialViewFolderPath)).toBeFalsy(); + expect(await umbracoApi.partialView.doesFolderExist(partialViewFolderName)).toBeFalsy(); }); test('can add a partial view folder in another', async ({umbracoApi}) => { + // Arrange const childFolderName = 'childFolder'; - partialViewFolderPath = await umbracoApi.partialView.createFolder(partialViewFolderName); + await umbracoApi.partialView.createFolder(partialViewFolderName); - await umbracoApi.partialView.getFolder(partialViewFolderPath); - - await umbracoApi.partialView.createFolder(childFolderName, partialViewFolderPath); - - const children = await umbracoApi.partialView.getFolderChildren(partialViewFolderPath); + // Act + await umbracoApi.partialView.createFolder(childFolderName, partialViewFolderName); + const children = await umbracoApi.partialView.getChildren(partialViewFolderName); // Assert - await expect(children.items[0].name).toEqual(childFolderName); + expect(children[0].name).toEqual(childFolderName); }); test('can add a partial view folder in a folder in another folder', async ({umbracoApi}) => { + // Arrange const childFolderName = 'childFolder'; const childOfChildFolderName = 'childOfChildFolder'; + const childFolderPath = partialViewFolderName + '/' + childFolderName; // Creates parent folder - partialViewFolderPath = await umbracoApi.partialView.createFolder(partialViewFolderName); + await umbracoApi.partialView.createFolder(partialViewFolderName); // Creates child folder in parent folder - const childOfParentPath = await umbracoApi.partialView.createFolder(childFolderName, partialViewFolderPath); - const childOfParent = await umbracoApi.partialView.getFolderChildren(partialViewFolderPath); + await umbracoApi.partialView.createFolder(childFolderName, partialViewFolderName); + // Act // Creates childOfChild folder in child folder - await umbracoApi.partialView.createFolder(childOfChildFolderName, childOfParentPath); - const childOfChild = await umbracoApi.partialView.getFolderChildren(childOfParentPath); + await umbracoApi.partialView.createFolder(childOfChildFolderName, childFolderPath); // Assert // Checks if the partial views folder are in the correct folders - await expect(childOfParent.items[0].name).toEqual(childFolderName); - await expect(childOfChild.items[0].name).toEqual(childOfChildFolderName); + const childOfParent = await umbracoApi.partialView.getChildren(partialViewFolderName); + const childOfChild = await umbracoApi.partialView.getChildren(childFolderPath); + expect(childOfParent[0].name).toEqual(childFolderName); + expect(childOfChild[0].name).toEqual(childOfChildFolderName); }); }); \ No newline at end of file diff --git a/tests/Umbraco.Tests.AcceptanceTest/tests/ApiTesting/Script/Script.spec.ts b/tests/Umbraco.Tests.AcceptanceTest/tests/ApiTesting/Script/Script.spec.ts index 5e008ed3c9..5c7f7b79fa 100644 --- a/tests/Umbraco.Tests.AcceptanceTest/tests/ApiTesting/Script/Script.spec.ts +++ b/tests/Umbraco.Tests.AcceptanceTest/tests/ApiTesting/Script/Script.spec.ts @@ -5,22 +5,23 @@ test.describe('Script tests', () => { let scriptPath = ""; const scriptName = 'scriptName.js'; - test.beforeEach(async ({page, umbracoApi}) => { + test.beforeEach(async ({umbracoApi}) => { await umbracoApi.script.ensureNameNotExists(scriptName); }); - test('can create a script', async ({page, umbracoApi, umbracoUi}) => { + test.afterEach(async ({umbracoApi}) => { + await umbracoApi.script.ensureNameNotExists(scriptName); + }); + + test('can create a script', async ({umbracoApi}) => { // Act scriptPath = await umbracoApi.script.create(scriptName, 'test'); // Assert expect(await umbracoApi.script.doesExist(scriptPath)).toBeTruthy(); - - // Clean - await umbracoApi.script.ensureNameNotExists(scriptName); }); - test('can update a script', async ({page, umbracoApi, umbracoUi}) => { + test('can update a script', async ({umbracoApi}) => { // Arrange const newContent = 'Howdy'; scriptPath = await umbracoApi.script.create(scriptName, 'test'); @@ -34,12 +35,9 @@ test.describe('Script tests', () => { // Checks if the content was updated for the script const updatedScript = await umbracoApi.script.get(scriptPath); expect(updatedScript.content).toEqual(newContent); - - // Clean - await umbracoApi.script.ensureNameNotExists(scriptName); }); - test('can delete a script', async ({page, umbracoApi, umbracoUi}) => { + test('can delete a script', async ({umbracoApi}) => { // Arrange scriptPath = await umbracoApi.script.create(scriptName, 'test'); expect(await umbracoApi.script.doesExist(scriptPath)).toBeTruthy(); diff --git a/tests/Umbraco.Tests.AcceptanceTest/tests/ApiTesting/Script/ScriptFolder.spec.ts b/tests/Umbraco.Tests.AcceptanceTest/tests/ApiTesting/Script/ScriptFolder.spec.ts index a29a0b5b51..a2ea8a3eac 100644 --- a/tests/Umbraco.Tests.AcceptanceTest/tests/ApiTesting/Script/ScriptFolder.spec.ts +++ b/tests/Umbraco.Tests.AcceptanceTest/tests/ApiTesting/Script/ScriptFolder.spec.ts @@ -2,73 +2,69 @@ import {test} from '@umbraco/playwright-testhelpers'; import {expect} from "@playwright/test"; test.describe('Script Folder tests', () => { - let scriptFolderPath = ''; const scriptFolderName = 'ScriptFolder'; - test.beforeEach(async ({page, umbracoApi}) => { + test.beforeEach(async ({umbracoApi}) => { await umbracoApi.script.ensureNameNotExists(scriptFolderName); }); - test('can create a script folder', async ({page, umbracoApi, umbracoUi}) => { + test.afterEach(async ({umbracoApi}) => { + await umbracoApi.script.ensureNameNotExists(scriptFolderName); + }); + + test('can create a script folder', async ({umbracoApi}) => { // Act - scriptFolderPath = await umbracoApi.script.createFolder(scriptFolderName); + await umbracoApi.script.createFolder(scriptFolderName); // Assert - expect(await umbracoApi.script.doesFolderExist(scriptFolderPath)).toBeTruthy(); - - // Clean - await umbracoApi.script.ensureNameNotExists(scriptFolderName); + expect(await umbracoApi.script.doesFolderExist(scriptFolderName)).toBeTruthy(); }); - test('can delete a script folder', async ({page, umbracoApi, umbracoUi}) => { + test('can delete a script folder', async ({umbracoApi}) => { // Arrange - scriptFolderPath = await umbracoApi.script.createFolder(scriptFolderName); + await umbracoApi.script.createFolder(scriptFolderName); expect(await umbracoApi.script.doesFolderExist(scriptFolderName)).toBeTruthy(); // Act - await umbracoApi.script.deleteFolder(scriptFolderPath); + await umbracoApi.script.deleteFolder(scriptFolderName); // Assert - expect(await umbracoApi.script.doesFolderExist(scriptFolderPath)).toBeFalsy(); + expect(await umbracoApi.script.doesFolderExist(scriptFolderName)).toBeFalsy(); }); - test('can add a script folder in another folder', async ({page, umbracoApi, umbracoUi}) => { + test('can add a script folder in another folder', async ({umbracoApi}) => { // Arrange const childFolderName = 'childFolder'; - scriptFolderPath = await umbracoApi.script.createFolder(scriptFolderName); - await umbracoApi.script.createFolder(childFolderName, scriptFolderPath); + await umbracoApi.script.createFolder(scriptFolderName); + await umbracoApi.script.createFolder(childFolderName, scriptFolderName); // Act - const childFolder = await umbracoApi.script.getChildren(scriptFolderPath); + const childFolder = await umbracoApi.script.getChildren(scriptFolderName); // Assert expect(childFolder[0].name).toEqual(childFolderName); - - // Clean - await umbracoApi.script.ensureNameNotExists(scriptFolderName); }); - test('can add a script folder in a folder in another folder', async ({page, umbracoApi, umbracoUi}) => { + test('can add a script folder in a folder in another folder', async ({umbracoApi}) => { // Arrange const childFolderName = 'childFolder'; const childOfChildFolderName = 'childOfChildFolder'; + const childFolderPath = scriptFolderName + '/' + childFolderName; - // Act // Creates parent folder - scriptFolderPath = await umbracoApi.script.createFolder(scriptFolderName); + await umbracoApi.script.createFolder(scriptFolderName); // Creates child folder in parent folder - const childOfParentPath = await umbracoApi.script.createFolder(childFolderName, scriptFolderPath); - const childOfParent = await umbracoApi.script.getChildren(scriptFolderPath); + await umbracoApi.script.createFolder(childFolderName, scriptFolderName); + + // Act // Creates childOfChild folder in child folder - await umbracoApi.script.createFolder(childOfChildFolderName, childOfParentPath); - const childOfChild = await umbracoApi.script.getChildren(childOfParentPath); - + await umbracoApi.script.createFolder(childOfChildFolderName, childFolderPath); + // Assert // Checks if the script folder are in the correct folders + const childOfParent = await umbracoApi.script.getChildren(scriptFolderName); + const childOfChild = await umbracoApi.script.getChildren(childFolderPath); expect(childOfParent[0].name).toEqual(childFolderName); expect(childOfChild[0].name).toEqual(childOfChildFolderName); - - // Clean - await umbracoApi.script.ensureNameNotExists(scriptFolderName); }); }); diff --git a/tests/Umbraco.Tests.AcceptanceTest/tests/ApiTesting/Stylesheet/Stylesheet.spec.ts b/tests/Umbraco.Tests.AcceptanceTest/tests/ApiTesting/Stylesheet/Stylesheet.spec.ts index 4fce95932c..17b2b389c6 100644 --- a/tests/Umbraco.Tests.AcceptanceTest/tests/ApiTesting/Stylesheet/Stylesheet.spec.ts +++ b/tests/Umbraco.Tests.AcceptanceTest/tests/ApiTesting/Stylesheet/Stylesheet.spec.ts @@ -2,30 +2,31 @@ import {test} from '@umbraco/playwright-testhelpers'; import {expect} from "@playwright/test"; test.describe('Stylesheet tests', () => { - let stylesheetPath = ""; const stylesheetName = 'Stylesheet.css'; + const folderName = 'StyledFolder'; test.beforeEach(async ({umbracoApi}) => { await umbracoApi.stylesheet.ensureNameNotExists(stylesheetName); }); test.afterEach(async ({umbracoApi}) => { - await umbracoApi.stylesheet.delete(stylesheetPath); + await umbracoApi.stylesheet.ensureNameNotExists(stylesheetName); + await umbracoApi.stylesheet.ensureNameNotExists(folderName); }); test('can create a stylesheet', async ({umbracoApi}) => { // Act - stylesheetPath = await umbracoApi.stylesheet.create(stylesheetName, 'content'); + await umbracoApi.stylesheet.create(stylesheetName, 'content'); // Assert - await expect(await umbracoApi.stylesheet.doesExist(stylesheetPath)).toBeTruthy(); + expect(await umbracoApi.stylesheet.doesExist(stylesheetName)).toBeTruthy(); }); test('can update a stylesheet', async ({umbracoApi}) => { // Arrange const newContent = 'BetterContent'; - stylesheetPath = await umbracoApi.stylesheet.create(stylesheetName, 'content'); - const stylesheet = await umbracoApi.stylesheet.get(stylesheetPath); + await umbracoApi.stylesheet.create(stylesheetName, 'content'); + const stylesheet = await umbracoApi.stylesheet.get(stylesheetName); stylesheet.content = newContent; // Act @@ -33,59 +34,51 @@ test.describe('Stylesheet tests', () => { // Assert // Checks if the content was updated for the stylesheet - const updatedStylesheet = await umbracoApi.stylesheet.get(stylesheetPath); - await expect(updatedStylesheet.content).toEqual(newContent); + const updatedStylesheet = await umbracoApi.stylesheet.get(stylesheetName); + expect(updatedStylesheet.content).toEqual(newContent); }); test('can delete a stylesheet', async ({umbracoApi}) => { // Arrange - stylesheetPath = await umbracoApi.stylesheet.create(stylesheetName, 'content'); - await expect(await umbracoApi.stylesheet.doesExist(stylesheetPath)).toBeTruthy(); + await umbracoApi.stylesheet.create(stylesheetName, 'content'); + expect(await umbracoApi.stylesheet.doesExist(stylesheetName)).toBeTruthy(); // Act - await umbracoApi.stylesheet.delete(stylesheetPath); + await umbracoApi.stylesheet.delete(stylesheetName); // Assert - await expect(await umbracoApi.stylesheet.doesExist(stylesheetPath)).toBeFalsy(); + expect(await umbracoApi.stylesheet.doesExist(stylesheetName)).toBeFalsy(); }); test('can create a stylesheet in a folder', async ({umbracoApi}) => { // Arrange - const folderName = 'StyledFolder'; await umbracoApi.stylesheet.ensureNameNotExists(folderName); - stylesheetPath = await umbracoApi.stylesheet.createFolder(folderName); + await umbracoApi.stylesheet.createFolder(folderName); // Act - await umbracoApi.stylesheet.create(stylesheetName, 'content', stylesheetPath); + await umbracoApi.stylesheet.create(stylesheetName, 'content', folderName); // Assert - const child = await umbracoApi.stylesheet.getChildren(stylesheetPath); - await expect(child[0].name).toEqual(stylesheetName); - - // Clean - await umbracoApi.stylesheet.deleteFolder(stylesheetPath); + const child = await umbracoApi.stylesheet.getChildren(folderName); + expect(child[0].name).toEqual(stylesheetName); }); test('can delete a stylesheet from a folder', async ({umbracoApi}) => { // Arrange - const folderName = 'StyledFolder'; await umbracoApi.stylesheet.ensureNameNotExists(folderName); - stylesheetPath = await umbracoApi.stylesheet.createFolder(folderName); - const stylesheetChildPath = await umbracoApi.stylesheet.create(stylesheetName, 'deleteMe', stylesheetPath); + await umbracoApi.stylesheet.createFolder(folderName); + await umbracoApi.stylesheet.create(stylesheetName, 'deleteMe', folderName); // Checks if the stylesheet was created - const child = await umbracoApi.stylesheet.getChildren(stylesheetPath); + const child = await umbracoApi.stylesheet.getChildren(folderName); // Checks if the child is in the folder - await expect(child[0].name).toEqual(stylesheetName); + expect(child[0].name).toEqual(stylesheetName); // Act - await umbracoApi.stylesheet.delete(stylesheetChildPath); + await umbracoApi.stylesheet.delete(stylesheetName); // Assert - const noChild = await umbracoApi.stylesheet.getChildren(stylesheetPath); - await expect(noChild[0]).toEqual(undefined); - - // Clean - await umbracoApi.stylesheet.deleteFolder(stylesheetPath); + const noChild = await umbracoApi.stylesheet.getChildren(folderName); + expect(noChild[0].hasChildren).toEqual(false); }); }); diff --git a/tests/Umbraco.Tests.AcceptanceTest/tests/ApiTesting/Stylesheet/StylesheetFolder.spec.ts b/tests/Umbraco.Tests.AcceptanceTest/tests/ApiTesting/Stylesheet/StylesheetFolder.spec.ts index a8204d6724..2670b0e42b 100644 --- a/tests/Umbraco.Tests.AcceptanceTest/tests/ApiTesting/Stylesheet/StylesheetFolder.spec.ts +++ b/tests/Umbraco.Tests.AcceptanceTest/tests/ApiTesting/Stylesheet/StylesheetFolder.spec.ts @@ -2,7 +2,6 @@ import {test} from '@umbraco/playwright-testhelpers'; import {expect} from "@playwright/test"; test.describe('Stylesheet Folder tests', () => { - let stylesheetFolderPath = ""; const stylesheetFolderName = 'StylesheetFolder'; test.beforeEach(async ({umbracoApi}) => { @@ -10,81 +9,83 @@ test.describe('Stylesheet Folder tests', () => { }); test.afterEach(async ({umbracoApi}) => { - await umbracoApi.stylesheet.deleteFolder(stylesheetFolderPath); + await umbracoApi.stylesheet.ensureNameNotExists(stylesheetFolderName); }); test('can create a stylesheet folder', async ({umbracoApi}) => { // Arrange - stylesheetFolderPath = await umbracoApi.stylesheet.createFolder(stylesheetFolderName); + await umbracoApi.stylesheet.createFolder(stylesheetFolderName); // Assert - await expect(await umbracoApi.stylesheet.doesFolderExist(stylesheetFolderPath)).toBeTruthy(); + expect(await umbracoApi.stylesheet.doesFolderExist(stylesheetFolderName)).toBeTruthy(); }); test('can delete a stylesheet folder', async ({umbracoApi}) => { // Arrange - stylesheetFolderPath = await umbracoApi.stylesheet.createFolder(stylesheetFolderName); - await expect(await umbracoApi.stylesheet.doesFolderExist(stylesheetFolderPath)).toBeTruthy(); + await umbracoApi.stylesheet.createFolder(stylesheetFolderName); + expect(await umbracoApi.stylesheet.doesFolderExist(stylesheetFolderName)).toBeTruthy(); // Act - await umbracoApi.stylesheet.deleteFolder(stylesheetFolderPath); + await umbracoApi.stylesheet.deleteFolder(stylesheetFolderName); // Assert - await expect(await umbracoApi.stylesheet.doesExist(stylesheetFolderPath)).toBeFalsy(); + expect(await umbracoApi.stylesheet.doesFolderExist(stylesheetFolderName)).toBeFalsy(); }); test('can add a stylesheet folder in another folder', async ({umbracoApi}) => { // Arrange const childFolderName = 'childFolder'; - stylesheetFolderPath = await umbracoApi.stylesheet.createFolder(stylesheetFolderName); + await umbracoApi.stylesheet.createFolder(stylesheetFolderName); // Act - await umbracoApi.stylesheet.createFolder(childFolderName, stylesheetFolderPath); + await umbracoApi.stylesheet.createFolder(childFolderName, stylesheetFolderName); // Assert - const children = await umbracoApi.stylesheet.getChildren(stylesheetFolderPath); - await expect(children[0].name).toEqual(childFolderName); + const children = await umbracoApi.stylesheet.getChildren(stylesheetFolderName); + expect(children[0].name).toEqual(childFolderName); }); - test('can add a stylesheet folder in a folder that is in another folder', async ({umbracoApi}) => { + test('can add a stylesheet folder in a folder in another folder', async ({umbracoApi}) => { // Arrange const childFolderName = 'childFolder'; const childOfChildFolderName = 'childOfChildFolder'; + const childFolderPath = stylesheetFolderName + '/' + childFolderName; // Creates parent folder - stylesheetFolderPath = await umbracoApi.stylesheet.createFolder(stylesheetFolderName); + await umbracoApi.stylesheet.createFolder(stylesheetFolderName); // Creates child folder in parent folder - const childOfParentPath = await umbracoApi.stylesheet.createFolder(childFolderName, stylesheetFolderPath); - const childOfParent = await umbracoApi.stylesheet.getChildren(stylesheetFolderPath); + await umbracoApi.stylesheet.createFolder(childFolderName, stylesheetFolderName); // Act // Creates childOfChild folder in child folder - await umbracoApi.stylesheet.createFolder(childOfChildFolderName, childOfParentPath); + await umbracoApi.stylesheet.createFolder(childOfChildFolderName, childFolderPath); // Assert // Checks if the stylesheet folder are in the correct folders - await expect(childOfParent[0].name).toEqual(childFolderName); - const childOfChild = await umbracoApi.stylesheet.getChildren(childOfParentPath); - await expect(childOfChild[0].name).toEqual(childOfChildFolderName); + const childOfParent = await umbracoApi.stylesheet.getChildren(stylesheetFolderName); + const childOfChild = await umbracoApi.stylesheet.getChildren(childFolderPath); + expect(childOfParent[0].name).toEqual(childFolderName); + expect(childOfChild[0].name).toEqual(childOfChildFolderName); }); test('can delete a stylesheet folder from another folder', async ({umbracoApi}) => { // Arrange const childFolderName = 'childFolder'; - stylesheetFolderPath = await umbracoApi.stylesheet.createFolder(stylesheetFolderName); - const childPath = await umbracoApi.stylesheet.createFolder(childFolderName, stylesheetFolderPath); - const child = await umbracoApi.stylesheet.getChildren(stylesheetFolderPath); + await umbracoApi.stylesheet.createFolder(stylesheetFolderName); + await umbracoApi.stylesheet.createFolder(childFolderName, stylesheetFolderName); // Checks if a child exists in the parent folder with the name - await expect(child[0].name).toEqual(childFolderName); - await umbracoApi.stylesheet.doesFolderExist(childPath); + const child = await umbracoApi.stylesheet.getChildren(stylesheetFolderName); + expect(child[0].name).toEqual(childFolderName); + expect(child[0].isFolder).toBe(true); + expect(await umbracoApi.stylesheet.doesNameExist(childFolderName)).toBeTruthy(); // Act - await umbracoApi.stylesheet.deleteFolder(childPath); + await umbracoApi.stylesheet.deleteFolder(childFolderName); // Assert - const noChild = await umbracoApi.stylesheet.getChildren(stylesheetFolderPath); - await expect(noChild[0]).toEqual(undefined); + const noChild = await umbracoApi.stylesheet.getChildren(stylesheetFolderName); + expect(noChild[0].hasChildren).toBe(false); }); }); diff --git a/tests/Umbraco.Tests.AcceptanceTest/tests/ApiTesting/Template/Template.spec.ts b/tests/Umbraco.Tests.AcceptanceTest/tests/ApiTesting/Template/Template.spec.ts index e0c8104ca1..c1723948c4 100644 --- a/tests/Umbraco.Tests.AcceptanceTest/tests/ApiTesting/Template/Template.spec.ts +++ b/tests/Umbraco.Tests.AcceptanceTest/tests/ApiTesting/Template/Template.spec.ts @@ -2,51 +2,53 @@ import {expect} from "@playwright/test"; test.describe('Template tests', () => { - let templateId = ""; + let templateId; const templateName = 'TemplateTester'; const templateAlias = AliasHelper.toAlias(templateName); - test.beforeEach(async ({page, umbracoApi}) => { + test.beforeEach(async ({umbracoApi}) => { await umbracoApi.template.ensureNameNotExists(templateName); }); - test.afterEach(async ({page, umbracoApi}) => { - await umbracoApi.template.delete(templateId); + test.afterEach(async ({umbracoApi}) => { + await umbracoApi.template.ensureNameNotExists(templateName); }) - test('can create a template', async ({page, umbracoApi, umbracoUi}) => { + test('can create a template', async ({umbracoApi}) => { + // Act templateId = await umbracoApi.template.create(templateName, templateAlias, 'Template Stuff'); // Assert - await expect(umbracoApi.template.doesExist(templateId)).toBeTruthy(); + expect(umbracoApi.template.doesExist(templateId)).toBeTruthy(); }); - test('can update a template', async ({page, umbracoApi, umbracoUi}) => { + test('can update a template', async ({umbracoApi}) => { + // Arrange const newTemplateAlias = 'betterAlias'; - templateId = await umbracoApi.template.create(templateName, templateAlias, 'Template Stuff'); - const templateData = await umbracoApi.template.get(templateId); + // Act // Updates the template templateData.alias = newTemplateAlias; await umbracoApi.template.update(templateId, templateData); // Assert - await expect(umbracoApi.template.doesExist(templateId)).toBeTruthy(); + expect(umbracoApi.template.doesExist(templateId)).toBeTruthy(); // Checks if the template alias was updated const updatedTemplate = await umbracoApi.template.get(templateId); - await expect(updatedTemplate.alias).toEqual(newTemplateAlias); + expect(updatedTemplate.alias).toEqual(newTemplateAlias); }); - test('can delete template', async ({page, umbracoApi, umbracoUi}) => { + test('can delete template', async ({umbracoApi}) => { + // Arrange templateId = await umbracoApi.template.create(templateName, templateAlias, 'More Template Stuff'); + expect(umbracoApi.template.doesExist(templateId)).toBeTruthy(); - await expect(umbracoApi.template.doesExist(templateId)).toBeTruthy(); - + // Act await umbracoApi.template.delete(templateId); // Assert - await expect(await umbracoApi.template.doesExist(templateId)).toBeFalsy(); + expect(await umbracoApi.template.doesExist(templateId)).toBeFalsy(); }); }); diff --git a/tests/Umbraco.Tests.AcceptanceTest/tests/ApiTesting/TemporaryFile/TemporaryFile.spec.ts b/tests/Umbraco.Tests.AcceptanceTest/tests/ApiTesting/TemporaryFile/TemporaryFile.spec.ts index 2a92d796da..03eda6f975 100644 --- a/tests/Umbraco.Tests.AcceptanceTest/tests/ApiTesting/TemporaryFile/TemporaryFile.spec.ts +++ b/tests/Umbraco.Tests.AcceptanceTest/tests/ApiTesting/TemporaryFile/TemporaryFile.spec.ts @@ -8,29 +8,31 @@ test.describe('Temporary File tests', () => { const mimeType = 'image/png'; const filePath = './fixtures/mediaLibrary/Umbraco.png'; - test.beforeEach(async ({page, umbracoApi}) => { + test.beforeEach(async ({umbracoApi}) => { await umbracoApi.temporaryFile.delete(temporaryFileId); }); - test.afterEach(async ({page, umbracoApi}) => { + test.afterEach(async ({umbracoApi}) => { await umbracoApi.temporaryFile.delete(temporaryFileId); }); - test('can create temporary file', async ({page, umbracoApi, umbracoUi}) => { + test('can create temporary file', async ({umbracoApi}) => { + // Act await umbracoApi.temporaryFile.create(temporaryFileId, fileName, mimeType, filePath); // Assert - await expect(await umbracoApi.temporaryFile.exists(temporaryFileId)).toBeTruthy(); + expect(await umbracoApi.temporaryFile.exists(temporaryFileId)).toBeTruthy(); }); - test('can delete temporary file', async ({page, umbracoApi, umbracoUi}) => { + test('can delete temporary file', async ({umbracoApi}) => { + // Arrange await umbracoApi.temporaryFile.create(temporaryFileId, fileName, mimeType, filePath); + expect(await umbracoApi.temporaryFile.get(temporaryFileId)).toBeTruthy(); - await expect(await umbracoApi.temporaryFile.get(temporaryFileId)).toBeTruthy(); - + // Act await umbracoApi.temporaryFile.delete(temporaryFileId); // Assert - await expect(await umbracoApi.temporaryFile.exists(temporaryFileId)).toBeFalsy(); + expect(await umbracoApi.temporaryFile.exists(temporaryFileId)).toBeFalsy(); }); }); diff --git a/tests/Umbraco.Tests.AcceptanceTest/tests/ApiTesting/User/User.spec.ts b/tests/Umbraco.Tests.AcceptanceTest/tests/ApiTesting/User/User.spec.ts index e4b142578e..07b27657fe 100644 --- a/tests/Umbraco.Tests.AcceptanceTest/tests/ApiTesting/User/User.spec.ts +++ b/tests/Umbraco.Tests.AcceptanceTest/tests/ApiTesting/User/User.spec.ts @@ -6,66 +6,65 @@ test.describe('User Tests', () => { const userEmail = "user@email.com"; const userName = "UserTests"; - test.beforeEach(async ({page, umbracoApi}) => { + test.beforeEach(async ({umbracoApi}) => { await umbracoApi.user.ensureNameNotExists(userName); }); - test.afterEach(async ({page, umbracoApi}) => { - await umbracoApi.user.delete(userId); + test.afterEach(async ({umbracoApi}) => { + await umbracoApi.user.ensureNameNotExists(userName); }); - test('can create a user', async ({page, umbracoApi, umbracoUi}) => { + test('can create a user', async ({umbracoApi}) => { + // Arrange // Gets the id for the writers userGroup const userGroup = await umbracoApi.userGroup.getByName("Writers"); const userGroupId = [userGroup.id]; + // Act userId = await umbracoApi.user.create(userEmail, userName, userGroupId); // Assert - await expect(await umbracoApi.user.exists(userId)).toBeTruthy(); + expect(await umbracoApi.user.exists(userId)).toBeTruthy(); }); - test('can update a user', async ({page, umbracoApi, umbracoUi}) => { + test('can update a user', async ({umbracoApi}) => { + // Arrange // Gets userGroup data for Writers and Translators const userGroup = await umbracoApi.userGroup.getByName("Writers"); const anotherUserGroup = await umbracoApi.userGroup.getByName("Translators"); - const userGroupId = [userGroup.id]; - userId = await umbracoApi.user.create(userEmail, userName, userGroupId); - const userData = await umbracoApi.user.get(userId); - const newUserGroupData = [ userGroup.id, anotherUserGroup.id ]; - userData.userGroupIds = newUserGroupData; + // Act await umbracoApi.user.update(userId, userData); // Assert await umbracoApi.user.exists(userId); // Checks if the user was updated with another userGroupID const updatedUser = await umbracoApi.user.get(userId); - await expect(updatedUser.userGroupIds.toString()).toEqual(newUserGroupData.toString()); + expect(updatedUser.userGroupIds.toString()).toEqual(newUserGroupData.toString()); }); - test('can delete a user', async ({page, umbracoApi, umbracoUi}) => { + test('can delete a user', async ({umbracoApi}) => { + // Arrange const userGroupData = await umbracoApi.userGroup.getByName("Writers"); - const userData = [ userGroupData.id ]; userId = await umbracoApi.user.create(userEmail, userName, userData); + expect(await umbracoApi.user.exists(userId)).toBeTruthy(); - await expect(await umbracoApi.user.exists(userId)).toBeTruthy(); - + // Act await umbracoApi.user.delete(userId); // Assert - await expect(await umbracoApi.user.exists(userId)).toBeFalsy(); + expect(await umbracoApi.user.exists(userId)).toBeFalsy(); }); }); diff --git a/tests/Umbraco.Tests.AcceptanceTest/tests/ApiTesting/User/UserAvatar.spec.ts b/tests/Umbraco.Tests.AcceptanceTest/tests/ApiTesting/User/UserAvatar.spec.ts index 647535ca13..2d5d372ff0 100644 --- a/tests/Umbraco.Tests.AcceptanceTest/tests/ApiTesting/User/UserAvatar.spec.ts +++ b/tests/Umbraco.Tests.AcceptanceTest/tests/ApiTesting/User/UserAvatar.spec.ts @@ -14,53 +14,52 @@ test.describe('User Avatar Tests', () => { const mimeType = 'image/png'; const avatarFilePath = './fixtures/mediaLibrary/Umbraco.png'; - test.beforeEach(async ({page, umbracoApi}) => { + test.beforeEach(async ({umbracoApi}) => { await umbracoApi.user.ensureNameNotExists(userName); await umbracoApi.temporaryFile.delete(avatarFileId); }); - test.afterEach(async ({page, umbracoApi}) => { + test.afterEach(async ({umbracoApi}) => { await umbracoApi.user.ensureNameNotExists(userName); await umbracoApi.temporaryFile.delete(avatarFileId); }); - test('can add an avatar to a user', async ({page, umbracoApi, umbracoUi}) => { + test('can add an avatar to a user', async ({umbracoApi}) => { + // Arrange const userGroup = await umbracoApi.userGroup.getByName("Writers"); - const userGroupData = [userGroup.id]; userId = await umbracoApi.user.create(userEmail, userName, userGroupData); - await umbracoApi.temporaryFile.create(avatarFileId, avatarName, mimeType, avatarFilePath); + // Act await umbracoApi.user.addAvatar(userId, avatarFileId); // Assert // Checks if the avatar was added to the user const userDataWithAvatar = await umbracoApi.user.get(userId); - await expect(userDataWithAvatar.avatarUrls.length !== 0).toBeTruthy(); + expect(userDataWithAvatar.avatarUrls.length !== 0).toBeTruthy(); }); - test('can remove an avatar from a user', async ({page, umbracoApi, umbracoUi}) => { + test('can remove an avatar from a user', async ({umbracoApi}) => { + // Arrange const userGroup = await umbracoApi.userGroup.getByName("Writers"); - const userGroupData = [userGroup.id]; userId = await umbracoApi.user.create(userEmail, userName, userGroupData); - await umbracoApi.temporaryFile.create(avatarFileId, avatarName, mimeType, avatarFilePath); - await umbracoApi.user.addAvatar(userId, avatarFileId); // Checks if the avatar was added to the user const userDataWithAvatar = await umbracoApi.user.get(userId); - await expect(userDataWithAvatar.avatarUrls.length !== 0).toBeTruthy(); + expect(userDataWithAvatar.avatarUrls.length !== 0).toBeTruthy(); + // Act await umbracoApi.user.removeAvatar(userId); // Assert // Checks if the avatar was removed from the user const userDataWithoutAvatar = await umbracoApi.user.get(userId); - await expect(userDataWithoutAvatar.avatarUrls.length).toEqual(0); + expect(userDataWithoutAvatar.avatarUrls.length).toEqual(0); }); }); diff --git a/tests/Umbraco.Tests.AcceptanceTest/tests/ApiTesting/UserGroup/UserGroup.spec.ts b/tests/Umbraco.Tests.AcceptanceTest/tests/ApiTesting/UserGroup/UserGroup.spec.ts index d8af2e6167..45fac96034 100644 --- a/tests/Umbraco.Tests.AcceptanceTest/tests/ApiTesting/UserGroup/UserGroup.spec.ts +++ b/tests/Umbraco.Tests.AcceptanceTest/tests/ApiTesting/UserGroup/UserGroup.spec.ts @@ -5,45 +5,49 @@ test.describe('User Group Tests', () => { let userGroupId = ""; const userGroupName = "UserGroupTest"; - test.beforeEach(async ({page, umbracoApi}) => { + test.beforeEach(async ({umbracoApi}) => { await umbracoApi.userGroup.ensureNameNotExists(userGroupName); }); - test.afterEach(async ({page, umbracoApi}) => { + test.afterEach(async ({umbracoApi}) => { await umbracoApi.userGroup.delete(userGroupId); }); - test('can create a user group', async ({page, umbracoApi, umbracoUi}) => { + test('can create a user group', async ({umbracoApi}) => { + // Arrange const sections = ["Umb.Section.Content", "Umb.Section.Forms", "Umb.Section.Media"]; + // Act userGroupId = await umbracoApi.userGroup.create(userGroupName, true, sections); // Assert - await expect(umbracoApi.userGroup.exist(userGroupId)).toBeTruthy(); + expect(umbracoApi.userGroup.exist(userGroupId)).toBeTruthy(); }); - test('can update a user group', async ({page, umbracoApi, umbracoUi}) => { + test('can update a user group', async ({umbracoApi}) => { + // Arrange userGroupId = await umbracoApi.userGroup.create('UserGroupNameTest', true); - const userGroupData = await umbracoApi.userGroup.get(userGroupId); - - // Updates name of the user group userGroupData.name = userGroupName; + + // Act await umbracoApi.userGroup.update(userGroupId, userGroupData); // Assert const updatedUserGroupData = await umbracoApi.userGroup.get(userGroupId); - await expect(updatedUserGroupData.name).toEqual(userGroupName); + expect(updatedUserGroupData.name).toEqual(userGroupName); }); - test('can delete a user group', async ({page, umbracoApi, umbracoUi}) => { + test('can delete a user group', async ({umbracoApi}) => { + // Arrange userGroupId = await umbracoApi.userGroup.create(userGroupName, true); + // Act await umbracoApi.userGroup.delete(userGroupId); // Assert - await expect(await umbracoApi.userGroup.exist(userGroupId)).toBeFalsy(); + expect(await umbracoApi.userGroup.exist(userGroupId)).toBeFalsy(); }); }); diff --git a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/LogViewer/LogViewer.spec.ts b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/LogViewer/LogViewer.spec.ts index 11b9d11816..23b69577f1 100644 --- a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/LogViewer/LogViewer.spec.ts +++ b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/LogViewer/LogViewer.spec.ts @@ -1,74 +1,70 @@ -import {test} from '@umbraco/playwright-testhelpers'; +import {ConstantHelper, test} from '@umbraco/playwright-testhelpers'; import {expect} from "@playwright/test"; test.describe('Log Viewer tests', () => { - test('can search', async ({page, umbracoApi, umbracoUi, request}) => { + test.beforeEach(async ({umbracoUi}) => { + await umbracoUi.goToBackOffice(); + await umbracoUi.logViewer.goToSettingsTreeItem('Log Viewer'); + }); + + test('can search', async ({umbracoApi, umbracoUi}) => { // Arrange const startTelemetryLevel = await umbracoApi.telemetry.getLevel(); const telemetryLevel = "Minimal"; await umbracoApi.telemetry.setLevel(telemetryLevel); // Act - await page.goto(umbracoApi.baseUrl + '/umbraco'); - await umbracoUi.goToSettingsTreeItem('Log Viewer'); - await page.getByRole('tab', {name: 'Search'}).click({force: true}); - await page.getByPlaceholder('Search logs...').fill(telemetryLevel); + await umbracoUi.logViewer.clickSearchButton(); + await umbracoUi.logViewer.enterSearchKeyword(telemetryLevel); // Assert // Checks if there is a log with the telemetry level to minimal - await page.waitForTimeout(1000); - await expect(await page.getByRole('group').first()).toContainText('Telemetry level set to "' + telemetryLevel + '"'); + await umbracoUi.waitForTimeout(1000); + await umbracoUi.logViewer.doesFirstLogHaveMessage('Telemetry level set to "' + telemetryLevel + '"'); // Clean await umbracoApi.telemetry.setLevel(startTelemetryLevel); }); - test('can change the search log level', async ({page, umbracoApi, umbracoUi}) => { + test('can change the search log level', async ({umbracoApi, umbracoUi}) => { // Arrange const logInformation = await umbracoApi.logViewer.getLevelCount(); const expectedLogCount = Math.min(logInformation.information, 100); // Act - await page.goto(umbracoApi.baseUrl + '/umbraco'); - await umbracoUi.goToSettingsTreeItem('Log Viewer'); - await page.getByRole('tab', {name: 'Search'}).click({force: true}); - await page.getByRole('button', {name: 'Select log levels'}).click(); - await page.locator('.log-level-menu-item').getByText('Information').click(); + await umbracoUi.logViewer.clickSearchButton(); + await umbracoUi.logViewer.selectLogLevel('Information'); // Assert // Check if the search log level indicator is visible - await expect(page.locator('.log-level-button-indicator', {hasText: 'Information'})).toBeVisible(); + await umbracoUi.logViewer.doesLogLevelIndicatorDisplay('Information'); // Check if the log count matches the expected count - await expect(page.locator('umb-log-viewer-message').locator('umb-log-viewer-level-tag', {hasText: 'Information'})).toHaveCount(expectedLogCount); + await umbracoUi.logViewer.doesLogLevelCountMatch('Information', expectedLogCount); }); - test('can create a saved search', async ({page, umbracoApi, umbracoUi}) => { + test('can create a saved search', async ({umbracoApi, umbracoUi}) => { // Arrange - const searchName = 'Test'; - const search = 'Acquiring MainDom'; + const searchName = 'TestSavedSearch'; + const search = 'test saved search'; await umbracoApi.logViewer.deleteSavedSearch(searchName); // Act - await page.goto(umbracoApi.baseUrl + '/umbraco'); - await umbracoUi.goToSettingsTreeItem('Log Viewer'); - await page.getByRole('tab', {name: 'Search'}).click({force: true}); - await page.getByPlaceholder('Search logs...').fill(search); - await page.getByLabel("Save search").click({force: true}); - await page.getByLabel("Search name").fill(searchName); - await page.locator('uui-dialog-layout').getByLabel("Save search").click(); + await umbracoUi.logViewer.clickSearchButton(); + await umbracoUi.logViewer.enterSearchKeyword(search); + await umbracoUi.logViewer.saveSearch(searchName); // Assert // Checks if the saved search is visible in the UI - await page.getByRole('tab', {name: 'Overview'}).click({force: true}); - await expect(page.locator('#saved-searches').getByLabel(searchName, {exact: true})).toBeVisible(); + await umbracoUi.logViewer.clickOverviewButton(); + await expect(umbracoUi.logViewer.checkSavedSearch(searchName)).toBeVisible(); expect(umbracoApi.logViewer.doesSavedSearchExist(searchName)).toBeTruthy(); // Clean await umbracoApi.logViewer.deleteSavedSearch(searchName); }); - test('can create a complex saved search', async ({page, umbracoApi, umbracoUi}) => { + test('can create a complex saved search', async ({umbracoApi, umbracoUi}) => { // Arrange const searchName = 'ComplexTest'; const search = "@Level='Fatal' or @Level='Error' or @Level='Warning'"; @@ -79,29 +75,25 @@ test.describe('Log Viewer tests', () => { const expectedLogCountWarning = logInformation.warning; // Act - await page.goto(umbracoApi.baseUrl + '/umbraco'); - await umbracoUi.goToSettingsTreeItem('Log Viewer'); - await page.getByRole('tab', {name: 'Search'}).click({force: true}); - await page.getByPlaceholder('Search logs...').fill(search); + await umbracoUi.logViewer.clickSearchButton(); + await umbracoUi.logViewer.enterSearchKeyword(search); // Checks if the complex search works before saving it. - await expect(page.locator('umb-log-viewer-message').locator('umb-log-viewer-level-tag', {hasText: 'Fatal'})).toHaveCount(expectedLogCountFatal); - await expect(page.locator('umb-log-viewer-message').locator('umb-log-viewer-level-tag', {hasText: 'Error'})).toHaveCount(expectedLogCountError); - await expect(page.locator('umb-log-viewer-message').locator('umb-log-viewer-level-tag', {hasText: 'Warning'})).toHaveCount(expectedLogCountWarning); - await page.getByLabel("Save search").click({force: true}); - await page.getByLabel("Search name").fill(searchName); - await page.locator('uui-dialog-layout').getByLabel("Save search").click(); + await umbracoUi.logViewer.doesLogLevelCountMatch('Fatal', expectedLogCountFatal); + await umbracoUi.logViewer.doesLogLevelCountMatch('Error', expectedLogCountError); + await umbracoUi.logViewer.doesLogLevelCountMatch('Warning', expectedLogCountWarning); + await umbracoUi.logViewer.saveSearch(searchName); // Assert // Checks if the saved search is visible in the UI - await page.getByRole('tab', {name: 'Overview'}).click({force: true}); - await expect(page.locator('#saved-searches').getByLabel(searchName)).toBeVisible(); + await umbracoUi.logViewer.clickOverviewButton(); + await expect(umbracoUi.logViewer.checkSavedSearch(searchName)).toBeVisible(); expect(umbracoApi.logViewer.doesSavedSearchExist(searchName)).toBeTruthy(); // Clean await umbracoApi.logViewer.deleteSavedSearch(searchName); }); - test('can delete a saved search', async ({page, umbracoApi, umbracoUi}) => { + test('can delete a saved search', async ({umbracoApi, umbracoUi}) => { // Arrange const searchName = 'ToBeDeletedSearchName'; const search = 'Acquiring MainDom'; @@ -109,36 +101,32 @@ test.describe('Log Viewer tests', () => { await umbracoApi.logViewer.createSavedSearch(searchName, search); // Act - await page.goto(umbracoApi.baseUrl + '/umbraco'); - await umbracoUi.goToSettingsTreeItem('Log Viewer'); - await page.getByRole('tab', {name: 'Search'}).click({force: true}); - await page.getByLabel('Saved searches').click(); - await page.locator('li').filter({hasText: searchName + ' ' + search}).getByLabel('Remove saved search').click({force: true}); + await umbracoUi.logViewer.clickSearchButton(); + await umbracoUi.logViewer.clickSavedSearchesButton(); + await umbracoUi.logViewer.removeSavedSearchByName(searchName + ' ' + search); // Assert // Checks if the saved search is visible in the UI - await page.getByRole('tab', {name: 'Overview'}).click({force: true}); - await expect(page.locator('#saved-searches').getByLabel(searchName)).not.toBeVisible(); + await umbracoUi.logViewer.clickOverviewButton(); + await expect(umbracoUi.logViewer.checkSavedSearch(searchName)).not.toBeVisible(); expect(await umbracoApi.logViewer.doesSavedSearchExist(searchName)).toBeFalsy(); }); - test('can expand a log entry', async ({page, umbracoApi, umbracoUi}) => { + test('can expand a log entry', async ({umbracoUi}) => { // Arrange - const search = "@MessageTemplate='Acquiring MainDom.'"; + const search = "StartsWith(@MessageTemplate, 'The token')"; // Act - await page.goto(umbracoApi.baseUrl + '/umbraco'); - await umbracoUi.goToSettingsTreeItem('Log Viewer'); - await page.getByRole('tab', {name: 'Search'}).click({force: true}); - await page.getByPlaceholder('Search logs...').fill(search); - await page.getByRole('group').locator('#message').first().click(); + await umbracoUi.logViewer.clickSearchButton(); + await umbracoUi.logViewer.enterSearchKeyword(search); + await umbracoUi.logViewer.clickFirstLogSearchResult(); // Assert - await expect(page.getByRole('list').getByText('Acquiring MainDom.')).toBeVisible(); + await umbracoUi.logViewer.doesDetailedLogHaveText('The token'); }); // Currently only works if the user is using the locale 'en-US' otherwise it will fail - test('can sort logs by timestamp', async ({page, umbracoApi, umbracoUi}) => { + test('can sort logs by timestamp', async ({umbracoApi, umbracoUi}) => { // Arrange const locale = 'en-US'; const options: Intl.DateTimeFormatOptions = { @@ -152,56 +140,52 @@ test.describe('Log Viewer tests', () => { }; //Act - await page.goto(umbracoApi.baseUrl + '/umbraco'); - await umbracoUi.goToSettingsTreeItem('Log Viewer'); - await page.getByRole('tab', {name: 'Search'}).click({force: true}); + await umbracoUi.logViewer.clickSearchButton(); // Sorts logs by timestamp - await page.getByLabel('Sort logs').click(); + await umbracoUi.logViewer.clickSortLogByTimestampButton(); // Gets the last log from the log viewer const lastLog = await umbracoApi.logViewer.getLog(0, 1, "Descending"); const dateToFormat = new Date(lastLog.items[0].timestamp); const lastLogTimestamp = new Intl.DateTimeFormat(locale, options).format(dateToFormat); // Assert - await expect(page.locator('umb-log-viewer-message').locator('[id="timestamp"]').first()).toContainText(lastLogTimestamp); + await umbracoUi.logViewer.doesFirstLogHaveTimestamp(lastLogTimestamp); }); // Will fail if there is not enough logs. - test('can use pagination', async ({page, umbracoApi, umbracoUi}) => { + test('can use pagination', async ({umbracoApi, umbracoUi}) => { // Arrange const secondPageLogs = await umbracoApi.logViewer.getLog(100, 100, 'Ascending'); const firstLogOnSecondPage = secondPageLogs.items[0].renderedMessage; // Act - await page.goto(umbracoApi.baseUrl + '/umbraco'); - await umbracoUi.goToSettingsTreeItem('Log Viewer'); - await page.getByRole('tab', {name: 'Search'}).click({force: true}); - await page.getByLabel('Go to page 2', {exact: true}).click(); + await umbracoUi.logViewer.clickSearchButton(); + await umbracoUi.logViewer.clickPageNumber(2); // Assert - await expect(page.locator('umb-log-viewer-message').locator('[id="message"]').first()).toContainText(firstLogOnSecondPage); + await umbracoUi.logViewer.doesFirstLogHaveMessage(firstLogOnSecondPage); // TODO: Remove the comment below when the issue is resolved. // At the time this test was created, the UI only highlights page 1. Uncomment the line below when the issue is resolved. // await expect(page.getByLabel('Pagination navigation. Current page: 2.', {exact: true})).toBeVisible(); }); - test('can use a saved search', async ({page, umbracoApi, umbracoUi}) => { + test('can use a saved search', async ({umbracoApi, umbracoUi}) => { // Arrange const searchName = 'TestSearch'; - const search = "StartsWith(@MessageTemplate, 'Acquiring MainDom.')"; + const search = "StartsWith(@MessageTemplate, 'The token')"; await umbracoApi.logViewer.deleteSavedSearch(searchName); await umbracoApi.logViewer.createSavedSearch(searchName, search); + // Need to reload page to get the latest saved search list after creating new saved search by api + await umbracoUi.reloadPage(); // Act - await page.goto(umbracoApi.baseUrl + '/umbraco'); - await umbracoUi.goToSettingsTreeItem('Log Viewer'); - await page.locator('#saved-searches').getByLabel(searchName).click(); + await umbracoUi.logViewer.clickSavedSearchByName(searchName); // Assert // Checks if the search has the correct search value - await expect(page.getByPlaceholder('Search logs...')).toHaveValue(search); + await umbracoUi.logViewer.doesSearchBoxHaveValue(search); // Checks if the saved search found the correct logs - await expect(page.getByRole('group').locator('#message', {hasText: 'Acquiring MainDom.'}).first()).toBeVisible(); + await umbracoUi.logViewer.doesFirstLogHaveMessage('The token'); // Clean await umbracoApi.logViewer.deleteSavedSearch(searchName); diff --git a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Settings/PartialViews.spec.ts b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Settings/PartialViews.spec.ts index 4468e1b075..05b3c9a6ae 100644 --- a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Settings/PartialViews.spec.ts +++ b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Settings/PartialViews.spec.ts @@ -4,10 +4,10 @@ import {expect} from "@playwright/test"; test.describe('Partial Views tests', () => { const partialViewName = 'TestPartialView'; const partialViewFileName = partialViewName + ".cshtml"; - + test.beforeEach(async ({umbracoUi}) => { await umbracoUi.goToBackOffice(); - await umbracoUi.goToSection(ConstantHelper.sections.settings); + await umbracoUi.partialView.goToSection(ConstantHelper.sections.settings); }); test('can create an empty partial view', async ({umbracoApi, umbracoUi}) => { @@ -15,7 +15,7 @@ test.describe('Partial Views tests', () => { await umbracoApi.partialView.ensureNameNotExists(partialViewName); // Act - await umbracoUi.partialView.openActionsMenuAtRoot(); + await umbracoUi.partialView.clickActionsMenuAtRoot(); await umbracoUi.partialView.clickNewEmptyPartialViewButton(); await umbracoUi.partialView.enterPartialViewName(partialViewName); // TODO: Remove this timeout when frontend validation is implemented @@ -24,20 +24,20 @@ test.describe('Partial Views tests', () => { // Assert expect(await umbracoApi.partialView.doesExist(partialViewFileName)).toBeTruthy(); - // TODO: when frontend is ready, verify the new partial view is displayed under the Partial Views section + // TODO: when frontend is ready, verify the new partial view is displayed under the Partial Views section // TODO: when frontend is ready, verify the notification displays - + // Clean await umbracoApi.partialView.ensureNameNotExists(partialViewFileName); }); - test('can create a partial view from snippet', async ({umbracoApi, umbracoUi}) => { + test.skip('can create a partial view from snippet', async ({umbracoApi, umbracoUi}) => { // Arrange await umbracoApi.partialView.ensureNameNotExists(partialViewFileName); const expectedTemplateContent = '@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage\r\n@using Umbraco.Cms.Core.Routing\r\n@using Umbraco.Extensions\r\n\n@inject IPublishedUrlProvider PublishedUrlProvider\r\n@*\r\n This snippet makes a breadcrumb of parents using an unordered HTML list.\r\n\r\n How it works:\r\n - It uses the Ancestors() method to get all parents and then generates links so the visitor can go back\r\n - Finally it outputs the name of the current page (without a link)\r\n*@\r\n\r\n@{ var selection = Model.Ancestors().ToArray(); }\r\n\r\n@if (selection?.Length > 0)\r\n{\r\n \r\n}'; // Act - await umbracoUi.partialView.openActionsMenuAtRoot(); + await umbracoUi.partialView.clickActionsMenuAtRoot(); await umbracoUi.partialView.clickNewPartialViewFromSnippetButton(); await umbracoUi.partialView.clickBreadcrumbButton(); await umbracoUi.partialView.enterPartialViewName(partialViewName); @@ -48,16 +48,15 @@ test.describe('Partial Views tests', () => { // Assert expect(await umbracoApi.partialView.doesExist(partialViewFileName)).toBeTruthy(); const partialViewData = await umbracoApi.partialView.getByName(partialViewFileName); - await expect(partialViewData.content).toBe(expectedTemplateContent); + expect(partialViewData.content).toBe(expectedTemplateContent); // TODO: when frontend is ready, verify the new partial view is displayed under the Partial Views section // TODO: when frontend is ready, verify the notification displays - + // Clean await umbracoApi.partialView.ensureNameNotExists(partialViewFileName); }); - -test('can update a partial view name', async ({umbracoApi, umbracoUi}) => { + test('can update a partial view name', async ({umbracoApi, umbracoUi}) => { // Arrange const updatedPartialViewName = 'TestPartialViewUpdated'; const updatedPartialViewFileName = updatedPartialViewName + ".cshtml"; @@ -66,7 +65,7 @@ test('can update a partial view name', async ({umbracoApi, umbracoUi}) => { await umbracoApi.partialView.create(partialViewFileName, "@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage\r\n", "/"); //Act - await umbracoUi.partialView.openPartialViewFileAtRoot(partialViewFileName); + await umbracoUi.partialView.openPartialViewAtRoot(partialViewFileName); await umbracoUi.partialView.enterPartialViewName(updatedPartialViewName); // TODO: Remove this timeout when frontend validation is implemented await umbracoUi.waitForTimeout(1000); @@ -77,7 +76,7 @@ test('can update a partial view name', async ({umbracoApi, umbracoUi}) => { // TODO: when frontend is ready, verify the updated partial view name is displayed under the Partial Views section expect(await umbracoApi.partialView.doesExist(partialViewFileName)).toBeFalsy(); // TODO: when frontend is ready, verify the old partial view name is NOT displayed under the Partial Views section - + // Clean await umbracoApi.partialView.ensureNameNotExists(updatedPartialViewFileName); }); @@ -94,7 +93,7 @@ test('can update a partial view name', async ({umbracoApi, umbracoUi}) => { await umbracoApi.partialView.create(partialViewFileName, "@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage\r\n", "/"); //Act - await umbracoUi.partialView.openPartialViewFileAtRoot(partialViewFileName); + await umbracoUi.partialView.openPartialViewAtRoot(partialViewFileName); await umbracoUi.partialView.enterPartialViewContent(updatedPartialViewContent); // TODO: Remove this timeout when frontend validation is implemented await umbracoUi.waitForTimeout(1000); @@ -102,8 +101,8 @@ test('can update a partial view name', async ({umbracoApi, umbracoUi}) => { // Assert const updatedPartialView = await umbracoApi.partialView.getByName(partialViewFileName); - await expect(updatedPartialView.content).toBe(updatedPartialViewContent); - + expect(updatedPartialView.content).toBe(updatedPartialViewContent); + // Clean await umbracoApi.partialView.ensureNameNotExists(partialViewFileName); }); @@ -111,28 +110,28 @@ test('can update a partial view name', async ({umbracoApi, umbracoUi}) => { test('can use query builder for a partial view', async ({umbracoApi, umbracoUi}) => { //Arrange const expectedTemplateContent = '\r\n' + - '@{\r\n' + - '\tvar selection = Umbraco.ContentAtRoot().FirstOrDefault()\r\n' + - ' .Children()\r\n' + - ' .Where(x => x.IsVisible());\r\n' + - '}\r\n' + - '\r\n' + - '\r\n' + - '@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage\r\n'; + '@{\r\n' + + '\tvar selection = Umbraco.ContentAtRoot().FirstOrDefault()\r\n' + + ' .Children()\r\n' + + ' .Where(x => x.IsVisible());\r\n' + + '}\r\n' + + '\r\n' + + '\r\n' + + '@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage\r\n'; await umbracoApi.partialView.ensureNameNotExists(partialViewFileName); await umbracoApi.partialView.create(partialViewFileName, "@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage\r\n", "/"); // Act - await umbracoUi.partialView.openPartialViewFileAtRoot(partialViewFileName); - await umbracoUi.partialView.addQueryBuilderIntoPartialView(); + await umbracoUi.partialView.openPartialViewAtRoot(partialViewFileName); + await umbracoUi.partialView.addQueryBuilderWithCreateDateOption(); await umbracoUi.partialView.clickSaveButton(); // Assert @@ -147,18 +146,18 @@ test('can update a partial view name', async ({umbracoApi, umbracoUi}) => { test.skip('can insert dictionaryItem into a partial view', async ({umbracoApi, umbracoUi}) => { // Arrange const dictionaryName = 'TestDictionary'; - + await umbracoApi.partialView.ensureNameNotExists(partialViewFileName); await umbracoApi.partialView.create(partialViewFileName, "@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage\r\n", "/"); await umbracoApi.dictionary.ensureNameNotExists(dictionaryName); await umbracoApi.dictionary.create(dictionaryName); - const partialViewContent = '@Umbraco.GetDictionaryValue("' + dictionaryName +'")@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage\r\n'; + const partialViewContent = '@Umbraco.GetDictionaryValue("' + dictionaryName + '")@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage\r\n'; // Act - await umbracoUi.partialView.openPartialViewFileAtRoot(partialViewFileName); - await umbracoUi.partialView.insertDictionaryItem(dictionaryName); + await umbracoUi.partialView.openPartialViewAtRoot(partialViewFileName); + await umbracoUi.partialView.insertDictionaryByName(dictionaryName); await umbracoUi.partialView.clickSaveButton(); // Assert @@ -170,19 +169,19 @@ test('can update a partial view name', async ({umbracoApi, umbracoUi}) => { await umbracoApi.template.ensureNameNotExists(partialViewFileName); }); - test('can delete a partial view', async ({umbracoApi, umbracoUi}) => { + test.skip('can delete a partial view', async ({umbracoApi, umbracoUi}) => { //Arrange await umbracoApi.partialView.ensureNameNotExists(partialViewFileName); await umbracoApi.partialView.create(partialViewFileName, "@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage\r\n", "/"); //Act await umbracoUi.partialView.clickRootFolderCaretButton(); - await umbracoUi.partialView.openActionsMenuForName(partialViewFileName); - await umbracoUi.partialView.deletePartialViewFile(); + await umbracoUi.partialView.openPartialViewAtRoot(partialViewFileName); + await umbracoUi.partialView.deletePartialView(); // Assert expect(await umbracoApi.partialView.doesExist(partialViewFileName)).toBeFalsy(); - // TODO: when frontend is ready, verify the partial view is NOT displayed under the Partial Views section + // TODO: when frontend is ready, verify the partial view is NOT displayed under the Partial Views section // TODO: when frontend is ready, verify the notification displays }); @@ -193,20 +192,20 @@ test('can update a partial view name', async ({umbracoApi, umbracoUi}) => { await umbracoApi.partialView.ensureNameNotExists(folderName); // Act - await umbracoUi.partialView.openActionsMenuAtRoot(); - await umbracoUi.partialView.createNewFolder(folderName); + await umbracoUi.partialView.clickActionsMenuAtRoot(); + await umbracoUi.partialView.createFolder(folderName); // Assert expect(await umbracoApi.partialView.doesFolderExist(folderName)).toBeTruthy(); - // TODO: when frontend is ready, verify the new folder is displayed under the Partial Views section + // TODO: when frontend is ready, verify the new folder is displayed under the Partial Views section // TODO: when frontend is ready, verify the notification displays //Clean await umbracoApi.partialView.ensureNameNotExists(folderName); }); - test.skip('can place a partial view into folder', async ({page, umbracoApi}) => { + test.skip('can place a partial view into folder', async ({umbracoApi}) => { // TODO: implement this later as the frontend is missing now }); - + }); diff --git a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Settings/Scripts.spec.ts b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Settings/Scripts.spec.ts index aa081d21fd..760e004d0d 100644 --- a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Settings/Scripts.spec.ts +++ b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Settings/Scripts.spec.ts @@ -6,23 +6,22 @@ test.describe('Script tests', () => { const scriptPath = scriptName + '.js'; const scriptFolderName = 'TestScriptFolder'; - test.beforeEach(async ({page, umbracoApi, umbracoUi}) => { - await page.goto(umbracoApi.baseUrl + '/umbraco'); - await umbracoUi.goToSection(ConstantHelper.sections.settings); + test.beforeEach(async ({umbracoUi}) => { + await umbracoUi.goToBackOffice(); + await umbracoUi.script.goToSection(ConstantHelper.sections.settings); }); - test('can create a empty script', async ({page, umbracoApi, umbracoUi}) => { + test('can create a empty script', async ({umbracoApi, umbracoUi}) => { // Arrange await umbracoApi.script.ensureNameNotExists(scriptPath); // Act - await page.locator('umb-tree-item', {hasText: 'Scripts'}).getByLabel('Open actions menu').click({force: true}); - await page.getByLabel('New empty script').click(); - // TODO: Change the label to script name when the label is updated - await page.getByLabel('template name').fill(scriptName); + await umbracoUi.script.clickActionsMenuAtRoot(); + await umbracoUi.script.clickNewScriptButton(); + await umbracoUi.script.enterScriptName(scriptName); // TODO: Remove this timeout when frontend validation is implemented - await page.waitForTimeout(1000); - await page.getByLabel('Save').click({force: true}); + await umbracoUi.waitForTimeout(1000); + await umbracoUi.script.clickSaveButton(); // Assert // TODO: Uncomment when the notification is visible @@ -33,18 +32,17 @@ test.describe('Script tests', () => { await umbracoApi.script.ensureNameNotExists(scriptPath); }); - test('can update a script', async ({page, umbracoApi, umbracoUi}) => { + test('can update a script', async ({ umbracoApi, umbracoUi}) => { // Arrange await umbracoApi.script.ensureNameNotExists(scriptPath); await umbracoApi.script.create(scriptPath, 'test'); const updatedScriptContent = 'const test = {\r\n script = \u0022Test\u0022,\r\n extension = \u0022.js\u0022,\r\n scriptPath: function() {\r\n return this.script \u002B this.extension;\r\n }\r\n};\r\n'; // Act - await page.locator('umb-tree-item', {hasText: 'Scripts'}).locator('#caret-button').click(); - await page.locator('umb-tree-item').getByLabel(scriptName).click(); - await page.locator('textarea.inputarea').clear(); - await page.locator('textarea.inputarea').fill(updatedScriptContent); - await page.getByLabel('Save').click(); + await umbracoUi.script.openScriptAtRoot(scriptPath); + await umbracoUi.script.enterScriptContent(updatedScriptContent); + await umbracoUi.waitForTimeout(1000); + await umbracoUi.script.clickSaveButton(); // Assert // TODO: Uncomment when the notification is visible @@ -56,16 +54,15 @@ test.describe('Script tests', () => { await umbracoApi.script.ensureNameNotExists(scriptPath); }); - test('can delete a script', async ({page, umbracoApi, umbracoUi}) => { + test('can delete a script', async ({umbracoApi, umbracoUi}) => { // Arrange await umbracoApi.script.ensureNameNotExists(scriptPath); await umbracoApi.script.create(scriptPath, ''); // Act - await page.locator('umb-tree-item', {hasText: 'Scripts'}).locator('#caret-button').click(); - await page.locator('umb-tree-item').locator('[label="' + scriptPath + '"] >> [label="Open actions menu"]').click(); - await page.getByLabel('Delete').click(); - await page.locator('#confirm').getByLabel('Delete').click(); + await umbracoUi.script.clickRootFolderCaretButton(); + await umbracoUi.script.clickActionsMenuForScript(scriptPath); + await umbracoUi.script.deleteScript(); // Assert // TODO: Uncomment when the notification is visible @@ -74,68 +71,60 @@ test.describe('Script tests', () => { }); // Folder - test('can create a folder', async ({page, umbracoApi, umbracoUi}) => { + test.skip('can create a folder', async ({umbracoApi, umbracoUi}) => { // Arrange await umbracoApi.script.ensureNameNotExists(scriptFolderName); // Act - await page.locator('umb-tree-item', {hasText: 'Scripts'}).getByLabel('Open actions menu').click({force: true}); - await page.getByLabel('Create folder').click(); - await page.locator('[headline="Create Folder"] >> input').fill(scriptFolderName); - await page.getByLabel('Create Folder', {exact: true}).click(); + await umbracoUi.script.clickActionsMenuAtRoot(); + await umbracoUi.script.createFolder(scriptFolderName); // Assert // TODO: Uncomment when the notification is visible // await umbracoUi.isSuccessNotificationVisible(); // TODO: Use the reload function for scripts when it is implemented - await page.reload(); - await umbracoUi.goToSection(ConstantHelper.sections.settings); - await page.locator('umb-tree-item', {hasText: 'Scripts'}).locator('#caret-button').click(); - await expect(page.locator('umb-tree-item').locator('[label="' + scriptFolderName + '"] ')).toBeVisible(); expect(await umbracoApi.script.doesFolderExist(scriptFolderName)).toBeTruthy(); // Clean await umbracoApi.script.ensureNameNotExists(scriptPath); }); - test('can delete a folder', async ({page, umbracoApi, umbracoUi}) => { + test.skip('can delete a folder', async ({umbracoApi, umbracoUi}) => { // Arrange await umbracoApi.script.createFolder(scriptFolderName); // Act - await page.locator('umb-tree-item', {hasText: 'Scripts'}).locator('#caret-button').click(); - await page.locator('umb-tree-item').locator('[label="' + scriptFolderName + '"] >> [label="Open actions menu"]').click(); - await page.getByLabel('Remove folder').click(); - await page.locator('#confirm').getByLabel('Delete').click(); + await umbracoUi.script.clickRootFolderCaretButton(); + await umbracoUi.script.clickActionsMenuForScript(scriptFolderName); + await umbracoUi.script.deleteFolder(); // Assert // TODO: Uncomment when the notification is visible // await umbracoUi.isSuccessNotificationVisible(); // TODO: Use the reload function for scripts when it is implemented - await page.reload(); - await umbracoUi.goToSection(ConstantHelper.sections.settings); - await page.locator('umb-tree-item', {hasText: 'Scripts'}).locator('#caret-button').click(); - await expect(page.locator('umb-tree-item').locator('[label="' + scriptFolderName + '"] ')).not.toBeVisible(); + await umbracoUi.reloadPage(); + await umbracoUi.script.goToSection(ConstantHelper.sections.settings); + // await page.locator('umb-tree-item', {hasText: 'Scripts'}).locator('#caret-button').click(); + expect(umbracoUi.script.isTreeItemVisible(scriptFolderName)).not.toBeTruthy(); + + // await expect(page.locator('umb-tree-item').locator('[label="' + scriptFolderName + '"] ')).not.toBeVisible(); expect(await umbracoApi.script.doesFolderExist(scriptFolderName)).toBeFalsy(); }); - test('can create a script in a folder', async ({page, umbracoApi, umbracoUi}) => { + test.skip('can create a script in a folder', async ({umbracoApi, umbracoUi}) => { // Arrange await umbracoApi.script.ensureNameNotExists(scriptFolderName); await umbracoApi.script.createFolder(scriptFolderName); const scriptContent = 'const test = {\r\n script = \u0022Test\u0022,\r\n extension = \u0022.js\u0022,\r\n scriptPath: function() {\r\n return this.script \u002B this.extension;\r\n }\r\n};\r\n'; // Act - await page.locator('umb-tree-item', {hasText: 'Scripts'}).locator('#caret-button').click(); - await page.locator('umb-tree-item').locator('[label="' + scriptFolderName + '"] >> [label="Open actions menu"]').click(); - await page.getByLabel('New empty script').click(); - // TODO: Change the label to script name when the label is updated - await page.getByLabel('template name').fill(scriptName); - await page.locator('textarea.inputarea').clear(); - await page.locator('textarea.inputarea').fill(scriptContent); - // TODO: Remove this timeout when frontend validation is implemented - await page.waitForTimeout(1000); - await page.getByLabel('Save').click({force: true}); + await umbracoUi.script.clickRootFolderCaretButton(); + await umbracoUi.script.clickActionsMenuForScript(scriptFolderName); + await umbracoUi.script.clickNewScriptButton(); + await umbracoUi.script.enterScriptName(scriptName); + await umbracoUi.script.enterScriptContent(scriptContent); + await umbracoUi.waitForTimeout(1000); + await umbracoUi.script.clickSaveButton(); // Assert // TODO: Uncomment when the notification is visible @@ -151,18 +140,16 @@ test.describe('Script tests', () => { await umbracoApi.script.ensureNameNotExists(scriptFolderName); }); - test('can create a folder in a folder', async ({page, umbracoApi, umbracoUi}) => { + test.skip('can create a folder in a folder', async ({umbracoApi, umbracoUi}) => { // Arrange await umbracoApi.script.ensureNameNotExists(scriptFolderName); await umbracoApi.script.createFolder(scriptFolderName); const childFolderName = "childFolderName"; // Act - await page.locator('umb-tree-item', {hasText: 'Scripts'}).locator('#caret-button').click(); - await page.locator('umb-tree-item').locator('[label="' + scriptFolderName + '"] >> [label="Open actions menu"]').click(); - await page.getByLabel('Create folder').click(); - await page.locator('[headline="Create Folder"] >> input').fill(childFolderName); - await page.getByLabel('Create Folder', {exact: true}).click(); + await umbracoUi.script.clickRootFolderCaretButton(); + await umbracoUi.script.clickActionsMenuForScript(scriptFolderName); + await umbracoUi.script.createFolder(childFolderName); // Assert // TODO: Uncomment when the notification is visible @@ -176,7 +163,7 @@ test.describe('Script tests', () => { await umbracoApi.script.ensureNameNotExists(scriptFolderName); }); - test('can create a folder in a folder in a folder', async ({page, umbracoApi, umbracoUi}) => { + test.skip('can create a folder in a folder in a folder', async ({ umbracoApi, umbracoUi}) => { // Arrange const childFolderName = 'ChildFolderName'; const childOfChildFolderName = 'ChildOfChildFolderName'; @@ -185,12 +172,9 @@ test.describe('Script tests', () => { await umbracoApi.script.createFolder(childFolderName, scriptFolderName); // Act - await page.locator('umb-tree-item', {hasText: 'Scripts'}).locator('#caret-button').click(); - await page.locator('umb-tree-item >> [label="' + scriptFolderName + '"]').locator('#caret-button').click(); - await page.locator('umb-tree-item').locator('[label="' + childFolderName + '"] >> [label="Open actions menu"]').click(); - await page.getByLabel('Create folder').click(); - await page.locator('[headline="Create Folder"] >> input').fill(childOfChildFolderName); - await page.getByLabel('Create Folder', {exact: true}).click(); + await umbracoUi.script.clickRootFolderCaretButton(); + await umbracoUi.script.clickActionsMenuForScript(scriptFolderName); + await umbracoUi.script.createFolder(childFolderName); // Assert // TODO: Uncomment when the notification is visible @@ -205,7 +189,7 @@ test.describe('Script tests', () => { }); // TODO: Remove skip from this test when the frontend is able to create a script in a folder in a folder. Currently the script is created in the first folder. - test.skip('can create a script in a folder in a folder', async ({page, umbracoApi, umbracoUi}) => { + test.skip('can create a script in a folder in a folder', async ({umbracoApi, umbracoUi}) => { // Arrange const childFolderName = 'ChildFolderName'; await umbracoApi.script.ensureNameNotExists(scriptFolderName); @@ -213,15 +197,16 @@ test.describe('Script tests', () => { await umbracoApi.script.createFolder(childFolderName, scriptFolderName); // Act - await page.locator('umb-tree-item', {hasText: 'Scripts'}).locator('#caret-button').click(); - await page.locator('umb-tree-item >> [label="' + scriptFolderName + '"]').locator('#caret-button').click(); - await page.locator('umb-tree-item').locator('[label="' + childFolderName + '"] >> [label="Open actions menu"]').click(); - await page.getByLabel('New empty script').click(); - // TODO: Change the label to script name when the label is updated - await page.getByLabel('template name').fill(scriptName); + await umbracoUi.script.clickRootFolderCaretButton(); + await umbracoUi.script.clickActionsMenuForScript(scriptFolderName); + await umbracoUi.script.clickNewScriptButton(); + await umbracoUi.script.enterScriptName(scriptName); + await umbracoUi.waitForTimeout(1000); + await umbracoUi.script.clickSaveButton(); + // TODO: Remove this timeout when frontend validation is implemented - await page.waitForTimeout(1000); - await page.getByLabel('Save').click({force: true}); + await umbracoUi.waitForTimeout(1000); + await umbracoUi.template.clickSaveButton(); // Assert // TODO: Uncomment when the notification is visible diff --git a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Settings/Stylesheets.spec.ts b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Settings/Stylesheets.spec.ts index 4cff86835b..1a99298ced 100644 --- a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Settings/Stylesheets.spec.ts +++ b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Settings/Stylesheets.spec.ts @@ -7,29 +7,29 @@ test.describe('Stylesheets tests', () => { const styleSheetFileName = styleSheetName + ".css"; const ruleName = 'TestRuleName'; const styleFolderName = 'TestStylesheetFolder'; - + test.beforeEach(async ({umbracoUi}) => { await umbracoUi.goToBackOffice(); - await umbracoUi.goToSection(ConstantHelper.sections.settings); + await umbracoUi.stylesheet.goToSection(ConstantHelper.sections.settings); }); - + test('can create a stylesheet file', async ({umbracoApi, umbracoUi}) => { // Arrange await umbracoApi.stylesheet.ensureNameNotExists(styleSheetFileName); //Act - await umbracoUi.stylesheet.openActionsMenuAtRoot(); - await umbracoUi.stylesheet.clickNewStylesheetFileButton(); + await umbracoUi.stylesheet.clickActionsMenuAtRoot(); + await umbracoUi.stylesheet.clickNewStylesheetButton(); await umbracoUi.stylesheet.enterStylesheetName(styleSheetName); // TODO: Remove this timeout when frontend validation is implemented - await await umbracoUi.waitForTimeout(1000); + await umbracoUi.waitForTimeout(1000); await umbracoUi.stylesheet.clickSaveButton(); // Assert expect(await umbracoApi.stylesheet.doesExist(styleSheetFileName)).toBeTruthy(); - // TODO: when frontend is ready, verify the new stylesheet is displayed under the Stylesheets section + // TODO: when frontend is ready, verify the new stylesheet is displayed under the Stylesheets section // TODO: when frontend is ready, verify the notification displays - + // Clean await umbracoApi.stylesheet.ensureNameNotExists(styleSheetFileName); }); @@ -39,11 +39,11 @@ test.describe('Stylesheets tests', () => { await umbracoApi.stylesheet.ensureNameNotExists(styleSheetFileName); //Act - await umbracoUi.stylesheet.openActionsMenuAtRoot(); - await umbracoUi.stylesheet.clickNewRTEStylesheetFileButton(); + await umbracoUi.stylesheet.clickActionsMenuAtRoot(); + await umbracoUi.stylesheet.clickNewRTEStylesheetButton(); await umbracoUi.stylesheet.enterStylesheetName(styleSheetName); await umbracoUi.stylesheet.addNewRule(ruleName, 'h1', 'color:red'); - // TODO: Remove this timeout when frontend validation is implemented + // TODO: Remove this timeout when frontend validation is implemented await umbracoUi.waitForTimeout(1000); await umbracoUi.stylesheet.clickSaveButton(); @@ -52,7 +52,7 @@ test.describe('Stylesheets tests', () => { expect(await umbracoApi.stylesheet.doesRuleNameExist(styleSheetFileName, ruleName)).toBeTruthy(); // TODO: when frontend is ready, verify the new stylesheet is displayed under the Stylesheets section // TODO: when frontend is ready, verify the notification displays - + // Clean await umbracoApi.stylesheet.ensureNameNotExists(styleSheetFileName); }); @@ -63,14 +63,14 @@ test.describe('Stylesheets tests', () => { await umbracoApi.stylesheet.create(styleSheetFileName, '', '/'); //Act - await umbracoUi.stylesheet.openStylesheetFileByNameAtRoot(styleSheetFileName); + await umbracoUi.stylesheet.openStylesheetByNameAtRoot(styleSheetFileName); await umbracoUi.stylesheet.addNewRule(ruleName, 'h1', 'color:red'); await umbracoUi.stylesheet.clickSaveButton(); // Assert expect(await umbracoApi.stylesheet.doesRuleNameExist(styleSheetFileName, ruleName)).toBeTruthy(); // TODO: when frontend is ready, verify the notification displays - + // Clean await umbracoApi.stylesheet.ensureNameNotExists(styleSheetFileName); }); @@ -82,22 +82,22 @@ test.describe('Stylesheets tests', () => { //Act await umbracoUi.stylesheet.clickRootFolderCaretButton(); - await umbracoUi.stylesheet.openActionsMenuForName(styleSheetFileName); - await umbracoUi.stylesheet.deleteStylesheetFile(); + await umbracoUi.stylesheet.clickActionsMenuForStylesheet(styleSheetFileName); + await umbracoUi.stylesheet.deleteStylesheet(); // Assert expect(await umbracoApi.stylesheet.doesNameExist(styleSheetFileName)).toBeFalsy(); // TODO: when frontend is ready, verify the new stylesheet is NOT displayed under the Stylesheets section // TODO: when frontend is ready, verify the notification displays }); - - test('can create a folder', async ({umbracoApi, umbracoUi}) => { + + test.skip('can create a folder', async ({umbracoApi, umbracoUi}) => { // Arrange - await umbracoApi.stylesheet.ensureNameNotExists(styleFolderName); + await umbracoApi.stylesheet.ensureNameNotExists(styleFolderName); // Act - await umbracoUi.stylesheet.openActionsMenuAtRoot(); - await umbracoUi.stylesheet.createNewFolder(styleFolderName); + await umbracoUi.stylesheet.clickActionsMenuAtRoot(); + await umbracoUi.stylesheet.createFolder(styleFolderName); // Assert expect(await umbracoApi.stylesheet.doesFolderExist(styleFolderName)).toBeTruthy(); @@ -108,15 +108,15 @@ test.describe('Stylesheets tests', () => { await umbracoApi.stylesheet.ensureNameNotExists(styleFolderName); }); - test('can remove a folder', async ({umbracoApi, umbracoUi}) => { + test.skip('can delete a folder', async ({umbracoApi, umbracoUi}) => { // Arrange - await umbracoApi.stylesheet.ensureNameNotExists(styleFolderName); + await umbracoApi.stylesheet.ensureNameNotExists(styleFolderName); await umbracoApi.stylesheet.createFolder(styleFolderName, ''); // Act await umbracoUi.stylesheet.clickRootFolderCaretButton(); - await umbracoUi.stylesheet.openActionsMenuForName(styleFolderName); - await umbracoUi.stylesheet.removeFolder(); + await umbracoUi.stylesheet.clickActionsMenuForStylesheet(styleFolderName); + await umbracoUi.stylesheet.deleteFolder(); // Assert expect(await umbracoApi.stylesheet.doesFolderExist(styleFolderName)).toBeFalsy(); @@ -133,18 +133,18 @@ test.describe('Stylesheets tests', () => { // Act await umbracoUi.stylesheet.clickRootFolderCaretButton(); - await umbracoUi.stylesheet.openActionsMenuForName(styleFolderName); - await umbracoUi.stylesheet.createNewFolder(childFolderName); + await umbracoUi.stylesheet.clickActionsMenuForStylesheet(styleFolderName); + await umbracoUi.stylesheet.createFolder(childFolderName); - //Assert + //Assert expect(await umbracoApi.stylesheet.doesNameExist(childFolderName)).toBeTruthy(); const styleChildren = await umbracoApi.stylesheet.getChildren(styleFolderName); expect(styleChildren[0].path).toBe(styleFolderName + '/' + childFolderName); // TODO: when frontend is ready, verify the new folder is displayed under the Stylesheets section // TODO: when frontend is ready, verify the notification displays - - // Clean - await umbracoApi.stylesheet.ensureNameNotExists(styleFolderName); + + // Clean + await umbracoApi.stylesheet.ensureNameNotExists(styleFolderName); }); // TODO: remove skip when frontend is ready as currently it will create 2 child folders in UI when creating a folder in a folder @@ -159,28 +159,28 @@ test.describe('Stylesheets tests', () => { // Act await umbracoUi.stylesheet.clickRootFolderCaretButton(); await umbracoUi.stylesheet.clickCaretButtonForName(styleFolderName); - await umbracoUi.stylesheet.openActionsMenuForName(childFolderName); - await umbracoUi.stylesheet.createNewFolder(childOfChildFolderName); + await umbracoUi.stylesheet.clickActionsMenuForStylesheet(childFolderName); + await umbracoUi.stylesheet.createFolder(childOfChildFolderName); - //Assert + //Assert expect(await umbracoApi.stylesheet.doesNameExist(childOfChildFolderName)).toBeTruthy(); const styleChildren = await umbracoApi.stylesheet.getChildren(styleFolderName + '/' + childFolderName); expect(styleChildren[0].path).toBe(styleFolderName + '/' + childFolderName + '/' + childOfChildFolderName); // TODO: when frontend is ready, verify the new folder is displayed under the Stylesheets section // TODO: when frontend is ready, verify the notification displays - - // Clean - await umbracoApi.stylesheet.ensureNameNotExists(styleFolderName); + + // Clean + await umbracoApi.stylesheet.ensureNameNotExists(styleFolderName); }); // TODO: implement this later as the frontend is missing now test.skip('can create a stylesheet in a folder', async ({umbracoApi, umbracoUi}) => { - + }); // TODO: implement this later as the frontend is missing now test.skip('can create a stylesheet in a folder in a folder', async ({umbracoApi, umbracoUi}) => { - + }); - + }); diff --git a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Settings/Templates.spec.ts b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Settings/Templates.spec.ts index e39041dff6..dc7815f30b 100644 --- a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Settings/Templates.spec.ts +++ b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Settings/Templates.spec.ts @@ -4,30 +4,30 @@ import {expect} from "@playwright/test"; test.describe('Template tests', () => { const templateName = 'TestTemplate'; - test.beforeEach(async ({page, umbracoApi}) => { + test.beforeEach(async ({umbracoUi, umbracoApi}) => { await umbracoApi.template.ensureNameNotExists(templateName); + await umbracoUi.goToBackOffice(); + await umbracoUi.template.goToSection(ConstantHelper.sections.settings); }); - test('can create a template', async ({page, umbracoApi, umbracoUi}) => { + test('can create a template', async ({umbracoApi, umbracoUi}) => { // Act - await page.goto(umbracoApi.baseUrl + '/umbraco'); - await umbracoUi.goToSection(ConstantHelper.sections.settings); - await page.locator('umb-tree-item', {hasText: 'Templates'}).getByLabel('Open actions menu').click({force: true}); - await page.getByLabel('Create').click(); - await page.getByLabel('template name').fill(templateName); + await umbracoUi.template.clickActionsMenuAtRoot(); + await umbracoUi.template.clickNewTemplateButton(); + await umbracoUi.template.enterTemplateName(templateName); // TODO: Remove this timeout when frontend validation is implemented - await page.waitForTimeout(1000); - await page.getByLabel('Save').click(); + await umbracoUi.waitForTimeout(1000); + await umbracoUi.template.clickSaveButton(); // Assert - await umbracoUi.isSuccessNotificationVisible(); + await umbracoUi.template.isSuccessNotificationVisible(); expect(await umbracoApi.template.doesNameExist(templateName)).toBeTruthy(); // Clean await umbracoApi.template.ensureNameNotExists(templateName); }); - test('can update a template', async ({page, umbracoApi, umbracoUi}) => { + test('can update a template', async ({umbracoApi, umbracoUi}) => { // Arrange const templateAlias = AliasHelper.toAlias(templateName); const updatedTemplateContent = '@using Umbraco.Cms.Web.Common.PublishedModels;\r\n' + @@ -40,14 +40,12 @@ test.describe('Template tests', () => { await umbracoApi.template.create(templateName, templateAlias, ''); // Act - await page.goto(umbracoApi.baseUrl + '/umbraco'); - await umbracoUi.goToTemplate(templateName) - await page.locator('textarea.inputarea').clear(); - await page.locator('textarea.inputarea').fill(updatedTemplateContent); - await page.getByLabel('Save').click(); + await umbracoUi.template.goToTemplate(templateName) + await umbracoUi.template.enterTemplateContent(updatedTemplateContent); + await umbracoUi.template.clickSaveButton(); // Assert - await umbracoUi.isSuccessNotificationVisible(); + await umbracoUi.template.isSuccessNotificationVisible(); // Checks if the template was updated const updatedTemplate = await umbracoApi.template.getByName(templateName); expect(updatedTemplate.content).toBe(updatedTemplateContent); @@ -56,25 +54,22 @@ test.describe('Template tests', () => { await umbracoApi.template.ensureNameNotExists(templateName); }); - test('can delete a template', async ({page, umbracoApi, umbracoUi}) => { + test('can delete a template', async ({umbracoApi, umbracoUi}) => { // Arrange const templateAlias = AliasHelper.toAlias(templateName); await umbracoApi.template.create(templateName, templateAlias, ''); // Act - await page.goto(umbracoApi.baseUrl + '/umbraco'); - await umbracoUi.goToSection(ConstantHelper.sections.settings); - await page.locator('umb-tree-item', {hasText: 'Templates'}).locator('#caret-button').click(); - await page.locator('umb-tree-item').locator('[label="' + templateName + '"] >> [label="Open actions menu"]').click(); - await page.getByLabel('Delete').click(); - await page.locator('#confirm').getByLabel('Delete').click(); + await umbracoUi.template.clickRootFolderCaretButton(); + await umbracoUi.template.clickActionsMenuForTemplate(templateName); + await umbracoUi.template.deleteTemplate(); // Assert - await umbracoUi.isSuccessNotificationVisible(); + await umbracoUi.template.isSuccessNotificationVisible(); expect(await umbracoApi.template.doesNameExist(templateName)).toBeFalsy(); }); - test('can set a template as master template', async ({page, umbracoApi, umbracoUi}) => { + test.skip('can set a template as master template', async ({page, umbracoApi, umbracoUi}) => { // Arrange const templateAlias = AliasHelper.toAlias(templateName); const childTemplateName = 'ChildTemplate'; @@ -84,16 +79,15 @@ test.describe('Template tests', () => { await umbracoApi.template.create(childTemplateName, childTemplateAlias, ''); // Act - await page.goto(umbracoApi.baseUrl + '/umbraco'); - await umbracoUi.goToTemplate(childTemplateName); - await page.getByLabel('Change Master template').click(); + await umbracoUi.template.goToTemplate(childTemplateName); + await umbracoUi.template.clickChangeMasterTemplateButton(); await page.locator('umb-tree-picker-modal').locator('#caret-button').click(); await page.getByRole('button', {name: templateName}).click(); - await page.getByLabel('Submit').click(); - await page.getByLabel('Save').click(); + await umbracoUi.template.clickSubmitButton(); + await umbracoUi.template.clickSaveButton(); // Assert - await umbracoUi.isSuccessNotificationVisible(); + await umbracoUi.template.isSuccessNotificationVisible(); await expect(page.locator('[label="Change Master template"]', {hasText: 'Master template: ' + templateName})).toBeVisible(); // Checks if the childTemplate has the masterTemplate set const childTemplate = await umbracoApi.template.getByName(childTemplateName); @@ -105,7 +99,7 @@ test.describe('Template tests', () => { await umbracoApi.template.ensureNameNotExists(childTemplateName); }); - test('can use query builder for a template', async ({page, umbracoApi, umbracoUi}) => { + test('can use query builder for a template', async ({umbracoApi, umbracoUi}) => { // Arrange const templateAlias = AliasHelper.toAlias(templateName); await umbracoApi.template.create(templateName, templateAlias, ''); @@ -131,18 +125,12 @@ test.describe('Template tests', () => { '}'; // Act - await page.goto(umbracoApi.baseUrl + '/umbraco'); - await umbracoUi.goToTemplate(templateName); - await page.locator('#query-builder-button').getByLabel('Query builder').click(); - await page.waitForTimeout(1000); - await page.locator('#property-alias-dropdown').getByLabel('Property alias').click({force: true}); - await page.waitForTimeout(1000); - await page.locator('#property-alias-dropdown').getByText('CreateDate').click({force:true}); - await page.getByLabel('Submit').click(); - await page.getByLabel('Save').click(); + await umbracoUi.template.goToTemplate(templateName); + await umbracoUi.template.addQueryBuilderWithCreateDateOption(); + await umbracoUi.template.clickSaveButton(); // Assert - await umbracoUi.isSuccessNotificationVisible(); + await umbracoUi.template.isSuccessNotificationVisible(); const templateData = await umbracoApi.template.getByName(templateName); expect(templateData.content).toBe(expectedTemplateContent); @@ -150,7 +138,7 @@ test.describe('Template tests', () => { await umbracoApi.template.ensureNameNotExists(templateName); }); - test('can insert sections into a template', async ({page, umbracoApi, umbracoUi}) => { + test('can insert sections into a template', async ({umbracoApi, umbracoUi}) => { // Arrange const templateAlias = AliasHelper.toAlias(templateName); await umbracoApi.template.create(templateName, templateAlias, ''); @@ -161,14 +149,13 @@ test.describe('Template tests', () => { '}'; // Act - await page.goto(umbracoApi.baseUrl + '/umbraco'); - await umbracoUi.goToTemplate(templateName); - await page.locator('#sections-button', {hasText: 'Sections'}).click(); - await page.getByLabel('Submit').click(); - await page.getByLabel('Save').click(); + await umbracoUi.template.goToTemplate(templateName); + await umbracoUi.template.clickSectionsButton(); + await umbracoUi.template.clickSubmitButton(); + await umbracoUi.template.clickSaveButton(); // Assert - await umbracoUi.isSuccessNotificationVisible(); + await umbracoUi.template.isSuccessNotificationVisible(); const templateData = await umbracoApi.template.getByName(templateName); expect(templateData.content).toBe(templateContent); @@ -176,15 +163,13 @@ test.describe('Template tests', () => { await umbracoApi.template.ensureNameNotExists(templateName); }); - test('can insert dictionaryItem into a template', async ({page, umbracoApi, umbracoUi}) => { + test('can insert dictionaryItem into a template', async ({umbracoApi, umbracoUi}) => { // Arrange const templateAlias = AliasHelper.toAlias(templateName); await umbracoApi.template.create(templateName, templateAlias, ''); - const dictionaryName = 'TestDictionary'; await umbracoApi.dictionary.ensureNameNotExists(dictionaryName); await umbracoApi.dictionary.create(dictionaryName); - const templateContent = '@Umbraco.GetDictionaryValue("TestDictionary")@using Umbraco.Cms.Web.Common.PublishedModels;\r\n' + '@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage\r\n' + '@{\r\n' + @@ -192,19 +177,12 @@ test.describe('Template tests', () => { '}'; // Act - await page.goto(umbracoApi.baseUrl + '/umbraco'); - await umbracoUi.goToTemplate(templateName); - await page.getByLabel('Choose value to insert').click(); - await page.getByLabel('Insert Dictionary item').click({force: true}); - // We need to wait for the modal to load before clicking the button - await page.waitForTimeout(1000); - await page.locator('umb-tree-picker-modal').locator('#caret-button').click({force: true}); - await page.getByLabel(dictionaryName).click(); - await page.getByLabel('Submit').click(); - await page.getByLabel('Save').click(); + await umbracoUi.template.goToTemplate(templateName); + await umbracoUi.template.insertDictionaryByName(dictionaryName); + await umbracoUi.template.clickSaveButton(); // Assert - await umbracoUi.isSuccessNotificationVisible(); + await umbracoUi.template.isSuccessNotificationVisible(); const templateData = await umbracoApi.template.getByName(templateName); expect(templateData.content).toBe(templateContent); diff --git a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Telemetry.spec.ts b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Telemetry.spec.ts index 9c87cdd3ff..98f5c15438 100644 --- a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Telemetry.spec.ts +++ b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Telemetry.spec.ts @@ -1,31 +1,38 @@ -import {test} from '@umbraco/playwright-testhelpers'; +import {ConstantHelper, test} from '@umbraco/playwright-testhelpers'; import {expect} from "@playwright/test"; test.describe('Telemetry tests', () => { - test.beforeEach(async ({page, umbracoApi}, testInfo) => { + test.beforeEach(async ({umbracoApi, umbracoUi}) => { await umbracoApi.telemetry.setLevel("Basic"); + await umbracoUi.goToBackOffice(); + await umbracoUi.telemetryData.goToSection(ConstantHelper.sections.settings); }); - test.afterEach(async ({page, umbracoApi}, testInfo) => { + test.afterEach(async ({umbracoApi}) => { await umbracoApi.telemetry.setLevel("Basic"); }); test('can change telemetry level', async ({page, umbracoApi, umbracoUi}) => { + // Arrange const expectedLevel = "Minimal"; + const levelValue = "1"; + await umbracoUi.telemetryData.clickTelemetryDataTab(); + await umbracoUi.telemetryData.changeTelemetryDataLevelValue(levelValue); - await page.goto(umbracoApi.baseUrl + '/umbraco'); + // We wait until we are sure that the Telemetry level has been saved before we continue. + await Promise.all([ + page.waitForResponse(resp => resp.url().includes(umbracoApi.baseUrl + '/umbraco/management/api/v1/telemetry/level') && resp.status() === 200), + await umbracoUi.telemetryData.clickSaveButton() + ]); - // Selects minimal as the telemetry level - await page.getByRole('tab', { name: 'Settings' }).click(); - await page.getByRole('tab', {name: 'Telemetry Data'}).click(); - await page.locator('[name="telemetryLevel"] >> input[id=input]').fill('1'); - await page.getByLabel('Save').click(); // Assert // UI - await page.reload(); - await expect(page.locator('[name="telemetryLevel"] >> input[id=input]')).toHaveValue('1'); + await umbracoUi.reloadPage(); + await expect(page.locator('[name="telemetryLevel"] >> input[id=input]')).toHaveValue(levelValue, {timeout: 20000}); + // await umbracoUi.telemetryData.doesTelemetryDataLevelHaveValue(levelValue); + // API - expect(await umbracoApi.telemetry.getLevel() == "Minimal").toBeTruthy(); + expect(await umbracoApi.telemetry.getLevel() == expectedLevel).toBeTruthy(); }); }); diff --git a/tests/Umbraco.Tests.AcceptanceTest/tests/auth.setup.ts b/tests/Umbraco.Tests.AcceptanceTest/tests/auth.setup.ts index 4b3c13391f..53b284e2a5 100644 --- a/tests/Umbraco.Tests.AcceptanceTest/tests/auth.setup.ts +++ b/tests/Umbraco.Tests.AcceptanceTest/tests/auth.setup.ts @@ -1,17 +1,19 @@ -import {test as setup, expect} from '@playwright/test'; +import {test as setup} from '@playwright/test'; import {STORAGE_STATE} from '../playwright.config'; -import {UiHelpers} from "@umbraco/playwright-testhelpers"; +import {ConstantHelper, UiHelpers} from "@umbraco/playwright-testhelpers"; setup('authenticate', async ({page}) => { const umbracoUi = new UiHelpers(page); - await page.goto(process.env.URL + '/umbraco'); - await page.getByLabel('Email').fill(process.env.UMBRACO_USER_LOGIN); - await page.getByLabel( 'Password', {exact: true}).fill(process.env.UMBRACO_USER_PASSWORD); - await page.getByRole('button', {name: 'Login'}).click(); + await umbracoUi.goToBackOffice(); + await umbracoUi.login.enterEmail(process.env.UMBRACO_USER_LOGIN); + await umbracoUi.login.enterPassword(process.env.UMBRACO_USER_PASSWORD); + await umbracoUi.login.clickLoginButton(); // Assert - await expect(page.locator('uui-tab-group').locator('[label="Settings"]')).toBeVisible({timeout: 10000}); - await umbracoUi.goToSection('Settings'); + //await expect(page.locator('uui-tab-group').locator('[label="Settings"]')).toBeVisible({timeout: 10000}); + // DELETE LATER + await umbracoUi.waitForTimeout(10000); + await umbracoUi.login.goToSection(ConstantHelper.sections.settings); await page.context().storageState({path: STORAGE_STATE}); });