@@ -24,6 +24,7 @@ import {
24
24
adminThumbnailSizeSlug ,
25
25
animatedTypeMedia ,
26
26
audioSlug ,
27
+ customFileNameMediaSlug ,
27
28
focalOnlySlug ,
28
29
mediaSlug ,
29
30
relationPreviewSlug ,
@@ -51,6 +52,7 @@ let withMetadataURL: AdminUrlUtil
51
52
let withoutMetadataURL : AdminUrlUtil
52
53
let withOnlyJPEGMetadataURL : AdminUrlUtil
53
54
let relationPreviewURL : AdminUrlUtil
55
+ let customFileNameURL : AdminUrlUtil
54
56
55
57
describe ( 'uploads' , ( ) => {
56
58
let page : Page
@@ -74,6 +76,7 @@ describe('uploads', () => {
74
76
withoutMetadataURL = new AdminUrlUtil ( serverURL , withoutMetadataSlug )
75
77
withOnlyJPEGMetadataURL = new AdminUrlUtil ( serverURL , withOnlyJPEGMetadataSlug )
76
78
relationPreviewURL = new AdminUrlUtil ( serverURL , relationPreviewSlug )
79
+ customFileNameURL = new AdminUrlUtil ( serverURL , customFileNameMediaSlug )
77
80
78
81
const context = await browser . newContext ( )
79
82
page = await context . newPage ( )
@@ -243,6 +246,25 @@ describe('uploads', () => {
243
246
await expect ( page . locator ( '.file-details img' ) ) . toBeVisible ( )
244
247
} )
245
248
249
+ test ( 'should have custom file name for image size' , async ( ) => {
250
+ await page . goto ( customFileNameURL . create )
251
+ await page . setInputFiles ( 'input[type="file"]' , path . resolve ( dirname , './image.png' ) )
252
+
253
+ await expect ( page . locator ( '.file-field__upload .thumbnail img' ) ) . toBeVisible ( )
254
+
255
+ await saveDocAndAssert ( page )
256
+
257
+ await expect ( page . locator ( '.file-details img' ) ) . toBeVisible ( )
258
+
259
+ await page . locator ( '.file-field__previewSizes' ) . click ( )
260
+
261
+ const renamedImageSizeFile = page
262
+ . locator ( '.preview-sizes__list .preview-sizes__sizeOption' )
263
+ . nth ( 1 )
264
+
265
+ await expect ( renamedImageSizeFile ) . toContainText ( 'custom-500x500.png' )
266
+ } )
267
+
246
268
test ( 'should show draft uploads in the relation list' , async ( ) => {
247
269
await page . goto ( relationURL . list )
248
270
// from the list edit the first document
0 commit comments