forked from umbraco/Umbraco-CMS
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
V15 QA Added tests for rendering content with member picker, multi ur…
…l picker and media picker (umbraco#17717) * Added test for rendering content with member picker value * Added tests for rendering content with multiple media picker * Added tests for rendering content with multi url picker * Bumped version * Updated tests for member picker * Make all rendering content tests run in the pipeline * Bumped version * Fixed indentation * Added clean for media * Reverted --------- Co-authored-by: Andreas Zerbst <[email protected]> Co-authored-by: Andreas Zerbst <[email protected]>
- Loading branch information
1 parent
6f08178
commit dc2dc09
Showing
6 changed files
with
217 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
...eptanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithMemberPicker.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
import {AliasHelper, test} from '@umbraco/playwright-testhelpers'; | ||
|
||
const contentName = 'Test Rendering Content'; | ||
const documentTypeName = 'TestDocumentTypeForContent'; | ||
const dataTypeName = 'Member Picker'; | ||
const templateName = 'TestTemplateForContent'; | ||
const propertyName = 'Test Member Picker'; | ||
let dataTypeData = null; | ||
const memberName = 'Test Member'; | ||
const memberTypeName = 'Test Member Type'; | ||
const username = 'testmember'; | ||
const email = '[email protected]'; | ||
const password = '0123456789'; | ||
|
||
test.beforeEach(async ({umbracoApi}) => { | ||
dataTypeData = await umbracoApi.dataType.getByName(dataTypeName); | ||
}); | ||
|
||
test.afterEach(async ({umbracoApi}) => { | ||
await umbracoApi.document.ensureNameNotExists(contentName); | ||
await umbracoApi.documentType.ensureNameNotExists(documentTypeName); | ||
await umbracoApi.template.ensureNameNotExists(templateName); | ||
}); | ||
|
||
test('can render content with member picker value', async ({umbracoApi, umbracoUi}) => { | ||
// Arrange | ||
// Create member | ||
await umbracoApi.memberType.ensureNameNotExists(memberTypeName); | ||
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; | ||
|
||
// Act | ||
await umbracoUi.contentRender.navigateToRenderedContentPage(contentURL); | ||
|
||
// Assert | ||
await umbracoUi.contentRender.doesContentRenderValueContainText(memberName); | ||
}); |
107 changes: 107 additions & 0 deletions
107
...tanceTest/tests/DefaultConfig/RenderingContent/RenderingContentWithMultiURLPicker.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
import {AliasHelper, test} from '@umbraco/playwright-testhelpers'; | ||
|
||
const contentName = 'Test Rendering Content'; | ||
const documentTypeName = 'TestDocumentTypeForContent'; | ||
const dataTypeName = 'Multi URL Picker'; | ||
const templateName = 'TestTemplateForContent'; | ||
const propertyName = 'Test Member Picker'; | ||
let dataTypeData = null; | ||
|
||
test.beforeEach(async ({umbracoApi}) => { | ||
dataTypeData = await umbracoApi.dataType.getByName(dataTypeName); | ||
}); | ||
|
||
test.afterEach(async ({umbracoApi}) => { | ||
await umbracoApi.document.ensureNameNotExists(contentName); | ||
await umbracoApi.documentType.ensureNameNotExists(documentTypeName); | ||
await umbracoApi.template.ensureNameNotExists(templateName); | ||
}); | ||
|
||
test('can render content with document link value', async ({umbracoApi, umbracoUi}) => { | ||
// Arrange | ||
// Create a document to link | ||
const documentTypeForLinkedDocumentName = 'TestDocumentType'; | ||
const documentTypeForLinkedDocumentId = await umbracoApi.documentType.createDefaultDocumentTypeWithAllowAsRoot(documentTypeForLinkedDocumentName); | ||
const linkedDocumentName = 'LinkedDocument'; | ||
const linkedDocumentId = await umbracoApi.document.createDefaultDocument(linkedDocumentName, documentTypeForLinkedDocumentId); | ||
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; | ||
|
||
// Act | ||
await umbracoUi.contentRender.navigateToRenderedContentPage(contentURL); | ||
|
||
// Assert | ||
await umbracoUi.contentRender.doesContentRenderValueContainText(linkedDocumentName); | ||
|
||
// Clean | ||
await umbracoApi.document.ensureNameNotExists(linkedDocumentName); | ||
await umbracoApi.documentType.ensureNameNotExists(documentTypeForLinkedDocumentName); | ||
}); | ||
|
||
test('can render content with media link value', async ({umbracoApi, umbracoUi}) => { | ||
// Arrange | ||
// Create a media to pick | ||
const mediaFileName = 'TestMediaFileForContent'; | ||
await umbracoApi.media.ensureNameNotExists(mediaFileName); | ||
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; | ||
|
||
// Act | ||
await umbracoUi.contentRender.navigateToRenderedContentPage(contentURL); | ||
|
||
// Assert | ||
await umbracoUi.contentRender.doesContentRenderValueContainText(mediaFileName); | ||
|
||
// Clean | ||
await umbracoApi.media.ensureNameNotExists(mediaFileName); | ||
}); | ||
|
||
test('can render content with external link value', async ({umbracoApi, umbracoUi}) => { | ||
// Arrange | ||
const linkUrl = 'https://docs.umbraco.com'; | ||
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; | ||
|
||
// Act | ||
await umbracoUi.contentRender.navigateToRenderedContentPage(contentURL); | ||
|
||
// Assert | ||
await umbracoUi.contentRender.doesContentRenderValueContainText(linkTitle); | ||
}); | ||
|
||
test('can render content with multiple url value', async ({umbracoApi, umbracoUi}) => { | ||
// Arrange | ||
const linkUrl = 'https://docs.umbraco.com'; | ||
const linkTitle = 'Umbraco Documentation'; | ||
// Create a media to pick | ||
const mediaFileName = 'TestMediaFileForContent'; | ||
await umbracoApi.media.ensureNameNotExists(mediaFileName); | ||
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; | ||
|
||
// Act | ||
await umbracoUi.contentRender.navigateToRenderedContentPage(contentURL); | ||
|
||
// Assert | ||
await umbracoUi.contentRender.doesContentRenderValueContainText(linkTitle); | ||
await umbracoUi.contentRender.doesContentRenderValueContainText(mediaFileName); | ||
|
||
// Clean | ||
await umbracoApi.media.ensureNameNotExists(mediaFileName); | ||
}); |
63 changes: 63 additions & 0 deletions
63
...Test/tests/DefaultConfig/RenderingContent/RenderingContentWithMultipleMediaPicker.spec.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
import {AliasHelper, test} from '@umbraco/playwright-testhelpers'; | ||
|
||
const contentName = 'Test Rendering Content'; | ||
const documentTypeName = 'TestDocumentTypeForContent'; | ||
const templateName = 'TestTemplateForContent'; | ||
const propertyName = 'Test Multiple Media Picker'; | ||
const firstMediaFileName = 'TestFirstMedia'; | ||
const secondMediaFileName = 'TestSecondMedia'; | ||
|
||
test.beforeEach(async ({umbracoApi}) => { | ||
await umbracoApi.media.ensureNameNotExists(firstMediaFileName); | ||
await umbracoApi.media.ensureNameNotExists(secondMediaFileName); | ||
}); | ||
|
||
test.afterEach(async ({umbracoApi}) => { | ||
await umbracoApi.document.ensureNameNotExists(contentName); | ||
await umbracoApi.documentType.ensureNameNotExists(documentTypeName); | ||
await umbracoApi.template.ensureNameNotExists(templateName); | ||
await umbracoApi.media.ensureNameNotExists(firstMediaFileName); | ||
await umbracoApi.media.ensureNameNotExists(secondMediaFileName); | ||
}); | ||
|
||
test('can render content with multiple media picker value', async ({umbracoApi, umbracoUi}) => { | ||
// Arrange | ||
const dataTypeName = 'Multiple Media Picker'; | ||
const dataTypeData = await umbracoApi.dataType.getByName(dataTypeName); | ||
// Create multiple images | ||
const firstMediaFileId = await umbracoApi.media.createDefaultMediaFile(firstMediaFileName); | ||
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; | ||
|
||
// Act | ||
await umbracoUi.contentRender.navigateToRenderedContentPage(contentURL); | ||
|
||
// Assert | ||
await umbracoUi.contentRender.doesContentRenderValueContainText(firstMediaFileName); | ||
await umbracoUi.contentRender.doesContentRenderValueContainText(secondMediaFileName); | ||
}); | ||
|
||
test('can render content with multiple image media picker value', async ({umbracoApi, umbracoUi}) => { | ||
// Arrange | ||
const dataTypeName = 'Multiple Image Media Picker'; | ||
const dataTypeData = await umbracoApi.dataType.getByName(dataTypeName); | ||
// Create multiple images | ||
const firstMediaFileId = await umbracoApi.media.createDefaultMediaWithImage(firstMediaFileName); | ||
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; | ||
|
||
// Act | ||
await umbracoUi.contentRender.navigateToRenderedContentPage(contentURL); | ||
|
||
// Assert | ||
await umbracoUi.contentRender.doesContentRenderValueContainText(firstMediaFileName); | ||
await umbracoUi.contentRender.doesContentRenderValueContainText(secondMediaFileName); | ||
}); |