@@ -308,12 +308,70 @@ describe('[api] apify push', () => {
308308 await testActorClient . version ( actorJson . version ) . update ( { buildTag : 'beta' } ) ;
309309
310310 await testRunCommand ( ActorsPushCommand , { args_actorId : testActor . id , flags_noPrompt : true } ) ;
311+ if ( testActor ) await testActorClient . delete ( ) ;
311312
312313 expect ( lastErrorMessage ( ) ) . to . includes ( 'is already on the platform' ) ;
313314 } ,
314315 TEST_TIMEOUT ,
315316 ) ;
316317
318+ it (
319+ 'should set title and description when creating a new actor' ,
320+ async ( ) => {
321+ const actorJson = JSON . parse ( readFileSync ( joinPath ( LOCAL_CONFIG_PATH ) , 'utf8' ) ) ;
322+
323+ actorJson . name = `${ actorJson . name } -title-test` ;
324+ actorJson . title = 'My Custom Actor Title' ;
325+ actorJson . description = 'This is a custom description for the actor.' ;
326+
327+ writeFileSync ( joinPath ( LOCAL_CONFIG_PATH ) , JSON . stringify ( actorJson , null , '\t' ) , { flag : 'w' } ) ;
328+ await testRunCommand ( ActorsPushCommand , { flags_noPrompt : true , flags_force : true } ) ;
329+
330+ const userInfo = await getLocalUserInfo ( ) ;
331+ const actorId = `${ userInfo . username } /${ actorJson . name } ` ;
332+ actorsForCleanup . add ( actorId ) ;
333+ const createdActorClient = testUserClient . actor ( actorId ) ;
334+ const createdActor = await createdActorClient . get ( ) ;
335+
336+ expect ( createdActor ?. title ) . to . be . eql ( 'My Custom Actor Title' ) ;
337+ expect ( createdActor ?. description ) . to . be . eql ( 'This is a custom description for the actor.' ) ;
338+
339+ if ( createdActor ) await createdActorClient . delete ( ) ;
340+ } ,
341+ TEST_TIMEOUT ,
342+ ) ;
343+
344+ it (
345+ 'should not rewrite current Actor title and description' ,
346+ async ( ) => {
347+ const testActorWithTitleDesc = {
348+ ...TEST_ACTOR ,
349+ title : 'Original Title' ,
350+ description : 'Original description.' ,
351+ } ;
352+ let testActor = await testUserClient . actors ( ) . create ( testActorWithTitleDesc ) ;
353+ actorsForCleanup . add ( testActor . id ) ;
354+ const testActorClient = testUserClient . actor ( testActor . id ) ;
355+
356+ // Remove title and description from local actor.json
357+ const actorJson = JSON . parse ( readFileSync ( joinPath ( LOCAL_CONFIG_PATH ) , 'utf8' ) ) ;
358+ delete actorJson . title ;
359+ delete actorJson . description ;
360+ writeFileSync ( joinPath ( LOCAL_CONFIG_PATH ) , JSON . stringify ( actorJson , null , '\t' ) , { flag : 'w' } ) ;
361+
362+ await testRunCommand ( ActorsPushCommand , { args_actorId : testActor . id , flags_noPrompt : true } ) ;
363+
364+ testActor = ( await testActorClient . get ( ) ) ! ;
365+
366+ if ( testActor ) await testActorClient . delete ( ) ;
367+
368+ // Title and description should be preserved from the original actor
369+ expect ( testActor . title ) . to . be . eql ( 'Original Title' ) ;
370+ expect ( testActor . description ) . to . be . eql ( 'Original description.' ) ;
371+ } ,
372+ TEST_TIMEOUT ,
373+ ) ;
374+
317375 it (
318376 'should not push Actor when there are no files to push' ,
319377 async ( ) => {
0 commit comments