I have problem, how to focus to CSS style by Jquery and JavaScript. I have this code:
it('Add new group', () => {
cy.waitForInitLoad();
cy.get('#dxToolbarMenu').then(($el) => {
expect($el[0].className).to.equal(
'dx-item dx-menu-item dx-menu-item-has-text dx-menu-item-has-icon',
)
})
Original CSS from web is in this picture:
You can do something like this:
cy.get('#dxToolbarMenu')
.find('.dx-item.dx-menu-item.dx-menu-item-has-text.dx-menu-item-has-icon')
You can also add focus() to focus on the Element.
cy.get('#dxToolbarMenu')
.find('.dx-item.dx-menu-item.dx-menu-item-has-text.dx-menu-item-has-icon')
.first() //In case of multiple elements with the same selector consider take the first one
.focus()