ThemeSiteSetup Broken In Test Setup

When trying to use the import-site-setup form of collective.themesitesetup manually in a test site, traversal to the import-site-setup form fails with the following code portal.unrestrictedTraverse(directory_string + "/@@import-site-setup”). Manually navigating to the form page in a robot framework instance of phone seems to work fine. In an attempt to get the functionality working anyway, I copied the code executed to handle the form import into the test setup. However, only top-level content is created, with all content within folders not being created.

Stepping through the calls, it seems as through the adapter query to get the content creation factory in GenericSetup.content._makeInstance returns None and so any child content which needs to be imported isn't created

Any suggestions as to why the themesitesetup behaves so differently when called from setUpPloneSite within the test site setup compared to a running Plone instance?

Unfortunately, the structure (content) import step is one of the many parts of Plone that have not get the love they would have deserve lately, so anything is possible :frowning:

So, according to your research, this adapter call only fails during setUpPloneSite, but succeeds later when the test server is running? That's surprising.

Is this Plone 4 or Plone 5? With both Dexterity and Archetypes or only Dexterity?

I don't remember anymore the details on why I ended up developing custom adapters for structure import, but you could try if including adding <include package="collective.themesitesetup" file="extras.zcml" /> helps, or even cherry-picking some adapter registration from it: collective.themesitesetup/src/collective/themesitesetup/extras.zcml at master · collective/collective.themesitesetup · GitHub

This is working on a Plone 5.0 site using only Dexterity types.

I'm debugging now, but including the extras.zcml (self.loadZCML(package=collective.themesitesetup, name="extras.zcml") seems to break the test site setup as it cannot install any of the GenericSetup profiles. This is as a result of the following adapter registration:

<adapter
      factory="Products.GenericSetup.content.FolderishExporterImporter"
      provides="Products.GenericSetup.interfaces.IFilesystemImporter"
      for="OFS.interfaces.IFolder"
      />

Thanks for the details. extras.zcml being broken is expected, because it was originally made for Plone 4.3.

Yet, I from the source I cannot figure out any obvious reason, why it behaves differently in test setup than in running site. I'll see if I can find time to try this out...

@JeffersonBledsoe Hi, we shortly discussed about your use case during the Plone Conference party. If I understood properly, your primarly goals is to populate Plone at CI for better tests and also other options than themesitesetup would work.

Look into export.sh, purge.sh and import.sh at https://github.com/collective/gatsby-source-plone/blob/master/demo/fixture/

They should provide generic solution for exporting and importing content using Plone REST API, curl and jq for test fixture purposes.