Uploaded image for project: 'Nuxeo Platform'
  1. Nuxeo Platform
  2. NXP-28028

Fix undefined doc path in test provisionning

    XMLWordPrintable

    Details

      Description

      Our ftest framework offers a useful step definition:

      I have a File document

      which provisions a document through the Rest API.

      During a ftest session, we have a notion of current location (this doc) initialized by default with default-domain see https://github.com/nuxeo/plugin-nuxeo-web-ui/blob/release-2.4.13/nuxeo-web-ui-ftest/test/features/step_definitions/support/fixtures/documents.js#L110:

      Before(function () {
        return nuxeo.repository().fetch('/default-domain').then((doc) => { this.doc = doc; });
      });
      

      At the same time, we have the

      I create a document with the following properties:
      

      step which will eventually set the current location to a doc with unknown path

      this.doc = { type: currentDocType, title };
      

      https://github.com/nuxeo/plugin-nuxeo-web-ui/blob/release-2.4.13/nuxeo-web-ui-ftest/test/features/step_definitions/create_dialog.js#L29

      When calling

      I have a File document

      we execute https://github.com/nuxeo/plugin-nuxeo-web-ui/blob/release-2.4.13/nuxeo-web-ui-ftest/test/features/step_definitions/document.js#L11

        return fixtures.documents.create(this.doc.path, doc).then((d) => {
          this.doc = d;
        });
      

      where this.doc.path is undefined if you called

      I create a document with the following properties:
      

      before hand and we end up with an error like:

      [chrome #0-0] Cannot read property 'indexOf' of undefined
      [chrome #0-0] TypeError: Cannot read property 'indexOf' of undefined
      [chrome #0-0]     at computePath (/home/fox/10.10-workspace/mp/marketplace-retention/ftest/web-ui/webdriver/node_modules/nuxeo/lib/repository.js:6:23)
      [chrome #0-0]     at Repository.create (/home/fox/10.10-workspace/mp/marketplace-retention/ftest/web-ui/webdriver/node_modules/nuxeo/lib/repository.js:81:18)
      [chrome #0-0]     at Object.create (/home/fox/10.10-workspace/mp/marketplace-retention/ftest/web-ui/webdriver/node_modules/@nuxeo/nuxeo-web-ui-ftest/test/features/step_definitions/support/fixtures/documents.js:25:52)
      [chrome #0-0]     at World.<anonymous> (/home/fox/10.10-workspace/mp/marketplace-retention/ftest/web-ui/webdriver/node_modules/@nuxeo/nuxeo-web-ui-ftest/test/features/step_definitions/document.js:11:29)
      [chrome #0-0]     at new Promise (<anonymous>)
      [chrome #0-0]     at new F (/home/fox/10.10-workspace/mp/marketplace-retention/ftest/web-ui/webdriver/node_modules/core-js/library/modules/_export.js:36:28)
      

        Attachments

          Issue Links

            Activity

              People

              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:

                  Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 2 hours
                  2h