vitalets / playwright-bdd

BDD testing with Playwright runner
https://vitalets.github.io/playwright-bdd/
MIT License
316 stars 40 forks source link

Feature: preserve arg types in call-step-from-step functions #243

Open jcamden opened 1 week ago

jcamden commented 1 week ago

Hey, thanks for this awesome package. It has been a game-changer for our testing strategy. Anyway,

The problem We regularly call step from step. However, we recently had a type error slip through on account of the fact that the keyword functions (from createBDD) do not preserve the arg types of the function which they receive. For instance, here is the type for the example from the docs:

Screenshot 2024-11-13 at 9 44 03 AM

We are hoping that the ...args: any[] could be improved.

A solution We can work around it by extracting that function out to a separate assignment, but this is not ideal. There may also be better ways to work around it; but I thought I'd inquire about whether it might be possible to preserve those types from playwright-bdd's side. Any chance you'd check it out? We really appreciate you!

vitalets commented 1 week ago

Hey @jcamden Yes, it definitely should keep step function signature. I will take a look.