diff --git a/deploy-ghpages.py b/deploy-ghpages.py index f601923..794cb8e 100755 --- a/deploy-ghpages.py +++ b/deploy-ghpages.py @@ -29,7 +29,7 @@ dir = mkdtemp() check_call("git clone --branch %s %s %s" % (deploy_branch, repo, dir), shell=True) chdir(dir) -check_call("python -m robot.libdoc robotpageobjects.page.Page index.html", shell=True) +check_call("python -m robot.libdoc robotpageobjects.Page index.html", shell=True) print "Docs built successfully" check_call("git config user.name '%s'" % getenv('GIT_NAME'), shell=True) check_call("git config user.email '%s'" % getenv('GIT_EMAIL'), shell=True) diff --git a/robotpageobjects/base.py b/robotpageobjects/base.py index 98cdae9..a4e71b3 100755 --- a/robotpageobjects/base.py +++ b/robotpageobjects/base.py @@ -83,12 +83,12 @@ def get_robot_aliases(cls, name, pageobject_name): """ ret = [] - # Look through the alias dict if not in libdoc. If there is an alias, add the aliased version to what is returned. - if not in_ld: - if name in cls._aliases: - 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. + # Look through the alias dict. If there is an alias, add the aliased version to what is returned. + if name in cls._aliases: + 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)) # Add the plain name of the keyword. diff --git a/robotpageobjects/page.py b/robotpageobjects/page.py index 0558de0..35c52f8 100755 --- a/robotpageobjects/page.py +++ b/robotpageobjects/page.py @@ -120,7 +120,6 @@ class Page(_BaseActions, _SelectorsManager, _ComponentsManager): """ __metaclass__ = _PageMeta - def __init__(self): """ Initializes the pageobject_name variable, which is used by the _Keywords class @@ -144,7 +143,12 @@ def __init__(self): @staticmethod @not_keyword def _titleize(str): - return re.sub(r"(\w)([A-Z])", r"\1 \2", str) + """ + Converts camel case to title case + :param str: camel case string + :return: title case string + """ + return re.sub('([a-z0-9])([A-Z])', r'\1 \2', re.sub(r"(.)([A-Z][a-z]+)", r'\1 \2', str)) @staticmethod @not_keyword @@ -271,16 +275,18 @@ def get_keyword_documentation(self, kwname): :return: a documentation string for kwname """ if kwname == '__intro__': - doc = """\n + docstring = self.__doc__ if self.__doc__ else '' + s2l_link = """\n All keywords listed in the Selenium2Library documentation are also available in this Page Object. See http://rtomac.github.io/robotframework-selenium2library/doc/Selenium2Library.html """ - return self.__doc__ + doc + return docstring + s2l_link kw = getattr(self, kwname, None) - doc = kw.__doc__ if kw.__doc__ else '' + alias = '' if kwname in _Keywords._aliases: - doc = '*Alias: %s*\n\n' % _Keywords.get_robot_aliases(kwname, self._underscore(self.name))[0].replace('_', ' ').title() + doc - return doc + alias = '*Alias: %s*\n\n' % _Keywords.get_robot_aliases(kwname, self._underscore(self.name))[0].replace('_', ' ').title() + docstring = kw.__doc__ if kw.__doc__ else '' + return alias + docstring @not_keyword def get_keyword_arguments(self, kwname):