diff --git a/robotpageobjects/base.py b/robotpageobjects/base.py index b364ec1..509d2d5 100755 --- a/robotpageobjects/base.py +++ b/robotpageobjects/base.py @@ -16,9 +16,6 @@ from .context import Context from .optionhandler import OptionHandler -# determine if libdoc is running to avoid generating docs for automatically generated aliases -ld = 'libdoc' -in_ld = any([ld in str(x) for x in inspect.stack()]) class _Keywords(object): """ @@ -89,8 +86,7 @@ def get_robot_aliases(cls, name, pageobject_name): ret.append(cls._aliases[name].replace(cls._alias_delimiter, "_" + pageobject_name + "_")) else: # If not aliased, add the keyword name with the page object name at the end. - if not in_ld: - ret.append("%s_%s" % (name, pageobject_name)) + ret.append("%s_%s" % (name, pageobject_name)) # Add the plain name of the keyword. ret.append(name) @@ -1043,8 +1039,8 @@ def _vars_match_template(template, vars): def location_should_be(self, expected_url): """ - Override Selenium2Library's location_should_be() method and intelligently - determine if the current browser url matches with the ending url or full url passed in the method. + Wrapper for Selenium2Library's location_should_be() method. Allows matching against the + baseurl if a partial url is given. :param url: Either complete url or partial url to be validated against :type url: str diff --git a/robotpageobjects/page.py b/robotpageobjects/page.py index f4a7266..553ed9b 100755 --- a/robotpageobjects/page.py +++ b/robotpageobjects/page.py @@ -30,6 +30,10 @@ from .base import _ComponentsManagerMeta, not_keyword, robot_alias, _BaseActions, _Keywords, Override, _SelectorsManager, _ComponentsManager +# determine if libdoc is running to avoid generating docs for automatically generated aliases +ld = 'libdoc' +in_ld = any([ld in str(x) for x in inspect.stack()]) + class _PageMeta(_ComponentsManagerMeta): """Meta class that allows decorating of all page object methods with must_return decorator. This ensures that all page object @@ -201,7 +205,10 @@ def get_keyword_names(self): elif inspect.ismethod(obj) and not name.startswith("_") and not _Keywords.is_method_excluded(name): # Add all methods that don't start with an underscore and were not marked with the # @not_keyword decorator. - keywords += _Keywords.get_robot_aliases(name, self._underscore(self.name)) + if not in_ld: + keywords += _Keywords.get_robot_aliases(name, self._underscore(self.name)) + else: + keywords.append(name) return keywords def _attempt_screenshot(self): @@ -287,6 +294,7 @@ def get_keyword_documentation(self, kwname): if kwname in _Keywords._aliases: alias = '*Alias: %s*\n\n' % _Keywords.get_robot_aliases(kwname, self._underscore(self.name))[0].replace('_', ' ').title() docstring = kw.__doc__ if kw.__doc__ else '' + docstring = re.sub(r'(wrapper)', r'*\1*', docstring, flags=re.I) return alias + docstring @not_keyword