Search code examples
apostrophe-cms

Create apostrophe instances in runtime and create pages dynamically


Im exploring apostrophe cms and it seems to fit my business. I have successfully created a sample widget, can someone help me with creating apostrophe instances in runtime, create pages and run my test cases. I want all the test cases for that widget to succeed before moving it to production


Solution

  • If you check out the Apostrophe Enterprise Testbed project, you can see how we do this ourselves, and even use the apostrophe-nightwatch-tools module as we do to carry out functional tests in a headless browser as part of a real Apostrophe-based site project. This is what you are trying to do. You could even fork that project as a starting point.

    There is no real barrier to using any browser functional testing library by the way, so the question is not really Apostrophe specific. But, that project will help guide you to a path we have had some success with.

    I should acknowledge however that since that suite is so large, we don't always get a successful result from it (especially when run via Travis rather than on our own machines), probably due to timing issues. These are less likely to come into play for a smaller suite, but we continue to revise and improve how we do this and contributions to further stabilize the suite are of course welcome as it's an open source project.