Change site id on testing [RESOLVED]

Hi all,

we are using plonetheme-webpack-plugin (thanks @datakurre for it!!) but I just discovered a little big problem with it:

We took the decision 5 years ago to rename our plone instance ID to website rather than the usual Plone.

So far so good as one can define that on plonetheme-webpack-plugin, but when trying to load CSS and JS from a Robot Framework test, it gets a 404 as, by default, creates an instance with Plone id.

A possible solution would be to allow on to get the instance ID from an environment variable, but I'm not sure that's the best solution.

Any ideas/suggestions? Thanks in advance!

Is there a reason why you cannot build a bundles with working Webpack public path for tests? Bundles in CVS? It may be that public path can also work when relative (++theme++something). I don't remember anymore why I chose absolute path (we are actually setting public path to separate server to serve those resources outside Plone).

Yes, so far we are storing the bundles on git, as we are ignoring the bundles coming from Plone, thus we need to put them on the index.html.

I will try to remove the /website/ and see if that works.

Are you saying you hardcode the site-id in the resource urls in your diazo template file? If I understand you correct, maybe the dynamic portlal_url could help you.

@tmassman thanks, I was thinking about it as well... too many thinks to try and check and not much time available :sweat:

I solved it! :smile:

The solution was to change the publicPath to have a string that did NOT contain the site id:

  const PLONE = new PlonePlugin({
    portalUrl: 'http://localhost:' + SITEPORT + '/' + SITENAME,
    momentLocales: ['de', 'en'],
    publicPath: '++theme++' + THEMENAME + '/mockup_assets/';,
    sourcePath: PATHS.src,
    copy: null

Now tests do pass and everything is fine :rainbow:

Thanks for all feedback and tips!


If you find time, please, contribute some of this into docs. Probably into collective.webpacktemplate. Eg. sharing your test configuration there would be awesome.

Btw, what why "copy: null"? What does it do or is expected to do?

@datakurre I will try to write the docs.

Regarding the copy: null, literally no idea. We got the webpack configuration from the bobtemplates skeleton, so maybe it was there? I removed it and things are still working :slight_smile: