UNPKG

@opentap/runner-client

Version:

This is the web client for the OpenTAP Runner.

812 lines (811 loc) 32.6 kB
import { BreakEvent, BreakPoints, CommonContext, CommonSettings, DataGridControl, GetTestPlanReferenceResponse, HeartbeatEvent, Image, Interaction, ListItemType, LogList, MetricsConfiguration, OnTestPlanRun, OnTestStepRun, Result, RunStatus, SaveTestPlanToRepositoryResponse, SessionEventName, SessionStateChangedEvent, SessionTimeoutEvent, Setting, SettingsChangedEvent, StartingEvent, StartedEvent, StoppedEvent, StoppingEvent, TestPlan, TestPlanChangedEvent, TestPlanReferenceChangedEvent, TestPlanSettingsChangedEvent, TestStepChangedEvent, TestStepType, TestStepValidationError, TypeCacheInvalidatedEvent, UserInputRequestCompletedEvent, UserInputRequestedEvent, WatchDog, EditStatus, } from './DTOs'; import { BaseClient } from './BaseClient'; import { jsonCodec } from './encoders'; import { NIL } from 'uuid'; export class SessionClient extends BaseClient { get sessionId() { return this._sessionId; } constructor(baseSubject, options) { super(baseSubject, options); this._sessionId = this.getSessionIdFromSubject(baseSubject); } /** * Extracts the sessionId from the subject. * @param subject //OpenTap.Runner.<runnerId>.Session.<sessionId> * @returns sessionId or undefined if not found */ getSessionIdFromSubject(subject) { const match = subject.match(/Session\.([^.]+)/); if (match && match[1]) { return match[1]; } return undefined; } /** * @param sessionLogsHandler Function to be called when log list or error is received * @param options (optional) Subscription options * @returns Subscription object */ connectSessionLogs(sessionLogsHandler, options) { return this.subscribe('SessionLogs', Object.assign(Object.assign({}, options), { callback(error, encodedMessage) { if (error) { sessionLogsHandler(undefined, error); return; } try { const logListJson = jsonCodec.decode(encodedMessage === null || encodedMessage === void 0 ? void 0 : encodedMessage.data); const logList = LogList.fromJS(logListJson); sessionLogsHandler(logList, error); } catch (error) { sessionLogsHandler(undefined, error); } } })); } /** * Connect to a specific session event * @param eventName The name of the session event to connect to * @param eventHandler Function to be called when session event or error is received * @param options (optional) Subscription options * @returns Subscription object */ connectSessionEvent(eventName, eventHandler, options) { const factory = SessionClient.sessionEventFactories[eventName]; return this.subscribe(`Events.${eventName}`, Object.assign(Object.assign({}, options), { callback: (error, encodedMessage) => { if (error) { eventHandler(undefined, error); return; } try { if (encodedMessage.data.length > 0) { const payload = jsonCodec.decode(encodedMessage.data); const sessionEvent = factory(payload); sessionEvent.sessionId = this.getSessionIdFromSubject(encodedMessage.subject); eventHandler(sessionEvent, null); } } catch (err) { eventHandler(undefined, err); } } })); } /** * @param eventHandler Function to be called when session event or error is received * @param options (optional) Subscription options * @returns Subscription object */ connectSessionEvents(eventHandler, options) { return this.subscribe(`Events.*`, Object.assign(Object.assign({}, options), { callback: (error, encodedMessage) => { if (error) { eventHandler(undefined, error); return; } try { const subject = encodedMessage.subject; const eventName = subject ? subject.split('.').pop() : undefined; const factory = eventName ? SessionClient.sessionEventFactories[eventName] : undefined; if (!factory) { return; } if (encodedMessage.data.length > 0) { const payload = jsonCodec.decode(encodedMessage.data); const sessionEvent = factory(payload); sessionEvent.sessionId = this.getSessionIdFromSubject(subject); eventHandler(sessionEvent, null); } } catch (err) { eventHandler(undefined, err); } } })); } /** * Connect to listen to the TestPlanRun events for the given test plan run ID. * @param {string} testPlanRunId * @param {(event:OnTestPlanRun|undefined,err:NatsError|Error|null)=>void} handler * @param {SubscriptionOptions} options? * @returns Subscription */ connectTestPlanRunEvents(testPlanRunId, handler, options) { return this.subscribe(`PlanRun.${testPlanRunId}`, Object.assign(Object.assign({}, options), { callback(error, encodedMessage) { var _a; if (error) { handler(undefined, undefined, error); return; } try { const onTestPlanRunJs = jsonCodec.decode(encodedMessage === null || encodedMessage === void 0 ? void 0 : encodedMessage.data); const onTestPlanRun = OnTestPlanRun.fromJS(onTestPlanRunJs); const planRunId = (_a = encodedMessage.subject.match(/\.PlanRun\.(.+)$/)) === null || _a === void 0 ? void 0 : _a[1]; handler(planRunId, onTestPlanRun, error); } catch (error) { try { if (encodedMessage.string()) { handler(undefined, undefined, error); } } catch (error) { handler(undefined, undefined, error); } } } })); } /** * Connect to listen to the test plan run logs for the given test plan run ID * @param {string} testPlanRunId * @param {(logList:LogList|undefined,err:NatsError|Error|null)=>void} handler * @param {SubscriptionOptions} options? * @returns Subscription */ connectTestPlanRunLogs(testPlanRunId, handler, options) { return this.subscribe(`PlanRun.${testPlanRunId}.Logs`, Object.assign(Object.assign({}, options), { callback(error, encodedMessage) { if (error) { handler(undefined, error); return; } try { const logListJson = jsonCodec.decode(encodedMessage === null || encodedMessage === void 0 ? void 0 : encodedMessage.data); const logList = LogList.fromJS(logListJson); handler(logList, error); } catch (error) { handler(undefined, error); } } })); } /** * Connect to listen to the test step run events for the given test step and test plan run ID * @param {string} testPlanRunId * @param {string} testStepRunId * @param {(testRun:OnTestStepRun|undefined,err:NatsError|Error|null)=>void} handler * @param {SubscriptionOptions} options? * @returns Subscription */ connectTestStepRunEvents(testPlanRunId, testStepRunId, handler, options) { return this.subscribe(`PlanRun.${testPlanRunId}.StepRun.${testStepRunId}`, Object.assign(Object.assign({}, options), { callback(error, encodedMessage) { var _a; if (error) { handler(undefined, undefined, undefined, error); return; } try { const onTestStepRunJs = jsonCodec.decode(encodedMessage === null || encodedMessage === void 0 ? void 0 : encodedMessage.data); const onTestStepRun = OnTestStepRun.fromJS(onTestStepRunJs); const [, planRunId, stepRunId] = (_a = encodedMessage.subject.match(/\.PlanRun\.(.+)\.StepRun\.(.+)$/)) !== null && _a !== void 0 ? _a : [ undefined, undefined, undefined, ]; handler(planRunId, stepRunId, onTestStepRun, error); } catch (error) { try { if (encodedMessage.string()) { handler(undefined, undefined, undefined, error); } } catch (error) { handler(undefined, undefined, undefined, error); } } } })); } /** * Connect to listen to the test step run results for the given test step and test plan run ID * @param {string} testPlanRunId * @param {string} testStepRunId * @param {string} resultName * @param {(result:Result|undefined,err:NatsError|Error|null)=>void} handler * @param {SubscriptionOptions} options? * @returns Subscription */ connectTestStepRunResults(testPlanRunId, testStepRunId, resultName, handler, options) { return this.subscribe(`PlanRun.${testPlanRunId}.StepRun.${testStepRunId}.Result.${resultName}`, Object.assign(Object.assign({}, options), { callback(error, encodedMessage) { if (error) { handler(undefined, error); return; } try { const resultJs = jsonCodec.decode(encodedMessage === null || encodedMessage === void 0 ? void 0 : encodedMessage.data); const result = Result.fromJS(resultJs); handler(result, error); } catch (error) { handler(undefined, error); } } })); } /** * Retrieve session logs * @param id (optional) * @param level (optional) * @param excludedSource (optional) * @param filterText (optional) * @param offset (optional) * @param limit (optional) * @return Successfully retrieved OpenTAP log messages. */ getSessionLogs(id, levels, excludedSources, filterText, offset, limit) { const getSessionLogsRequest = { id, levels, excludedSources, filterText, offset, limit }; return this.request('GetSessionLogs', getSessionLogsRequest) .then(logListJs => LogList.fromJS(logListJs)) .then(this.success()) .catch(this.error()); } /** * Retrieve session log indexes * @param id (optional) * @param level (optional) * @param excludedSource (optional) * @param filterText (optional) * @param searchText (optional) * @return Logs indexes retrieved */ sessionLogSearch(id, levels, excludedSources, filterText, searchText) { const getSessionSearchRequest = { id, levels, excludedSources, filterText, searchText }; return this.request('SessionLogSearch', getSessionSearchRequest).then(this.success()).catch(this.error()); } /** * Retrieve log sources * @param id (optional) * @return Logs indexes retrieved */ sessionLogSources(id) { return this.request('SessionLogSources', id).then(this.success()).catch(this.error()); } /** * Retrieve session log counts * @param id (optional) * @return Logs indexes retrieved */ sessionLogCounts(id) { return this.request('SessionLogCounts', id).then(this.success()).catch(this.error()); } /** * Retrieve log severities * @return Log levels retrieved */ logLevels() { return this.request('LogLevels').then(this.success()).catch(this.error()); } /** * Get status, with an optional testplan execution completion timeout * @param {number | null | undefined} timeout (optional) * @return RunStatus retrieved */ getStatus(timeout) { return this.request('GetStatus', timeout) .then(runStatusJs => RunStatus.fromJS(runStatusJs)) .then(this.success()) .catch(this.error()); } /** * Get edit status that contains undo/redo buffer count and testplan dirty status * @returns EditStatus retrieved */ getEditStatus() { return this.request('GetEditStatus') .then(editStatusJs => EditStatus.fromJS(editStatusJs)) .then(this.success()) .catch(this.error()); } /** * Upload test plan XML * @param xml Test Plan XML * @return Test plan loaded. List of load errors is returned. */ setTestPlanXML(xml) { return this.request('SetTestPlanXML', xml).then(this.success()).catch(this.error()); } /** * Retrieve loaded test plan XML * @return Test plan retrieved */ getTestPlanXML() { // Generate a unique subject where the Runner will publish the chunks return this.request('GetTestPlanXML').then(this.success()).catch(this.error()); } /** * Downloads the resource from the runner and returns it as raw bytes * @return Raw bytes representing the resource */ downloadResource(resource) { var _a; const runnerResourcePrefix = 'subject://'; if (!((_a = resource.source) === null || _a === void 0 ? void 0 : _a.startsWith(runnerResourcePrefix))) { return Promise.reject('The source of the provided resource is not a nats subject.'); } const subject = resource.source.slice(runnerResourcePrefix.length); return this.request(subject, undefined, { rawResponse: true, fullSubject: true }) .then(this.success()) .catch(this.error()); } /** * Moves the test steps as children of target step * @param TargetStepId target test step id * @param StepIds test steps ids to move */ moveStepsAsChildren(targetStepId, StepIds) { // need to send GUID.EMPTY if target step id is empty, so that runner can parse correctly const TargetStepId = targetStepId ? targetStepId : NIL; this.request('MoveStepsAsChildren', { StepIds, TargetStepId }).then(this.success()).catch(this.error()); } /** * Moves the test steps as sibling of target step * @param TargetStepId target test step id * @param StepIds test steps ids to move */ moveSteps(targetStepId, StepIds) { // need to send GUID.EMPTY if target step id is empty, so that runner can parse correctly const TargetStepId = targetStepId ? targetStepId : NIL; this.request('MoveSteps', { StepIds, TargetStepId }).then(this.success()).catch(this.error()); } /** * Copy test steps * @param stepIds test step ids to copy * @return copied steps */ copySteps(StepIds) { return this.request('CopySteps', { StepIds }).then(this.success()).catch(this.error()); } /** * Paste copied test steps as sibling of target step * @param TargetStepId target test step id * @param Clipboard test steps copied to clipboard */ pasteStepsAsChildren(targetStepId, Clipboard) { // need to send GUID.EMPTY if target step id is empty, so that runner can parse correctly const TargetStepId = targetStepId ? targetStepId : NIL; this.request('PasteStepsAsChildren', { TargetStepId, Clipboard }).then(this.success()).catch(this.error()); } /** * Paste copied test steps as sibling of target step * @param TargetStepId target test step id * @param Clipboard test steps copied to clipboard */ pasteSteps(targetStepId, Clipboard) { // need to send GUID.EMPTY if target step id is empty, so that runner can parse correctly const TargetStepId = targetStepId ? targetStepId : NIL; this.request('PasteSteps', { TargetStepId, Clipboard }).then(this.success()).catch(this.error()); } /** * Delete test steps * @param stepIds test step ids to delete */ deleteSteps(StepIds) { this.request('DeleteSteps', { StepIds }).then(this.success()).catch(this.error()); } /** * Undo */ testPlanUndo() { this.request('TestPlanUndo').then(this.success()).catch(this.error()); } /** * Redo */ testPlanRedo() { this.request('TestPlanRedo').then(this.success()).catch(this.error()); } /** * Load test plan using a test plan TapPackage from a repository * @param {RepositoryPackageDefinition} packageReference * @return Test plan loaded. List of load errors is returned. */ loadTestPlanFromRepository(packageReference) { return this.request('LoadTestPlanFromRepository', packageReference).then(this.success()).catch(this.error()); } /** * Save currently loaded test plan to a repository * @param {RepositoryPackageDefinition} packageReference * @return Test plan uploaded with reference. */ saveTestPlanToRepository(packageReference) { return this.request('SaveTestPlanToRepository', packageReference) .then(SaveTestPlanToRepositoryResponse.fromJS) .then(this.success()) .catch(this.error()); } /** * Test plan resources opened * @return Test plan resources opened. */ resourcesOpen() { return this.request('ResourcesOpen') .then(testPlanJs => TestPlan.fromJS(testPlanJs)) .then(this.success()) .catch(this.error()); } /** * Test plan resources closed * @return Test plan resources closed. */ resourcesClose() { return this.request('ResourcesClose') .then(testPlanJs => TestPlan.fromJS(testPlanJs)) .then(this.success()) .catch(this.error()); } /** * Retrieve test plan or test step settings * @param {string} contextId * @return List of settings retrieved */ getSettings(contextId) { return this.request('GetSettings', contextId) .then(settingArrayJs => settingArrayJs.map(settingJs => Setting.fromJS(settingJs))) .then(this.success()) .catch(this.error()); } /** * Change test plan or test step settings * @param {string} contextId * @param {Setting[]} settings * @return Settings changed */ setSettings(contextId, settings) { const setSettingsRequest = { contextId, settings }; return this.request('SetSettings', setSettingsRequest) .then(settingArrayJs => settingArrayJs.map(settingJs => Setting.fromJS(settingJs))) .then(this.success()) .catch(this.error()); } /** * Retrieve test plan structure * @param {string[] | null | undefined} properties * @return Test plan retrieved */ getTestPlan(properties) { return this.request('GetTestPlan', properties) .then(testPlanJs => TestPlan.fromJS(testPlanJs)) .then(this.success()) .catch(this.error()); } /** * Change test plan structure * @param {TestPlan} plan * @return Test plan changed */ setTestPlan(plan) { return this.request('SetTestPlan', plan) .then(testPlanJs => TestPlan.fromJS(testPlanJs)) .then(this.success()) .catch(this.error()); } /** * Set the name of the test plan * @param {string} testPlanName * @return {Promise<void>} */ setTestPlanName(testPlanName) { return this.request('SetTestPlanName', testPlanName).then(this.success()).catch(this.error()); } /** * Gets the loaded test plan repository reference. * @return {Promise<GetTestPlanReferenceResponse>} */ getTestPlanReference() { return this.request('GetTestPlanReference') .then(GetTestPlanReferenceResponse.fromJS) .then(this.success()) .catch(this.error()); } /** * Retrieve all validation errors present in the test plan * @return Retrieved validation errors for loaded TestPlan */ getValidationErrors() { return this.request('GetValidationErrors') .then(testStepValidationErrorArrayJs => testStepValidationErrorArrayJs.map(testStepValidationErrorJs => TestStepValidationError.fromJS(testStepValidationErrorJs))) .then(this.success()) .catch(this.error()); } /** * Retrieve or change common test step settings * @param {CommonSettings} commonSettings * @return Common test step settings retrieved or changed */ commonStepSettings(commonSettings) { return this.request('CommonStepSettings', commonSettings) .then(commonSettingsJs => CommonSettings.fromJS(commonSettingsJs)) .then(this.success()) .catch(this.error()); } /** * Retrieve or invoke common test step settings context menu items * @param {string} propertyName * @param {TestPlan} commonContext * @return Get context menu (right-click menu) for a property in the testplan or teststep */ commonStepSettingsContextMenu(propertyName, commonContext) { const commonStepSettingsContextRequest = { propertyName, commonContext }; return this.request('CommonStepSettingsContextMenu', commonStepSettingsContextRequest) .then(commonContextJs => CommonContext.fromJS(commonContextJs)) .then(this.success()) .catch(this.error()); } /** * Retrieve all pending user input IDs * @return Retrieved pending user inputs */ getUserInputs() { return this.request('GetUserInputs').then(this.success()).catch(this.error()); } /** * Retrieve pending user input based on ID * @param {string} id * @return Retrieved pending user input */ getUserInput(id) { return this.request('GetUserInput', id) .then(interactionJs => Interaction.fromJS(interactionJs)) .then(this.success()) .catch(this.error()); } /** * Modify or answer pending user input based on ID * @param interaction * @returns {Promise<Interaction>} */ setUserInput(interaction) { return this.request('SetUserInput', interaction) .then(interactionJs => Interaction.fromJS(interactionJs)) .then(this.success()) .catch(this.error()); } /** * Property context menu * @param {string} contextId * @param {string | null} propertyName * @return Get context menu (right-click menu) for a property in the testplan or teststep */ getContextMenu(contextId, propertyName) { const propertyReferenceRequest = { contextId, propertyName, }; return this.request('GetContextMenu', propertyReferenceRequest) .then(settingArrayJs => settingArrayJs.map(settingJs => Setting.fromJS(settingJs))) .then(this.success()) .catch(this.error()); } /** * Property context menu * @param {string} contextId * @param {string | null} propertyName * @param {Setting[]} contextMenu * @return Set context menu (right-click menu) for a property in the testplan or teststep */ setContextMenu(contextId, propertyName, contextMenu) { const setContextMenuRequest = { contextId, propertyName, contextMenu, }; return this.request('SetContextMenu', setContextMenuRequest) .then(settingArrayJs => settingArrayJs.map(settingJs => Setting.fromJS(settingJs))) .then(this.success()) .catch(this.error()); } /** * Get data grid * @param {string} contextId * @param {string | null} propertyName * @return DataGridControl retrieved */ getDataGrid(contextId, propertyName) { const propertyReferenceRequest = { contextId, propertyName, }; return this.request('GetDataGrid', propertyReferenceRequest) .then(dataGridControlJs => DataGridControl.fromJS(dataGridControlJs)) .then(this.success()) .catch(this.error()); } /** * Set data grid * @return Set data grid */ setDataGrid(contextId, propertyName, dataGridControl) { const setDataGridRequest = { contextId, propertyName, dataGridControl }; return this.request('SetDataGrid', setDataGridRequest) .then(dataGridControlJs => DataGridControl.fromJS(dataGridControlJs)) .then(this.success()) .catch(this.error()); } /** * Add item type to data grid * @param {string} contextId * @param {string | null} propertyName * @param {string | null} typeName * @return DataGridControl retrieved */ addDataGridItemType(contextId, propertyName, typeName) { const addDataGridItemTypeRequest = { contextId, propertyName, typeName, }; return this.request('AddDataGridItemType', addDataGridItemTypeRequest) .then(dataGridControlJs => DataGridControl.fromJS(dataGridControlJs)) .then(this.success()) .catch(this.error()); } /** * Add item to data grid * @param {string} contextId * @param {string | null} propertyName * @return DataGridControl retrieved */ addDataGridItem(contextId, propertyName) { const propertyReferenceRequest = { contextId, propertyName, }; return this.request('AddDataGridItem', propertyReferenceRequest) .then(dataGridControlJs => DataGridControl.fromJS(dataGridControlJs)) .then(this.success()) .catch(this.error()); } /** * Get item types available in the data grid * @param {string} contextId * @param {string | null} propertyName * @return List of ListItemType retrieved */ getDataGridTypes(contextId, propertyName) { const propertyReferenceRequest = { contextId, propertyName, }; return this.request('GetDataGridTypes', propertyReferenceRequest) .then(listItemTypeArrayJs => listItemTypeArrayJs.map(listItemTypeJs => ListItemType.fromJS(listItemTypeJs))) .then(this.success()) .catch(this.error()); } /** * Retrieve static available step type information. * @return StepTypes retrieved */ getStepTypes() { return this.request('GetStepTypes') .then(testStepTypeArrayJs => testStepTypeArrayJs.map(testStepTypeJs => TestStepType.fromJS(testStepTypeJs))) .then(this.success()) .catch(this.error()); } /** * Pause test plan execution at next possible test step */ setPauseNext() { return this.request('SetPauseNext').then(this.success()).catch(this.error()); } /** * Retrieve breakpoints set in test plan */ getBreakpoints() { return this.request('GetBreakpoints') .then(breakPointsJs => BreakPoints.fromJS(breakPointsJs)) .then(this.success()) .catch(this.error()); } /** * Set breakpoints in test plan * @param {BreakPoints} breakPointsDto * @return BreakPoints retrieved */ setBreakpoints(breakPointsDto) { return this.request('SetBreakpoints', breakPointsDto) .then(breakPointsJs => BreakPoints.fromJS(breakPointsJs)) .then(this.success()) .catch(this.error()); } /** * Jump test plan execution to step. Execution state must be 'breaking'. * @param {string} stepId */ setJumpToStep(stepId) { return this.request('SetJumpToStep', stepId).then(this.success()).catch(this.error()); } /** * Execute test plan with attaching metadata * @param {Parameter[]} parameters * @return RunStatus retrieved */ runTestPlan(parameters) { return this.request('RunTestPlan', parameters) .then(runStatusJs => RunStatus.fromJS(runStatusJs)) .then(this.success()) .catch(this.error()); } /** * Abort test plan execution */ abortTestPlan() { return this.request('AbortTestPlan').then(this.success()).catch(this.error()); } /** * Shuts down session */ shutdown() { return this.request('Shutdown').then(this.success()).catch(this.error()); } /** * Retrieves installed packages in this session */ getImage() { return this.request('GetImage') .then(imageJs => Image.fromJS(imageJs)) .then(this.success()) .catch(this.error()); } /** * Retrieves session readiness */ getReadiness() { return this.request('GetReadiness').then(this.success()).catch(this.error()); } /** * Retrieves watchdog */ getWatchDog() { return this.request('GetWatchDog') .then(watchDogJs => WatchDog.fromJS(watchDogJs)) .then(this.success()) .catch(this.error()); } /** * Sets a new watchdog * @param {WatchDog} watchDog */ setWatchDog(watchDog) { return this.request('SetWatchDog', watchDog) .then(watchDogJs => WatchDog.fromJS(watchDogJs)) .then(this.success()) .catch(this.error()); } /** * Retrieve settings types used in creating a Settings TapPackage */ getSettingsTypes() { return this.request('GetSettingsTypes').then(this.success()).catch(this.error()); } /** * Get the metric information * @returns Promise */ getMetricsConfiguration() { return this.request('GetMetricsConfiguration') .then(metricsRequestJs => MetricsConfiguration.fromJS(metricsRequestJs)) .then(this.success()) .catch(this.error()); } /** * Set the metric information. Used for setting up which metrics should be published for polling. * @param {IMetricsConfiguration} metricsRequest * @returns Promise */ setMetricsConfiguration(metricsRequest) { return this.request('SetMetricsConfiguration', metricsRequest).then(this.success()).catch(this.error()); } } SessionClient.sessionEventFactories = { [SessionEventName.TypeCacheInvalidated]: () => TypeCacheInvalidatedEvent.fromJS(), [SessionEventName.TestPlanSettingsChanged]: () => TestPlanSettingsChangedEvent.fromJS(), [SessionEventName.SessionTimeout]: () => SessionTimeoutEvent.fromJS(), [SessionEventName.Starting]: () => StartingEvent.fromJS(), [SessionEventName.Started]: () => StartedEvent.fromJS(), [SessionEventName.Heartbeat]: payload => HeartbeatEvent.fromJS(payload), [SessionEventName.Stopping]: () => StoppingEvent.fromJS(), [SessionEventName.Stopped]: () => StoppedEvent.fromJS(), [SessionEventName.TestPlanChanged]: payload => TestPlanChangedEvent.fromJS(payload), [SessionEventName.TestPlanReferenceChanged]: payload => TestPlanReferenceChangedEvent.fromJS(payload), [SessionEventName.SessionStateChanged]: payload => SessionStateChangedEvent.fromJS(payload), [SessionEventName.SettingsChanged]: payload => SettingsChangedEvent.fromJS(payload), [SessionEventName.TestStepChanged]: payload => TestStepChangedEvent.fromJS(payload), [SessionEventName.Break]: payload => BreakEvent.fromJS(payload), [SessionEventName.UserInputRequested]: payload => UserInputRequestedEvent.fromJS(payload), [SessionEventName.UserInputRequestCompleted]: payload => UserInputRequestCompletedEvent.fromJS(payload), };