I would like to use page.should have_no_content to check if the page doesn\'t display the label to user, here what it is in HTML:
I found a solution using:
Then /^"([^\"]+)" should not be visible$/ do |text|
paths = [
"//*[@class='hidden']/*[contains(.,'#{text}')]",
"//*[@class='invisible']/*[contains(.,'#{text}')]",
"//*[@style='display: none;']/*[contains(.,'#{text}')]"
]
xpath = paths.join '|'
page.should have_xpath(xpath)
end