add_action( 'elementor/query/random_testimonial', function( $query ) {

    $query->set( 'post_type', 'testimonial' );

    $query->set( 'posts_per_page', 1 );

    $query->set( 'orderby', 'rand' );

} );

add_action( 'elementor/query/testimonials', function( $query ) {

    $query->set( 'post_type', 'testimonial' );

    $query->set( 'posts_per_page', -1 );

    $query->set( 'orderby', 'rand' );

} );