Behatch / contexts

Behat extension with most custom helper steps
Other
394 stars 203 forks source link

Way to easy adjust lots of wait for 'element' #250

Open Trogie opened 6 years ago

Trogie commented 6 years ago

Hello,

I am using the behatch browser context a lot. Thanks for the great work!

But because I got lots of different production/staging/dev websites with different languages and/or texts for elements.

So when I want to use the same scenarios for different sites it's sometimes pretty hard to maintain.

For example on site A I wait for a "text a", on site B the text is "text b"

I usually have my application contexts in the behat configuration default suites defined. The different sites on profile level in behat.yml

so quick write: ` suites: default: projectA: paths:

But then I need to find a good way to 'translate' the texts of forexample iWaitUntilISee(): SiteA: Then I wait until I see "text A" SiteB: Then I wait until I see "text B"

I am not the big OO programmer so If I am wrong correct me please: I thought on extending the browsercontext and overwriting iWaitUntilISee function so it checks for a certain parameter/text value in the profile section, uses that to wait for, or else use it's parent function? Would that be the right way?

sanpii commented 6 years ago

Hello,

I thought on extending the browsercontext

I don’t see alternative.

and overwriting iWaitUntilISee function

Instead of overwriting iWaitUntilSee you can create a new function likes I wait until I see the site title (who uses iWaitUntilSee internaly) and take from configuration the site title.

Trogie commented 6 years ago

Hmmm, yes I see your point.

The problem is that I already feel I have too much almost the same functions or steps. And for the non-programmer-testers who write gherkin scenarios too sometimes it's getting even more difficult...