Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-22023

Add automated test for "Recommended Templates when creating pages"

    XMLWordPrintable

Details

    • Unknown

    Description

      The manual test is here: Recommended Templates when creating pages

      The test verifies if the Recommended Templates when creating pages work properly (i.e. including setting the 'Template to use', setting the 'Creation Restrictions' on a space and verify the template is only recommended on that space).

       

      What is missing from the automated tests that already exists is:

      • to verify that the template is selected by default
      • to verify that the respective template is only recommended on the respective space for Templates that have a "creation restriction" matching the current location (or a parent of the current location)

       

      Matrix discussion: https://matrix.to/#/!ikPtGZaGWtyblizzlR:matrix.xwiki.com/$1711099950365ToCEZ:matrix.xwiki.com?via=matrix.org&via=matrix.xwiki.com&via=helsinki-systems.de

      Vincent Massol:
      Ilie Andriuta: Hi! Continuing the manual tests migration, there is a test about checking if the Recommended Templates when creating pages work properly: https://test.xwiki.org/xwiki/bin/view/Administration%20Tests/Recommended%20Templates%20when%20creating%20pages. I've checked https://github.com/xwiki/xwiki-platform/blob/ad3295ccc85a7b115d3dfd3ef81607c23e101fc4/xwiki-platform-core/xwiki-platform-administration/xwiki-platform-administration-test/xwiki-platform-administration-test-docker/src/test/it/org/xwiki/administration/test/ui/PageTemplatesIT.java but I'm not sure if the corresponding automated test exists (i.e. including setting the 'Template to use', setting the 'Creation Restrictions' on a space and verify the template is only recommended on that space). Can you please confirm?

      Thanks!

      Go to "Administer Wiki" ✅
      Go to Content and click on Page Templates ✅
      Write a "Template Provider" name in the Title field ✅
      Click on Create ✅
      Write a name in the "Template name" field ✅
      In the "Template to use" field select an existing page eg. Sandbox.TestPage1 ✅
      Under Creation Restrictions select a page eg. Home ✅ https://github.com/xwiki/xwiki-platform/blob/7bf7094f8ffac095f5d66809af7554c9cc44de09/xwiki-platform-core/xwiki-platform-administration/xwiki-platform-administration-test/xwiki-platform-administration-test-docker/src/test/it/org/xwiki/administration/test/ui/PageTemplatesIT.java#L180
      Click "Save and View" ✅
      Go to the page selected under Creation Restrictions ✅
      Click on Create ✅
      And more

      So I'd say it's 100% covered (in PageTemplatesIT)

      There's one thing not tested: that the restrictions works, ie that you cannot create a page from a template outside of the restricted spaces (but you do't have it in your manuel test either)

      Ilie Andriuta: yes, but the does it check the Expected Results?

      The newly created provider template is automatically selected? (Depending on the location, when creating a page, the page type could "promote" several Templates and the first one might be automatically selected. This promotion occurs ONLY for Templates that have a "creation restriction" matching the current location (or a parent of the current location)).
       
      Vincent Massol: I forgot the check this. Checking (need to understand it first)

      Ilie Andriuta: thanks, this is also an important part of the test

      Vincent Massol: What's sure is that you can at least drop all the rest from the test
      let me try the feature first, to understand it

      Ilie Andriuta: sure

      Vincent Massol: There's one thing not tested: that the restrictions works, ie that you cannot create a page from a template outside of the restricted spaces (but you do't have it in your manuel test either)

      Actually this is tested in the automated test (or very close)

      so the automated test is just missing one line to verify that the template is selected by default, that should be very easy to add
      it's missing at https://github.com/xwiki/xwiki-platform/blob/7bf7094f8ffac095f5d66809af7554c9cc44de09/xwiki-platform-core/xwiki-platform-administration/xwiki-platform-administration-test/xwiki-platform-administration-test-docker/src/test/it/org/xwiki/administration/test/ui/PageTemplatesIT.java#L184-L188

      Ilie Andriuta: and verify the template is only recommended on that space, right?
      this one is also missing
      this is not about creation allowance, it's about suggestion

      Vincent Massol: by recommended you mean selected by default, right?

      Ilie Andriuta: yes, when you create a page, it's selected by default
      I mean it's the one which it's selected
      only in that space
      in other spaces it's not selected in the Create Page view

      Vincent Massol: Ilie Andriuta: we test here that if you try to use the template in another space it fails: https://github.com/xwiki/xwiki-platform/blob/7bf7094f8ffac095f5d66809af7554c9cc44de09/xwiki-platform-core/xwiki-platform-administration/xwiki-platform-administration-test/xwiki-platform-administration-test-docker/src/test/it/org/xwiki/administration/test/ui/PageTemplatesIT.java#L190-L199 (when it's restricted)
      which is a bit different

      Ilie Andriuta: yes..

      Ilie Andriuta: in this case, I'm not sure if we should mark the test as automated
      Vincent Massol, as the suggestion part only in restricted spaces in an important part of the test

      Vincent Massol: sure, you can create a jira with the 2 missing verifications
      would be good to find the jira issue that implemented automatic template selection too to indicate in it that it forgot to add a test for it
      I'm entering a meeting now, will try to find that jira later (unless you find it first)

      Vincent Massol: could be https://jira.xwiki.org/browse/XWIKI-14310

      Ilie Andriuta: yes, looks like this is it
      I will create a task and link it

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              iandriuta Ilie Andriuta
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated: