featurist / browser-monkey

Reliable DOM testing
https://browsermonkey.org
53 stars 6 forks source link

Expect attributes on multiple elements #47

Closed SachaZvetelman closed 7 years ago

SachaZvetelman commented 8 years ago

Currently you can do: page.titles().shouldHave({ text: ['Title 1', 'Title 2', 'Title 3'] });

It would be useful to be able to do the same, but with attributes. Something like: page.titles().shouldHave({ attributes: { href: ['https://google.com/', 'https://google.co.uk/', 'https://google.com.ar/'] } });

dereke commented 7 years ago

Ah this was implemented in v2.2.0 - https://github.com/featurist/browser-monkey/blob/master/CHANGELOG.md#220---2017-02-27

browser.find('img').shouldHave({
  attributes: [
    {src: '/monkey1.jpg', alt: 'first monkey'},
    {src: '/monkey2.jpg', alt: 'second monkey'},
  ]
})