Skip to content

Commit

Permalink
V15 QA Fixing the failing tests in the pipeline (umbraco#17718)
Browse files Browse the repository at this point in the history
* Updated tests for content with media picker

* Fixed tests for content with multi url picker

* Skip tests for update action permission as it is removed now

* Fixed tests for list view media

* Fixed notification

* Updated method name due to api helper changes

* Fixed tests for welcome

* Fixed test for deleting a tab in a document type

* Updated expectation test result due to UI changes

* Updated create stylesheet method

* Fixed tests due to the action for selecting media item changes

* Bumped version

* Fixed expected result

* Fixed due to test helper changes

* Added more waits
  • Loading branch information
nhudinh0309 authored Dec 11, 2024
1 parent dc2dc09 commit de92f1c
Show file tree
Hide file tree
Showing 16 changed files with 43 additions and 59 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ test('can add an image to the image media picker', async ({umbracoApi, umbracoUi

// Act
await umbracoUi.content.goToContentWithName(contentName);
await umbracoUi.content.selectMediaByName(mediaName);
await umbracoUi.content.clickChooseButtonAndSelectMediaWithName(mediaName);
await umbracoUi.content.clickSubmitButton();
await umbracoUi.content.clickSaveButton();

Expand Down Expand Up @@ -141,7 +141,7 @@ test.skip('image count can not be more than max amount set in image media picker

// Act
await umbracoUi.content.goToContentWithName(contentName);
await umbracoUi.content.selectMediaByName(mediaName);
await umbracoUi.content.clickChooseButtonAndSelectMediaWithName(mediaName);
await umbracoUi.content.clickSubmitButton();
await umbracoUi.content.clickSaveButton();

Expand All @@ -167,7 +167,7 @@ test('can add an image from the image media picker with a start node', async ({u

// Act
await umbracoUi.content.goToContentWithName(contentName);
await umbracoUi.content.selectMediaByName(mediaName);
await umbracoUi.content.clickChooseButtonAndSelectMediaWithName(mediaName);
await umbracoUi.content.clickSubmitButton();
await umbracoUi.content.clickSaveButton();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ test('can create content with the media picker data type', {tag: '@smoke'}, asyn
await umbracoUi.content.clickCreateButton();
await umbracoUi.content.chooseDocumentType(documentTypeName);
await umbracoUi.content.enterContentName(contentName);
await umbracoUi.content.selectMediaByName(mediaFileName);
await umbracoUi.content.clickChooseButtonAndSelectMediaWithName(mediaFileName);
await umbracoUi.content.clickSubmitButton();
await umbracoUi.content.clickSaveButton();

Expand Down Expand Up @@ -63,7 +63,7 @@ test('can publish content with the media picker data type', async ({umbracoApi,
await umbracoUi.content.clickCreateButton();
await umbracoUi.content.chooseDocumentType(documentTypeName);
await umbracoUi.content.enterContentName(contentName);
await umbracoUi.content.selectMediaByName(mediaFileName);
await umbracoUi.content.clickChooseButtonAndSelectMediaWithName(mediaFileName);
await umbracoUi.content.clickSubmitButton();
await umbracoUi.content.clickSaveAndPublishButton();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ test('can create content with the document link', {tag: '@smoke'}, async ({page,
expect(contentData.values[0].value[0].icon).toEqual('icon-document');
expect(contentData.values[0].value[0].target).toBeNull();
expect(contentData.values[0].value[0].unique).toEqual(linkedDocumentId);
// Uncomment this when the front-end is ready. Currently the link title is not auto filled after choosing document to link
//expect(contentData.values[0].value[0].name).toEqual(linkedDocumentId);
expect(contentData.values[0].value[0].name).toEqual(linkedDocumentName);

// Clean
await umbracoApi.documentType.ensureNameNotExists(documentTypeForLinkedDocumentName);
Expand Down Expand Up @@ -99,8 +98,7 @@ test('can publish content with the document link', async ({umbracoApi, umbracoUi
expect(contentData.values[0].value[0].icon).toEqual('icon-document');
expect(contentData.values[0].value[0].target).toBeNull();
expect(contentData.values[0].value[0].unique).toEqual(linkedDocumentId);
// Uncomment this when the front-end is ready. Currently the link title is not auto filled after choosing document to link
//expect(contentData.values[0].value[0].name).toEqual(linkedDocumentId);
expect(contentData.values[0].value[0].name).toEqual(linkedDocumentName);

// Clean
await umbracoApi.documentType.ensureNameNotExists(documentTypeForLinkedDocumentName);
Expand Down Expand Up @@ -166,8 +164,7 @@ test('can create content with the media link', async ({umbracoApi, umbracoUi}) =
expect(contentData.values[0].value[0].type).toEqual('media');
expect(contentData.values[0].value[0].icon).toEqual('icon-picture');
expect(contentData.values[0].value[0].unique).toEqual(mediaFileId);
// Uncomment this when the front-end is ready. Currently the link title is not auto filled after choosing media to link
//expect(contentData.values[0].value[0].name).toEqual(mediaFileName);
expect(contentData.values[0].value[0].name).toEqual(mediaFileName);

// Clean
await umbracoApi.media.ensureNameNotExists(mediaFileName);
Expand Down Expand Up @@ -211,8 +208,7 @@ test('can add multiple links in the content', async ({umbracoApi, umbracoUi}) =>
expect(contentData.values[0].value[0].type).toEqual('media');
expect(contentData.values[0].value[0].icon).toEqual('icon-picture');
expect(contentData.values[0].value[0].unique).toEqual(mediaFileId);
// Uncomment this when the front-end is ready. Currently the link title is not auto filled after choosing media to link
//expect(contentData.values[0].value[0].name).toEqual(mediaFileName);
expect(contentData.values[0].value[0].name).toEqual(mediaFileName);
// Verify the information of the second URL picker
expect(contentData.values[0].value[1].type).toEqual('external');
expect(contentData.values[0].value[1].icon).toEqual('icon-link');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ test('can add multiple images to the multiple image media picker', async ({umbra
// Act
await umbracoUi.content.goToContentWithName(contentName);
await umbracoUi.content.clickChooseMediaPickerButton();
await umbracoUi.content.clickMediaByNameInMediaPicker(firstMediaFileName);
await umbracoUi.content.clickMediaByNameInMediaPicker(secondMediaFileName);
await umbracoUi.content.selectMediaWithName(firstMediaFileName);
await umbracoUi.content.selectMediaWithName(secondMediaFileName);
await umbracoUi.content.clickSubmitButton();
await umbracoUi.content.clickSaveButton();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ test('can add multiple media files to the multiple media picker', async ({umbrac
// Act
await umbracoUi.content.goToContentWithName(contentName);
await umbracoUi.content.clickChooseMediaPickerButton();
await umbracoUi.content.clickMediaByNameInMediaPicker(firstMediaFileName);
await umbracoUi.content.clickMediaByNameInMediaPicker(secondMediaFileName);
await umbracoUi.content.selectMediaWithName(firstMediaFileName);
await umbracoUi.content.selectMediaWithName(secondMediaFileName);
await umbracoUi.content.clickSubmitButton();
await umbracoUi.content.clickSaveButton();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ test('can add culture and hostname for multiple languages', async ({umbracoApi,
await umbracoUi.content.enterDomain(secondDomainName, 1);
await umbracoUi.content.selectDomainLanguageOption(secondLanguageName, 1);
await umbracoUi.content.clickSaveModalButton();
await umbracoUi.waitForTimeout(500);

// Assert
const domainsData = await umbracoApi.document.getDomains(contentId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,8 @@ for (const listViewType of listViewTypes) {
expect(dataTypeData.values).toContainEqual(expectedDataTypeValues);
});

test('can update bulk action permission', async ({umbracoApi, umbracoUi}) => {
// Skip this test as currently there is no setting for bulk action permission
test.skip('can update bulk action permission', async ({umbracoApi, umbracoUi}) => {
// Arrange
const bulkActionPermissionValue = 'Allow bulk trash';
const expectedDataTypeValues = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,20 +100,10 @@ test('can disable one view in the media section', async ({umbracoApi, umbracoUi}
});

test('can allow bulk trash in the media section', async ({umbracoApi, umbracoUi}) => {
// Arrange
const updatedValue = {
"allowBulkPublish": false,
"allowBulkUnpublish": false,
"allowBulkCopy": false,
"allowBulkDelete": true,
"allowBulkMove": false
};

// Act
await umbracoApi.dataType.updateListViewMediaDataType('bulkActionPermissions', updatedValue);
await umbracoUi.media.goToSection(ConstantHelper.sections.media);
await umbracoUi.media.selectMediaByName(firstMediaFileName);
await umbracoUi.media.selectMediaByName(secondMediaFileName);
await umbracoUi.media.selectMediaWithName(firstMediaFileName);
await umbracoUi.media.selectMediaWithName(secondMediaFileName);
await umbracoUi.media.clickBulkTrashButton();
await umbracoUi.media.clickConfirmTrashButton();

Expand All @@ -127,24 +117,17 @@ test('can allow bulk trash in the media section', async ({umbracoApi, umbracoUi}
await umbracoUi.media.isItemVisibleInRecycleBin(secondMediaFileName, true, false);
});

test('can allow bulk move in the media section', async ({umbracoApi, umbracoUi}) => {
// TODO: Remove skip when update code to select media successfully.
test.skip('can allow bulk move in the media section', async ({umbracoApi, umbracoUi}) => {
// Arrange
const mediaFolderName = 'Test Folder Name';
const updatedValue = {
"allowBulkPublish": false,
"allowBulkUnpublish": false,
"allowBulkCopy": false,
"allowBulkDelete": false,
"allowBulkMove": true
};
await umbracoApi.media.ensureNameNotExists(mediaFolderName);
const mediaFolderId = await umbracoApi.media.createDefaultMediaFolder(mediaFolderName);

// Act
await umbracoApi.dataType.updateListViewMediaDataType('bulkActionPermissions', updatedValue);
await umbracoUi.media.goToSection(ConstantHelper.sections.media);
await umbracoUi.media.selectMediaByName(firstMediaFileName);
await umbracoUi.media.selectMediaByName(secondMediaFileName);
await umbracoUi.media.selectMediaWithName(firstMediaFileName);
await umbracoUi.media.selectMediaWithName(secondMediaFileName);
await umbracoUi.media.clickBulkMoveToButton();
await umbracoUi.media.clickCaretButtonForName('Media');
await umbracoUi.media.clickModalTextByName(mediaFolderName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ test('can trash a folder', async ({umbracoApi, umbracoUi}) => {
await umbracoUi.media.clickConfirmTrashButton();

// Assert
await umbracoUi.media.doesSuccessNotificationHaveText(NotificationConstantHelper.success.folderDeleted);
await umbracoUi.media.doesSuccessNotificationHaveText(NotificationConstantHelper.success.movedToRecycleBin);
await umbracoUi.media.isTreeItemVisible(folderName, false);
expect(await umbracoApi.media.doesNameExist(folderName)).toBeFalsy();
});
Expand Down Expand Up @@ -155,11 +155,11 @@ test('can search for a media file', async ({umbracoApi, umbracoUi}) => {
await umbracoUi.media.goToSection(ConstantHelper.sections.media);

// Act
await umbracoUi.media.searchForMediaItemByName(mediaFileName);
await umbracoUi.media.searchForMediaItemByName(secondMediaFile);

// Assert
await umbracoUi.media.doesMediaCardsContainAmount(1);
await umbracoUi.media.doesMediaCardContainText(mediaFileName);
await umbracoUi.media.doesMediaCardContainText(secondMediaFile);

// Clean
await umbracoApi.media.ensureNameNotExists(secondMediaFile);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
// await umbracoUi.package.clickCreatePackageButton();
// await umbracoUi.package.enterPackageName(packageName);
// await umbracoUi.package.clickAddMediaToPackageButton();
// await umbracoUi.media.selectMediaByName(mediaName);
// await umbracoUi.media.selectMediaWithName(mediaName);
// await umbracoUi.package.clickSubmitButton();
// await umbracoUi.package.clickCreateButton();
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ test.beforeEach(async ({umbracoUi}) => {

test('can click on buttons', async ({umbracoUi}) => {
// Arrange
const getTheHelpYouNeedDocumentationUrl = 'https://docs.umbraco.com/umbraco-cms/umbraco-cms';
const goToTheForumUrl = 'https://our.umbraco.com/forum';
const getTheHelpYouNeedDocumentationUrl = 'https://docs.umbraco.com/umbraco-cms';
const goToTheForumUrl = 'https://our.umbraco.com/forum/';
const chatWithTheCommunityUrl = 'https://discord.umbraco.com';
const getCertifiedUrl = 'https://umbraco.com/training/';
const getTheHelpYouNeedSupportUrl = 'https://umbraco.com/support/';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,11 @@ test('can delete a tab in a document type', async ({umbracoApi, umbracoUi}) => {
await umbracoUi.documentType.clickConfirmToDeleteButton();
await umbracoUi.documentType.clickSaveButton();

await umbracoApi.documentType.getByName(documentTypeName);
// Assert
await umbracoUi.documentType.isSuccessNotificationVisible();
expect(await umbracoApi.documentType.doesNameExist(documentTypeName)).toBeTruthy();
const documentTypeData = await umbracoApi.documentType.getByName(documentTypeName);
expect(documentTypeData.containers.length).toBe(0);
});

test('can delete a property editor in a document type', {tag: '@smoke'}, async ({umbracoApi, umbracoUi}) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,23 @@ test('can create an empty partial view', {tag: '@smoke'}, async ({umbracoApi, um

test('can create a partial view from snippet', async ({umbracoApi, umbracoUi}) => {
// Arrange
const expectedPartialViewContentWindows = '@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage\r\n@using Umbraco.Cms.Core.Routing\r\n@using Umbraco.Extensions\r\n\n@inject IPublishedUrlProvider PublishedUrlProvider\r\n@*\r\n This snippet makes a breadcrumb of parents using an unordered HTML list.\r\n\r\n How it works:\r\n - It uses the Ancestors() method to get all parents and then generates links so the visitor can go back\r\n - Finally it outputs the name of the current page (without a link)\r\n*@\r\n\r\n@{ var selection = Model.Ancestors().ToArray(); }\r\n\r\n@if (selection?.Length > 0)\r\n{\r\n <ul class=\"breadcrumb\">\r\n @* For each page in the ancestors collection which have been ordered by Level (so we start with the highest top node first) *@\r\n @foreach (var item in selection.OrderBy(x => x.Level))\r\n {\r\n <li><a href=\"@item.Url(PublishedUrlProvider)\">@item.Name</a> <span class=\"divider\">/</span></li>\r\n }\r\n\r\n @* Display the current page as the last item in the list *@\r\n <li class=\"active\">@Model.Name</li>\r\n </ul>\r\n}';
const expectedPartialViewContentLinux = '@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage\n@using Umbraco.Cms.Core.Routing\n@using Umbraco.Extensions\n\n@inject IPublishedUrlProvider PublishedUrlProvider\n@*\n This snippet makes a breadcrumb of parents using an unordered HTML list.\n\n How it works:\n - It uses the Ancestors() method to get all parents and then generates links so the visitor can go back\n - Finally it outputs the name of the current page (without a link)\n*@\n\n@{ var selection = Model.Ancestors().ToArray(); }\n\n@if (selection?.Length > 0)\n{\n <ul class=\"breadcrumb\">\n @* For each page in the ancestors collection which have been ordered by Level (so we start with the highest top node first) *@\n @foreach (var item in selection.OrderBy(x => x.Level))\n {\n <li><a href=\"@item.Url(PublishedUrlProvider)\">@item.Name</a> <span class=\"divider\">/</span></li>\n }\n\n @* Display the current page as the last item in the list *@\n <li class=\"active\">@Model.Name</li>\n </ul>\n}';
const expectedPartialViewContentWindows = '@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage\r\n@using Umbraco.Cms.Core.PublishedCache\r\n@using Umbraco.Cms.Core.Routing\r\n@using Umbraco.Cms.Core.Services.Navigation\r\n\n@inject IPublishedContentCache PublishedContentCache\r\n@inject IDocumentNavigationQueryService DocumentNavigationQueryService\r\n@inject IPublishedUrlProvider PublishedUrlProvider\r\n@*\r\n This snippet makes a breadcrumb of parents using an unordered HTML list.\r\n\r\n How it works:\r\n - It uses the Ancestors method to get all parents and then generates links so the visitor can go back\r\n - Finally it outputs the name of the current page (without a link)\r\n*@\r\n\r\n@{ var selection = Model.Ancestors(PublishedContentCache, DocumentNavigationQueryService).ToArray(); }\r\n\r\n@if (selection?.Length > 0)\r\n{\r\n <ul class=\"breadcrumb\">\r\n @* For each page in the ancestors collection which have been ordered by Level (so we start with the highest top node first) *@\r\n @foreach (var item in selection.OrderBy(x => x.Level))\r\n {\r\n <li><a href=\"@item.Url(PublishedUrlProvider)\">@item.Name</a> <span class=\"divider\">/</span></li>\r\n }\r\n\r\n @* Display the current page as the last item in the list *@\r\n <li class=\"active\">@Model.Name</li>\r\n </ul>\r\n}';
const expectedPartialViewContentLinux = '@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage\n@using Umbraco.Cms.Core.PublishedCache\n@using Umbraco.Cms.Core.Routing\n@using Umbraco.Cms.Core.Services.Navigation\n\n@inject IPublishedContentCache PublishedContentCache\n@inject IDocumentNavigationQueryService DocumentNavigationQueryService\n@inject IPublishedUrlProvider PublishedUrlProvider\n@*\n This snippet makes a breadcrumb of parents using an unordered HTML list.\n\n How it works:\n - It uses the Ancestors method to get all parents and then generates links so the visitor can go back\n - Finally it outputs the name of the current page (without a link)\n*@\n\n@{ var selection = Model.Ancestors(PublishedContentCache, DocumentNavigationQueryService).ToArray(); }\n\n@if (selection?.Length > 0)\n{\n <ul class=\"breadcrumb\">\n @* For each page in the ancestors collection which have been ordered by Level (so we start with the highest top node first) *@\n @foreach (var item in selection.OrderBy(x => x.Level))\n {\n <li><a href=\"@item.Url(PublishedUrlProvider)\">@item.Name</a> <span class=\"divider\">/</span></li>\n }\n\n @* Display the current page as the last item in the list *@\n <li class=\"active\">@Model.Name</li>\n </ul>\n}';

// Act
await umbracoUi.partialView.clickActionsMenuAtRoot();
await umbracoUi.partialView.clickCreateButton();
await umbracoUi.partialView.clickNewPartialViewFromSnippetButton();
await umbracoUi.partialView.clickBreadcrumbButton();
await umbracoUi.partialView.enterPartialViewName(partialViewName);
await umbracoUi.waitForTimeout(500);
await umbracoUi.partialView.clickSaveButton();

// Assert
await umbracoUi.partialView.doesSuccessNotificationHaveText(NotificationConstantHelper.success.created);
expect(await umbracoApi.partialView.doesExist(partialViewFileName)).toBeTruthy();
const partialViewData = await umbracoApi.partialView.getByName(partialViewFileName);
console.log(partialViewData.content);

switch (process.platform) {
case 'win32':
Expand Down
Loading

0 comments on commit de92f1c

Please sign in to comment.