diff --git a/src/Umbraco.Cms.Api.Management/Factories/DocumentPresentationFactory.cs b/src/Umbraco.Cms.Api.Management/Factories/DocumentPresentationFactory.cs index b48e4aa2b7..f0e3c9901e 100644 --- a/src/Umbraco.Cms.Api.Management/Factories/DocumentPresentationFactory.cs +++ b/src/Umbraco.Cms.Api.Management/Factories/DocumentPresentationFactory.cs @@ -45,8 +45,6 @@ internal sealed class DocumentPresentationFactory : IDocumentPresentationFactory { DocumentResponseModel responseModel = _umbracoMapper.Map(content)!; - responseModel.Urls = await _documentUrlFactory.CreateUrlsAsync(content); - Guid? templateKey = content.TemplateId.HasValue ? _templateService.GetAsync(content.TemplateId.Value).Result?.Key : null; @@ -62,8 +60,6 @@ internal sealed class DocumentPresentationFactory : IDocumentPresentationFactory { PublishedDocumentResponseModel responseModel = _umbracoMapper.Map(content)!; - responseModel.Urls = await _documentUrlFactory.CreateUrlsAsync(content); - Guid? templateKey = content.PublishTemplateId.HasValue ? _templateService.GetAsync(content.PublishTemplateId.Value).Result?.Key : null; @@ -80,8 +76,6 @@ internal sealed class DocumentPresentationFactory : IDocumentPresentationFactory DocumentResponseModel responseModel = _umbracoMapper.Map(content)!; _umbracoMapper.Map(schedule, responseModel); - responseModel.Urls = await _documentUrlFactory.CreateUrlsAsync(content); - Guid? templateKey = content.TemplateId.HasValue ? _templateService.GetAsync(content.TemplateId.Value).Result?.Key : null; diff --git a/src/Umbraco.Cms.Api.Management/ViewModels/Document/DocumentResponseModel.cs b/src/Umbraco.Cms.Api.Management/ViewModels/Document/DocumentResponseModel.cs index 2854a53320..8338c2ccf9 100644 --- a/src/Umbraco.Cms.Api.Management/ViewModels/Document/DocumentResponseModel.cs +++ b/src/Umbraco.Cms.Api.Management/ViewModels/Document/DocumentResponseModel.cs @@ -1,7 +1,8 @@ -namespace Umbraco.Cms.Api.Management.ViewModels.Document; +namespace Umbraco.Cms.Api.Management.ViewModels.Document; public class DocumentResponseModel : DocumentResponseModelBase { + [Obsolete("This property is no longer populated. Please use /document/{id}/urls instead to retrieve the URLs for a document. Scheduled for removal in Umbraco 17.")] public IEnumerable Urls { get; set; } = Enumerable.Empty(); public ReferenceByIdModel? Template { get; set; } diff --git a/src/Umbraco.Web.UI.Client/src/mocks/data/document/document.data.ts b/src/Umbraco.Web.UI.Client/src/mocks/data/document/document.data.ts index 6ff9902a87..ec53e44a1c 100644 --- a/src/Umbraco.Web.UI.Client/src/mocks/data/document/document.data.ts +++ b/src/Umbraco.Web.UI.Client/src/mocks/data/document/document.data.ts @@ -11,12 +11,7 @@ export type UmbMockDocumentModel = DocumentResponseModel & DocumentTreeItemRespo export const data: Array = [ { ancestors: [], - urls: [ - { - culture: 'en-US', - url: '/', - }, - ], + urls: [], template: null, id: 'the-simplest-document-id', createDate: '2023-02-06T15:32:05.350038', diff --git a/src/Umbraco.Web.UI.Client/src/packages/content/content/workspace/content-detail-validation-path-translator.test.ts b/src/Umbraco.Web.UI.Client/src/packages/content/content/workspace/content-detail-validation-path-translator.test.ts index 51614196fd..0b5d379f51 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/content/content/workspace/content-detail-validation-path-translator.test.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/content/content/workspace/content-detail-validation-path-translator.test.ts @@ -25,7 +25,6 @@ describe('UmbValidationPropertyPathTranslationController', () => { unique: 'test', isTrashed: false, template: null, - urls: [], values: [ { alias: 'headline', diff --git a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/publishing/pending-changes/document-published-pending-changes.manager.test.ts b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/publishing/pending-changes/document-published-pending-changes.manager.test.ts index 7df1d7e556..43e091aa4c 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/publishing/pending-changes/document-published-pending-changes.manager.test.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/publishing/pending-changes/document-published-pending-changes.manager.test.ts @@ -47,12 +47,6 @@ describe('UmbSelectionManager', () => { let publishedDocument: UmbDocumentDetailModel; let documentBase: UmbDocumentDetailModel = { entityType: UMB_DOCUMENT_ENTITY_TYPE, - urls: [ - { - culture: 'en-US', - url: '/document-1', - }, - ], template: null, unique: '1', documentType: { @@ -118,12 +112,6 @@ describe('UmbSelectionManager', () => { let publishedDocument: UmbDocumentDetailModel; let documentBase: UmbDocumentDetailModel = { entityType: UMB_DOCUMENT_ENTITY_TYPE, - urls: [ - { - culture: 'en-US', - url: '/document-1', - }, - ], template: null, unique: '1', documentType: { diff --git a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/publishing/repository/document-publishing.server.data-source.ts b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/publishing/repository/document-publishing.server.data-source.ts index 7d3d76d3ce..8689a74f64 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/publishing/repository/document-publishing.server.data-source.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/publishing/repository/document-publishing.server.data-source.ts @@ -182,12 +182,6 @@ export class UmbDocumentPublishingServerDataSource { scheduledUnpublishDate: variant.scheduledUnpublishDate || null, }; }), - urls: data.urls.map((url) => { - return { - culture: url.culture || null, - url: url.url, - }; - }), template: data.template ? { unique: data.template.id } : null, documentType: { unique: data.documentType.id, diff --git a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/repository/detail/document-detail.server.data-source.ts b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/repository/detail/document-detail.server.data-source.ts index e5881b873f..2f8d9de1e7 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/repository/detail/document-detail.server.data-source.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/repository/detail/document-detail.server.data-source.ts @@ -37,7 +37,6 @@ export class UmbDocumentServerDataSource implements UmbDetailDataSource { - return { - culture: url.culture || null, - url: url.url, - }; - }), template: data.template ? { unique: data.template.id } : null, documentType: { unique: data.documentType.id, diff --git a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/types.ts b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/types.ts index bf3fe6fd1f..1ae7b92d33 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/types.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/types.ts @@ -29,7 +29,6 @@ export interface UmbDocumentDetailModel extends UmbContentDetailModel { entityType: UmbDocumentEntityType; isTrashed: boolean; template: { unique: string } | null; - urls: Array; values: Array; variants: Array; } diff --git a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/workspace/document-workspace.context.ts b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/workspace/document-workspace.context.ts index 96b62c2deb..a0f1a629d0 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/documents/documents/workspace/document-workspace.context.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/documents/documents/workspace/document-workspace.context.ts @@ -67,7 +67,6 @@ export class UmbDocumentWorkspaceContext readonly contentTypeHasCollection = this._data.createObservablePartOfCurrent( (data) => !!data?.documentType.collection, ); - readonly urls = this._data.createObservablePartOfCurrent((data) => data?.urls || []); readonly templateId = this._data.createObservablePartOfCurrent((data) => data?.template?.unique || null); #isTrashedContext = new UmbIsTrashedEntityContext(this); diff --git a/src/Umbraco.Web.UI.Client/src/packages/multi-url-picker/link-picker-modal/link-picker-modal.element.ts b/src/Umbraco.Web.UI.Client/src/packages/multi-url-picker/link-picker-modal/link-picker-modal.element.ts index c8db4b103c..8c9935e55f 100644 --- a/src/Umbraco.Web.UI.Client/src/packages/multi-url-picker/link-picker-modal/link-picker-modal.element.ts +++ b/src/Umbraco.Web.UI.Client/src/packages/multi-url-picker/link-picker-modal/link-picker-modal.element.ts @@ -8,7 +8,7 @@ import { css, customElement, html, nothing, query, state, when } from '@umbraco- import { isUmbracoFolder, UmbMediaTypeStructureRepository } from '@umbraco-cms/backoffice/media-type'; import { umbBindToValidation, UmbValidationContext } from '@umbraco-cms/backoffice/validation'; import { umbConfirmModal, UmbModalBaseElement } from '@umbraco-cms/backoffice/modal'; -import { UmbDocumentDetailRepository } from '@umbraco-cms/backoffice/document'; +import { UmbDocumentDetailRepository, UmbDocumentUrlRepository } from '@umbraco-cms/backoffice/document'; import { UmbMediaDetailRepository } from '@umbraco-cms/backoffice/media'; import type { UmbInputDocumentElement } from '@umbraco-cms/backoffice/document'; import type { UmbInputMediaElement } from '@umbraco-cms/backoffice/media'; @@ -136,7 +136,9 @@ export class UmbLinkPickerModalElement extends UmbModalBaseElement -For example to run the Login Test, +For example to run the Login Test: npx playwright test tests/DefaultConfig/Login/Login.spec.ts +To run a single test (if you have several in a file), you can use this syntax. + + npx playwright test -g "" + +For example: + + npx playwright test -g "can create content with the document link" + ### Executing tests in UI Mode If you would like to have an overview of all your test, to be able to see all the steps in the tests being executed and you would like to be able to run all of your tests one after another, and maybe only just one test. Then you should use UI Mode. As before, you need to run these commands in the 'tests/Umbraco.Tests.AcceptanceTest' folder. diff --git a/tests/Umbraco.Tests.AcceptanceTest/package-lock.json b/tests/Umbraco.Tests.AcceptanceTest/package-lock.json index 590df76164..548ce33d22 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.31", - "@umbraco/playwright-testhelpers": "^16.0.2", + "@umbraco/playwright-testhelpers": "^16.0.3", "camelize": "^1.0.0", "dotenv": "^16.3.1", "node-fetch": "^2.6.7" @@ -67,9 +67,9 @@ } }, "node_modules/@umbraco/playwright-testhelpers": { - "version": "16.0.2", - "resolved": "https://registry.npmjs.org/@umbraco/playwright-testhelpers/-/playwright-testhelpers-16.0.2.tgz", - "integrity": "sha512-zYlUiiJ31UbySdRl5+J5D+uGd7Kq/jz5cV/D2fao4KarZs1OXxLDx84mvdGa1o/TctJNfgjw9Igylt1cRD9YrA==", + "version": "16.0.3", + "resolved": "https://registry.npmjs.org/@umbraco/playwright-testhelpers/-/playwright-testhelpers-16.0.3.tgz", + "integrity": "sha512-hul0tWdNxzXMx901ZadX8IgAHpMQGAwhrZrfLEoxTIOSwytGoTPsfOSFUNhBhzU6yNXdt0Oi6g4aggmjrJARfg==", "license": "MIT", "dependencies": { "@umbraco/json-models-builders": "2.0.31", diff --git a/tests/Umbraco.Tests.AcceptanceTest/package.json b/tests/Umbraco.Tests.AcceptanceTest/package.json index 0d9be49124..c3812d6579 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.31", - "@umbraco/playwright-testhelpers": "^16.0.2", + "@umbraco/playwright-testhelpers": "^16.0.3", "camelize": "^1.0.0", "dotenv": "^16.3.1", "node-fetch": "^2.6.7" diff --git a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithApprovedColor.spec.ts b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithApprovedColor.spec.ts index 5daad8769b..7daaf22eac 100644 --- a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithApprovedColor.spec.ts +++ b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithApprovedColor.spec.ts @@ -22,9 +22,8 @@ test.afterEach(async ({umbracoApi}) => { test('can render content with an approved color with label', async ({umbracoApi, umbracoUi}) => { // Arrange const templateId = await umbracoApi.template.createTemplateWithDisplayingApprovedColorValue(templateName, AliasHelper.toAlias(propertyName)); - await umbracoApi.document.createPublishedDocumentWithValue(contentName, colorValue, dataTypeId, templateId, propertyName, documentTypeName); - const contentData = await umbracoApi.document.getByName(contentName); - const contentURL = contentData.urls[0].url; + const contentKey = await umbracoApi.document.createPublishedDocumentWithValue(contentName, colorValue, dataTypeId, templateId, propertyName, documentTypeName); + const contentURL = await umbracoApi.document.getDocumentUrl(contentKey); // Act await umbracoUi.contentRender.navigateToRenderedContentPage(contentURL); @@ -36,9 +35,8 @@ test('can render content with an approved color with label', async ({umbracoApi, test('can render content with an approved color without label', async ({umbracoApi, umbracoUi}) => { // Arrange const templateId = await umbracoApi.template.createTemplateWithDisplayingApprovedColorValue(templateName, AliasHelper.toAlias(propertyName), false); - await umbracoApi.document.createPublishedDocumentWithValue(contentName, colorValue, dataTypeId, templateId, propertyName, documentTypeName); - const contentData = await umbracoApi.document.getByName(contentName); - const contentURL = contentData.urls[0].url; + const contentKey = await umbracoApi.document.createPublishedDocumentWithValue(contentName, colorValue, dataTypeId, templateId, propertyName, documentTypeName); + const contentURL = await umbracoApi.document.getDocumentUrl(contentKey); // Act await umbracoUi.contentRender.navigateToRenderedContentPage(contentURL); diff --git a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithCheckboxList.spec.ts b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithCheckboxList.spec.ts index 83fe60e58b..6313b2227c 100644 --- a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithCheckboxList.spec.ts +++ b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithCheckboxList.spec.ts @@ -25,9 +25,8 @@ for (const checkbox of checkboxList) { const checkboxValue = checkbox.value; const dataTypeId = await umbracoApi.dataType.createCheckboxListDataType(customDataTypeName, checkboxValue); const templateId = await umbracoApi.template.createTemplateWithDisplayingMulitpleStringValue(templateName, AliasHelper.toAlias(propertyName)); - await umbracoApi.document.createPublishedDocumentWithValue(contentName, checkboxValue, dataTypeId, templateId, propertyName, documentTypeName); - const contentData = await umbracoApi.document.getByName(contentName); - const contentURL = contentData.urls[0].url; + const contentKey = await umbracoApi.document.createPublishedDocumentWithValue(contentName, checkboxValue, dataTypeId, templateId, propertyName, documentTypeName); + const contentURL = await umbracoApi.document.getDocumentUrl(contentKey); // Act await umbracoUi.contentRender.navigateToRenderedContentPage(contentURL); diff --git a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithContentPicker.spec.ts b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithContentPicker.spec.ts index a5246a04bd..77103f2feb 100644 --- a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithContentPicker.spec.ts +++ b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithContentPicker.spec.ts @@ -19,9 +19,9 @@ test.beforeEach(async ({umbracoApi}) => { }); test.afterEach(async ({umbracoApi}) => { - await umbracoApi.document.ensureNameNotExists(contentName); + await umbracoApi.document.ensureNameNotExists(contentName); await umbracoApi.documentType.ensureNameNotExists(documentTypeName); - await umbracoApi.document.ensureNameNotExists(contentPickerName); + await umbracoApi.document.ensureNameNotExists(contentPickerName); await umbracoApi.documentType.ensureNameNotExists(contentPickerDocumentTypeName); await umbracoApi.template.ensureNameNotExists(templateName); }); @@ -29,9 +29,8 @@ test.afterEach(async ({umbracoApi}) => { test('can render content with content picker value', async ({umbracoApi, umbracoUi}) => { // Arrange const templateId = await umbracoApi.template.createTemplateWithDisplayingContentPickerValue(templateName, AliasHelper.toAlias(propertyName)); - await umbracoApi.document.createPublishedDocumentWithValue(contentName, contentPickerId, dataTypeData.id, templateId, propertyName, documentTypeName); - const contentData = await umbracoApi.document.getByName(contentName); - const contentURL = contentData.urls[0].url; + const contentKey = await umbracoApi.document.createPublishedDocumentWithValue(contentName, contentPickerId, dataTypeData.id, templateId, propertyName, documentTypeName); + const contentURL = await umbracoApi.document.getDocumentUrl(contentKey); // Act await umbracoUi.contentRender.navigateToRenderedContentPage(contentURL); diff --git a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithDatePicker.spec.ts b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithDatePicker.spec.ts index 212ff8c35e..4cf8fd795e 100644 --- a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithDatePicker.spec.ts +++ b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithDatePicker.spec.ts @@ -6,7 +6,7 @@ const templateName = 'TestTemplateForContent'; const propertyName = 'Test Date Picker'; test.afterEach(async ({umbracoApi}) => { - await umbracoApi.document.ensureNameNotExists(contentName); + await umbracoApi.document.ensureNameNotExists(contentName); await umbracoApi.documentType.ensureNameNotExists(documentTypeName); await umbracoApi.template.ensureNameNotExists(templateName); }); @@ -20,11 +20,10 @@ const dateTimes = [ for (const dateTime of dateTimes) { test(`can render content with a date ${dateTime.type}`, async ({umbracoApi, umbracoUi}) => { - const dataTypeData = await umbracoApi.dataType.getByName(dateTime.dataTypeName); + const dataTypeData = await umbracoApi.dataType.getByName(dateTime.dataTypeName); const templateId = await umbracoApi.template.createTemplateWithDisplayingStringValue(templateName, AliasHelper.toAlias(propertyName)); - await umbracoApi.document.createPublishedDocumentWithValue(contentName, dateTime.value, dataTypeData.id, templateId, propertyName, documentTypeName); - const contentData = await umbracoApi.document.getByName(contentName); - const contentURL = contentData.urls[0].url; + const contentKey = await umbracoApi.document.createPublishedDocumentWithValue(contentName, dateTime.value, dataTypeData.id, templateId, propertyName, documentTypeName); + const contentURL= await umbracoApi.document.getDocumentUrl(contentKey); // Act await umbracoUi.contentRender.navigateToRenderedContentPage(contentURL); diff --git a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithDropdown.spec.ts b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithDropdown.spec.ts index 8cb3992554..5e08644eec 100644 --- a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithDropdown.spec.ts +++ b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithDropdown.spec.ts @@ -7,7 +7,7 @@ const templateName = 'TestTemplateForContent'; const propertyName = 'Test Dropdown'; test.afterEach(async ({umbracoApi}) => { - await umbracoApi.document.ensureNameNotExists(contentName); + await umbracoApi.document.ensureNameNotExists(contentName); await umbracoApi.documentType.ensureNameNotExists(documentTypeName); await umbracoApi.template.ensureNameNotExists(templateName); await umbracoApi.dataType.ensureNameNotExists(customDataTypeName); @@ -28,10 +28,9 @@ for (const dropdown of dropdownValues) { templateId = await umbracoApi.template.createTemplateWithDisplayingMulitpleStringValue(templateName, AliasHelper.toAlias(propertyName)); } else { templateId = await umbracoApi.template.createTemplateWithDisplayingStringValue(templateName, AliasHelper.toAlias(propertyName)); - } - await umbracoApi.document.createPublishedDocumentWithValue(contentName, dropdown.value, dataTypeId, templateId, propertyName, documentTypeName); - const contentData = await umbracoApi.document.getByName(contentName); - const contentURL = contentData.urls[0].url; + } + const contentKey = await umbracoApi.document.createPublishedDocumentWithValue(contentName, dropdown.value, dataTypeId, templateId, propertyName, documentTypeName); + const contentURL = await umbracoApi.document.getDocumentUrl(contentKey); // Act await umbracoUi.contentRender.navigateToRenderedContentPage(contentURL); @@ -39,6 +38,6 @@ for (const dropdown of dropdownValues) { // Assert dropdown.value.forEach(async value => { await umbracoUi.contentRender.doesContentRenderValueContainText(value); - }); + }); }); -} \ No newline at end of file +} diff --git a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithImageCropper.spec.ts b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithImageCropper.spec.ts index de6c40da56..27dc87c78b 100644 --- a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithImageCropper.spec.ts +++ b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithImageCropper.spec.ts @@ -10,11 +10,11 @@ const cropValue = {label: cropLabel, alias: AliasHelper.toAlias(cropLabel), widt let dataTypeId = null; test.beforeEach(async ({umbracoApi}) => { - dataTypeId = await umbracoApi.dataType.createImageCropperDataTypeWithOneCrop(customDataTypeName, cropValue.label, cropValue.width, cropValue.height); + dataTypeId = await umbracoApi.dataType.createImageCropperDataTypeWithOneCrop(customDataTypeName, cropValue.label, cropValue.width, cropValue.height); }); test.afterEach(async ({umbracoApi}) => { - await umbracoApi.document.ensureNameNotExists(contentName); + await umbracoApi.document.ensureNameNotExists(contentName); await umbracoApi.documentType.ensureNameNotExists(documentTypeName); await umbracoApi.template.ensureNameNotExists(templateName); await umbracoApi.dataType.ensureNameNotExists(customDataTypeName); @@ -25,7 +25,7 @@ test('can render content with an image cropper', async ({umbracoApi, umbracoUi}) const templateId = await umbracoApi.template.createTemplateWithDisplayingImageCropperValue(templateName, AliasHelper.toAlias(propertyName), AliasHelper.toAlias(cropValue.label)); await umbracoApi.document.createPublishedDocumentWithImageCropper(contentName, cropValue, dataTypeId, templateId, propertyName, documentTypeName); const contentData = await umbracoApi.document.getByName(contentName); - const contentURL = contentData.urls[0].url; + const contentURL = await umbracoApi.document.getDocumentUrl(contentData.id); const imageSrc = contentData.values[0].value.src; // Act @@ -33,4 +33,4 @@ test('can render content with an image cropper', async ({umbracoApi, umbracoUi}) // Assert await umbracoUi.contentRender.doesContentRenderValueHaveImage(imageSrc, cropValue.width, cropValue.height); -}); \ No newline at end of file +}); diff --git a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithMemberPicker.spec.ts b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithMemberPicker.spec.ts index 665e0bb2d3..a86b01994e 100644 --- a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithMemberPicker.spec.ts +++ b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithMemberPicker.spec.ts @@ -29,13 +29,12 @@ test('can render content with member picker value', async ({umbracoApi, umbracoU const memberTypeId = await umbracoApi.memberType.createDefaultMemberType(memberTypeName); const memberId = await umbracoApi.member.createDefaultMember(memberName, memberTypeId, email, username, password); const templateId = await umbracoApi.template.createTemplateWithDisplayingMemberPickerValue(templateName, AliasHelper.toAlias(propertyName)); - await umbracoApi.document.createPublishedDocumentWithValue(contentName, memberId, dataTypeData.id, templateId, propertyName, documentTypeName); - const contentData = await umbracoApi.document.getByName(contentName); - const contentURL = contentData.urls[0].url; + const contentKey = await umbracoApi.document.createPublishedDocumentWithValue(contentName, memberId, dataTypeData.id, templateId, propertyName, documentTypeName); + const contentURL = await umbracoApi.document.getDocumentUrl(contentKey); // Act await umbracoUi.contentRender.navigateToRenderedContentPage(contentURL); // Assert await umbracoUi.contentRender.doesContentRenderValueContainText(memberName); -}); \ No newline at end of file +}); diff --git a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithMultiURLPicker.spec.ts b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithMultiURLPicker.spec.ts index 9fd965ea43..4ac0afa309 100644 --- a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithMultiURLPicker.spec.ts +++ b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithMultiURLPicker.spec.ts @@ -27,9 +27,8 @@ test('can render content with document link value', async ({umbracoApi, umbracoU await umbracoApi.document.publish(linkedDocumentId); // Create a published document with document link value const templateId = await umbracoApi.template.createTemplateWithDisplayingMultiURLPickerValue(templateName, AliasHelper.toAlias(propertyName)); - await umbracoApi.document.createPublishedDocumentWithDocumentLinkURLPicker(contentName, linkedDocumentName, linkedDocumentId, dataTypeData.id, templateId, propertyName, documentTypeName); - const contentData = await umbracoApi.document.getByName(contentName); - const contentURL = contentData.urls[0].url; + const contentKey = await umbracoApi.document.createPublishedDocumentWithDocumentLinkURLPicker(contentName, linkedDocumentName, linkedDocumentId, dataTypeData.id, templateId, propertyName, documentTypeName); + const contentURL = await umbracoApi.document.getDocumentUrl(contentKey); // Act await umbracoUi.contentRender.navigateToRenderedContentPage(contentURL); @@ -50,9 +49,8 @@ test('can render content with media link value', async ({umbracoApi, umbracoUi}) const mediaFileId = await umbracoApi.media.createDefaultMediaWithImage(mediaFileName); // Create a published document with media link value const templateId = await umbracoApi.template.createTemplateWithDisplayingMultiURLPickerValue(templateName, AliasHelper.toAlias(propertyName)); - await umbracoApi.document.createPublishedDocumentWithImageLinkURLPicker(contentName, mediaFileName, mediaFileId, dataTypeData.id, templateId, propertyName, documentTypeName); - const contentData = await umbracoApi.document.getByName(contentName); - const contentURL = contentData.urls[0].url; + const contentKey = await umbracoApi.document.createPublishedDocumentWithImageLinkURLPicker(contentName, mediaFileName, mediaFileId, dataTypeData.id, templateId, propertyName, documentTypeName); + const contentURL = await umbracoApi.document.getDocumentUrl(contentKey); // Act await umbracoUi.contentRender.navigateToRenderedContentPage(contentURL); @@ -70,9 +68,8 @@ test('can render content with external link value', async ({umbracoApi, umbracoU const linkTitle = 'Umbraco Documentation'; // Create a published document with external link value const templateId = await umbracoApi.template.createTemplateWithDisplayingMultiURLPickerValue(templateName, AliasHelper.toAlias(propertyName)); - await umbracoApi.document.createPublishedDocumentWithExternalLinkURLPicker(contentName, linkTitle, linkUrl, dataTypeData.id, templateId, propertyName, documentTypeName); - const contentData = await umbracoApi.document.getByName(contentName); - const contentURL = contentData.urls[0].url; + const contentKey = await umbracoApi.document.createPublishedDocumentWithExternalLinkURLPicker(contentName, linkTitle, linkUrl, dataTypeData.id, templateId, propertyName, documentTypeName); + const contentURL = await umbracoApi.document.getDocumentUrl(contentKey); // Act await umbracoUi.contentRender.navigateToRenderedContentPage(contentURL); @@ -91,9 +88,8 @@ test('can render content with multiple url value', async ({umbracoApi, umbracoUi const mediaFileId = await umbracoApi.media.createDefaultMediaWithImage(mediaFileName); // Create a published document with external link value and image url value const templateId = await umbracoApi.template.createTemplateWithDisplayingMultiURLPickerValue(templateName, AliasHelper.toAlias(propertyName)); - await umbracoApi.document.createPublishedDocumentWithImageLinkAndExternalLink(contentName, mediaFileName, mediaFileId, linkTitle, linkUrl, dataTypeData.id, templateId, propertyName, documentTypeName); - const contentData = await umbracoApi.document.getByName(contentName); - const contentURL = contentData.urls[0].url; + const contentKey = await umbracoApi.document.createPublishedDocumentWithImageLinkAndExternalLink(contentName, mediaFileName, mediaFileId, linkTitle, linkUrl, dataTypeData.id, templateId, propertyName, documentTypeName); + const contentURL = await umbracoApi.document.getDocumentUrl(contentKey); // Act await umbracoUi.contentRender.navigateToRenderedContentPage(contentURL); diff --git a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithMultipleMediaPicker.spec.ts b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithMultipleMediaPicker.spec.ts index 0f0416066f..6b516df736 100644 --- a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithMultipleMediaPicker.spec.ts +++ b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithMultipleMediaPicker.spec.ts @@ -29,9 +29,8 @@ test('can render content with multiple media picker value', async ({umbracoApi, const secondMediaFileId = await umbracoApi.media.createDefaultMediaWithArticle(secondMediaFileName); // Create a published document with multiple media picker value const templateId = await umbracoApi.template.createTemplateWithDisplayingMultipleMediaPickerValue(templateName, AliasHelper.toAlias(propertyName)); - await umbracoApi.document.createPublishedDocumentWithTwoMediaPicker(contentName, firstMediaFileId, secondMediaFileId, dataTypeData.id, templateId, propertyName, documentTypeName); - const contentData = await umbracoApi.document.getByName(contentName); - const contentURL = contentData.urls[0].url; + const contentKey = await umbracoApi.document.createPublishedDocumentWithTwoMediaPicker(contentName, firstMediaFileId, secondMediaFileId, dataTypeData.id, templateId, propertyName, documentTypeName); + const contentURL = await umbracoApi.document.getDocumentUrl(contentKey); // Act await umbracoUi.contentRender.navigateToRenderedContentPage(contentURL); @@ -51,9 +50,8 @@ test.fixme('can render content with multiple image media picker value', async ({ const secondMediaFileId = await umbracoApi.media.createDefaultMediaWithImage(secondMediaFileName); // Create a published document with multiple image media picker value const templateId = await umbracoApi.template.createTemplateWithDisplayingMultipleMediaPickerValue(templateName, AliasHelper.toAlias(propertyName)); - await umbracoApi.document.createPublishedDocumentWithTwoMediaPicker(contentName, firstMediaFileId, secondMediaFileId, dataTypeData.id, templateId, propertyName, documentTypeName); - const contentData = await umbracoApi.document.getByName(contentName); - const contentURL = contentData.urls[0].url; + const contentKey = await umbracoApi.document.createPublishedDocumentWithTwoMediaPicker(contentName, firstMediaFileId, secondMediaFileId, dataTypeData.id, templateId, propertyName, documentTypeName); + const contentURL = await umbracoApi.document.getDocumentUrl(contentKey); // Act await umbracoUi.contentRender.navigateToRenderedContentPage(contentURL); @@ -61,4 +59,4 @@ test.fixme('can render content with multiple image media picker value', async ({ // Assert await umbracoUi.contentRender.doesContentRenderValueContainText(firstMediaFileName); await umbracoUi.contentRender.doesContentRenderValueContainText(secondMediaFileName); -}); \ No newline at end of file +}); diff --git a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithNumeric.spec.ts b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithNumeric.spec.ts index 48985217b4..7f3dc69555 100644 --- a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithNumeric.spec.ts +++ b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithNumeric.spec.ts @@ -27,9 +27,8 @@ for (const numeric of numerics) { // Arrange const numericValue = numeric.value; const templateId = await umbracoApi.template.createTemplateWithDisplayingStringValue(templateName, AliasHelper.toAlias(propertyName)); - await umbracoApi.document.createPublishedDocumentWithValue(contentName, numericValue, dataTypeData.id, templateId, propertyName, documentTypeName); - const contentData = await umbracoApi.document.getByName(contentName); - const contentURL = contentData.urls[0].url; + const contentKey = await umbracoApi.document.createPublishedDocumentWithValue(contentName, numericValue, dataTypeData.id, templateId, propertyName, documentTypeName); + const contentURL = await umbracoApi.document.getDocumentUrl(contentKey); // Act await umbracoUi.contentRender.navigateToRenderedContentPage(contentURL); diff --git a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithRadiobox.spec.ts b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithRadiobox.spec.ts index 540f0c2b05..2309eeb320 100644 --- a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithRadiobox.spec.ts +++ b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithRadiobox.spec.ts @@ -7,7 +7,7 @@ const templateName = 'TestTemplateForContent'; const propertyName = 'Test Radiobox'; test.afterEach(async ({umbracoApi}) => { - await umbracoApi.document.ensureNameNotExists(contentName); + await umbracoApi.document.ensureNameNotExists(contentName); await umbracoApi.documentType.ensureNameNotExists(documentTypeName); await umbracoApi.template.ensureNameNotExists(templateName); await umbracoApi.dataType.ensureNameNotExists(customDataTypeName); @@ -23,9 +23,8 @@ for (const radiobox of radioboxValues) { // Arrange const dataTypeId = await umbracoApi.dataType.createRadioboxDataType(customDataTypeName, [radiobox.value]); const templateId = await umbracoApi.template.createTemplateWithDisplayingStringValue(templateName, AliasHelper.toAlias(propertyName)); - await umbracoApi.document.createPublishedDocumentWithValue(contentName, radiobox.value, dataTypeId, templateId, propertyName, documentTypeName); - const contentData = await umbracoApi.document.getByName(contentName); - const contentURL = contentData.urls[0].url; + const contentKey = await umbracoApi.document.createPublishedDocumentWithValue(contentName, radiobox.value, dataTypeId, templateId, propertyName, documentTypeName); + const contentURL = await umbracoApi.document.getDocumentUrl(contentKey); // Act await umbracoUi.contentRender.navigateToRenderedContentPage(contentURL); @@ -33,4 +32,4 @@ for (const radiobox of radioboxValues) { // Assert await umbracoUi.contentRender.doesContentRenderValueContainText(radiobox.value); }); -} \ No newline at end of file +} diff --git a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithTags.spec.ts b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithTags.spec.ts index 6b7e8423b6..a09ac8a2b1 100644 --- a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithTags.spec.ts +++ b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithTags.spec.ts @@ -28,9 +28,8 @@ for (const tag of tags) { // Arrange const tagValue = tag.value; const templateId = await umbracoApi.template.createTemplateWithDisplayingMulitpleStringValue(templateName, AliasHelper.toAlias(propertyName)); - await umbracoApi.document.createPublishedDocumentWithValue(contentName, tagValue, dataTypeData.id, templateId, propertyName, documentTypeName); - const contentData = await umbracoApi.document.getByName(contentName); - const contentURL = contentData.urls[0].url; + const contentKey = await umbracoApi.document.createPublishedDocumentWithValue(contentName, tagValue, dataTypeData.id, templateId, propertyName, documentTypeName); + const contentURL = await umbracoApi.document.getDocumentUrl(contentKey); // Act await umbracoUi.contentRender.navigateToRenderedContentPage(contentURL); diff --git a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithTextarea.spec.ts b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithTextarea.spec.ts index 251bf997e1..558e2e74d8 100644 --- a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithTextarea.spec.ts +++ b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithTextarea.spec.ts @@ -31,9 +31,8 @@ for (const textarea of textareas) { // Arrange const textareaValue = textarea.value; const templateId = await umbracoApi.template.createTemplateWithDisplayingStringValue(templateName, AliasHelper.toAlias(propertyName)); - await umbracoApi.document.createPublishedDocumentWithValue(contentName, textareaValue, dataTypeData.id, templateId, propertyName, documentTypeName); - const contentData = await umbracoApi.document.getByName(contentName); - const contentURL = contentData.urls[0].url; + const contentKey = await umbracoApi.document.createPublishedDocumentWithValue(contentName, textareaValue, dataTypeData.id, templateId, propertyName, documentTypeName); + const contentURL = await umbracoApi.document.getDocumentUrl(contentKey); // Act await umbracoUi.contentRender.navigateToRenderedContentPage(contentURL); diff --git a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithTextstring.spec.ts b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithTextstring.spec.ts index 36944e5f45..95d11d7230 100644 --- a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithTextstring.spec.ts +++ b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithTextstring.spec.ts @@ -31,9 +31,8 @@ for (const textstring of textstrings) { // Arrange const textstringValue = textstring.value; const templateId = await umbracoApi.template.createTemplateWithDisplayingStringValue(templateName, AliasHelper.toAlias(propertyName)); - await umbracoApi.document.createPublishedDocumentWithValue(contentName, textstringValue, dataTypeData.id, templateId, propertyName, documentTypeName); - const contentData = await umbracoApi.document.getByName(contentName); - const contentURL = contentData.urls[0].url; + const contentKey = await umbracoApi.document.createPublishedDocumentWithValue(contentName, textstringValue, dataTypeData.id, templateId, propertyName, documentTypeName); + const contentURL = await umbracoApi.document.getDocumentUrl(contentKey); // Act await umbracoUi.contentRender.navigateToRenderedContentPage(contentURL); diff --git a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithTrueFalse.spec.ts b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithTrueFalse.spec.ts index 9ef50db657..043cb8c36d 100644 --- a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithTrueFalse.spec.ts +++ b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithTrueFalse.spec.ts @@ -17,7 +17,7 @@ test.afterEach(async ({umbracoApi}) => { await umbracoApi.template.ensureNameNotExists(templateName); }); -const trueFalseValues = [ +const trueFalseValues = [ {type: 'true value ', value: true, expectedValue: 'True'}, {type: 'false value', value: false, expectedValue: 'False'}, ]; @@ -26,9 +26,8 @@ for (const trueFalse of trueFalseValues) { test(`can render content with ${trueFalse.type}`, async ({umbracoApi, umbracoUi}) => { // Arrange const templateId = await umbracoApi.template.createTemplateWithDisplayingStringValue(templateName, AliasHelper.toAlias(propertyName)); - await umbracoApi.document.createPublishedDocumentWithValue(contentName, trueFalse.value, dataTypeData.id, templateId, propertyName, documentTypeName); - const contentData = await umbracoApi.document.getByName(contentName); - const contentURL = contentData.urls[0].url; + const contentKey = await umbracoApi.document.createPublishedDocumentWithValue(contentName, trueFalse.value, dataTypeData.id, templateId, propertyName, documentTypeName); + const contentURL = await umbracoApi.document.getDocumentUrl(contentKey); // Act await umbracoUi.contentRender.navigateToRenderedContentPage(contentURL); diff --git a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithUploadFile.spec.ts b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithUploadFile.spec.ts index 92399d3f70..10043f535c 100644 --- a/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithUploadFile.spec.ts +++ b/tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithUploadFile.spec.ts @@ -27,7 +27,7 @@ for (const uploadedFile of uploadedFileList) { const templateId = await umbracoApi.template.createTemplateWithDisplayingUploadedFileValue(templateName, AliasHelper.toAlias(propertyName)); await umbracoApi.document.createPublishedDocumentWithUploadFile(contentName, uploadedFile.uploadedFileName, uploadedFile.mineType, dataTypeData.id, templateId, propertyName, documentTypeName); const contentData = await umbracoApi.document.getByName(contentName); - const contentURL = contentData.urls[0].url; + const contentURL = await umbracoApi.document.getDocumentUrl(contentData.id); const uploadFileSrc = contentData.values[0].value.src; // Act