问题
How do you test for an input's title/tooltip with rspec?
I wasn't testing for tooltips until I noticed a few stopped working and it wasn't caught by the other tests. (Had to add something so the question would be accepted)
回答1:
How about:
find('#element-locator')['title'].should == 'Expected title'
回答2:
You can also look at the HTML attributes:
expect(page).to have_selector("<selector>[data-content='<content>']")
来源:https://stackoverflow.com/questions/16698902/how-to-test-for-input-title-tooltip-with-rspec