@@ -158,3 +158,35 @@ test.fixme('can not publish a mandatory media picker with an empty value', async
158
158
expect ( contentData . values [ 0 ] . value [ 0 ] . focalPoint ) . toBeNull ( ) ;
159
159
expect ( contentData . values [ 0 ] . value [ 0 ] . crops ) . toEqual ( [ ] ) ;
160
160
} ) ;
161
+
162
+ // This is a test for the regression issue #10431
163
+ test ( 'can add a media image to a media picker in variant content, remove it and then add it again' , async ( { umbracoApi, umbracoUi} ) => {
164
+ // Arrange
165
+ const dataTypeData = await umbracoApi . dataType . getByName ( dataTypeName ) ;
166
+ const documentTypeId = await umbracoApi . documentType . createDocumentTypeWithPropertyEditor ( documentTypeName , dataTypeName , dataTypeData . id , 'Test Group' , true , true , false ) ;
167
+ await umbracoApi . document . createDefaultDocumentWithEnglishCulture ( contentName , documentTypeId ) ;
168
+ const mediaFileId = await umbracoApi . media . createDefaultMediaWithImage ( mediaFileName ) ;
169
+ await umbracoUi . goToBackOffice ( ) ;
170
+ await umbracoUi . content . goToSection ( ConstantHelper . sections . content ) ;
171
+
172
+ // Act
173
+ await umbracoUi . content . goToContentWithName ( contentName ) ;
174
+ // Adds media item to a media picker
175
+ await umbracoUi . content . clickChooseButtonAndSelectMediaWithKey ( mediaFileId ) ;
176
+ await umbracoUi . content . clickChooseModalButton ( ) ;
177
+ await umbracoUi . content . clickSaveAndPublishButton ( ) ;
178
+ await umbracoUi . content . clickContainerSaveAndPublishButton ( ) ;
179
+ await umbracoUi . content . isSuccessStateVisibleForSaveAndPublishButton ( ) ;
180
+ // Removes media item from the media picker
181
+ await umbracoUi . content . removeMediaPickerByName ( mediaFileName ) ;
182
+ await umbracoUi . content . clickSaveAndPublishButton ( ) ;
183
+ await umbracoUi . content . clickContainerSaveAndPublishButton ( ) ;
184
+ await umbracoUi . content . isSuccessStateVisibleForSaveAndPublishButton ( ) ;
185
+
186
+ // Adds media item to a media picker again
187
+ await umbracoUi . content . clickChooseButtonAndSelectMediaWithKey ( mediaFileId ) ;
188
+ await umbracoUi . content . clickChooseModalButton ( ) ;
189
+
190
+ // Assert
191
+ await umbracoUi . content . isMediaNameVisible ( mediaFileName ) ;
192
+ } ) ;
0 commit comments