postmanlabs / pmquickstarts

Follow along with our tutorials to get you up and running with Postman.
Apache License 2.0
5 stars 13 forks source link

Problems in "Day 02: Collections and environments" of the "30 Days of Postman - for developers" #64

Open JMasr opened 6 months ago

JMasr commented 6 months ago

Describe the bug The test 4 and test 5 on the submit request for "Day 02: Collections and environments" in the "30 Days of Postman - for developers" always fail because the request name used is different to the actual name of the previous requests.

URL of where you see the bug Post-response scripts on the lines: 25, 26, 34, and 35

To Reproduce Steps to reproduce the behavior:

  1. Folk the "Day 02: Collections and environments" of the "30 Days of Postman - for developers"
  2. Follow the instructions
  3. See how the test always fail
  4. Go to the Test section and see the undefined error type.

Expected behavior After complete the instructions correctly, the test must be on green and only be red if the data were wrong.

Screenshots Captura de pantalla 2024-05-06 192429

Desktop (please complete the following information):

JMasr commented 6 months ago

A possible solution is just remove the HTTP verbs on the request name

`pm.test("Old request updated", () => { let oldRequest = folder.item.find(req => {return req.name === "raw text"}) pm.expect(oldRequest.name, 'check name').equals("raw text") pm.expect(oldRequest.request.method, 'check method').equals("POST") pass += 1 })

pm.test("New request added", () => { pm.expect(folder.item.length, 'check number of requests').equals(2)

let newRequest = folder.item.find(req => { return req.name === "query params"})
pm.expect(newRequest.name, 'check name').equals("query params")
pm.expect(newRequest.request.method, 'check method').equals("GET")
pm.expect(newRequest.request.url.query.length, 'check parameters').equals(2)
pass += 1

})`

Captura de pantalla 2024-05-06 192739