Skip to content
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

Using PageObjectExtension in multiple Symfony2 bundles #5

Closed
qpleple opened this issue Jun 14, 2013 · 3 comments
Closed

Using PageObjectExtension in multiple Symfony2 bundles #5

qpleple opened this issue Jun 14, 2013 · 3 comments

Comments

@qpleple
Copy link

qpleple commented Jun 14, 2013

Hi,
Is there a way to use PageObjectExtension when features are organized in Symfony2 bundles? The issue I'm running into is that I will end up having some classes Page in each of my bundles, next to the features, but I can only specify one namespace in namespaces.page.

default:
    extensions:
        Behat\MinkExtension\Extension:
            base_url: 'http://short'
            goutte: ~
            selenium2: ~
            default_session: 'symfony2'
        SensioLabs\Behat\PageObjectExtension\Extension:
            namespaces:
                page: Short\SiteBundle\Features\Page
        Behat\Symfony2Extension\Extension:
            mink_driver: true

A workaround, maybe, is to define one profile per bundle, but we can't run all tests at once:

site:
    # ...
    extensions:
        Behat\Symfony2Extension\Extension:
            bundle: ShortSiteBundle
        SensioLabs\Behat\PageObjectExtension\Extension:
            namespaces:
                page: Short\SiteBundle\Features\Page
admin:
    # ...
    extensions:
        Behat\Symfony2Extension\Extension:
            bundle: ShortAdminBundle
        SensioLabs\Behat\PageObjectExtension\Extension:
            namespaces:
                page: Short\AdminBundle\Features\Page
@jakzal
Copy link
Member

jakzal commented Jun 14, 2013

At the moment it's not possible (but I have it in plans).

Also, at the moment you have to define one profile per bundle anyway since that's how behat works.

@qpleple
Copy link
Author

qpleple commented Jun 14, 2013

Ok, thanks. I ended up using having my tests at application level. It works great. I'm describing here my solution in case anyone is interested. Feedback is welcome :)


I'm placing my tests next to my bundles.

src
+- Short
   +- SiteBundle
   +- AdminBundle
   +- ApiBundle
   +- Tests
      +- Features
      |  +- search.feature
      |  +- login.feature
      |  +- votes.feature
      +- Context
      |  +- FeatureContext.php
      |  +- DebugContext.php
      +- Page
         +- Homepage.php
         +- Category.php
         +- Post.php
         +- Contact.php

My behat.yml file looks like this

default:
    paths:
        features: src/Short/Tests/Features
    context:
        class: Short\Tests\Context\FeatureContext
    extensions:
        Behat\MinkExtension\Extension:
            base_url: 'http://short'
            goutte: ~
            selenium2: ~
            default_session: 'symfony2'
        SensioLabs\Behat\PageObjectExtension\Extension:
            namespaces:
                page: Short\Tests\Page
        Behat\Symfony2Extension\Extension:
            mink_driver: true

@jakzal
Copy link
Member

jakzal commented May 22, 2017

Closing this as keeping your features or page objects in bundles is no longer recommended.

@jakzal jakzal closed this as completed May 22, 2017
@SubmeetVet SubmeetVet mentioned this issue Jan 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants