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

#1703: The deleted tags are not removed from Tags drop-down until the web page is refreshed #29400

Merged
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
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
@@ -0,0 +1,45 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->

<tests xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:mftf:Test/etc/testSchema.xsd">
<test name="AdminEnhancedMediaGalleryVerifyUpdatedTagsTest">
<annotations>
<features value="MediaGallery"/>
<useCaseId value="https://github.com/magento/adobe-stock-integration/issues/1703"/>
<title value="User checks if the deleted tags are removed from Edit page, Tags field"/>
<stories value="User checks if the deleted tags are removed from Edit page, Tags field"/>
<testCaseId value="https://studio.cucumber.io/projects/131313/test-plan/folders/1337102/scenarios/5064888"/>
<description value="User checks if changes made on the tags are updated from Edit page, Tags field"/>
<severity value="CRITICAL"/>
<group value="media_gallery_ui"/>
</annotations>
<before>
<actionGroup ref="AdminLoginActionGroup" stepKey="loginAsAdmin"/>
<actionGroup ref="AdminOpenStandaloneMediaGalleryActionGroup" stepKey="openMediaGallery"/>
</before>
<after>
<actionGroup ref="AdminEnhancedMediaGalleryImageDetailsDeleteActionGroup" stepKey="deleteImage"/>
</after>
<actionGroup ref="AdminEnhancedMediaGalleryUploadImageActionGroup" stepKey="uploadImage">
<argument name="image" value="ImageUpload"/>
</actionGroup>
<actionGroup ref="AdminEnhancedMediaGalleryImageDetailsEditActionGroup" stepKey="editImage"/>
Copy link
Member

Choose a reason for hiding this comment

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

I think AdminEnhancedMediaGalleryViewImageDetails should be executed before this step

<actionGroup ref="AdminMediaGalleryEditAssetAddKeywordActionGroup" stepKey="setKeywords">
<argument name="keyword" value="UpdatedImageDetails.keyword"/>
</actionGroup>
<actionGroup ref="AdminEnhancedMediaGalleryImageDetailsSaveActionGroup" stepKey="saveImage">
<argument name="image" value="UpdatedImageDetails"/>
</actionGroup>
<actionGroup ref="AdminEnhancedMediaGalleryVerifyImageKeywordsActionGroup" stepKey="verifyAddedKeywords">
<argument name="keywords" value="UpdatedImageDetails.keyword"/>
</actionGroup>
<actionGroup ref="AdminEnhancedMediaGalleryVerifyImageKeywordsActionGroup" stepKey="verifyMetadataKeywords">
Copy link
Member

Choose a reason for hiding this comment

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

Can you please also verify the removal of the keyword

<argument name="keywords" value="ImageMetadata.keywords"/>
</actionGroup>
</test>
</tests>
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ define([
form = modalElement.find('#image-edit-details-form'),
imageId = this.imageModel().getSelected().id,
keywords = this.mediaGalleryEditDetails().selectedKeywords(),
imageDetails = this.mediaGalleryImageDetails();
imageDetails = this.mediaGalleryImageDetails(),
imageEditDetails = this.mediaGalleryEditDetails();

if (form.validation('isValid')) {
saveDetails(
Expand All @@ -98,6 +99,7 @@ define([
this.closeModal();
this.imageModel().reloadGrid();
imageDetails.removeCached(imageId);
imageEditDetails.removeCached(imageId, keywords);

if (imageDetails.isActive()) {
imageDetails.showImageDetailsById(imageId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,16 @@ define([
}

return true;
},

/**
* Remove cached image details in edit form
*
* @param {String} id
* @param {String} tags
*/
removeCached: function (id, tags) {
Copy link
Member

Choose a reason for hiding this comment

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

I would simply remove cached image and rely on reloading from the backend to make sure frontend and backend are on the same page

this.images[id].tags = tags;
}
});
});