diff --git a/build/azure-pipelines.yml b/build/azure-pipelines.yml index 314301450c..0520b2cb54 100644 --- a/build/azure-pipelines.yml +++ b/build/azure-pipelines.yml @@ -466,7 +466,8 @@ stages: - pwsh: | "UMBRACO_USER_LOGIN=$(UMBRACO__CMS__UNATTENDED__UNATTENDEDUSEREMAIL) UMBRACO_USER_PASSWORD=$(UMBRACO__CMS__UNATTENDED__UNATTENDEDUSERPASSWORD) - URL=$(ASPNETCORE_URLS)" | Out-File .env + URL=$(ASPNETCORE_URLS) + STORAGE_STAGE_PATH=$(Build.SourcesDirectory)/tests/Umbraco.Tests.AcceptanceTest/playwright/.auth/user.json" | Out-File .env displayName: Generate .env workingDirectory: $(Build.SourcesDirectory)/tests/Umbraco.Tests.AcceptanceTest diff --git a/tests/Umbraco.Tests.AcceptanceTest/config.js b/tests/Umbraco.Tests.AcceptanceTest/config.js index f8b88c9d50..173ecdced8 100644 --- a/tests/Umbraco.Tests.AcceptanceTest/config.js +++ b/tests/Umbraco.Tests.AcceptanceTest/config.js @@ -3,12 +3,12 @@ const fs = require('fs'); const properties = [ { - description: 'Enter your umbraco superadmin username/email', + description: 'Enter your Umbraco superadmin username/email', name: 'username', required: true }, { - description: 'Enter your umbraco superadmin password', + description: 'Enter your Umbraco superadmin password', name: 'password', hidden: true, required: true @@ -22,7 +22,7 @@ const properties = [ const configPath = './.env' -console.log("Configure your umbraco test environment") +console.log("Configure your Umbraco test environment") prompt.start(); @@ -31,7 +31,8 @@ prompt.get(properties, function (error, result) { var fileContent = `UMBRACO_USER_LOGIN=${result.username} UMBRACO_USER_PASSWORD=${result.password} -URL=${result.baseUrl || "https://localhost:44339"}`; +URL=${result.baseUrl || "https://localhost:44339"} +STORAGE_STAGE_PATH=${__dirname.replace(/\\/g,'/')}/playwright/.auth/user.json`; 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 12abdd0b6e..ff3d87c6c5 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": "^2.0.5", - "@umbraco/playwright-testhelpers": "^2.0.0-beta.33", + "@umbraco/playwright-testhelpers": "^2.0.0-beta.38", "camelize": "^1.0.0", "dotenv": "^16.3.1", "faker": "^4.1.0", @@ -146,9 +146,9 @@ "integrity": "sha512-9tCqYEDHI5RYFQigXFwF1hnCwcWCOJl/hmll0lr5D2Ljjb0o4wphb69wikeJDz5qCEzXCoPvG6ss5SDP6IfOdg==" }, "node_modules/@umbraco/playwright-testhelpers": { - "version": "2.0.0-beta.33", - "resolved": "https://registry.npmjs.org/@umbraco/playwright-testhelpers/-/playwright-testhelpers-2.0.0-beta.33.tgz", - "integrity": "sha512-fGG/tSlIzzN4thhtYTTvIoXFsfEcKjtdtSkGVUVx1S/FanvI8EyUTlBzqV/6hIq0/wytsPMEvBsmy3AUunKvUQ==", + "version": "2.0.0-beta.38", + "resolved": "https://registry.npmjs.org/@umbraco/playwright-testhelpers/-/playwright-testhelpers-2.0.0-beta.38.tgz", + "integrity": "sha512-OkPTSmohkC9+6A+qfwkUFYRD4guR5hPXWMHtsPtvLyolm7PXvH5gb3XF5n88Jsv+7YM+IqIxQHkXmPaVmgIyrA==", "dependencies": { "@umbraco/json-models-builders": "2.0.5", "camelize": "^1.0.0", diff --git a/tests/Umbraco.Tests.AcceptanceTest/package.json b/tests/Umbraco.Tests.AcceptanceTest/package.json index f357231520..74bedb0ec9 100644 --- a/tests/Umbraco.Tests.AcceptanceTest/package.json +++ b/tests/Umbraco.Tests.AcceptanceTest/package.json @@ -21,7 +21,7 @@ }, "dependencies": { "@umbraco/json-models-builders": "^2.0.5", - "@umbraco/playwright-testhelpers": "^2.0.0-beta.33", + "@umbraco/playwright-testhelpers": "^2.0.0-beta.38", "camelize": "^1.0.0", "dotenv": "^16.3.1", "faker": "^4.1.0", diff --git a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Settings/Script/Script.spec.ts b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Settings/Script/Script.spec.ts index 8142e841bb..720a3e6637 100644 --- a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Settings/Script/Script.spec.ts +++ b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Settings/Script/Script.spec.ts @@ -27,7 +27,7 @@ test.describe('Script tests', () => { await umbracoUi.script.isSuccessNotificationVisible(); expect(await umbracoApi.script.doesNameExist(scriptName)).toBeTruthy(); await umbracoUi.script.clickRootFolderCaretButton(); - await umbracoUi.script.isScriptTreeItemVisibile(scriptName); + await umbracoUi.script.isScriptTreeItemVisible(scriptName); }); test.skip('can create a script with content', async ({umbracoApi, umbracoUi}) => { @@ -48,7 +48,7 @@ test.describe('Script tests', () => { const scriptData = await umbracoApi.script.getByName(scriptName); expect(scriptData.content).toBe(scriptContent); await umbracoUi.script.clickRootFolderCaretButton(); - await umbracoUi.script.isScriptTreeItemVisibile(scriptName); + await umbracoUi.script.isScriptTreeItemVisible(scriptName); }); test.skip('can update a script', async ({umbracoApi, umbracoUi}) => { @@ -79,7 +79,7 @@ test.describe('Script tests', () => { // Assert await umbracoUi.script.isSuccessNotificationVisible(); expect(await umbracoApi.script.doesNameExist(scriptName)).toBeFalsy(); - await umbracoUi.script.isScriptTreeItemVisibile(scriptName, false); + await umbracoUi.script.isScriptTreeItemVisible(scriptName, false); }); test.skip('can rename a script', async ({umbracoApi, umbracoUi}) => { diff --git a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Settings/Script/ScriptFolder.spec.ts b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Settings/Script/ScriptFolder.spec.ts index 5130c6f4fb..ca81e69465 100644 --- a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Settings/Script/ScriptFolder.spec.ts +++ b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Settings/Script/ScriptFolder.spec.ts @@ -24,7 +24,7 @@ test.describe('Script tests', () => { await umbracoUi.script.isSuccessNotificationVisible(); expect(await umbracoApi.script.doesFolderExist(scriptFolderName)).toBeTruthy(); await umbracoUi.script.clickRootFolderCaretButton(); - await umbracoUi.script.isScriptTreeItemVisibile(scriptFolderName); + await umbracoUi.script.isScriptTreeItemVisible(scriptFolderName); }); test.skip('can delete a folder', async ({umbracoApi, umbracoUi}) => { @@ -39,7 +39,7 @@ test.describe('Script tests', () => { // Assert await umbracoUi.script.isSuccessNotificationVisible(); expect(await umbracoApi.script.doesFolderExist(scriptFolderName)).toBeFalsy(); - await umbracoUi.script.isScriptTreeItemVisibile(scriptFolderName, false); + await umbracoUi.script.isScriptTreeItemVisible(scriptFolderName, false); }); test.skip('can create a script in a folder', async ({umbracoApi, umbracoUi}) => { @@ -64,7 +64,7 @@ test.describe('Script tests', () => { const scriptData = await umbracoApi.script.get(scriptChildren[0].path); expect(scriptData.content).toBe(scriptContent); await umbracoUi.stylesheet.clickCaretButtonForName(scriptFolderName); - await umbracoUi.script.isScriptTreeItemVisibile(scriptName); + await umbracoUi.script.isScriptTreeItemVisible(scriptName); }); test.skip('can create a folder in a folder', async ({umbracoApi, umbracoUi}) => { @@ -83,7 +83,7 @@ test.describe('Script tests', () => { const scriptChildren = await umbracoApi.script.getChildren('/' + scriptFolderName); expect(scriptChildren[0].path).toBe('/' + scriptFolderName + '/' + childFolderName); await umbracoUi.stylesheet.clickCaretButtonForName(scriptFolderName); - await umbracoUi.script.isScriptTreeItemVisibile(childFolderName); + await umbracoUi.script.isScriptTreeItemVisible(childFolderName); }); test.skip('can create a folder in a folder in a folder', async ({umbracoApi, umbracoUi}) => { @@ -105,7 +105,7 @@ test.describe('Script tests', () => { const scriptChildren = await umbracoApi.script.getChildren('/' + scriptFolderName + '/' + childFolderName); expect(scriptChildren[0].path).toBe('/' + scriptFolderName + '/' + childFolderName + '/' + childOfChildFolderName); await umbracoUi.stylesheet.clickCaretButtonForName(childFolderName); - await umbracoUi.script.isScriptTreeItemVisibile(childOfChildFolderName); + await umbracoUi.script.isScriptTreeItemVisible(childOfChildFolderName); }); test.skip('can create a script in a folder in a folder', async ({umbracoApi, umbracoUi}) => { @@ -129,6 +129,6 @@ test.describe('Script tests', () => { const scriptChildren = await umbracoApi.script.getChildren('/' + scriptFolderName + '/' + childFolderName); expect(scriptChildren[0].path).toBe('/' + scriptFolderName + '/' + childFolderName + '/' + scriptName); await umbracoUi.stylesheet.clickCaretButtonForName(childFolderName); - await umbracoUi.script.isScriptTreeItemVisibile(scriptName); + await umbracoUi.script.isScriptTreeItemVisible(scriptName); }); }); diff --git a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Settings/Template/Templates.spec.ts b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Settings/Template/Templates.spec.ts index d50a805451..f6bb6ecae1 100644 --- a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Settings/Template/Templates.spec.ts +++ b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Settings/Template/Templates.spec.ts @@ -8,14 +8,16 @@ test.describe('Template tests', () => { test.beforeEach(async ({umbracoUi, umbracoApi}) => { await umbracoApi.template.ensureNameNotExists(templateName); await umbracoUi.goToBackOffice(); - await umbracoUi.template.goToSection(ConstantHelper.sections.settings); }); test.afterEach(async ({umbracoApi}) => { await umbracoApi.template.ensureNameNotExists(templateName); }); - test.skip('can create a template', async ({umbracoApi, umbracoUi}) => { + test('can create a template', async ({page, umbracoApi, umbracoUi}) => { + // Arrange + await umbracoUi.template.goToSection(ConstantHelper.sections.settings); + // Act await umbracoUi.template.clickActionsMenuAtRoot(); await umbracoUi.template.clickCreateButton(); @@ -25,11 +27,10 @@ test.describe('Template tests', () => { // Assert await umbracoUi.template.isSuccessNotificationVisible(); expect(await umbracoApi.template.doesNameExist(templateName)).toBeTruthy(); - await umbracoUi.template.clickRootFolderCaretButton(); - await umbracoUi.template.isTemplateTreeItemVisibile(templateName); + await umbracoUi.template.isTemplateRootTreeItemVisible(templateName); }); - test.skip('can update content of a template', async ({umbracoApi, umbracoUi}) => { + test('can update content of a template', async ({umbracoApi, umbracoUi}) => { // Arrange const updatedTemplateContent = defaultTemplateContent + '\r\n' + '
AcceptanceTests
'; @@ -48,7 +49,7 @@ test.describe('Template tests', () => { expect(updatedTemplate.content).toBe(updatedTemplateContent); }); - test.skip('can rename a template', async ({umbracoApi, umbracoUi}) => { + test('can rename a template', async ({umbracoApi, umbracoUi}) => { // Arrange const wrongTemplateName = 'WrongTemplateName'; const templateAlias = AliasHelper.toAlias(wrongTemplateName); @@ -67,22 +68,23 @@ test.describe('Template tests', () => { expect(templateData.name).toBe(templateName); }); - test.skip('can delete a template', async ({umbracoApi, umbracoUi}) => { + test('can delete a template', async ({umbracoApi, umbracoUi}) => { // Arrange await umbracoApi.template.createDefaultTemplate(templateName); + await umbracoUi.template.goToSection(ConstantHelper.sections.settings); // Act - await umbracoUi.template.clickRootFolderCaretButton(); + await umbracoUi.template.reloadTemplateTree(); await umbracoUi.template.clickActionsMenuForTemplate(templateName); await umbracoUi.template.clickDeleteAndConfirmButton(); // Assert await umbracoUi.template.isSuccessNotificationVisible(); expect(await umbracoApi.template.doesNameExist(templateName)).toBeFalsy(); - await umbracoUi.template.isTemplateTreeItemVisibile(templateName, false); + await umbracoUi.template.isTemplateRootTreeItemVisible(templateName, false); }); - test.skip('can set a template as master template', async ({umbracoApi, umbracoUi}) => { + test('can set a template as master template', async ({umbracoApi, umbracoUi}) => { // Arrange const childTemplateName = 'ChildTemplate'; await umbracoApi.template.ensureNameNotExists(childTemplateName); @@ -108,7 +110,7 @@ test.describe('Template tests', () => { await umbracoApi.template.ensureNameNotExists(childTemplateName); }); - test.skip('can remove a master template', async ({umbracoApi, umbracoUi}) => { + test('can remove a master template', async ({umbracoApi, umbracoUi}) => { // Arrange const childTemplateName = 'ChildTemplate'; const templateAlias = AliasHelper.toAlias(templateName); @@ -139,9 +141,9 @@ test.describe('Template tests', () => { const propertyAliasValue = 'UpdateDate'; const isAscending = true; const expectedCode = 'Umbraco.ContentAtRoot().FirstOrDefault()\r\n' + - ' .Children()\r\n' + - ' .Where(x => x.IsVisible())\r\n' + - ' .OrderBy(x => x.' + propertyAliasValue + ')'; + ' .Children()\r\n' + + ' .Where(x => x.IsVisible())\r\n' + + ' .OrderBy(x => x.' + propertyAliasValue + ')'; const expectedTemplateContent = '\r\n' + '@{\r\n' + '\tvar selection = ' + expectedCode + ';\r\n' + @@ -156,7 +158,7 @@ test.describe('Template tests', () => { '\r\n' + '\r\n' + defaultTemplateContent; - await umbracoApi.template.createDefaultTemplate(templateName); + await umbracoApi.template.createDefaultTemplate(templateName); // Act await umbracoUi.template.goToTemplate(templateName); @@ -173,16 +175,16 @@ test.describe('Template tests', () => { expect(templateData.content).toBe(expectedTemplateContent); }); - test.skip('can use query builder with Where statement for a template', async ({umbracoApi, umbracoUi}) => { + test('can use query builder with Where statement for a template', async ({umbracoApi, umbracoUi}) => { // Arrange //Arrange const propertyAliasValue = 'Name'; const operatorValue = 'is'; const constrainValue = 'Test Content'; const expectedCode = 'Umbraco.ContentAtRoot().FirstOrDefault()\r\n' + - ' .Children()\r\n' + - ' .Where(x => (x.' + propertyAliasValue + ' == "' + constrainValue + '"))\r\n' + - ' .Where(x => x.IsVisible())'; + ' .Children()\r\n' + + ' .Where(x => (x.' + propertyAliasValue + ' == "' + constrainValue + '"))\r\n' + + ' .Where(x => x.IsVisible())'; const expectedTemplateContent = '\r\n' + '@{\r\n' + '\tvar selection = ' + expectedCode + ';\r\n' + @@ -197,10 +199,11 @@ test.describe('Template tests', () => { '\r\n' + '\r\n' + defaultTemplateContent; - await umbracoApi.template.createDefaultTemplate(templateName); + await umbracoApi.template.createDefaultTemplate(templateName); // Act await umbracoUi.template.goToTemplate(templateName); + // TODO: refactor later await umbracoUi.waitForTimeout(1000); await umbracoUi.template.addQueryBuilderWithWhereStatement(propertyAliasValue, operatorValue, constrainValue); // Verify that the code is shown @@ -214,7 +217,7 @@ test.describe('Template tests', () => { expect(templateData.content).toBe(expectedTemplateContent); }); - test.skip('can insert sections - render child template into a template', async ({umbracoApi, umbracoUi}) => { + test('can insert sections - render child template into a template', async ({umbracoApi, umbracoUi}) => { // Arrange const sectionType = 'Render child template'; const insertedContent = '@RenderBody()'; @@ -223,6 +226,7 @@ test.describe('Template tests', () => { // Act await umbracoUi.template.goToTemplate(templateName); + // TODO: refactor later await umbracoUi.waitForTimeout(1000); await umbracoUi.template.insertSection(sectionType); await umbracoUi.template.clickSaveButton(); @@ -233,7 +237,7 @@ test.describe('Template tests', () => { expect(templateData.content).toBe(templateContent); }); - test.skip('can insert sections - render a named section into a template', async ({umbracoApi, umbracoUi}) => { + test('can insert sections - render a named section into a template', async ({umbracoApi, umbracoUi}) => { // Arrange const sectionType = 'Render a named section'; const sectionName = 'TestSectionName'; @@ -243,6 +247,7 @@ test.describe('Template tests', () => { // Act await umbracoUi.template.goToTemplate(templateName); + // TODO: refactor later await umbracoUi.waitForTimeout(1000); await umbracoUi.template.insertSection(sectionType, sectionName); await umbracoUi.template.clickSaveButton(); @@ -253,7 +258,7 @@ test.describe('Template tests', () => { expect(templateData.content).toBe(templateContent); }); - test.skip('can insert sections - define a named section into a template', async ({umbracoApi, umbracoUi}) => { + test('can insert sections - define a named section into a template', async ({umbracoApi, umbracoUi}) => { // Arrange const sectionType = 'Define a named section'; const sectionName = 'TestSectionName'; @@ -263,6 +268,7 @@ test.describe('Template tests', () => { // Act await umbracoUi.template.goToTemplate(templateName); + // TODO: refactor later await umbracoUi.waitForTimeout(1000); await umbracoUi.template.insertSection(sectionType, sectionName); await umbracoUi.template.clickSaveButton(); @@ -273,7 +279,7 @@ test.describe('Template tests', () => { expect(templateData.content).toBe(templateContent); }); - test.skip('can insert dictionary item into a template', async ({umbracoApi, umbracoUi}) => { + test('can insert dictionary item into a template', async ({umbracoApi, umbracoUi}) => { // Arrange await umbracoApi.template.createDefaultTemplate(templateName); const dictionaryName = 'TestDictionary'; @@ -283,6 +289,7 @@ test.describe('Template tests', () => { // Act await umbracoUi.template.goToTemplate(templateName); + // TODO: refactor later await umbracoUi.waitForTimeout(1000); await umbracoUi.template.insertDictionaryItem(dictionaryName); await umbracoUi.template.clickSaveButton(); @@ -296,7 +303,7 @@ test.describe('Template tests', () => { await umbracoApi.dictionary.ensureNameNotExists(dictionaryName); }); - test.skip('can insert partial view into a template', async ({umbracoApi, umbracoUi}) => { + test('can insert partial view into a template', async ({umbracoApi, umbracoUi}) => { // Arrange await umbracoApi.template.createDefaultTemplate(templateName); const partialViewName = 'TestPartialView'; @@ -307,6 +314,7 @@ test.describe('Template tests', () => { // Act await umbracoUi.template.goToTemplate(templateName); + // TODO: refactor later await umbracoUi.waitForTimeout(1000); await umbracoUi.template.insertPartialView(partialViewFileName); await umbracoUi.template.clickSaveButton(); @@ -317,7 +325,7 @@ test.describe('Template tests', () => { expect(templateData.content).toBe(templateContent); }); - test.skip('can insert value into a template', async ({umbracoApi, umbracoUi}) => { + test('can insert value into a template', async ({umbracoApi, umbracoUi}) => { // Arrange await umbracoApi.template.createDefaultTemplate(templateName); const systemFieldValue = 'createDate'; @@ -325,6 +333,7 @@ test.describe('Template tests', () => { // Act await umbracoUi.template.goToTemplate(templateName); + // TODO: refactor later await umbracoUi.waitForTimeout(1000); await umbracoUi.template.insertSystemFieldValue(systemFieldValue); await umbracoUi.template.clickSaveButton(); @@ -349,16 +358,16 @@ test.describe('Template tests', () => { await umbracoApi.document.createDefaultDocumentWithParent(childContentName, childDocumentTypeId, contentId); // Create template await umbracoApi.template.createDefaultTemplate(templateName); - + // Act await umbracoUi.template.goToTemplate(templateName); await umbracoUi.template.clickQueryBuilderButton(); await umbracoUi.template.chooseRootContentInQueryBuilder('(' + contentName + ')'); - + // Assert await umbracoUi.template.doesReturnedItemsHaveCount(1); await umbracoUi.template.doesQueryResultHaveContentName(childContentName); - + // Clean await umbracoApi.documentType.ensureNameNotExists(documentTypeName); });