k6-cucumber-steps API Reference - v2.0.10-alpha.0
    Preparing search index...

    Function k6IAuthenticateWithTheFollowingUrlAndRequestBodyAsWith

    • Authenticates with the API using credentials from a data table. Supports both JSON (default) and form-urlencoded formats.

      Parameters

      • context: string

        User context identifier (e.g., "standard_user", "admin")

      • formatOrTable: any

        Either the format ("json" | "form") or the data table

      • maybeTable: any

        Optional data table if format is specified

      Returns void

      When I k6 authenticate with the following url and request body as "standard_user":
        | endpoint | username      | password    |
        | /login   | test_user     | pass123     |
      
      When I k6 authenticate with the following url and request body as "admin" with "form":
        | endpoint | client_id     | client_secret | grant_type         |
        | /token   | my-app        | secret123     | client_credentials |