def translations(fixture): """The user can choose between languages. The text for which translations exist change accordingly.""" fixture.browser.open('/') vassert( fixture.browser.is_element_present(XPath.heading_with_text(1, "Addresses")) ) vassert( fixture.browser.is_element_present(XPath.label_with_text("Name")) ) #go to the the translated page fixture.browser.click(XPath.link_with_text('Afrikaans')) vassert( fixture.browser.is_element_present(XPath.heading_with_text(1, "Adresse")) ) vassert( fixture.browser.is_element_present(XPath.label_with_text("Naam")) )
def async_upload_error(fixture): """If an error happens during (ajax) upload, the user is notified.""" fixture.reahl_server.set_app(fixture.new_wsgi_app(enable_js=True)) fixture.config.reahlsystem.debug = False # So that we don't see the exception output while testing browser = fixture.driver_browser browser.open('/') vassert(not browser.is_element_present( XPath.label_with_text('an error ocurred, please try again later.'))) with expected(Exception): browser.type(XPath.input_labelled('Choose file(s)'), fixture.file_to_upload1.name) vassert( browser.wait_for_element_present( XPath.span_containing( 'an error occurred, please try again later.'))) vassert(not browser.is_element_enabled(XPath.button_labelled('Cancel')))
def upload_button_indicates_focus(self): element = self.driver_browser.find_element( XPath.label_with_text('Choose file(s)')) return 'focus' in element.get_attribute('class')