Home Manual Reference Source
public class | source

ChatController

Extends:

* → ChatController

Constructor Summary

Public Constructor
public

constructor(args: args)

Adds the browser to the controller from the Base Controller constructor.

Member Summary

Public Members
public

Method Summary

Public Methods
public

Gets messages for selected contact

public

Gets contact name from top of chat message window

public

Get last message (as in the newest) for selected contact

public

async sendChatMessageToContact(name: String, message: String)

Selects contact, then sends message to them

Public Constructors

public constructor(args: args) source

Adds the browser to the controller from the Base Controller constructor. This then gets pushed into the various page objects and is ultimately used there to make calls to the actual browser.

Params:

NameTypeAttributeDescription
args args

Args from client

Public Members

public chatPage: * source

Public Methods

public async getChatMessagesForContact(name: String): Array source

Gets messages for selected contact

Params:

NameTypeAttributeDescription
name String

name of contact

Return:

Array

Array of objects of messages.

Example:

client.chatController.getChatMessagesForContact('Test User')
// Returns...
[{
   from: 'Another User',
   timestamp: 'Friday, March 21, 2017',
   message: 'Hey from another user!'
},
{
   from: 'Another User',
   timestamp: 'Monday, March 24, 2017',
   message: 'Did you get my last message?'
},
{
   from: 'Another User 2',
   timestamp: 'Tuesday, March 25, 2017',
   message: 'Hey, Another User is trying to reach you...'
}]

public async getChatWindowHeaderName(): String source

Gets contact name from top of chat message window

Return:

String

Name of contact

TODO:

  • Fix this!

public async getLastMessageForContact(name: String): Object source

Get last message (as in the newest) for selected contact

Params:

NameTypeAttributeDescription
name String

name of contact

Return:

Object

Object with from, timestamp, and message.

Example:

client.chatController.getLastMessageForContact('Test User')
// Returns...
{
   from: 'Another User',
   timestamp: 'Friday, March 24, 2017',
   message: 'Hey from another user!'
}

public async sendChatMessageToContact(name: String, message: String) source

Selects contact, then sends message to them

Params:

NameTypeAttributeDescription
name String

Name of contact

message String

Message to send