2.2.51 • Published 11 months ago

cli-testlib-prototype-testing v2.2.51

Weekly downloads
-
License
ISC
Repository
-
Last release
11 months ago

cli-testlib-prototype-testing

This library is designated to automate slack command line interface (cli) methods. It provides a simplified and programmatic way to interact with the cli and used primarily for E2E testing.

Quickstart guide

  1. Install the package
npm install cli-testlib-prototype-testing
  1. Set cli path with environment variable SLACK_CLI_PATH
    • supply a link to a binary on the global path, like slack-cli, hermes, or hermes-dev
  2. Import and use HermesCLILib, HermesVerificationHelper or SlackTracerId
import { HermesCLILib } from 'cli-testlib-prototype-testing';
...
const actualOutput = await HermesCLILib.runSimpleCommand('slack-cli version');

How to use the package

  1. HermesCLILib - contains all methods to interact with cli
    • methods named after slack cli methods, e.g. HermesCLILib.deploy()
  2. HermesVerificationHelper - helper methods to verify cli output
    • shouldContainString
    • shouldContainStrings
    • shouldNotContainStrings
  3. SlackTracerId - trace IDs to verify cli command output
    • see available exported IDs on SlackTracerId object
    • to enable: SLACK_TEST_TRACE=true
// Import avialable objects from the package
import {
	HermesCLILib,
	SlackTracerId,
	HermesVerificationHelper
} from 'cli-testlib-prototype-testing';

describe('CLI - Feedback', () => {
	// Create a variable with a link to cli binary installed on your machine
	const cli = process.env.SLACK_CLI_PATH;

	it('can successfully follow the feedback survey link', async function () {
		// Create command
		const command = `${cli} feedback`;

		// Collect actual output from the command
		const actual = await HermesCLILib.runSimpleCommand(command);

		// Set expected array of strings
		const expected = [
			// Expected string
			'Feedback survey',
			// Available trace
			SlackTracerId.SLACK_TRACE_FEEDBACK_MESSAGE
		];

		// Check results with helper command
		await HermesVerificationHelper.shouldContainStrings(actual, expected, command);
	});
});

Configuration

EnvVarRequiredNote
SLACK_CLI_PATHyespath to slack cli binary
SLACK_CLI_LOG_LEVELnodefault: 'info'. Logger levels
2.2.51

11 months ago

2.2.5

11 months ago

2.2.4

11 months ago

2.2.3

11 months ago

2.2.2

11 months ago

2.2.1

11 months ago

2.2.0

11 months ago