LiipFunctionalTestBundle icon indicating copy to clipboard operation
LiipFunctionalTestBundle copied to clipboard

Make this bundle usable for browser end-to-end tests

Open ghost opened this issue 10 years ago • 2 comments

It seems, this bundle is mostly used for tests with PHPUnit and WebTestCase. We want to also do tests in a browser (e.g. via [1][2]). This means we need to include test setup information in the HTTP requests (via Query params?):

  • What fixtures to load
  • What user to login as

e.g.

localhost:8000/someroute?_login=admin&_fixtures=Bamarni\MainBundle\DataFixtures\ORM\LoadData,Me\MyBundle\DataFixtures\ORM\LoadData

And we need a listener to do this on KernelEvents::REQUEST(?).

[1] http://angular.github.io/protractor [2] https://github.com/minkphp

I'll work on this next week unless somebody claims this would be a silly idea. Would you take a PR for this?

ghost avatar Jan 23 '15 17:01 ghost

Its not quite clear to me what you want to do ..

lsmith77 avatar Jan 26 '15 15:01 lsmith77

Maybe you'd like to have a look at https://github.com/comsolit/LiipFunctionalTestBundle/tree/wip_make_e2e_tests_possible

I've extracted all Database related stuff in a standalone class https://github.com/comsolit/LiipFunctionalTestBundle/blob/wip_make_e2e_tests_possible/Database/TestDatabasePreparator.php

The TestDatabasePreparator is used from the https://github.com/comsolit/LiipFunctionalTestBundle/blob/wip_make_e2e_tests_possible/EventListener/PrepareDatabaseListener.php

So in Jenkins I start a PHP server in the test environment and can issue requests against the application and for each request the DB is initialized with a set of fixtures that I can select with the '_fixtures' GET parameter.

ghost avatar Jan 26 '15 17:01 ghost