How can i use Rspec Expectations in Page-object classes. I need to assert elements. Currently i am using xpath, other locators to check element existence. I know using it is step definitions. But i need it in classes.
Code:
class AssertTest
include PageObject
span(:success, text: "Message added successfully")
def assert_element
success_element.when_present (or) success?
# I need to use Rspec expectations instead
# continue...
end
end
In step definitions i am able to use it like:
@current_page.text.should include "message"