Files
threshold-ui/ui/admin/tests/e2e/helpers/boundary-cli.js
T
Michael Li 7816772ef2 test(admin/e2e): Add first playwright test (#1637)
Adds an end-to-end test for the Admin UI using Playwright. This test uses the Admin UI to create the necessary resources to connect to a target. The test then uses the CLI to start a session and checks in the Admin UI that a session is created
2023-02-23 18:30:51 -05:00

34 lines
822 B
JavaScript

/* eslint-disable no-undef */
const { execSync } = require('child_process');
/**
* Checks that the boundary cli is available
*/
exports.checkBoundaryCli = async () => {
try {
execSync('which boundary');
} catch (e) {
throw new Error('boundary does not exist on the path');
}
};
/**
* Uses the boundary CLI to authenticate to the specified Boundary instance
*/
exports.authenticateBoundaryCli = async () => {
try {
execSync(
'boundary authenticate password' +
' -addr=' +
process.env.BOUNDARY_ADDR +
' -auth-method-id=' +
process.env.E2E_PASSWORD_AUTH_METHOD_ID +
' -login-name=' +
process.env.E2E_PASSWORD_ADMIN_LOGIN_NAME +
' -password=env://E2E_PASSWORD_ADMIN_PASSWORD'
);
} catch (e) {
console.log(`${e.stderr}`);
}
};