-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
V14 Added the Content tests with Upload Article, Upload Audio and Upl…
…oad File data type (#16945) * Added the test files for article * Added Content tests with Upload Article datatype * Added the audio test files * Fix format * Updated the Content tests with Upload Article * Added Content tests with Upload Audio * Added Content tests with Upload File * Bumped version * Make all Content tests run in the pipeline * Cleaned code * Make the smoke tests run in the pipeline
- Loading branch information
1 parent
405fd97
commit 8eeac27
Showing
9 changed files
with
341 additions
and
5 deletions.
There are no files selected for viewing
Binary file added
BIN
+28.5 KB
tests/Umbraco.Tests.AcceptanceTest/fixtures/mediaLibrary/ArticleDOC.doc
Binary file not shown.
Binary file added
BIN
+12.9 KB
tests/Umbraco.Tests.AcceptanceTest/fixtures/mediaLibrary/ArticleDOCX.docx
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+34.7 KB
tests/Umbraco.Tests.AcceptanceTest/fixtures/mediaLibrary/AudioOPUS.opus
Binary file not shown.
Binary file added
BIN
+28.4 KB
tests/Umbraco.Tests.AcceptanceTest/fixtures/mediaLibrary/AudioWEBA.weba
Binary file not shown.
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
112 changes: 112 additions & 0 deletions
112
...Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Content/ContentWithUploadArticle.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,112 @@ | ||
import {ConstantHelper, test, AliasHelper} from '@umbraco/playwright-testhelpers'; | ||
import {expect} from "@playwright/test"; | ||
|
||
const contentName = 'TestContent'; | ||
const documentTypeName = 'TestDocumentTypeForContent'; | ||
const dataTypeName = 'Upload Article'; | ||
const uploadFilePath = './fixtures/mediaLibrary/'; | ||
|
||
test.beforeEach(async ({umbracoApi}) => { | ||
await umbracoApi.documentType.ensureNameNotExists(documentTypeName); | ||
await umbracoApi.document.ensureNameNotExists(contentName); | ||
}); | ||
|
||
test.afterEach(async ({umbracoApi}) => { | ||
await umbracoApi.document.ensureNameNotExists(contentName); | ||
await umbracoApi.documentType.ensureNameNotExists(documentTypeName); | ||
}); | ||
|
||
test('can create content with the upload article data type', async ({umbracoApi, umbracoUi}) => { | ||
// Arrange | ||
const expectedState = 'Draft'; | ||
const dataTypeData = await umbracoApi.dataType.getByName(dataTypeName); | ||
await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, dataTypeName, dataTypeData.id); | ||
await umbracoUi.goToBackOffice(); | ||
await umbracoUi.content.goToSection(ConstantHelper.sections.content); | ||
|
||
// Act | ||
await umbracoUi.content.clickActionsMenuAtRoot(); | ||
await umbracoUi.content.clickCreateButton(); | ||
await umbracoUi.content.chooseDocumentType(documentTypeName); | ||
await umbracoUi.content.enterContentName(contentName); | ||
await umbracoUi.content.clickSaveButton(); | ||
|
||
// Assert | ||
await umbracoUi.content.isSuccessNotificationVisible(); | ||
expect(await umbracoApi.document.doesNameExist(contentName)).toBeTruthy(); | ||
const contentData = await umbracoApi.document.getByName(contentName); | ||
expect(contentData.variants[0].state).toBe(expectedState); | ||
expect(contentData.values).toEqual([]); | ||
}); | ||
|
||
test('can publish content with the upload article data type', async ({umbracoApi, umbracoUi}) => { | ||
// Arrange | ||
const expectedState = 'Published'; | ||
const dataTypeData = await umbracoApi.dataType.getByName(dataTypeName); | ||
const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, dataTypeName, dataTypeData.id); | ||
await umbracoApi.document.createDefaultDocument(contentName, documentTypeId); | ||
await umbracoUi.goToBackOffice(); | ||
await umbracoUi.content.goToSection(ConstantHelper.sections.content); | ||
|
||
// Act | ||
await umbracoUi.content.goToContentWithName(contentName); | ||
await umbracoUi.content.clickSaveAndPublishButton(); | ||
|
||
// Assert | ||
await umbracoUi.content.doesSuccessNotificationsHaveCount(2); | ||
expect(await umbracoApi.document.doesNameExist(contentName)).toBeTruthy(); | ||
const contentData = await umbracoApi.document.getByName(contentName); | ||
expect(contentData.variants[0].state).toBe(expectedState); | ||
expect(contentData.values).toEqual([]); | ||
}); | ||
|
||
const uploadFiles = [ | ||
{fileExtension: 'pdf', fileName: 'Article.pdf'}, | ||
{fileExtension: 'docx', fileName: 'ArticleDOCX.docx'}, | ||
{fileExtension: 'doc', fileName: 'ArticleDOC.doc'} | ||
]; | ||
for (const uploadFile of uploadFiles) { | ||
test(`can upload an article with the ${uploadFile.fileExtension} extension in the content`, async ({umbracoApi, umbracoUi}) => { | ||
// Arrange | ||
const dataTypeData = await umbracoApi.dataType.getByName(dataTypeName); | ||
const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, dataTypeName, dataTypeData.id); | ||
await umbracoApi.document.createDefaultDocument(contentName, documentTypeId); | ||
await umbracoUi.goToBackOffice(); | ||
await umbracoUi.content.goToSection(ConstantHelper.sections.content); | ||
|
||
// Act | ||
await umbracoUi.content.goToContentWithName(contentName); | ||
await umbracoUi.content.uploadFile(uploadFilePath + uploadFile.fileName); | ||
await umbracoUi.content.clickSaveButton(); | ||
|
||
// Assert | ||
await umbracoUi.content.isSuccessNotificationVisible(); | ||
expect(await umbracoApi.document.doesNameExist(contentName)).toBeTruthy(); | ||
const contentData = await umbracoApi.document.getByName(contentName); | ||
expect(contentData.values[0].alias).toEqual(AliasHelper.toAlias(dataTypeName)); | ||
expect(contentData.values[0].value.src).toContain(AliasHelper.toAlias(uploadFile.fileName)); | ||
}); | ||
} | ||
|
||
// TODO: Remove skip when the front-end is ready. Currently the uploaded file still displays after removing. | ||
test.skip('can remove an article file in the content', async ({umbracoApi, umbracoUi}) => { | ||
// Arrange | ||
const uploadFileName = 'Article.pdf'; | ||
const mimeType = 'application/pdf'; | ||
const dataTypeData = await umbracoApi.dataType.getByName(dataTypeName); | ||
const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, dataTypeName, dataTypeData.id); | ||
await umbracoApi.document.createDocumentWithUploadFile(contentName, documentTypeId, dataTypeName, uploadFileName, mimeType); | ||
await umbracoUi.goToBackOffice(); | ||
await umbracoUi.content.goToSection(ConstantHelper.sections.content); | ||
|
||
// Act | ||
await umbracoUi.content.goToContentWithName(contentName); | ||
await umbracoUi.content.clickRemoveFilesButton(); | ||
await umbracoUi.content.clickSaveButton(); | ||
|
||
// Assert | ||
await umbracoUi.content.isSuccessNotificationVisible(); | ||
expect(await umbracoApi.document.doesNameExist(contentName)).toBeTruthy(); | ||
const contentData = await umbracoApi.document.getByName(contentName); | ||
expect(contentData.values).toEqual([]); | ||
}); |
113 changes: 113 additions & 0 deletions
113
...s/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Content/ContentWithUploadAudio.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,113 @@ | ||
import {ConstantHelper, test, AliasHelper} from '@umbraco/playwright-testhelpers'; | ||
import {expect} from "@playwright/test"; | ||
|
||
const contentName = 'TestContent'; | ||
const documentTypeName = 'TestDocumentTypeForContent'; | ||
const dataTypeName = 'Upload Audio'; | ||
const uploadFilePath = './fixtures/mediaLibrary/'; | ||
|
||
test.beforeEach(async ({umbracoApi}) => { | ||
await umbracoApi.documentType.ensureNameNotExists(documentTypeName); | ||
await umbracoApi.document.ensureNameNotExists(contentName); | ||
}); | ||
|
||
test.afterEach(async ({umbracoApi}) => { | ||
await umbracoApi.document.ensureNameNotExists(contentName); | ||
await umbracoApi.documentType.ensureNameNotExists(documentTypeName); | ||
}); | ||
|
||
test('can create content with the upload audio data type', async ({umbracoApi, umbracoUi}) => { | ||
// Arrange | ||
const expectedState = 'Draft'; | ||
const dataTypeData = await umbracoApi.dataType.getByName(dataTypeName); | ||
await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, dataTypeName, dataTypeData.id); | ||
await umbracoUi.goToBackOffice(); | ||
await umbracoUi.content.goToSection(ConstantHelper.sections.content); | ||
|
||
// Act | ||
await umbracoUi.content.clickActionsMenuAtRoot(); | ||
await umbracoUi.content.clickCreateButton(); | ||
await umbracoUi.content.chooseDocumentType(documentTypeName); | ||
await umbracoUi.content.enterContentName(contentName); | ||
await umbracoUi.content.clickSaveButton(); | ||
|
||
// Assert | ||
await umbracoUi.content.isSuccessNotificationVisible(); | ||
expect(await umbracoApi.document.doesNameExist(contentName)).toBeTruthy(); | ||
const contentData = await umbracoApi.document.getByName(contentName); | ||
expect(contentData.variants[0].state).toBe(expectedState); | ||
expect(contentData.values).toEqual([]); | ||
}); | ||
|
||
test('can publish content with the upload audio data type', async ({umbracoApi, umbracoUi}) => { | ||
// Arrange | ||
const expectedState = 'Published'; | ||
const dataTypeData = await umbracoApi.dataType.getByName(dataTypeName); | ||
const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, dataTypeName, dataTypeData.id); | ||
await umbracoApi.document.createDefaultDocument(contentName, documentTypeId); | ||
await umbracoUi.goToBackOffice(); | ||
await umbracoUi.content.goToSection(ConstantHelper.sections.content); | ||
|
||
// Act | ||
await umbracoUi.content.goToContentWithName(contentName); | ||
await umbracoUi.content.clickSaveAndPublishButton(); | ||
|
||
// Assert | ||
await umbracoUi.content.doesSuccessNotificationsHaveCount(2); | ||
expect(await umbracoApi.document.doesNameExist(contentName)).toBeTruthy(); | ||
const contentData = await umbracoApi.document.getByName(contentName); | ||
expect(contentData.variants[0].state).toBe(expectedState); | ||
expect(contentData.values).toEqual([]); | ||
}); | ||
|
||
const uploadFiles = [ | ||
{fileExtension: 'mp3', fileName: 'Audio.mp3'}, | ||
{fileExtension: 'weba', fileName: 'AudioWEBA.weba'}, | ||
{fileExtension: 'oga', fileName: 'AudioOGA.oga'}, | ||
{fileExtension: 'opus', fileName: 'AudioOPUS.opus'} | ||
]; | ||
for (const uploadFile of uploadFiles) { | ||
test(`can upload an audio with the ${uploadFile.fileExtension} extension in the content`, async ({umbracoApi, umbracoUi}) => { | ||
// Arrange | ||
const dataTypeData = await umbracoApi.dataType.getByName(dataTypeName); | ||
const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, dataTypeName, dataTypeData.id); | ||
await umbracoApi.document.createDefaultDocument(contentName, documentTypeId); | ||
await umbracoUi.goToBackOffice(); | ||
await umbracoUi.content.goToSection(ConstantHelper.sections.content); | ||
|
||
// Act | ||
await umbracoUi.content.goToContentWithName(contentName); | ||
await umbracoUi.content.uploadFile(uploadFilePath + uploadFile.fileName); | ||
await umbracoUi.content.clickSaveButton(); | ||
|
||
// Assert | ||
await umbracoUi.content.isSuccessNotificationVisible(); | ||
expect(await umbracoApi.document.doesNameExist(contentName)).toBeTruthy(); | ||
const contentData = await umbracoApi.document.getByName(contentName); | ||
expect(contentData.values[0].alias).toEqual(AliasHelper.toAlias(dataTypeName)); | ||
expect(contentData.values[0].value.src).toContain(AliasHelper.toAlias(uploadFile.fileName)); | ||
}); | ||
} | ||
|
||
// TODO: Remove skip when the front-end is ready. Currently the uploaded file still displays after removing. | ||
test.skip('can remove an audio file in the content', async ({umbracoApi, umbracoUi}) => { | ||
// Arrange | ||
const uploadFileName = 'Audio.mp3'; | ||
const mineType = 'audio/mpeg'; | ||
const dataTypeData = await umbracoApi.dataType.getByName(dataTypeName); | ||
const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, dataTypeName, dataTypeData.id); | ||
await umbracoApi.document.createDocumentWithUploadFile(contentName, documentTypeId, dataTypeName, uploadFileName, mineType); | ||
await umbracoUi.goToBackOffice(); | ||
await umbracoUi.content.goToSection(ConstantHelper.sections.content); | ||
|
||
// Act | ||
await umbracoUi.content.goToContentWithName(contentName); | ||
await umbracoUi.content.clickRemoveFilesButton(); | ||
await umbracoUi.content.clickSaveButton(); | ||
|
||
// Assert | ||
await umbracoUi.content.isSuccessNotificationVisible(); | ||
expect(await umbracoApi.document.doesNameExist(contentName)).toBeTruthy(); | ||
const contentData = await umbracoApi.document.getByName(contentName); | ||
expect(contentData.values).toEqual([]); | ||
}); |
111 changes: 111 additions & 0 deletions
111
tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/Content/ContentWithUploadFile.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,111 @@ | ||
import {ConstantHelper, test, AliasHelper} from '@umbraco/playwright-testhelpers'; | ||
import {expect} from "@playwright/test"; | ||
|
||
const contentName = 'TestContent'; | ||
const documentTypeName = 'TestDocumentTypeForContent'; | ||
const dataTypeName = 'Upload File'; | ||
const uploadFilePath = './fixtures/mediaLibrary/'; | ||
|
||
test.beforeEach(async ({umbracoApi}) => { | ||
await umbracoApi.documentType.ensureNameNotExists(documentTypeName); | ||
await umbracoApi.document.ensureNameNotExists(contentName); | ||
}); | ||
|
||
test.afterEach(async ({umbracoApi}) => { | ||
await umbracoApi.document.ensureNameNotExists(contentName); | ||
await umbracoApi.documentType.ensureNameNotExists(documentTypeName); | ||
}); | ||
|
||
test('can create content with the upload file data type', async ({umbracoApi, umbracoUi}) => { | ||
// Arrange | ||
const expectedState = 'Draft'; | ||
const dataTypeData = await umbracoApi.dataType.getByName(dataTypeName); | ||
await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, dataTypeName, dataTypeData.id); | ||
await umbracoUi.goToBackOffice(); | ||
await umbracoUi.content.goToSection(ConstantHelper.sections.content); | ||
|
||
// Act | ||
await umbracoUi.content.clickActionsMenuAtRoot(); | ||
await umbracoUi.content.clickCreateButton(); | ||
await umbracoUi.content.chooseDocumentType(documentTypeName); | ||
await umbracoUi.content.enterContentName(contentName); | ||
await umbracoUi.content.clickSaveButton(); | ||
|
||
// Assert | ||
await umbracoUi.content.isSuccessNotificationVisible(); | ||
expect(await umbracoApi.document.doesNameExist(contentName)).toBeTruthy(); | ||
const contentData = await umbracoApi.document.getByName(contentName); | ||
expect(contentData.variants[0].state).toBe(expectedState); | ||
expect(contentData.values).toEqual([]); | ||
}); | ||
|
||
test('can publish content with the upload file data type', async ({umbracoApi, umbracoUi}) => { | ||
// Arrange | ||
const expectedState = 'Published'; | ||
const dataTypeData = await umbracoApi.dataType.getByName(dataTypeName); | ||
const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, dataTypeName, dataTypeData.id); | ||
await umbracoApi.document.createDefaultDocument(contentName, documentTypeId); | ||
await umbracoUi.goToBackOffice(); | ||
await umbracoUi.content.goToSection(ConstantHelper.sections.content); | ||
|
||
// Act | ||
await umbracoUi.content.goToContentWithName(contentName); | ||
await umbracoUi.content.clickSaveAndPublishButton(); | ||
|
||
// Assert | ||
await umbracoUi.content.doesSuccessNotificationsHaveCount(2); | ||
expect(await umbracoApi.document.doesNameExist(contentName)).toBeTruthy(); | ||
const contentData = await umbracoApi.document.getByName(contentName); | ||
expect(contentData.variants[0].state).toBe(expectedState); | ||
expect(contentData.values).toEqual([]); | ||
}); | ||
|
||
const uploadFiles = [ | ||
{fileExtension: 'txt', fileName: 'File.txt'}, | ||
{fileExtension: 'png', fileName: 'Umbraco.png'} | ||
]; | ||
for (const uploadFile of uploadFiles) { | ||
test(`can upload a file with the ${uploadFile.fileExtension} extension in the content`, async ({umbracoApi, umbracoUi}) => { | ||
// Arrange | ||
const dataTypeData = await umbracoApi.dataType.getByName(dataTypeName); | ||
const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, dataTypeName, dataTypeData.id); | ||
await umbracoApi.document.createDefaultDocument(contentName, documentTypeId); | ||
await umbracoUi.goToBackOffice(); | ||
await umbracoUi.content.goToSection(ConstantHelper.sections.content); | ||
|
||
// Act | ||
await umbracoUi.content.goToContentWithName(contentName); | ||
await umbracoUi.content.uploadFile(uploadFilePath + uploadFile.fileName); | ||
await umbracoUi.content.clickSaveButton(); | ||
|
||
// Assert | ||
await umbracoUi.content.isSuccessNotificationVisible(); | ||
expect(await umbracoApi.document.doesNameExist(contentName)).toBeTruthy(); | ||
const contentData = await umbracoApi.document.getByName(contentName); | ||
expect(contentData.values[0].alias).toEqual(AliasHelper.toAlias(dataTypeName)); | ||
expect(contentData.values[0].value.src).toContain(AliasHelper.toAlias(uploadFile.fileName)); | ||
}); | ||
} | ||
|
||
// TODO: Remove skip when the front-end is ready. Currently the uploaded file still displays after removing. | ||
test.skip('can remove a text file in the content', async ({umbracoApi, umbracoUi}) => { | ||
// Arrange | ||
const uploadFileName = 'File.txt'; | ||
const mineType = 'text/plain'; | ||
const dataTypeData = await umbracoApi.dataType.getByName(dataTypeName); | ||
const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, dataTypeName, dataTypeData.id); | ||
await umbracoApi.document.createDocumentWithUploadFile(contentName, documentTypeId, dataTypeName, uploadFileName, mineType); | ||
await umbracoUi.goToBackOffice(); | ||
await umbracoUi.content.goToSection(ConstantHelper.sections.content); | ||
|
||
// Act | ||
await umbracoUi.content.goToContentWithName(contentName); | ||
await umbracoUi.content.clickRemoveFilesButton(); | ||
await umbracoUi.content.clickSaveButton(); | ||
|
||
// Assert | ||
await umbracoUi.content.isSuccessNotificationVisible(); | ||
expect(await umbracoApi.document.doesNameExist(contentName)).toBeTruthy(); | ||
const contentData = await umbracoApi.document.getByName(contentName); | ||
expect(contentData.values).toEqual([]); | ||
}); |