Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V14 QA Added Content tests with various of data types #16824

Merged
merged 50 commits into from
Aug 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
2b3799b
Added Content tests with content picker
nhudinh0309 Jul 4, 2024
09b1f36
Removed the test for content picker
nhudinh0309 Jul 4, 2024
4d202ae
Added Content tests with the default content picker
nhudinh0309 Jul 4, 2024
24799f0
Added more Content tests with Content Picker data type
nhudinh0309 Jul 8, 2024
a10bfc3
Added the Content tests with Dropdown
nhudinh0309 Jul 16, 2024
c003100
Added Content tests with Image Cropper
nhudinh0309 Jul 16, 2024
76222b0
Updated upload file method due to test helper changes
nhudinh0309 Jul 16, 2024
639b11c
Added Content tests with Image Cropper
nhudinh0309 Jul 17, 2024
0b02f72
Added Content tests with Image Cropper data type
nhudinh0309 Jul 23, 2024
d9de96c
Added Content tests with Media Picker data type
nhudinh0309 Jul 23, 2024
9f7c5ab
Updated Media tests due to ui helper changes
nhudinh0309 Jul 23, 2024
046629e
Merge branch 'v14/dev' into v14/QA/content-with-various-data-type-tests
nhudinh0309 Jul 23, 2024
485c97c
Bumped version of test helper and json builder
nhudinh0309 Jul 23, 2024
f905764
Make all Content tests run in pipeline - should remove it before merging
nhudinh0309 Jul 23, 2024
de2becb
Fixed the name of tests
nhudinh0309 Jul 25, 2024
3b33392
Updated the tests for Media Picker in Content section
nhudinh0309 Jul 25, 2024
4097a3a
Added the Content tests with Multiple Media Picker
nhudinh0309 Jul 25, 2024
f485019
Merge branch 'v14/QA/content-with-dropdown-tests' into v14/QA/content…
nhudinh0309 Jul 25, 2024
f01c00a
Merge branch 'v14/QA/content-with-content-picker-tests' into v14/QA/c…
nhudinh0309 Jul 25, 2024
6c5b195
Updated the Content test with Content Picker due to the test helper c…
nhudinh0309 Jul 25, 2024
e9d935b
Bumped version of test helper
nhudinh0309 Jul 25, 2024
57eaf69
Merge branch 'v14/dev' into v14/QA/content-with-various-data-type-tests
nhudinh0309 Jul 25, 2024
c9fc047
Fixed the failing tests for Content
nhudinh0309 Jul 25, 2024
ce7aa8d
Removed Image Cropper test in this branch
nhudinh0309 Jul 25, 2024
7d2a305
Added more waits
nhudinh0309 Jul 25, 2024
ec80d3c
Added smoke tags
nhudinh0309 Jul 25, 2024
f75f32e
Make smoke tests run in the pipeline
nhudinh0309 Jul 25, 2024
82812d1
Added Content tests for Image Cropper
nhudinh0309 Jul 26, 2024
96a7a08
Added smoke tags to make all Image Cropper tests running in the pipeline
nhudinh0309 Jul 26, 2024
17b3527
Added Content tests with Member Picker
nhudinh0309 Jul 31, 2024
0842dcd
Added Content tests with Multiple Image Media Picker
nhudinh0309 Jul 31, 2024
c91a2db
Added Content tests with Numeric
nhudinh0309 Jul 31, 2024
686f14c
Merge branch 'v14/QA/content-with-member-picker-tests' into v14/QA/co…
nhudinh0309 Aug 5, 2024
52e1fc5
Merge branch 'v14/dev' into v14/QA/content-with-image-cropper-tests
nhudinh0309 Aug 5, 2024
8f455b4
Bumped version of test helper
nhudinh0309 Aug 5, 2024
471337a
Make all Content tests running in the pipeline
nhudinh0309 Aug 5, 2024
2bf439d
Assert that the content is published
nhudinh0309 Aug 7, 2024
0d212a0
Assert that the content is published
nhudinh0309 Aug 7, 2024
3b2f8db
Merge branch 'v14/dev' into v14/QA/content-with-image-cropper-tests
nhudinh0309 Aug 7, 2024
1b6fe1e
Merge branch 'v14/dev' into v14/QA/content-with-various-data-type-tests
nhudinh0309 Aug 13, 2024
f6eea83
Fixed code conflict
nhudinh0309 Aug 13, 2024
f484fae
Fixed comment and code conflict
nhudinh0309 Aug 13, 2024
601fadc
Make all Content tests run in the pipeline
nhudinh0309 Aug 13, 2024
4d8c54b
Merge branch 'v14/QA/content-with-image-cropper-tests' of https://git…
nhudinh0309 Aug 13, 2024
580b20f
Merge branch 'v14/dev' into v14/QA/content-with-image-cropper-tests
nhudinh0309 Aug 23, 2024
8732d97
Refactor the Content tests with different data type
nhudinh0309 Aug 23, 2024
db5853d
Merge branch 'v14/dev' into v14/QA/content-with-image-cropper-tests
nhudinh0309 Aug 23, 2024
2a65fe5
Cleaned code
nhudinh0309 Aug 27, 2024
f49cfaa
Make the smoke tests run in the pipeline
nhudinh0309 Aug 27, 2024
e599415
Merge branch 'v14/dev' into v14/QA/content-with-image-cropper-tests
nhudinh0309 Aug 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ test.afterEach(async ({umbracoApi}) => {

test('can create content with the checkbox list 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.content.goToSection(ConstantHelper.sections.content);
Expand All @@ -33,26 +34,27 @@ test('can create content with the checkbox list data type', async ({umbracoApi,
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 checkbox list data type', async ({umbracoApi, umbracoUi}) => {
// Arrange
const expectedState = 'Published';
const dataTypeData = await umbracoApi.dataType.getByName(dataTypeName);
await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, dataTypeName, dataTypeData.id);
const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, dataTypeName, dataTypeData.id);
await umbracoApi.document.createDefaultDocument(contentName, documentTypeId);
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.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([]);
});

Expand All @@ -61,14 +63,12 @@ test('can create content with the custom checkbox list data type', async ({umbra
const customDataTypeName = 'CustomCheckboxList';
const optionValues = ['testOption1', 'testOption2'];
const customDataTypeId = await umbracoApi.dataType.createCheckboxListDataType(customDataTypeName, optionValues);
await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, customDataTypeName, customDataTypeId);
const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, customDataTypeName, customDataTypeId);
await umbracoApi.document.createDefaultDocument(contentName, documentTypeId);
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.goToContentWithName(contentName);
await umbracoUi.content.chooseCheckboxListOption(optionValues[0]);
await umbracoUi.content.clickSaveAndPublishButton();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,10 @@ const contentPickerDocumentTypeName = 'DocumentTypeForContentPicker';
const contentPickerName = 'TestContentPicker';
let contentPickerDocumentTypeId = '';

test.beforeEach(async ({umbracoApi, umbracoUi}) => {
test.beforeEach(async ({umbracoApi}) => {
await umbracoApi.documentType.ensureNameNotExists(documentTypeName);
await umbracoApi.document.ensureNameNotExists(contentName);
contentPickerDocumentTypeId = await umbracoApi.documentType.createDefaultDocumentTypeWithAllowAsRoot(contentPickerDocumentTypeName);
await umbracoUi.goToBackOffice();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why was this removed from the beforeEach?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because we need to go to the back office after creating the content in some tests, this step should be defined in each test rather than in the beforeEach

});

test.afterEach(async ({umbracoApi}) => {
Expand All @@ -24,9 +23,11 @@ test.afterEach(async ({umbracoApi}) => {

test('can create content with the content picker datatype', {tag: '@smoke'}, async ({umbracoApi, umbracoUi}) => {
// Arrange
const expectedState = 'Draft';
const dataTypeData = await umbracoApi.dataType.getByName(dataTypeName);
await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, dataTypeName, dataTypeData.id);
const contentPickerId = await umbracoApi.document.createDefaultDocument(contentPickerName, contentPickerDocumentTypeId);
await umbracoUi.goToBackOffice();
await umbracoUi.content.goToSection(ConstantHelper.sections.content);

// Act
Expand All @@ -38,47 +39,49 @@ test('can create content with the content picker datatype', {tag: '@smoke'}, asy
await umbracoUi.content.clickSaveButton();

// Assert
await umbracoUi.content.doesSuccessNotificationsHaveCount(1);
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[0].value).toEqual(contentPickerId);
});

test('can publish content with the content picker data type', async ({umbracoApi, umbracoUi}) => {
// Arrange
const expectedState = 'Published';
const dataTypeData = await umbracoApi.dataType.getByName(dataTypeName);
await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, dataTypeName, dataTypeData.id);
const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, dataTypeName, dataTypeData.id);
await umbracoApi.document.createDefaultDocument(contentName, documentTypeId);
const contentPickerId = await umbracoApi.document.createDefaultDocument(contentPickerName, contentPickerDocumentTypeId);
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.goToContentWithName(contentName);
await umbracoUi.content.addContentPicker(contentPickerName);
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[0].value).toEqual(contentPickerId);
});

test('can open content picker in the content', async ({umbracoApi, umbracoUi}) => {
// Arrange
const customDataTypeName = 'CustomContentPicker';
const customDataTypeId = await umbracoApi.dataType.createContentPickerDataTypeWithShowOpenButton(customDataTypeName);
await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, customDataTypeName, customDataTypeId);
const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, customDataTypeName, customDataTypeId);
await umbracoApi.document.createDefaultDocument(contentName, documentTypeId);
// Create content to pick
await umbracoApi.document.createDefaultDocument(contentPickerName, contentPickerDocumentTypeId);
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.goToContentWithName(contentName);
await umbracoUi.content.addContentPicker(contentPickerName);

// Assert
Expand All @@ -97,19 +100,18 @@ test('can choose start node for the content picker in the content', async ({umbr
const childContentPickerName = 'TestChildContentPicker';
await umbracoApi.documentType.ensureNameNotExists(childContentPickerDocumentTypeName);
const childContentPickerDocumentTypeId = await umbracoApi.documentType.createDefaultDocumentType(childContentPickerDocumentTypeName);
const contentPickerDocumentTypeId = await umbracoApi.documentType.createDocumentTypeWithAllowedChildNode(contentPickerName, childContentPickerDocumentTypeId);
contentPickerDocumentTypeId = await umbracoApi.documentType.createDocumentTypeWithAllowedChildNode(contentPickerName, childContentPickerDocumentTypeId);
const contentPickerId = await umbracoApi.document.createDefaultDocument(contentPickerName, contentPickerDocumentTypeId);
await umbracoApi.document.createDefaultDocumentWithParent(childContentPickerName, childContentPickerDocumentTypeId, contentPickerId);
// Create a custom content picker with start node
const customDataTypeId = await umbracoApi.dataType.createContentPickerDataTypeWithStartNode(customDataTypeName, contentPickerId);
await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, customDataTypeName, customDataTypeId);
const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, customDataTypeName, customDataTypeId);
await umbracoApi.document.createDefaultDocument(contentName, documentTypeId);
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.goToContentWithName(contentName);
await umbracoUi.content.clickChooseButton();

// Assert
Expand All @@ -128,19 +130,18 @@ test.skip('can ignore user start node for the content picker in the content', as
const childContentPickerName = 'TestChildContentPicker';
await umbracoApi.documentType.ensureNameNotExists(childContentPickerDocumentTypeName);
const childContentPickerDocumentTypeId = await umbracoApi.documentType.createDefaultDocumentType(childContentPickerDocumentTypeName);
const contentPickerDocumentTypeId = await umbracoApi.documentType.createDocumentTypeWithAllowedChildNode(contentPickerName, childContentPickerDocumentTypeId);
contentPickerDocumentTypeId = await umbracoApi.documentType.createDocumentTypeWithAllowedChildNode(contentPickerName, childContentPickerDocumentTypeId);
const contentPickerId = await umbracoApi.document.createDefaultDocument(contentPickerName, contentPickerDocumentTypeId);
await umbracoApi.document.createDefaultDocumentWithParent(childContentPickerName, childContentPickerDocumentTypeId, contentPickerId);
// Create a custom content picker with the setting "ignore user start node" is enable
const customDataTypeId = await umbracoApi.dataType.createContentPickerDataTypeWithIgnoreUserStartNodes(customDataTypeName, contentPickerId);
await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, customDataTypeName, customDataTypeId);
const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, customDataTypeName, customDataTypeId);
await umbracoApi.document.createDefaultDocument(contentName, documentTypeId);
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.goToContentWithName(contentName);
await umbracoUi.content.clickChooseButton();

// Assert
Expand All @@ -158,6 +159,7 @@ test('can remove content picker in the content', async ({umbracoApi, umbracoUi})
const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, dataTypeName, dataTypeData.id);
const contentPickerId = await umbracoApi.document.createDefaultDocument(contentPickerName, contentPickerDocumentTypeId);
await umbracoApi.document.createDocumentWithContentPicker(contentName, documentTypeId, contentPickerId);
await umbracoUi.goToBackOffice();
await umbracoUi.content.goToSection(ConstantHelper.sections.content);

// Act
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ for (const dataTypeName of dataTypeNames) {

test(`can create content with the ${dataTypeName} 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.content.goToSection(ConstantHelper.sections.content);
Expand All @@ -35,26 +36,27 @@ for (const dataTypeName of dataTypeNames) {
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 ${dataTypeName} data type`, async ({umbracoApi, umbracoUi}) => {
// Arrange
const expectedState = 'Published';
const dataTypeData = await umbracoApi.dataType.getByName(dataTypeName);
await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, dataTypeName, dataTypeData.id);
const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, dataTypeName, dataTypeData.id);
await umbracoApi.document.createDefaultDocument(contentName, documentTypeId);
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.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([]);
});

Expand All @@ -65,14 +67,12 @@ for (const dataTypeName of dataTypeNames) {
const selectedOptions = dataTypeName === 'Dropdown' ? [optionValues[0]] : optionValues;
const isMultiple = dataTypeName === 'Dropdown' ? false : true;
const customDataTypeId = await umbracoApi.dataType.createDropdownDataType(customDataTypeName, isMultiple, optionValues);
await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, customDataTypeName, customDataTypeId);
const documentTypeId = await umbracoApi.documentType.createDocumentTypeWithPropertyEditor(documentTypeName, customDataTypeName, customDataTypeId);
await umbracoApi.document.createDefaultDocument(contentName, documentTypeId);
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.goToContentWithName(contentName);
await umbracoUi.content.chooseDropdownOption(selectedOptions);
await umbracoUi.content.clickSaveAndPublishButton();

Expand Down
Loading
Loading