stepci / stepci

Automated API Testing and Quality Assurance
https://stepci.com
Mozilla Public License 2.0
1.63k stars 76 forks source link

[Bug]: HTTP selectors check is shown as undefined in stepci test summary #238

Open geozap opened 1 month ago

geozap commented 1 month ago

What happened?

In stepci test summary (verbose mode) http selectors check is shown as "undefined".

What did you expect to happen?

Summary shows results for each selector in http selectors check including selector name, expected and given value.

Version

2.8.2

Environment

Node v20.16.0

How can we reproduce this bug?

Example workflow file:

version: "1.1"
name: Status Check
tests:
  example:
    steps:
      - name: GET request
        http:
          url: https://example.com
          method: GET
          check:
            status: /^20/
            selectors:
              title: "Example Domain"

and run stepci run -v workflow.yaml


In my opinion results returned by runner are fine. The problem is line 118 in stepci/src/lib/render.ts which looks for "selector", but have to look for "selectors".

if (['jsonpath', 'xpath', 'headers', 'messages', 'selector', 'cookies', 'performance', 'captures', 'ssl'].includes(check)) {

Also to show the right label in summary stepci/src/labels.json has to be extended by "selectors": "Selectors" in addition to "selector": "Selector", which is required by captures.selector I think.

Relevant log output

...

Checks

✕ undefined

Expected

undefined

Given

undefined

✔ Status

Expected

/^20/

Given

200

Tests: 0 failed, 1 passed, 1 total
Steps: 0 failed, 0 skipped, 1 passed, 1 total
Time:  0.975s, estimated 1s
CO2:   0.00045g

Workflow passed after 0.975s

Would you be interested in working on a bugfix for this issue?

mishushakov commented 1 month ago

Can you send a pull request?

geozap commented 1 month ago

Unfortunately i am not very familiar with typescript projects and their development.