-
Notifications
You must be signed in to change notification settings - Fork 48
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Decouple PageObjects from Behat Implementation? #61
Comments
I actually have done this partly few months ago. I just haven't finished nor published it. I'm pretty busy till SymfonyCon. I'll be catching up with my open source stuff in December :) |
Awesome, looking forward to it :) |
I'm not sure if you'll be able to use it Symfony test cases easily yet as currently page objects are heavily based on Mink. It might be the next step though. I'll give it a thought. |
There is a Browserkit driver for mink A Symfony specific implementation could be created as well, in order to configure the factory and if needed extend the WebTestCase analog to the Behat PageObjectAware contexts |
As I see it, the building blocks are there, we only need to put them together and extract the PageObjects from this repo :) |
Here is an approach to integrate the POP into Symfony WebTestCase. This is by no means a final approach, just a demo. https://github.com/mozzymoz/e2eTests/tree/master/src/E2eTests/PopBundle |
Yes, that's interesting even for "non-test" scenarios: I would like to scrape a site for a service on which there's any rest API or WS in general. @jakzal any thoughts? |
@DonCallisto I did some work which I haven't released in the end. I tried to make this in a real BC way, but since breaking changes in Mink (see #92), perhaps it's time to take this opportunity to rethink the design and come up with something new. Page objects currently extend Mink elements, which was a cautious decision. The extensions initial focus group was testers with only basic coding experience. I don't think this is our user base at the moment. One thing that's been in my head for quite some time is removing necessity to extend Mink elements, but provide tools to inject them directly into page object properties. We'd describe how to query elements with annotations: class SearchPage
{
/**
* @FindBy(name="search_box")
*/
private $searchInput;
/**
* @FindBy(id="search")
*/
private $submit;
/**
* @FindBy(css=".container .message")
*/
private $message;
/**
* @FindBy(xpath="//div//h1")
*/
private $title;
} We could start fresh by implementing this approach as a library, and then integrate it with Behat in this extension in a next major version. |
Cool: only thing that "worry" me is about "collections", so dynamic selectors or something like this. If you want, I'm in for doing some work with you. Just let me know when and how 😄 |
Hi there,
I have been thinking of using the page object pattern in a way to share the Objects with Symfony Webtestcases and found that the entire SensioLabs\Behat\PageObjectExtension\PageObject namespace could become an own library, making it possible to build Pageobjects for an application reusable among different test suites.
Technically it is already possible to use the PageObject Namespace in any context, however putting them in their own lib would be cleaner and not needed, Behat specific classes are not included in the project.
What do you think?
The text was updated successfully, but these errors were encountered: