Behatch/contexts

Way to easy adjust lots of wait for 'element'

Opened this issue · 2 comments

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: - ... contexts: - behatch:context:browser projectB: ... siteA: base_url: siteA.com ... siteB: base_url: siteB.org
When I start behat I precify the suite and profile to be able to run my scenarios/suites against diffent sites/profiles.

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?

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.

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...