Skip to content

Commit 0442ddc

Browse files
authored
V16 Added acceptance tests for the regression issue #16985 (#19712)
* Updated tests for adding a thumbnail to a block grid * Added tests for adding a block thumbnail * Make tests run in the pipeline * Reverted npm command
1 parent 3b04d54 commit 0442ddc

File tree

2 files changed

+24
-7
lines changed

2 files changed

+24
-7
lines changed

tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/DataType/BlockGrid/Block/BlockGridBlockAdvanced.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -240,27 +240,27 @@ test('can remove a icon color from a block', async ({umbracoApi, umbracoUi}) =>
240240
expect(await umbracoApi.dataType.doesBlockEditorBlockContainIconColor(blockGridEditorName, contentElementTypeId, '')).toBeTruthy();
241241
});
242242

243-
// TODO: Remove skip when the code is updated due to UI changes
244-
test.skip('can add a thumbnail to a block', async ({umbracoApi, umbracoUi}) => {
243+
test('can add a thumbnail to a block', {tag: '@smoke'}, async ({umbracoApi, umbracoUi}) => {
245244
// Arrange
246245
const mediaName = 'TestMedia';
247246
await umbracoApi.media.ensureNameNotExists(mediaName);
248-
await umbracoApi.media.createDefaultMediaWithImage(mediaName);
247+
const mediaId = await umbracoApi.media.createDefaultMediaWithImage(mediaName);
249248
const textStringData = await umbracoApi.dataType.getByName(dataTypeName);
250249
const contentElementTypeId = await umbracoApi.documentType.createDefaultElementType(elementTypeName, groupName, dataTypeName, textStringData.id);
251250
await umbracoApi.dataType.createBlockGridWithABlock(blockGridEditorName, contentElementTypeId);
252-
const mediaUrl = await umbracoApi.media.getMediaPathByName(mediaName);
251+
const mediaUrl = await umbracoApi.media.getMediaUrl(mediaId);
253252

254253
// Act
255254
await umbracoUi.dataType.goToDataType(blockGridEditorName);
256255
await umbracoUi.dataType.goToBlockWithName(elementTypeName);
257256
await umbracoUi.dataType.goToBlockAdvancedTab();
258-
await umbracoUi.dataType.chooseBlockThumbnailWithPath(mediaUrl.fileName, mediaUrl.mediaPath);
257+
await umbracoUi.dataType.chooseBlockThumbnailWithPath(mediaUrl);
259258
await umbracoUi.dataType.clickSubmitButton();
260259
await umbracoUi.dataType.clickSaveButton();
261260

262261
// Assert
263262
await umbracoUi.dataType.isSuccessStateVisibleForSaveButton();
263+
await umbracoUi.dataType.doesBlockHaveThumbnailImage(mediaUrl);
264264
});
265265

266266
// TODO: Remove skip when the code is updated. Currently it is missing the assertion steps

tests/Umbraco.Tests.AcceptanceTest/tests/DefaultConfig/DataType/BlockListEditor/BlockListBlocks.spec.ts

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -414,9 +414,26 @@ test('can disable hide content editor in a block', async ({umbracoApi, umbracoUi
414414
expect(blockData.values[0].value[0].forceHideContentEditorInOverlay).toEqual(false);
415415
});
416416

417-
// TODO: Thumbnails are not showing in the UI
418-
test.skip('can add a thumbnail to a block ', {tag: '@smoke'}, async ({umbracoApi, umbracoUi}) => {
417+
test('can add a thumbnail to a block', {tag: '@release'}, async ({umbracoApi, umbracoUi}) => {
418+
// Arrange
419+
const mediaName = 'TestMedia';
420+
await umbracoApi.media.ensureNameNotExists(mediaName);
421+
const mediaId = await umbracoApi.media.createDefaultMediaWithImage(mediaName);
422+
const textStringData = await umbracoApi.dataType.getByName(dataTypeName);
423+
const contentElementTypeId = await umbracoApi.documentType.createDefaultElementType(elementTypeName, groupName, dataTypeName, textStringData.id);
424+
await umbracoApi.dataType.createBlockListDataTypeWithABlock(blockListEditorName, contentElementTypeId);
425+
const mediaUrl = await umbracoApi.media.getMediaUrl(mediaId);
419426

427+
// Act
428+
await umbracoUi.dataType.goToDataType(blockListEditorName);
429+
await umbracoUi.dataType.goToBlockWithName(elementTypeName);
430+
await umbracoUi.dataType.chooseBlockThumbnailWithPath(mediaUrl);
431+
await umbracoUi.dataType.clickSubmitButton();
432+
await umbracoUi.dataType.clickSaveButton();
433+
434+
// Assert
435+
await umbracoUi.dataType.isSuccessStateVisibleForSaveButton();
436+
await umbracoUi.dataType.doesBlockHaveThumbnailImage(mediaUrl);
420437
});
421438

422439
// TODO: Thumbnails are not showing in the UI

0 commit comments

Comments
 (0)