Uploaded August 2023 | Updated September 2026, 1 week ago
This video shows how my plugin github.com/bahmutov/cypress-await sync mode preprocessor can automatically transform Cypress specs to allow direct assignment of values in Cypress to avoid a pyramid of callbacks. This plugin allows you to simply get the value:
const text = cy.get(selector).invoke('text')
const n = cy.wait(alias).its('response.body.length')
Find the full application example at github.com/bahmutov/cypress-todomvc-await-example and read the blog post "Use Async Await In Cypress Specs" glebbahmutov.com/blog/use-async-await-in-cypress-specs
This video shows how my plugin github.com/bahmutov/cypress-await sync mode preprocessor can automatically transform Cypress specs to allow direct assignment of values in Cypress to avoid a pyramid of callbacks. This plugin allows you to simply get the value:
const text = cy.get(selector).invoke('text')
const n = cy.wait(alias).its('response.body.length')
Find the full application example at github.com/bahmutov/cypress-todomvc-await-example and read the blog post "Use Async Await In Cypress Specs" glebbahmutov.com/blog/use-async-await-in-cypress-specs

![Dispatch Custom HTML Events From Cypress Tests
Sometimes an element on the page subscribes to custom events. You can dispatch events using plain HTML method el.dispatchEvent or by using Cypress command cy.trigger
cy.get(#signal).then(function ($el) {
$el[0].dispatchEvent(new CustomEvent(go))
})
// using cy.trigger
cy.get(#signal).trigger(warn)
Find the full example recipe at https://glebbahmutov.com/cypress-examples/ Dispatch Custom HTML Events From Cypress Tests](https://i.ytimg.com/vi/qCqzS3LtSeI/mqdefault.jpg)








![Confirm Sorted Attributes
If you need to get an attribute from each DOM element, and you dont care about the order, you should compare sorted arrays. This video shows how to grab a data-... attribute using plain Cypress syntax and cypress-map plugins. Find the full recipe at https://glebbahmutov.com/cypress-examples Here is the cypress-map solution
// the expected SKU numbers
const skus = [00991C, 00100C, 00500A, 0044B].sort()
cy.get(#purchases li)
.map(dataset.sku)
.invoke(sort)
.print()
.should(deep.equal, skus) Confirm Sorted Attributes](https://i.ytimg.com/vi/sVb5MU2AkqE/mqdefault.jpg)