You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'd like to propose a new feature for the SpecBind library. A co-worker was showing us how to use SpecBind (with Selenium) the other day, and I noticed that it is very close conceptually to allowing devs and testers to just configure the URL's under test and have SpecBind attempt a best match between elements mentioned in features and elements on the page in the Selenium browser object. That best match could be based on id, name, or class. If relying on name or class (for example) and multiple elements on the page have the same, a run-time exception could be thrown so the dev can disambiguate by changing an element id or a feature name (or both).
It seems like this configuration plus the feature tests could be enough test coding without defining/decorating a thin page model.
As an attempt to prove the concept for this proposal, I forked the SpecBind code and modified PageMapper.Initialize to use reflection to build (and cache) a page type, named like the name given in the configured URL. It allows a feature file to run against a correspondingly named page URL from the configuration.
I've tried modifying the SeleniumBrowser class to scrape the page that's currently loaded in the SeleniumBrowser object and dynamically add corresponding properties to the page type (and replace the page type in cache). However, even dynamically decorating these properties as LocatorElement's seems to not add them in time (or in the right place?) to be matched by the properties referenced in the feature file.
Can anyone give some recommendations on where/how I should make a change that will dynamically add these properties such that the property can match to the one referenced from the feature step (ideally only on the feature step where the property is referenced)?
Thanks,
Matt
The text was updated successfully, but these errors were encountered:
Hi,
I'd like to propose a new feature for the SpecBind library. A co-worker was showing us how to use SpecBind (with Selenium) the other day, and I noticed that it is very close conceptually to allowing devs and testers to just configure the URL's under test and have SpecBind attempt a best match between elements mentioned in features and elements on the page in the Selenium browser object. That best match could be based on id, name, or class. If relying on name or class (for example) and multiple elements on the page have the same, a run-time exception could be thrown so the dev can disambiguate by changing an element id or a feature name (or both).
Example of desired result:
It seems like this configuration plus the feature tests could be enough test coding without defining/decorating a thin page model.
As an attempt to prove the concept for this proposal, I forked the SpecBind code and modified PageMapper.Initialize to use reflection to build (and cache) a page type, named like the name given in the configured URL. It allows a feature file to run against a correspondingly named page URL from the configuration.
I've tried modifying the SeleniumBrowser class to scrape the page that's currently loaded in the SeleniumBrowser object and dynamically add corresponding properties to the page type (and replace the page type in cache). However, even dynamically decorating these properties as LocatorElement's seems to not add them in time (or in the right place?) to be matched by the properties referenced in the feature file.
Can anyone give some recommendations on where/how I should make a change that will dynamically add these properties such that the property can match to the one referenced from the feature step (ideally only on the feature step where the property is referenced)?
Thanks,
Matt
The text was updated successfully, but these errors were encountered: