Uploaded image for project: 'Xray for Jira'
  1. Xray for Jira
  2. XRAY-6252

When using the Jira REST API to edit a Manual Test, attachments are duplicated

    XporterXMLWordPrintable

Details

    • XRAY 2020 Sprint 2, XRAY 2020 Sprint 3
    • OK

    Description

      When using the Jira REST API to update a Manual Test, attachments are duplicated.
      Since Xray 4.0.0+, when we use the Jira REST API and the Manual Test Step Custom Field is used with an attachment, these attachments are NOT updated (as expected) but instead duplicated.

      This is problematic if a user gets all the CFS from the GET Jira endpoint and them used the PUT endpoint with the same fields: In this case, each request will duplicate the attachments of each Test Step.

      Steps to reproduce:

      1. Create a Manual Test with a single Test Step with 1 attachment.
      2. Update the Issue's Test Step Custom Field via Jira REST API with the attachment included
      3. The attachment is not updated, as expected, but instead all the attachments mentioned in the REST requests are added to the Test Step.

      Jira update REST API request:

      PUT <SERVER>/rest/api/2/issue/<ISSUE KEY>
      
      {
        "fields": {
          "customfield_10104": {
              "steps": [{"id": 6249, "index": 1, "fields": {"action": "potato"}, "attachments": [{
          "id": 1571,
          "fileName": "Screenshot 2020-07-27 at 10.36.53.png",
          "fileIcon": "image.gif",
          "mimeType": "image/png",
          "fileIconAlt": "PNG File",
          "fileSize": "647 kB",
          "numericalFileSize": 662564,
          "created": "2020-07-27T10:45:49+01:00",
          "createdDate": 1595843149722,
          "author": "admin",
          "authorFullName": "Bruce Wayne",
          "fileURL": "http://localhost:30000/plugins/servlet/raven/attachment/1571/Screenshot+2020-07-27+at+10.36.53.png",
          "filePath": "/Users/xpand/Documents/jira_home/data/attachments/CALC/10000/CALC-2251/xray_1571"
      			}]}]
          }
        }
      }
      

      Attachments

        Activity

          People

            dpca Diamantino Campos
            hslb Hugo Braz [X] (Inactive)
            Hugo Braz [X] (Inactive), Sara Santos [X] (Inactive), Tomás Caldas [X] (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 0 minutes
                0m
                Remaining:
                Time Spent - 4 days, 5 hours Remaining Estimate - 5 hours
                5h
                Logged:
                Time Spent - 4 days, 5 hours Remaining Estimate - 5 hours
                4d 5h