1

Been struggling a few days trying to get this to work. I have a graphQL endpoint which allows users to upload an image to their user profile.

The image is in same directory as feature files and its finding it ok.

Following the documentation, I came up with:

 Scenario: Upload an Avatar
    Given path 'query'
    And header Accept = 'application/json'
    And multipart file myFile = { read: 'bud.png', filename: 'bud.png', contentType: 'image/png' }
    Given text query =
      """
      mutation {
        setUserAvatar(userID: "571d7a92", imageFile: "bud.png"){id}
      }

      """
    And request { query: '#(query)' }
    When method POST
    Then status 200
    And print response

However the server keeps giving me response (200) with "message": "string is not an Upload"

So I am assuming I'm not calling the image properly. Any tips?

mark quinteros
  • 129
  • 1
  • 7

1 Answers1

1

This is a wild guess, but replace the And request step with:

And multipart field query = query

Else you may have to do some investigation. Here is a thread that can help you diagnose this: https://github.com/intuit/karate/issues/1645#issuecomment-862502881

And before going through the above exercise, try to get a cURL command that works, which the "server side team" should be able to give you.

Peter Thomas
  • 54,465
  • 21
  • 84
  • 248