ekino / veggies

:sparkles: :rocket: Veggies is an awesome cucumberjs library for API/CLI testing. Great for testing APIs built upon Express, Koa, HAPI, Loopback and others. It's also the perfect companion for testing CLI applications built with commander, meow & Co.
https://ekino.github.io/veggies/
MIT License
90 stars 18 forks source link

baseUrl is unavailable for use in my custom step definitions #26

Closed mnishizawa closed 6 years ago

mnishizawa commented 6 years ago

Do you want to request a feature or report a bug? bug?

What is the current behavior? When attempting to call makeRequest in my custom definitions, it says baseUrl is undefined. Regular posts work fine when they match the pattern in your definitions.js file so I am fairly certain we have set up the value correctly in our world.js

If the current behavior is a bug, please provide the steps to reproduce. I have installed the baseUrl in my world.js

httpApi.install({
    baseUrl: 'http://localhost:7000',
})(defineSupportCode)

In my support/definitions.js, I have written the following code:

    Given(/^[Aa]n authenticated user named (.+) with password (.+) in (.+)$/, function(userName, password, system) {
        this.httpApiClient.setJsonBody({
            "userName": userName,
            "password": password,
            "system"  : system
        });
        return this.httpApiClient.makeRequest("POST", this.state.populate("/auth"), baseUrl); 
    })

I get the error: ReferenceError: baseUrl is not defined

What is the expected behavior? I should be able to access baseUrl from my definitions.js file

Please provide your exact configuration and mention your veggies, node, yarn/npm version and operating system. OS: MacOS High Sierra Node: 8.5.0 NPM: 5.3.0 Veggies: Only the github repo is in the package.json, but we just started playing with this 2 days ago Cucumber: ^3.2.1