Many practical applications (e.g., coating, painting, printing, or agrochemical spraying) involve depositing complex fluids onto a solid substrate using a predominantly uniaxial extensional flow. In this work, we conduct experiments by gradually depositing non-Newtonian surfactant fluids onto a horizontal solid substrate via a vertical needle. We investigate the extent to which, the spreading dynamics of the fluid contact line on the solid substrate can affect the thinning dynamics of the fluid filament formed between the needle and the substrate. Our work considers two model viscoelastic surfactant fluids based on cetylpyridinium chloride and sodium salicylate (CPyCl/NaSal) and octadecyltrimethylammonium bromide and sodium oleate (C(8)TAB/NaOA) in deionized water. Experiments are performed using two flat substrates: a big substrate, where fluid contact line is free to move, and a finite-size substrate, where fluid contact line is pinned. The fluid wetting on the substrate is characterized by measuring the contact-line velocity and dynamic contact angle, while the extensional flow is evaluated by measuring the fluid midfilament diameter. Two novel regimes are identified: In regime I, fluid wetting and filament pinch-off dynamics are independent, while in regime II, the fluid wetting significantly affects the extensional flows by lowering the material extensional relaxation times and Trouton ratios. Our analysis shows that spreading of these viscoelastic surfactant fluids are surprisingly well captured by Tanner's law suggested for spreading of a Newtonian fluid on solid substrates. Finally, we propose a scaling analysis based on a combination of the wetting forces and viscous dissipation that can successfully explain the effects of wetting on filament pinch-off dynamics.