saucelabs / node-saucelabs

A wrapper around Sauce Labs API
Apache License 2.0
93 stars 44 forks source link

listJobs auto_only or manual_only filtering doesn't work #263

Closed waggledans closed 2 months ago

waggledans commented 2 months ago

Description

This is a bit subtle.

  const api = new SauceLabs();
  const jobs = await api.listJobs(process.env.SAUCE_USERNAME, {
    limit: 10,
    full: true,
    auto_only: true,
  });

will return 10 jobs - some of them are automated and some - manual.

The CLI command sl listJobs <username> [limit] [subaccounts] [full] [manual_only] [auto_only] will ignore positional args containing _ as well: sl listJobs $SAUCE_USERNAME 1 false false true false is equivalent to `sl listJobs $SAUCE_USERNAME 1 false

The latest main changed this behaviour and now an underscore is not ignored but it created another problem - both auto_only and manual_only defaults are sent (both are false to which server returns 400)

$ bin/sl listJobs $SAUCE_USERNAME 1
Error: Failed calling listJobs: Response code 400 (Bad Request), [object Object]

Expected Behavior

listJobs allows specifying auto_only or manual_only filter.

In general, query params containing an underscore are supported

Actual Behavior

Params like auto_only or manual_only are ignored

Steps to Reproduce the Problem

  1. Make sure you have both automated and manual jobs
  2. Run a simple script
    const api = new SauceLabs();
    const jobs = await api.listJobs(process.env.SAUCE_USERNAME, {
    limit: 10,
    full: true,
    auto_only: true,
    });
    1. Check the output, it will contain manual: true as well as manual: false