Kind: global class
Utilizes the Observer Pattern, where the Page is the producer and the Node Playwright Test is the consumer. Every time the Page produces a message (window.dataLayer.push, or GA-Universal/GA4 network request), the consumer's subscribers callbacks are called.
Subscribe for messages. Used by the consumer.
Kind: instance method of PubSub
Param | Type | Description |
---|---|---|
subscriber | function |
callback function to be executed once the message arrives |
Unsubscribe from messages. Used by the consumer.
Kind: instance method of PubSub
Param | Type | Description |
---|---|---|
subscriber | function |
reference to a callback function previously subscribed |
Publish messages. Used by the producer.
Kind: instance method of PubSub
Param | Type | Description |
---|---|---|
message | Message |
message published. |
Returns a promise that will be resolved when a message matching WaitForMessageOptions
is found,
or rejected if WaitForMessageOptions.timeout
is reached. Used by the consumer.
Kind: instance method of PubSub
Returns: Promise.<Message>
- message published.
Param | Type |
---|---|
[config] | WaitForMessageOptions |