aem-testing-clients icon indicating copy to clipboard operation
aem-testing-clients copied to clipboard

The default template to create page does not contain thumbnail

Open mohiaror opened this issue 5 years ago • 5 comments

The default template [0] does not contain a thumbnail. Is this by design? If yes, will a test case requiring a page with thumbnail have to create its own template resource?

cc - @dulvac , @volteanu

[0] https://github.com/adobe/aem-testing-clients/blob/aem-cloud/src/main/resources/com/adobe/cq/testing/junit/rules/template.json

mohiaror avatar Nov 04 '20 12:11 mohiaror

@mohiaror the template is minimal to make the tests as lightweight as possible. Is the thumbnail a mandatory part? If it's missing, does it break any functionality?

volteanu avatar Nov 04 '20 12:11 volteanu

@volteanu It does not break any functionality per se but limits the scope of testing product code. We have a servlet which returns 200 HTTP status code if the thumbnail is present for the page or 302 redirect code if the thumbnail is not present and the redirection happens to the default thumbnail. We would like to test both the scenarios. It was possible to do that with the older we-retail based template.

mohiaror avatar Nov 04 '20 13:11 mohiaror

@volteanu Can we do it after the template has been created at [0]? We add the thumbnail by reading the inputstream and putting it after creating a node name thumbnail.png as a child of the template node?

[0] https://github.com/adobe/aem-testing-clients/blob/aem-cloud/src/main/java/com/adobe/cq/testing/junit/rules/Page.java#L149

mohiaror avatar Nov 09 '20 05:11 mohiaror

@volteanu Can you please help with an update here? Is this something which can be done as it will also help to achieve the parity between the older sample page and the one generated through this code?

mohiaror avatar Nov 16 '20 10:11 mohiaror

@mohiaror I've checked and it seems the JCR contentloader doesn't support binary data in JSON. This means we can't add the thumbnail directly in the template.json and we need a separate request. The general idea is to have the Page#prepare() as lightweight as possible because it's called very often (potentially for each test method), but I think we can add one more request in there if this a common need.

The alternative would be to have a specialized rule that extends Page and overrides the prepare method to do the extra call.

volteanu avatar Nov 26 '20 09:11 volteanu