Giter Club home page Giter Club logo

Comments (3)

christian-bromann avatar christian-bromann commented on July 26, 2024 1

I'm not sure whether I miss something but I guess instead of user it's meant to be used as

Yes exactly. This is a bug in the documentation.

Is there a reason for not picking up the provided username (options/env). Does that stem from saucelabs sub-accounts perhaps?

Yes, as you mention you could technically also fetch the details of a subaccount.

from node-saucelabs.

christian-bromann avatar christian-bromann commented on July 26, 2024

I think this is just not properly documented. I you create you create an instance like this:

const myAccount = new SauceLabs()

it gets username and password from the environment (SAUCE_USERNAME and SAUCE_ACCESS_KEY). You can also pass in an option object:

const myAccount = new SauceLabs({ user: 'foo', key: 'bar' })

from node-saucelabs.

zewa666 avatar zewa666 commented on July 26, 2024

thats true, but if neither of the ENV is set you end up with an error of something along the lines "slice of undefined bla bla bla ..." which most likely points to this section here. So proper error could be thrown instead to tell the user to either provide the options or define the ENV. Routes themselves do reject with no auth mechanism defined

Still, even when that is set, the shown sample pretty much can't run as the global user variable is not available.

import SauceLabs from 'saucelabs';
// if imports are not supported by your Node.js version, import the package as follows:
// const SauceLabs = require('saucelabs').default;

(async () => {
    const myAccount = new SauceLabs();

    // get job details of last run job
    const job = await user.listJobs(   // <---------- where comes this user from? no window global defined
        process.env.SAUCE_USERNAME,
        { limit: 1, full: true }
    );

I'm not sure whether I miss something but I guess instead of user it's meant to be used as

const job = await myAccount.listJobs()

Last but not least, with listJobs as an example, to cover my last question, you need to again pass on the username. Is there a reason for not picking up the provided username (options/env). Does that stem from saucelabs sub-accounts perhaps?

from node-saucelabs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.