Is there an easier way to test your custom widgets

0
When I want to test the changes I made developing my custom widget, I have to: build the widget copy the .mpk file to a project update the widget in Mendix Rerun the project (full rerun, instead of quick reload) …and this every time I make a change in my widget.   Are there any suggestions that could make this process easier/faster? Maybe build and add the .mpk file automatically to my Mendix project when saving changes. Or even a reload just like saving .scss files.   Any help would be appreciated!
asked
2 answers
0

Hi Pedro,

best way to create and also test custom widget is with mendix/generator-widget, also you can find more information in Mendix docs Build a Pluggable Web Widget: Part 1 | Mendix Documentation. Why is the best way for test it? Because each time you run npm it’s will automaticlly create mpk and import it in app.

answered
0

Hi, you can supply a testproject path in your package.json where the widget is built to: 

 "config": {
    "projectPath": "./tests/testProject/"
  },

then the widget .mpk should be placed in the widgets folder of that testproject, then you can synchronize app directory app and update the widget in the Mendix testproject and rerun the project

 

  1. Build the widget by running npm run build in the root folder of the pluggable widget.

  2. Open the Mendix test project in tests/testProject by selecting File > Open Project.

  3. In the Open App dialog box, select Locally on disk.

  4. Open the GroupBoxTestProject.mpr file inside your group box widget project folder.

source:

https://docs.mendix.com/howto8/extensibility/build-native-widget/

 

answered