See BehatBundle examples to see how to use Behat sentences to:
- create Languages, Content items, Content Types
- create Users with complex permissions
- create given YAML configuration
Use the TestContext to log in to the Repository and perform API calls as given user. You can tag your scenario with @admin
to be automatically logged in as admin user before the scenario starts.
Look at AdminUI feature files to see example browser tests for AdminUI. If you want to reuse these Steps in your code in addition to the Context that defines them you also need to include:
Ibexa\Behat\Browser\Context\Hooks
Ibexa\Behat\Browser\Context\BrowserContext
Selenium does not support drag and drop interactions between iframes. To achieve that you can use the UtilityContext::moveWithHover
method (which also supports hover simulation between the actions). See the drag-mock documentation (the library we use behind the scenes) for more information.
Before you start using that you need to inject the drag-mock script into your templates: one way of doing this is described in Webpack Encore configuration doc. For an example see ez.config.manager.js.
With EzBehatExtension
enabled Behat becomes SiteAccess aware. The SiteAccess used can be specified using EZPLATFORM_SITEACCESS
environment variable, otherwise the default SiteAccess will be used.
Use the Ibexa\Behat\Browser\Context\Hooks
Context class to access browser and server logs after Scenario failure, which combined with the screenshots feature makes debugging failures (even on CI) much easier.
BehatBundle might override some settings with values that are needed for testing. If you want to disable this behaviour you should set the ibexa.testing.override_configuration
parameter to false
.