Work with the Test Harness

Use the TestHarness class to test your Apex SDK for Slack apps.

Represents a test with a Slack state and user session.

Usage

The TestHarness class enables you to mock the Apex SDK for Slack elements for running in a test environment, allowing the creation of a Slack state and user session as needed.

See Test Slack Apps.

The following are methods for TestHarness.

Signature

Return Value

Type: Slack.TestHarness.State

Represents an actions layout component in a view for the test harness.

Usage

Use TestHarness.Actions to work with actions, such as testing a button or querying an external select component.

The Slack.TestHarness.Actions object is returned as a window object, which is then cast back into a Slack.TestHarness.Actions object. Get the component by name by casting it back to a Slack.TestHarness.Actions object. See Classes and Casting.

The following are methods for TestHarness.Actions.

Gets a child component in the given index on the actions layout component.

Signature

Parameters

idx

Type: Integer

The index of the component

clazz

Type: System.Type

The Apex type of the component

Return Value

Type: Object

Gets a child component on the actions layout component by name.

Signature

Parameters

name

Type: String

The name of the actions component

clazz

Type: System.Type

The Apex type of the component

Gets the number of child components for the actions component.

Signature

Return Value

Type: Integer

Signature

Return Value

Type: String

Represents a button component in a view for the test harness.

The following are methods for TestHarness.Button.

Simulates clicking a button.

Signature

Return Value

Type: void

Gets the confirm composition object for the button.

Signature

Return Value

Type: Slack.TestHarness.Confirm

Gets the label for the button.

Signature

Return Value

Type: String

Gets the name for the button.

Signature

Return Value

Type: String

Gets the style for the button.

Signature

Return Value

Type: String

Gets the URL for the button.

Signature

Return Value

Type: String

Gets the value for the button.

Signature

Return Value

Type: String

Represents a channel for the test harness.

The following are methods for TestHarness.Channel.

Adds a user to the channel.

Signature

Parameters

user

Type: Slack.TestHarness.User

Adds the specified user to the channel. Returns an exception if the user doesn't belong to the channel.

Return Value

Type: void

Gets if the specified user is able to open the channel.

Signature

Parameters

user

Type: Slack.TestHarness.User

Gets the channel ID.

Signature

Return Value

Type: String

Signature

Return Value

Type: String

Gets the message count on the channel for the specified user.

Signature

Parameters

user

Type: Slack.TestHarness.User

Return Value

Type: Integer

Gets the list of messages for the channel for the specified user.

Signature

Parameters

user

Type: Slack.TestHarness.User

Return Value

Type: List<Slack.TestHarness.Message>

Gets the name for the channel.

Signature

Return Value

Type: String

Gets the team for the channel.

Signature

Return Value

Type: Slack.TestHarness.Team

Returns true if the channel is private, or false otherwise.

Signature

Return Value

Type: Boolean

Removes the specified user from the channel.

Signature

Parameters

user

Type: Slack.TestHarness.User

Return Value

Type: void

Simulates sending a message to the channel from the user's session.

Signature

Parameters

userSession

Type: Slack.TestHarness.UserSession

text

Type: String

Represents a checkbox component in a view for the test harness.

The following are methods for TestHarness.Checkbox.

Gets the confirm composition object for the checkbox.

Signature

Return Value

Type: Slack.TestHarness.Confirm

Gets the description for the checkbox.

Signature

Return Value

Type: String

Gets the initial value for the checkbox.

Signature

Return Value

Type: Boolean

Gets the label for the checkbox.

Signature

Gets the name of the checkbox.

Signature

Return Value

Type: String

Gets the value of the checkbox.

Signature

Return Value

Type: Boolean

Sets the value of the checkbox. If the checkbox contains an onchange event, an action is fired.

Signature

Parameters

value

Type: Boolean

Return Value

Type: void

Toggles the value of the checkbox. If the checkbox contains an onchange event, an action is fired.

Signature

Return Value

Type: void

Represents a checkbox group component in a view for the test harness.

The following are methods for TestHarness.CheckboxGroup.

Gets the confirm composition object for the checkbox group.

Signature

Return Value

Type: Slack.TestHarness.Confirm

Signature

Return Value

Type: String

Gets the initial value for the checkbox group.

Signature

Return Value

Type: List<String>

Signature

Return Value

Type: String

Gets the name of the checkbox group.

Signature

Return Value

Type: String

Gets the value of the checkbox group.

Signature

Return Value

Type: List<String>

Sets the value of the checkbox group. If the checkbox group contains an onchange event, an action is fired.

Signature

Parameters

listOfIdentifiers

Type: List<String>

Return Value

Type: void

Signature

Parameters

option

Type: Slack.TestHarness.Option

Return Value

Type: void

Toggles the value of an individual option for the checkbox group. If the checkbox group contains an onchange event, an action is fired.

Signature

Parameters

identifier

Type: String

Return Value

Type: void

Represents a confirm composition object in a view for the test harness.

The following are methods for TestHarness.Confirm.

Gets the confirm button text.

Signature

Return Value

Type: String

Gets the deny button text.

Signature

Return Value

Type: String

Gets the confirmation style.

Signature

Return Value

Type: String

Gets the confirmation dialog text.

Signature

Return Value

Type: String

Gets the confirmation dialog title.

Signature

Return Value

Type: String

Represents the context layout component in a view for the test harness.

The following are methods for TestHarness.Context.

Gets a child component in a given index on the context component.

Signature

Parameters

idx

Type: Integer

The index of the component

clazz

Type: System.Type

The Apex type of the component

Return Value

Type: Object

Gets the number of child components on the context component.

Signature

Return Value

Type: Integer

Gets the name of the context component.

Signature

Return Value

Type: String

Represents a conversations select component in a view for the test harness.

The following are methods for TestHarness.ConversationsSelect.

Gets the confirm composition object for the component.

Signature

Return Value

Type: Slack.TestHarness.Confirm

Gets the filter composition object for the conversations select.

Signature

Return Value

Type: Slack.TestHarness.Filter

Gets the initial value for the conversations select. If the component isn’t a multi-select, an exception is thrown.

Signature

Return Value

Type: List<String>

Gets the initial value for the conversations select. If the component is a multi-select, an exception is thrown.

Signature

Return Value

Type: String

Gets the max selection for the conversations select. Returns 1 if the component isn’t a multi-select.

Signature

Return Value

Type: Integer

Gets the value for the conversations select. If the component isn’t a multi-select, an exception is thrown.

Signature

Return Value

Type: List<String>

Gets the name for the conversations select.

Signature

Return Value

Type: String

Gets the list of options for the conversations select.

Signature

Return Value

Type: List<Slack.TestHarness.Option>

Gets the placeholder for the conversations select.

Signature

Return Value

Type: String

Gets the value for the component. If the component is a multi-select, an exception is thrown.

Signature

Return Value

Type: String

Returns true if the conversations select is a multi-select.

Signature

Return Value

Type: Boolean

Sets the value of the conversations select. If the conversations select contains an onchange event, an action is fired. If the component isn’t a multi-select, an exception is thrown.

Signature

Parameters

listOfIdentifiers

Type: List<String>

Return Value

Type: void

Sets the value of the conversations select. If the conversations select contains an onchange event, an action is fired. If the conversations select is a multi-select, an exception is thrown.

Signature

Parameters

identifier

Type: String

Represents a datasource composition object for the test harness.

The following are methods for TestHarness.Datasource.

Signature

Return Value

Type: String

Signature

Return Value

Type: Map<String,Object>

Represents a date picker component in a view for the test harness.

The following are methods for TestHarness.DatePicker.

Gets the confirm composition object for the date picker.

Signature

Return Value

Type: Slack.TestHarness.Confirm

Gets the initial value for the date picker.

Signature

Return Value

Type: String

Gets the name for the date picker.

Signature

Return Value

Type: String

Gets the placeholder for the date picker.

Return Value

Type: String

Gets the value for the date picker.

Signature

Return Value

Type: String

Sets the value for the date picker.

Signature

Parameters

value

Type: String

Represents a date time picker component in a view for the test harness.

The following are methods for TestHarness.DateTimePicker.

Gets the confirm composition object for the date time picker.

Signature

Return Value

Type: Slack.TestHarness.Confirm

Gets the label for the date input.

Signature

Return Value

Type: String

Gets the initial value for the date time picker.

Signature

Return Value

Type: String

Gets the name for the date time picker.

Signature

Return Value

Type: String

Gets the placeholder for the date time picker.

Signature

Return Value

Type: String

Gets the required value for the date time picker.

Signature

Return Value

Type: Boolean

Gets the submission name for the date time picker.

Signature

Return Value

Type: String

Gets the label for the time input.

Signature

Return Value

Type: String

Gets the value for the date time picker.

Signature

Return Value

Type: String

Sets the date value on the component.

Signature

Parameters

value

Type: String

Return Value

Type: void

Sets the time value on the component.

Signature

Parameters

value

Type: String

Return Value

Type: void

Sets the value for the date time picker.

Signature

Parameters

value

Type: String

Return Value

Type: void

Represents a divider component in a view for the test harness.

The following are methods for TestHarness.Divider.

Gets the name for the divider.

Signature

Return Value

Type: String

Represents a Slack Enterprise for the test harness.

The following are methods for TestHarness.Enterprise.

Gets the ID for the enterprise

Signature

Return Value

Type: String

Gets the name for the enterprise.

Signature

Return Value

Type: String

Represents an external select component in a view for the test harness.

The following are methods for TestHarness.ExternalSelect.

Gets the confirm composition object for the external select.

Signature

Return Value

Type: Slack.TestHarness.Confirm

Gets the datasource composition object for the external select.

Signature

Return Value

Type: Slack.TestHarness.Datasource

Gets the initial value for the external select. If the component isn’t a multi-select, an exception is thrown.

Signature

Return Value

Gets the initial list of resolved options for the component.

Signature

Return Value

Type: List<Slack.TestHarness.Option>

Gets the initial value for the external select. If the component is a multi-select, an exception is thrown.

Signature

Return Value

Type: String

Gets the max selection for the external select. Returns 1 if the component isn’t a multi-select.

Signature

Return Value

Type: Integer

Gets the min query length for the external select.

Signature

Return Value

Type: Integer

Gets the value for the external select. If the component isn’t a multi-select, an exception is thrown.

Signature

Return Value

Type: List<String>

Gets the name for the external select.

Signature

Return Value

Type: String

Signature

Return Value

Type: List<Slack.TestHarness.OptionGroup>

Gets the list of options for the external select.

Signature

Return Value

Type: List<Slack.TestHarness.Option>

Gets the placeholder for the external select.

Signature

Return Value

Type: String

Gets the value for the external select. If the component is a multi-select, an exception is thrown.

Signature

Return Value

Type: String

Returns true if the external select is a multi-select.

Signature

Return Value

Type: Boolean

Simulates a query on the external select. If the min query length isn’t met, an exception is thrown.

Signature

Parameters

query

Type: String

Return Value

Type: void

Sets the value of the external select. If the external select contains an onchange event, an action is fired. If the component isn’t a multi-select, an exception is thrown.

Signature

Parameters

listOfIdentifiers

Type: List<String>

Return Value

Type: void

Sets the value of the external select. If the external select contains an onchange event, an action is fired. If the component is a multi-select, an exception is thrown.

Signature

Parameters

identifier

Type: String

Return Value

Type: void

The following are methods for `TestHarness.File '.

Signature

Return Value

Type: Object

Signature

Return Value

Type: String

Signature

Return Value

Type: String

Signature

Return Value

Type: String

Signature

Return Value

Type: String

Represents a filter composition object in a view for the test harness.

The following are methods for TestHarness.Filter.

Gets the excludeBotUsers value for the filter object.

Signature

Return Value

Type: Boolean

Gets the resolved exclude external shared value for the filter object.

Signature

Return Value

Type: Boolean

Gets the include list for the filter object.

Signature

Return Value

Type: List<String>

Represents a header component in a view for the test harness.

The following are methods for TestHarness.Header.

Gets the name for the header.

Signature

Return Value

Type: String

Gets the text for the header.

Signature

Return Value

Type: String

Represents a home surface component in a view for the test harness.

The following are methods for TestHarness.Home.

Gets a button component by its label value.

Signature

Return Value

Type: Slack.TestHarness.Button

Gets a child component on the home component.

Signature

Parameters

idx

Type: Integer

clazz

Type: System.Type

Return Value

Type: Object

Signature

Return Value

name

Type: String

clazz

Type: System.Type

Return Value

Type: Object

Gets the number of child components on the home component.

Signature

Return Value

Type: Integer

Signature

Parameters

label

Type: String

Return Value

Type: Slack.TestHarness.Input

Represents an image component in a view for the test harness.

The following are methods for TestHarness.Image.

Gets the alternative text for the image.

Signature

Return Value

Type: String

Gets the URL for the image.

Signature

Return Value

Type: String

Gets the name for the image.

Signature

Return Value

Type: String

Gets the title for the image.

Signature

Return Value

Type: String

Represents an inline image component in a view for the test harness.

The following are methods for TestHarness.InlineImage.

Gets the alternative text for the inline image.

Signature

Return Value

Type: String

Gets the URL for the inline image.

Signature

Return Value

Type: String

Gets the name for the inline image.

Signature

Return Value

Type: String

Represents an input layout component in a view for a test harness.

The following are methods for TestHarness.Input.

Gets a child component on the input component.

Signature

Parameters

clazz

Type: System.Type

Return Value

Type: Object

Gets a child component on the input component by name.

Signature

Parameters

name

Type: String

clazz

Type: System.Type

Return Value

Type: Object

Gets the hint for the input component.

Signature

Return Value

Type: String

Gets the label for the input component.

Signature

Return Value

Type: String

Gets the name for the input component.

Signature

Return Value

Type: String

Returns true if the input component is required.

Signature

Return Value

Type: Boolean

Represents a message surface component in a view for the test harness.

The following are methods for TestHarness.Message.

Returns true if the message can be seen by the specified user.

Signature

Parameters

user

Type: Slack.TestHarness.User

Return Value

Type: Boolean

Gets a button component by its label value.

Signature

Parameters

label

Type: String

Return Value

Type: Slack.TestHarness.Button

Gets the channel value for the message.

Signature

Return Value

Type: Slack.TestHarness.Channel

Gets a child component in a given index on the message component.

Signature

Parameters

idx

Type: Integer

clazz

Type: System.Type

Return Value

Type: Object

Gets a child component on the message component by name.

Signature

Return Value

Type: String

Gets the number of child components for the message component.

Signature

Return Value

Type: Integer

Gets the input component by label for the message component.

Signature

Parameters

label

Type: String

Return Value

Type: Slack.TestHarness.Input

Gets the timestamp for the message.

Signature

Return Value

Type: String

Gets the text for the message.

Signature

Return Value

Type: String

Returns true if the message is ephemeral.

Signature

Return Value

Type: Boolean

Represents a modal surface component in a view for the test harness.

The following are methods for TestHarness.Modal.

Simulates closing a modal, which returns the view_closed payload.

Signature

Return Value

Type: void

Gets a button component by its label value.

Signature

Parameters

label

Type: String

Return Value

Type: Slack.TestHarness.Button

Gets the close label for the modal.

Signature

Return Value

Type: String

Gets a child component in the given index on the modal component.

Signature

Parameters

idx

Type: Integer

clazz

Type: System.Type

Return Value

Type: Object

Gets a child component on the modal component by name.

Signature

Parameters

name

Type: String

clazz

Type: System.Type

Return Value

Type: Object

Gets the number of child components for the modal component.

Signature

Return Value

Type: Integer

Gets an input block component by its label value.

Signature

Parameters

label

Type: String

Return Value

Type: Slack.TestHarness.Input

Gets any input error for a given input block by name.

Signature

Parameters

inputBlockName

Type: String

Return Value

Type: String

Signature

Return Value

Type: List

Signature

Return Value

Type: String

Signature

Return Value

Type: String

Signature

Return Value

Type: Boolean

Signature

Return Value

Type: void

Represents an option component in a view for a test harness.

The following are methods for TestHarness.Option.

Gets the description for the option.

Signature

Return Value

Type: String

Gets the identifier for the option.

Signature

Return Value

Type: String

Gets the label for the option.

Signature

Return Value

Type: String

Gets the url for the option.

Signature

Return Value

Type: String

Gets the value for the option.

Signature

Return Value

Type: Boolean

Represents an option group component in a view for the test harness.

The following are methods for TestHarness.OptionGroup.

Gets the label for the option group.

Signature

Return Value

Type: String

Gets the list of options for the option group.

Signature

Return Value

Type: List<Slack.TestHarness.Option>

Represents an overflow menu within a section or an actions component in a view for the test harness.

The following are methods for TestHarness.Overflow.

Simulates clicking the component with the specified option index. If the component contains an onclick event, an action is fired.

Signature

Parameters

idx

Type: Integer

Return Value

Type: void

Simulates clicking the component with the specified option. If the component contains an onclick event, an action is fired.

Signature

Parameters

option

Type: Slack.TestHarness.Option

Return Value

Type: void

Simulates clicking the component with the specified option identifier. If the component contains an onclick event, an action is fired.

Signature

Parameters

identifier

Type: String

Return Value

Type: void

Gets the confirm composition object for the overflow menu.

Signature

Return Value

Type: Slack.TestHarness.Confirm

Gets the name for the overflow menu.

Signature

Return Value

Type: String

Gets the list of options for the overflow menu.

Signature

Return Value

Type: List<Slack.TestHarness.Option>

Represents a radio group component

The following are methods for TestHarness.RadioGroup.

Gets the confirm composition object for the radio group.

Signature

Return Value

Type: Slack.TestHarness.Confirm

Gets the initial value for the radio group.

Signature

Return Value

Type: String

Gets the name for the radio group.

Signature

Return Value

Type: String

Gets the list of options for the radio group.

Signature

Return Value

Type: List<Slack.TestHarness.Option>

Gets the value for the radio group.

Signature

Return Value

Type: String

Sets the value for the radio group. If the radio group contains an onchange event, an action is fired.

Signature

Return Value

Type: void

Represents a section component in a view for the test harness.

The following are methods for TestHarness.Section.

Gets a child component in the given index on the section component.

Signature

Parameters

idx

Type: Integer

clazz

Type: System.Type

Gets a child component on the section component.

Signature

Parameters

clazz

Type: System.Type

Return Value

Type: Object

Gets a child component on the section component by name.

Signature

Parameters

name

Type: String

clazz

Type: System.Type

Return Value

Type: Object

Gets the field count for the section component.

Signature

Return Value

Type: Integer

Gets the field text for the section component at the specified index.

Signature

Parameters

idx

Type: Integer

Return Value

Type: String

Gets the name for the section component.

Signature

Return Value

Type: String

Gets the text for the component.

Signature

Return Value

Type: String

Represents a select component in a view for the test harness.

The following are methods for TestHarness.SelectInput.

Gets the confirm composition object for the component.

Signature

Return Value

Type: Slack.TestHarness.Confirm

Gets the initial value for the select component. If the component isn’t a multi-select, an exception is thrown.

Signature

Return Value

Type: List<String>

Gets the initial value for the select component. If the component is a multi-select, an exception is thrown.

Signature

Return Value

Type: String

Gets the maxSelection value, which shows the maximum number of options that can be selected. Returns 1 if the component isn’t a multi-select.

Signature

Return Value

Type: Integer

Gets the value for the select component. If the component isn’t a multi-select, an exception is thrown.

Signature

Return Value

Type: List<String>

Gets the name of the select component.

Signature

Return Value

Type: String

Gets the list of options for the select component.

Signature

Return Value

Type: List<Slack.TestHarness.Option>

Gets the list of option groups for the select component.

Signature

Return Value

Type: List<Slack.TestHarness.OptionGroup>

Gets the placeholder for the select component.

Signature

Return Value

Type: String

Gets the value for the select component.

Signature

Return Value

Type: String

Returns true if the select component is a multi-select.

Signature

Return Value

Type: Boolean

Sets the value of the select component. If the component contains an onchange event, an action is fired. If the component isn’t a multi-select, an exception is thrown.

Signature

Parameters

listOfIdentifiers

Type: List<String>

Return Value

Type: void

Sets the value of the select component. If the component contains an onchange event, an action is fired. If the component is a multi-select, an exception is thrown.

Signature

Parameters

identifier

Type: String

Return Value

Type: void

Represents a Slack State that sets up your test harness.

The following are methods for TestHarness.State.

Signature

Return Value

Type: void

Signature

Return Value

Type: void

Signature

Return Value

Type: void

Signature

Return Value

Type: void

Creates a direct channel for the given user.

Signature

Parameters

user

Type: Slack.TestHarness.User

Return Value

Type: Slack.TestHarness.Channel

Creates an enterprise for the test harness.

Signature

Parameters

enterpriseId

Type: String

enterpriseName

Type: String

Return Value

Type: Slack.TestHarness.Enterprise

Signature

Return Value

Type: Slack.TestHarness.Enterprise

Signature

Parameters

team

Type: Slack.TestHarness.Team

channelName

Type: String

locale

Type: String

Return Value

Type: Slack.TestHarness.Channel

Creates a private channel with the specified name.

Signature

Parameters

channelName

Type: String

Return Value

Type: Slack.TestHarness.Channel

Creates a private channel for the default team.

Signature

Parameters

team

Type: Slack.TestHarness.Team

channelName

Type: String

Return Value

Type: Slack.TestHarness.Channel

Creates a public channel with the specified name.

Signature

Parameters

channelName

Type: String

Return Value

Type: Slack.TestHarness.Channel

Creates a public channel for the specified team.

Signature

Parameters

team

Type: Slack.TestHarness.Team

channelName

Type: String

Return Value

Type: Slack.TestHarness.Channel

Creates a team for the default enterprise.

Signature

Parameters

teamDomain

Type: String

Return Value

Type: Slack.TestHarness.Team

Creates a team using the specified enterprise name.

Signature

Parameters

teamDomain

Type: String

enterprise

Type: Slack.TestHarness.Enterprise

Return Value

Type: Slack.TestHarness.Team

Creates a user on the default team.

Signature

Parameters

username

Type: String

name

Type: String

Return Value

Type: Slack.TestHarness.User

Creates a user on the specified team.

Signature

Parameters

username

Type: String

name

Type: String

team

Type: Slack.TestHarness.Team

Return Value

Type:

Creates a user session using the default user and default channel.

Signature

Return Value

Type: Slack.TestHarness.UserSession

Signature

Parameters

user

Type: Slack.TestHarness.User

defaultChannel

Type: Slack.TestHarness.Channel

Return Value

Type: Slack.TestHarness.UserSession

Gets a channel based on its ID for the specified team.

Signature

Parameters

team

Type: Slack.TestHarness.Team

Return Value

Type: Slack.TestHarness.Channel

Gets the list of channels for the specified team.

Signature

Parameters

team

Type: Slack.TestHarness.Team

Return Value

Type: List<Slack.TestHarness.Channel>

Gets the default channel for the test harness.

Signature

Return Value

Type: Slack.TestHarness.Channel

Gets the default enterprise for the test harness.

Signature

Return Value

Type: Slack.TestHarness.Enterprise

Gets the default team for the test harness.

Signature

Return Value

Type: Slack.TestHarness.Team

Gets the default user for the test harness.

Signature

Return Value

Type: Slack.TestHarness.User

Signature

Return Value

Type: String

Gets a user for the test harness.

Signature

Parameters

team

Type: Slack.TestHarness.Team

username

Type: String

Return Value

Type: Slack.TestHarness.User

Signature

Parameters

team

Type: Slack.TestHarness.Team

username

Type: String

Return Value

Type: Slack.TestHarness.User

Signature

Parameters

team

Type: Slack.TestHarness.Team

Return Value

Type: List<Slack.TestHarness.User>

Signature

Parameters

appClientMock

Type: Slack.AppClientMock

Return Value

Type: void

Signature

Parameters

botClientMock

Type: Slack.BotClientMock

Return Value

Type: void

Signature

Parameters

locale

Type: String

Return Value

Type: void

Signature

Parameters

userClientMock

Type: Slack.UserClientMock

Return Value

Type: void

Represents a team or workspace for the test harness.

The following are methods for TestHarness.Team.

Gets the list of channels for the team.

Signature

Type: List<Slack.TestHarness.Channel>

Gets the enterprise for the team.

Signature

Return Value

Type: Slack.TestHarness.Enterprise

Gets the ID for the team.

Signature

Return Value

Type: String

Gets the domain for the team.

Signature

Return Value

Type: String

Represents a text component in a view for a test harness.

The following are methods for TestHarness.Text.

Gets the text for the component.

Signature

Return Value

Type: String

Represents the text input component in a view for the test harness.

The following are methods for TestHarness.TextInput.

Gets the initial value for the text input component.

Signature

Return Value

Type: String

Gets the maximum length for the text input component.

Signature

Return Value

Type: Integer

Gets the minimum length for the text input component.

Signature

Return Value

Type: Integer

Gets the name for the text input component.

Signature

Return Value

Type: String

Gets the placeholder for the text input component.

Signature

Return Value

Type: String

Gets the value for the text input component.

Signature

Return Value

Type: String

Gets the multiline value for the text input component.

Signature

Return Value

Type: Boolean

Sets the value for the text input component.

Signature

Return Value

Type: String

Represents the time picker component in a view for the test harness.

The following are methods for TestHarness.TimePicker.

Gets the confirm composition object for the time picker component.

Signature

Return Value

Type: Slack.TestHarness.Confirm

Gets the initial value for the time picker component.

Signature

Return Value

Type: String

Gets the name for the time picker component.

Signature

Return Value

Type: String

Gets the placeholder for the time picker component.

Signature

Return Value

Type: String

Gets the value for the time picker component.

Signature

Return Value

Type: String

Sets the value for the time picker component.

Signature

Return Value

Type: void

Represents a Slack user for the test harness.

The following are methods for TestHarness.User.

Gets the ID for the user.

Signature

Return Value

Type: String

Signature

Return Value

Type: String

Gets the name for the user.

Signature

Return Value

Type: String

Gets the team for the user.

Signature

Return Value

Type: Slack.TestHarness.Team

Gets the username for the user.

Signature

Return Value

Type: String

Represents a user session that denotes a user interacting with Slack using a client, maintaining session-specific state such as an open channel or modal.

The following are methods for TestHarness.UserSession.

Simulates closing all modals in the modal stack for the user session.

Signature

Return Value

Type: void

Simulates closing the currently visible modal on top of the modal stack for the user session.

Signature

Return Value

Type: void

Executes an event in the context of an existing user session. The session is used to retrieve the user, team, and enterprise to set on the request. The session is also used for any relevant input or output context for the specific event.

Signature

Parameters

event

Type: Slack.Event

slackApp

Type: Slack.App

Return Value

Type: void

Simulates executing a global shortcut for the user session.

Signature

Parameters

globalShortcut

Type: String

slackApp

Type: Slack.App

Return Value

Type: void

Simulates executing a message shortcut for a given message for the user session.

Signature

Parameters

messageShortcut

Type: String

message

Type: Slack.TestHarness.Message

slackApp

Type: Slack.App

Return Value

Type: void

Simulates executing a slash command on the given Slack app ID for the user session.

Signature

Parameters

command

Type: String

slackApp

Type: Slack.App

Return Value

Type: void

Simulates executing a slash command with a text payload for the user session.

Signature

Parameters

command

Type: String

text

Type: String

slackApp

Type: Slack.App

Return Value

Type: void

Gets the open app home for the user session.

Signature

Return Value

Type: Slack.TestHarness.Home

Gets the message count for the user session.

Signature

Return Value

Type: Integer

Gets the list of messages for the user session.

Signature

Return Value

Type: List<Slack.TestHarness.Message>

Gets the list of modals in stack order for the user session.

Signature

Return Value

Type: List<Slack.TestHarness.Modal>

Gets the open channel for the user session.

Signature

Return Value

Type: Slack.TestHarness.Channel

Gets the Slack state.

Signature

Return Value

Type: Slack.TestHarness.State

Gets the open modal on top of the modal stack for the user session.

Signature

Return Value

Type: Slack.TestHarness.Modal

Gets the user for the user session.

Signature

Return Value

Type: Slack.TestHarness.User

Simulates opening the app home for a given app ID for the user session.

Signature

Parameters

slackApp

Type: Slack.App

Return Value

Type: Slack.TestHarness.Home

Simulates opening a channel for the given channel ID for the user session.

Signature

Parameters

channelId

Type: String

Return Value

Type: Slack.TestHarness.Channel

Simulates posting a message to the open channel for the user session.

Signature

Parameters

message

Type: String

Return Value

Type: Slack.TestHarness.Message

Represents a users select component in a view for the test harness.

The following are methods for TestHarness.UsersSelect.

Gets the confirm composition object for the users select component.

Signature

Return Value

Type: Slack.TestHarness.Confirm

Gets the initial value for the users select component. If the component isn’t a multi-select, an exception is thrown.

Signature

Return Value

Type: List<String>

Gets the initial value for the users select component. If the component is a multi-select, an exception is thrown.

Signature

Return Value

Type: void

Gets the resolved max selection for the users select component. Returns 1 if the component isn’t a multi-select.

Signature

Return Value

Type: Integer

Gets the value for the users select component. If the component isn’t a multi-select, an exception is thrown.

Signature

Return Value

Type: List<String>

Gets the name for the users select component.

Signature

Return Value

Type: String

Gets the list of options for the users select component.

Signature

Return Value

Type: List<Slack.TestHarness.Option>

Gets the placeholder for the users select component.

Signature

Return Value

Type: String

Gets the value for the users select component.

Signature

Return Value

Type: String

Gets the value for the users select component. If the component isn’t a multi-select, an exception is thrown.

Signature

Return Value

Type: Boolean

Sets the value of the users select component. If the component contains an onchange event, an action is fired. If the component isn’t a multi-select, an exception is thrown.

Signature

Parameters

listOfIdentifiers

Type: List<String>

Return Value

Type: void

Sets the value of the users select component. If the component contains an onchange event, an action is fired. If the component is a multi-select, an exception is thrown.

Signature

Parameters

identifier

Type: String

Return Value

Type: void