How can I get a reference to the button? which is always a sibling of the text I'm searching for.
In protractor test:
let spanText = 'My text';
let spanRef = element(by.css('span[name=' + spanText + ']'));
Html:
<div>
<span name="My text">My text</span>
<button type="button">
Click me!
</button>
</div>