Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The default template to create page does not contain thumbnail #43

Open
mohiaror opened this issue Nov 4, 2020 · 5 comments
Open

The default template to create page does not contain thumbnail #43

mohiaror opened this issue Nov 4, 2020 · 5 comments

Comments

@mohiaror
Copy link

mohiaror commented Nov 4, 2020

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

@volteanu
Copy link
Member

volteanu commented Nov 4, 2020

@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?

@mohiaror
Copy link
Author

mohiaror commented Nov 4, 2020

@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
Copy link
Author

mohiaror commented Nov 9, 2020

@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
Copy link
Author

@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?

@volteanu
Copy link
Member

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants