# Day 16 - Page is correct | TypeError

**URL:** <https://community.postman.com/t/day-16-page-is-correct-typeerror/58615>\
**Category:** Help Hub\
**Tags:** postman-api, 30-days\
**Created:** [March 8, 2024, 2:51pm UTC](https://community.postman.com/t/day-16-page-is-correct-typeerror/58615 "2024-03-08T14:51:23Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![milindrai](https://avatars.discourse-cdn.com/v4/letter/m/87869e/32.png) [@milindrai](https://community.postman.com/u/milindrai)\
**Post date:** [March 8, 2024, 2:51pm UTC](https://community.postman.com/t/day-16-page-is-correct-typeerror/58615/1 "2024-03-08T14:51:23Z")

</div>

I can’t figure out why this test case is failing

 ![Screenshot 2024-03-08 201522](https://us1.discourse-cdn.com/getpostman/original/3X/c/5/c5ca3d2a3b945972233310e62e69f54d643efd5f.png)  
 ![Screenshot 2024-03-08 201504](https://us1.discourse-cdn.com/getpostman/original/3X/f/c/fc0b96a812f61a8f6a0c31ee77634c55ede04d25.png)  
 ![Screenshot 2024-03-08 201451](https://us1.discourse-cdn.com/getpostman/original/3X/4/0/40f9b9cbc5c22f9f68ea5003436250acea63295f.png)

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [March 8, 2024, 3:07pm UTC](https://community.postman.com/t/day-16-page-is-correct-typeerror/58615/2 "2024-03-08T15:07:31Z")

</div>

Hey @milindrai 👋

What are you actually sending - What does the Postman console show?

Have you previous set that environment variable? Is there a value set in both the current and initial values?

---

<div class="post-metadata">

**Author:** ![milindrai](https://avatars.discourse-cdn.com/v4/letter/m/87869e/32.png) [@milindrai](https://community.postman.com/u/milindrai)\
**Post date:** [March 8, 2024, 3:13pm UTC](https://community.postman.com/t/day-16-page-is-correct-typeerror/58615/3 "2024-03-08T15:13:15Z")

</div>

Yes, I have set the environment variable…  
the initial value of page variable is 0 and the current value is 405.

---

<div class="post-metadata">

**Author:** ![danny-dainton](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/danny-dainton/32/29401_2.png) [@danny-dainton](https://community.postman.com/u/danny-dainton)\
**Post date:** [March 8, 2024, 3:21pm UTC](https://community.postman.com/t/day-16-page-is-correct-typeerror/58615/4 "2024-03-08T15:21:41Z")

</div>

The test would be checking that the `initial` is above one but I think it might have to do with the scope of variable you’re using - Have you tried using either a Global or Collection level variable for the request?

---

<div class="post-metadata">

**Author:** ![milindrai](https://avatars.discourse-cdn.com/v4/letter/m/87869e/32.png) [@milindrai](https://community.postman.com/u/milindrai)\
**Post date:** [March 8, 2024, 4:47pm UTC](https://community.postman.com/t/day-16-page-is-correct-typeerror/58615/5 "2024-03-08T16:47:22Z")

</div>

I tried the all three variable types and also taking and checking that the initial value should be greater than 1…but still it’s failing.

 ![Screenshot 2024-03-08 221259](https://us1.discourse-cdn.com/getpostman/original/3X/1/c/1cd6363f835409a1511847cb4eb62945c5f5263c.png)  
 ![Screenshot 2024-03-08 221514](https://us1.discourse-cdn.com/getpostman/original/3X/6/5/65a9bce5d68cc7d71db4b0ac28e60e550a3525f8.png)

---

<div class="post-metadata">

**Author:** ![michaelderekjones](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/michaelderekjones/32/14819_2.png) [@michaelderekjones](https://community.postman.com/u/michaelderekjones)\
**Post date:** [March 10, 2024, 3:21pm UTC](https://community.postman.com/t/day-16-page-is-correct-typeerror/58615/6 "2024-03-10T15:21:39Z")

</div>

This challenge looks like its missing some steps/documentation.

This is the failing test.

```auto
pm.test("Page is correct", () => {
    let submitRequest = collection.item[1].item.find(req => { return req.name === "submit"})
    pm.expect(submitRequest.request.url.query[0].key, 'check key value').to.equal("page")
    pm.expect(parseInt(submitRequest.request.url.query[0].value), 'check param value').to.be.above(0)
    
    pass += 1
})

```

It’s expecting a query parameter on the “submit” request called “page”.

Its the value of this query parameter that needs to be above zero.

It’s not related to the collection/environment variables related to page from the main request.

It’s currently failing with “undefined” because you probably haven’t set it yet.

However, I can’t find anywhere in the documentation that tells you that you need to create this.

It does say this in the main documentation.

> **Run the collection** :
> 
> - Run the collection or folder in the runner
> - Make a note of the last call that runs in the collection - the one with the failed test. You will need that page number for an extra step on the solution for this challenge.

@danny-dainton It’s this extra step that appears to be missing from the documentation.

---

<div class="post-metadata">

**Author:** ![system](https://sea2.discourse-cdn.com/getpostman/user_avatar/community.postman.com/system/32/29796_2.png) [@system](https://community.postman.com/u/system)\
**Post date:** [April 9, 2024, 3:22pm UTC](https://community.postman.com/t/day-16-page-is-correct-typeerror/58615/7 "2024-04-09T15:22:15Z")

</div>

Closed on April 9, 2024, 3:22pm UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
