// Resolve once the next matching event fires — the promise form of one()
cy.promiseOn(events: string, predicate?: ElePredicate<NodeData, EdgeData>): Promise<Event<NodeData, EdgeData>>Resolve once the next matching event fires — the promise form of one().
| Name | Description |
|---|---|
events: string | one or more space-separated event names |
predicate: ElePredicate<NodeData, EdgeData>? | an optional delegation predicate over the target |
Returns
Promise<Event<NodeData, EdgeData>>a promise for the event object
Example
const next = cy.promiseOn('example');cy.emit('example');console.log((await next).type); // 'example'Also spelled cy.pon.