2.1.0 • Published 11 months ago
@marcelo.eliseu/cucumber-support v2.1.0
@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}`}