Gherkin BDD style framework in typescript

#1

I am trying to put in place a framework in codeceptjs using gherkin and page objects.
It works fine with javascript, however, when I try to use typescript instead of javascript, I am stuck as I am unable to pass pageObject in step definition file as mentioned below.

Scenario(‘login’, (I, loginPage) => {
loginPage.sendForm(‘john@doe.com’,‘123456’);
I.see(‘Hello, John’);
});

Can you please help me with a sample example using gherkin feature files, steps, page objects.

#2

Hi @mayank1489, Did you manage to solve this?

I also have this problem in Codeception (PHP).

#3

Is this issue solved? I face the same issue as well and is blocking my tests :frowning:

#4

No, I have not seen any reply on this issue from the maintainers.
What I tried instead was instead of using codeceptjs page obejcts, I exported functions from the page object file and imported them in the spec files as usual.

Then compile the typescript code to javascript and in conf file pass compiled javascript files as starting point of execution.

Hope this helps

#5

Hey Mayank, thanks a lot for getting back. Can you share some code snippets? I’m pretty new to Javascript and is still in the learning phase.
Thanks in advance.