@marcelo.eliseu/cucumber-support
TypeScript icon, indicating that this package has built-in type declarations

2.1.0 • Public • Published

@inshur/cucumber-support

Inshur's implementation of a support libs for cucumber.js test consumers.

Usage

mongoDB

Use cucumber hook before or after all scenarios for mongoDB connection.

BeforeAll(async function () {
  await mongodbService.connectToDatabase();
});

AfterAll(async function () {
  await mongodbService.closeDBConnections();
});

auth0Service

Token for internal service, configure the environment for docker:

  AUTH0_INTERNAL_AUTOMATED_TEST_URL=https://inshur-dev0-internal.eu.auth0.com/oauth/token
  AUTH0_INTERNAL_AUTOMATED_TEST_CLIENT_ID=<client_id>
  AUTH0_INTERNAL_AUTOMATED_TEST_CLIENT_SECRET=<client_secrect>
      let response = await auth0Service.token();
      let access_token = response.data.access_token;
      ...

use token on axios

  const apiClient: AxiosInstance = axios.create({
      baseURL: process.env.SERVICE_URL,
      withCredentials: true,
      headers: {
        'Content-type': 'application/json',
        Accept: '*/*'
      },
    })
  ...
  apiClient.defaults.headers.common = {'Authorization': `Bearer ${access_token}`}

Readme

Keywords

none

Package Sidebar

Install

npm i @marcelo.eliseu/cucumber-support

Weekly Downloads

1

Version

2.1.0

License

unlicensed

Unpacked Size

17.2 kB

Total Files

14

Last publish

Collaborators

  • marcelo.eliseu