With not much to go on:
- Make sure the GPIO's in your stepper()-method correspond to the correct winding of the stepper motor
- Make sure that the "Firing order" of the GPIO's is correct
- Make sure there's enough juice to drive the stepper motor windings
Better first create (or find) a test project consisting of a controller (an actual Arduino or an ESP), two buttons and a stepper motor and write code that will let your motor step CW or CCW depending on which button you press.
When that's sorted, merge it into your (this) current project.