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

EZEE-2950: Inject drag-mock using Webpack Encore #121

Merged
merged 3 commits into from
Jan 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions Resources/encore/ez.config.manager.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const path = require('path');

module.exports = (eZConfig, eZConfigManager) => {
if (!eZConfig.entry['ezplatform-page-builder-edit-js'] || !eZConfig.entry['ezplatform-form-builder-common-js']) {
return;
}

const dragMockScriptPath = '../public/js/scripts/drag-mock.js';
eZConfigManager.add({
eZConfig,
entryName: 'ezplatform-page-builder-edit-js',
newItems: [
path.resolve(__dirname, dragMockScriptPath),
],
});
eZConfigManager.add({
eZConfig,
entryName: 'ezplatform-form-builder-common-js',
newItems: [
path.resolve(__dirname, dragMockScriptPath),
],
});
};
30 changes: 30 additions & 0 deletions Resources/public/js/scripts/drag-mock.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion doc/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ See [BehatBundle examples](https://github.com/ezsystems/BehatBundle/tree/7.0/fea
- create Users with complex permissions
- create given YAML configuration

## Logging into the repository
### Logging into the repository

Use the [TestContext](../Context/Api/TestContext.php) 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.

Expand All @@ -18,6 +18,12 @@ Look at [AdminUI feature files](https://github.com/ezsystems/ezplatform-admin-ui
- `EzSystems\EzPlatformAdminUi\Behat\Helper\Hooks`
- `EzSystems\EzPlatformAdminUi\Behat\Helper\UtilityContext`

#### Improved drag and drop

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](https://github.com/andywer/drag-mock#browser) (the library we use behind the scenes) for more information.

Before you start using that you need to inject the [drag-mock script](../Resources/public/js/scripts/drag-mock.js) into your templates: one way of doing this is described in [Webpack Encore configuration doc](https://doc.ezplatform.com/en/latest/guide/bundles/#configuration-from-a-bundle). For an example see [ez.config.manager.js](../Resources/encore/ez.config.manager.js).

## BehatBundle extension

With `EzBehatExtension` enabled you can inject services into your Context classes using the `@injectService` annotation.
Expand Down