js

package
v0.0.0-...-71aaf32 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 5, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const CONSOLE_LOG_CONTROL_STRING = "CC:"

The unique console log line prefix which denotes a control message to the test rig. The text after this string is a JSON object which contains information on the type of update (e.g a new event, a verification request)

For example:

CC:{"t":1,"d":{"RoomID":"!foo:bar","Event":{...}}}

Variables

This section is empty.

Functions

func EmitControlMessageEventJS

func EmitControlMessageEventJS(roomIDJsCode, eventJSONJsCode string) string

func EmitControlMessageSyncJS

func EmitControlMessageSyncJS() string

func EmitControlMessageVerificationJS

func EmitControlMessageVerificationJS(stageJSCode, txnIDJSCode, userIDJSCode, deviceIDJSCode, dataJSCode string) string

func NewJSClient

func NewJSClient(t ct.TestLike, opts api.ClientCreationOpts) (api.Client, error)

func SetupJSLogs

func SetupJSLogs(filename string)

func WriteJSLogs

func WriteJSLogs()

Types

type ControlMessage

type ControlMessage struct {
	Type MessageType     `json:"t"`
	Data json.RawMessage `json:"d"`
}

func (*ControlMessage) AsControlMessageEvent

func (c *ControlMessage) AsControlMessageEvent() *ControlMessageEvent

func (*ControlMessage) AsControlMessageSync

func (c *ControlMessage) AsControlMessageSync() *ControlMessageSync

func (*ControlMessage) AsControlMessageVerification

func (c *ControlMessage) AsControlMessageVerification() *ControlMessageVerification

type ControlMessageEvent

type ControlMessageEvent struct {
	RoomID string
	Event  JSEvent
}

type ControlMessageSync

type ControlMessageSync struct{}

type ControlMessageVerification

type ControlMessageVerification struct {
	Stage    string
	TxnID    string
	UserID   string
	DeviceID string
	Data     json.RawMessage // data specific to the Stage
}

type JSClient

type JSClient struct {
	// contains filtered or unexported fields
}

func (*JSClient) Backpaginate

func (c *JSClient) Backpaginate(t ct.TestLike, roomID string, count int) error

func (*JSClient) BackupKeys

func (c *JSClient) BackupKeys(t ct.TestLike) (recoveryKey string, err error)

func (*JSClient) Close

func (c *JSClient) Close(t ct.TestLike)

Close is called to clean up resources. Specifically, we need to shut off existing browsers and any FFI bindings. If we get callbacks/events after this point, tests may panic if the callbacks log messages.

func (*JSClient) CurrentAccessToken

func (c *JSClient) CurrentAccessToken(t ct.TestLike) string

func (*JSClient) DeletePersistentStorage

func (c *JSClient) DeletePersistentStorage(t ct.TestLike)

func (*JSClient) ForceClose

func (c *JSClient) ForceClose(t ct.TestLike)

func (*JSClient) GetEvent

func (c *JSClient) GetEvent(t ct.TestLike, roomID, eventID string) (*api.Event, error)

func (*JSClient) GetEventShield

func (c *JSClient) GetEventShield(t ct.TestLike, roomID, eventID string) (*api.EventShield, error)

func (*JSClient) GetNotification

func (c *JSClient) GetNotification(t ct.TestLike, roomID, eventID string) (*api.Notification, error)

func (*JSClient) InviteUser

func (c *JSClient) InviteUser(t ct.TestLike, roomID, userID string) error

func (*JSClient) IsRoomEncrypted

func (c *JSClient) IsRoomEncrypted(t ct.TestLike, roomID string) (bool, error)

IsRoomEncrypted returns true if the room is encrypted. May return an error e.g if you provide a bogus room ID.

func (*JSClient) ListenForVerificationRequests

func (c *JSClient) ListenForVerificationRequests(t ct.TestLike) chan api.VerificationStage

func (*JSClient) LoadBackup

func (c *JSClient) LoadBackup(t ct.TestLike, recoveryKey string) error

func (*JSClient) Logf

func (c *JSClient) Logf(t ct.TestLike, format string, args ...interface{})

func (*JSClient) Login

func (c *JSClient) Login(t ct.TestLike, opts api.ClientCreationOpts) error

func (*JSClient) Opts

func (c *JSClient) Opts() api.ClientCreationOpts

func (*JSClient) RequestOwnUserVerification

func (c *JSClient) RequestOwnUserVerification(t ct.TestLike) chan api.VerificationStage

func (*JSClient) SendMessage

func (c *JSClient) SendMessage(t ct.TestLike, roomID, text string) (eventID string, err error)

func (*JSClient) StartSyncing

func (c *JSClient) StartSyncing(t ct.TestLike) (stopSyncing func(), err error)

StartSyncing to begin syncing from sync v2 / sliding sync. Tests should call stopSyncing() at the end of the test.

func (*JSClient) Type

func (c *JSClient) Type() api.ClientTypeLang

func (*JSClient) UserID

func (c *JSClient) UserID() string

func (*JSClient) WaitUntilEventInRoom

func (c *JSClient) WaitUntilEventInRoom(t ct.TestLike, roomID string, checker func(e api.Event) bool) api.Waiter

type JSEvent

type JSEvent struct {
	Type     string                 `json:"type"`
	Sender   string                 `json:"sender,omitempty"`
	StateKey *string                `json:"state_key,omitempty"`
	Content  map[string]interface{} `json:"content"`
	ID       string                 `json:"event_id"`
}

type MessageType

type MessageType int
const (
	MessageTypeEvent        MessageType = 1
	MessageTypeSync         MessageType = 2
	MessageTypeVerification MessageType = 3
)

Directories

Path Synopsis
package chrome provides helper functions to execute JS in a Chrome browser
package chrome provides helper functions to execute JS in a Chrome browser

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL