ncbi / robotframework-pageobjects

Implementation of the Page Object pattern with Robot Framework and selenium. Also facilitates page object pattern independent of Robot Framework
http://ncbi.github.io/robotframework-pageobjects
Other
84 stars 75 forks source link

Would like a way to externally set "robotpageobjects.page.in_ld" #55

Open boakley opened 9 years ago

boakley commented 9 years ago

The Page.get_keyword_names function attempts to auto-detect that it is running from within libdoc, and returns an abridged version of the keywords (ie: it doesn't include aliases). This is great when generating documentation from libdoc, but not so great when generating documentation from other documentation tools (think: robotframework-hub, and maybe others).

It would be nice if there was a public, documented way to set this flag. What I'm doing now is import robotpageobjects.page; robotpageobjects.page.in_ld=True, but that seems sketchy and prone to breaking in future releases of the pageobjects code.

I would like a supported way to flip this bit. Perhaps a class method (Page.set_keyword_mode("libdoc")) or at least a guarantee that robotpageobjects.in_ld is public, and won't change in future versions of the library.

kahunacohen commented 9 years ago

Would you be willing to fork and issue a PR? We are swamped at the moment. Thanks.

boakley commented 9 years ago

Yeah, I'll do that.

boakley commented 9 years ago

How do I run the current test suites?

On Tue, Jul 7, 2015 at 2:13 PM, Aaron Cohen notifications@github.com wrote:

Would you be willing to fork and issue a PR? We are swamped at the moment. Thanks.

— Reply to this email directly or view it on GitHub https://github.com/ncbi/robotframework-pageobjects/issues/55#issuecomment-119307184 .

kahunacohen commented 9 years ago

Good point. I'll add instructions in the READMe. It may take me a few days

On Tue, Jul 7, 2015 at 3:21 PM, Bryan Oakley notifications@github.com wrote:

How do I run the current test suites?

On Tue, Jul 7, 2015 at 2:13 PM, Aaron Cohen notifications@github.com wrote:

Would you be willing to fork and issue a PR? We are swamped at the moment. Thanks.

— Reply to this email directly or view it on GitHub < https://github.com/ncbi/robotframework-pageobjects/issues/55#issuecomment-119307184

.

— Reply to this email directly or view it on GitHub https://github.com/ncbi/robotframework-pageobjects/issues/55#issuecomment-119308779 .

hellmanj commented 9 years ago

@boakley, were you able to run the tests? We just install nose and run nosetests -vs tests/test_unit.py tests/test_functional.py

kahunacohen commented 9 years ago

I modified README to include section on developing and writing tests...

hellmanj commented 9 years ago

Oh great, sorry I missed that.

kahunacohen commented 9 years ago

Yeah I changed the readme directly on master...

On Mon, Jul 13, 2015 at 9:34 AM, Jared Hellman notifications@github.com wrote:

Oh great, sorry I missed that.

— Reply to this email directly or view it on GitHub https://github.com/ncbi/robotframework-pageobjects/issues/55#issuecomment-120928390 .

boakley commented 9 years ago

With the instructions you added I am able to run the tests. I get a couple failures on my mac, is that expected? These are the four that failed (I won't include all the output for the sake of brevity. I can post it later if you want)

test_go_to_outside_robot (test_functional.ActionsTestCase) ... FAIL test_se2lib_keywords_are_still_available_if_both_se2lib_and_po_are_imported (test_functional.KeywordsTestCase) ... FAIL test_s2l_keyword_with_selector (test_functional.SelectorsTestCase) ... FAIL test_selector_with_se2lib_keyword (test_functional.SelectorsTestCase) ... FAIL

On Mon, Jul 13, 2015 at 8:27 AM, Jared Hellman notifications@github.com wrote:

@boakley https://github.com/boakley, were you able to run the tests? We just install nose and run nosetests -vs tests/test_unit.py tests/test_functional.py

— Reply to this email directly or view it on GitHub https://github.com/ncbi/robotframework-pageobjects/issues/55#issuecomment-120925945 .

hellmanj commented 9 years ago

It should be working on mac, can you please post the stack traces and maybe a pip freeze?

boakley commented 9 years ago

here's the tail end of the test run:

======================================================================
FAIL: test_go_to_outside_robot (test_functional.ActionsTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/bryanoakley/Dropbox/git/robotframework-pageobjects/tests/test_functional.py", line 191, in test_go_to_outside_robot
    self.assert_run(run, expected_returncode=0, search_output="OK")
  File "/Users/bryanoakley/Dropbox/git/robotframework-pageobjects/tests/basetestcase.py", line 234, in assert_run
    returncode, expected_returncode, run.cmd, run.output))
AssertionError: Return code was 1, expecting 0 with the command: 'python  test_go_to.py'
The message was:
 F.
======================================================================
FAIL: test_no_uri_template (__main__.TestWidgetItem)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test_go_to.py", line 18, in test_no_uri_template
    self.p.title_should_be('Google')
  File "<string>", line 2, in title_should_be
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Selenium2Library/keywords/keywordgroup.py", line 12, in _run_on_failure_decorator
    return method(*args, **kwargs)
  File "/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Selenium2Library/keywords/_browsermanagement.py", line 361, in title_should_be
    % (title, actual))
AssertionError: Title should have been 'Google' but was ''

----------------------------------------------------------------------
Ran 2 tests in 2.529s

FAILED (failures=1)

======================================================================
FAIL: test_se2lib_keywords_are_still_available_if_both_se2lib_and_po_are_imported (test_functional.KeywordsTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/bryanoakley/Dropbox/git/robotframework-pageobjects/tests/test_functional.py", line 439, in test_se2lib_keywords_are_still_available_if_both_se2lib_and_po_are_imported
    self.assert_run(run, expected_returncode=0, search_output="PASS")
  File "/Users/bryanoakley/Dropbox/git/robotframework-pageobjects/tests/basetestcase.py", line 234, in assert_run
    returncode, expected_returncode, run.cmd, run.output))
AssertionError: Return code was 1, expecting 0 with the command: 'pybot --variable baseurl:file:////Users/bryanoakley/Dropbox/git/robotframework-pageobjects/tests/scenarios -P po  test_se2lib_called_before_po.robot'
The message was:
==============================================================================
Test Se2Lib Called Before Po                                                  
==============================================================================
Overridden Keyword Should Be Available in Se2Lib                      | FAIL |
Multiple keywords with name 'Title Should Be' found.
Give the full name of the keyword you want to use.
Found: 'Selenium2Library.Title Should Be' and 'widget_rel_uri_attr.Page.Title Should Be'
------------------------------------------------------------------------------
Test Se2Lib Called Before Po                                          | FAIL |
1 critical test, 0 passed, 1 failed
1 test total, 0 passed, 1 failed
==============================================================================
Output:  /Users/bryanoakley/Dropbox/git/robotframework-pageobjects/tests/scenarios/output.xml
Log:     /Users/bryanoakley/Dropbox/git/robotframework-pageobjects/tests/scenarios/log.html
Report:  /Users/bryanoakley/Dropbox/git/robotframework-pageobjects/tests/scenarios/report.html

======================================================================
FAIL: test_s2l_keyword_with_selector (test_functional.SelectorsTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/bryanoakley/Dropbox/git/robotframework-pageobjects/tests/test_functional.py", line 213, in test_s2l_keyword_with_selector
    self.assert_run(run, expected_returncode=0, search_output="PASS")
  File "/Users/bryanoakley/Dropbox/git/robotframework-pageobjects/tests/basetestcase.py", line 234, in assert_run
    returncode, expected_returncode, run.cmd, run.output))
AssertionError: Return code was 1, expecting 0 with the command: 'pybot --variable baseurl:file:////Users/bryanoakley/Dropbox/git/robotframework-pageobjects/tests/scenarios -P po  test_s2l_keyword_with_selector.robot'
The message was:
==============================================================================
Test S2L Keyword With Selector                                                
==============================================================================
Test Click Element With Selector                                      | FAIL |
ValueError: Element locator 'search button' did not match any elements.
------------------------------------------------------------------------------
Test S2L Keyword With Selector                                        | FAIL |
1 critical test, 0 passed, 1 failed
1 test total, 0 passed, 1 failed
==============================================================================
Output:  /Users/bryanoakley/Dropbox/git/robotframework-pageobjects/tests/scenarios/output.xml
Log:     /Users/bryanoakley/Dropbox/git/robotframework-pageobjects/tests/scenarios/log.html
Report:  /Users/bryanoakley/Dropbox/git/robotframework-pageobjects/tests/scenarios/report.html

======================================================================
FAIL: test_selector_with_se2lib_keyword (test_functional.SelectorsTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/bryanoakley/Dropbox/git/robotframework-pageobjects/tests/test_functional.py", line 253, in test_selector_with_se2lib_keyword
    self.assert_run(run, expected_returncode=0, search_output="PASS")
  File "/Users/bryanoakley/Dropbox/git/robotframework-pageobjects/tests/basetestcase.py", line 234, in assert_run
    returncode, expected_returncode, run.cmd, run.output))
AssertionError: Return code was 1, expecting 0 with the command: 'pybot -P po  test_selector_with_se2lib_keyword.robot'
The message was:
==============================================================================
Test Selector With Se2Lib Keyword :: Selectors should work with Se2Lib keyw...
==============================================================================
Test Widget Site                                                      | FAIL |
ValueError: Element locator 'search-button' did not match any elements.
------------------------------------------------------------------------------
Test Selector With Se2Lib Keyword :: Selectors should work with Se... | FAIL |
1 critical test, 0 passed, 1 failed
1 test total, 0 passed, 1 failed
==============================================================================
Output:  /Users/bryanoakley/Dropbox/git/robotframework-pageobjects/tests/scenarios/output.xml
Log:     /Users/bryanoakley/Dropbox/git/robotframework-pageobjects/tests/scenarios/log.html
Report:  /Users/bryanoakley/Dropbox/git/robotframework-pageobjects/tests/scenarios/report.html

----------------------------------------------------------------------
Ran 135 tests in 224.525s

FAILED (SKIP=3, failures=4)
boakley commented 9 years ago

Here's the result of pip freeze:

aniso8601==0.92
argh==0.26.1
astroid==1.2.1
backports.ssl-match-hostname==3.4.0.2
castro==1.0.6
certifi==2015.4.28
CherryPy==3.2.4
dbbot==0.1
decorator==3.4.2
Django==1.8
django-debugtools==1.2.1
djangorestframework==3.1.1
docutils==0.12
elasticsearch==1.4.0
execnet==1.2.0
fake-factory==0.4.0
Flask==0.10.1
Flask-Bootstrap==3.1.1.2
Flask-MimeRender==0.1.3
Flask-RESTful==0.2.11
fs==0.4.0
gntp==1.0.2
google-api-python-client==1.3.1
halite==0.1.15
httplib2==0.9
httpretty==0.8.3
itsdangerous==0.24
jdcal==1.0
Jinja2==2.7.3
lockfile==0.9.1
logilab-common==0.62.1
M2Crypto==0.21.1
Markdown==2.4.1
markdown2==2.1.0
MarkupSafe==0.23
mercurial==2.8.2
mock==1.0.1
msgpack-python==0.4.0
nose==1.3.7
oauth2==1.5.211
oauth2client==1.4.5
openpyxl==2.2.0
Paste==1.7.5.1
pathtools==0.1.2
pbr==0.10.8
pika==0.9.13
PIL==1.1.7
Pmw==2.0.0
py==1.4.22
pyasn1==0.1.7
pyasn1-modules==0.0.5
pycrypto==2.6.1
Pygments==1.6
pylint==1.3.1
pymongo==2.6.3
pytest==2.6.0
pytest-xdist==1.10
python-gflags==2.0
python-jenkins==0.4.5
PyTumblr==0.0.6
pytz==2014.10
PyWebDAV==0.9.8
PyYAML==3.11
pyzmq==14.0.1
requests==2.7.0
robotframework==2.8.7
robotframework-databaselibrary==0.6
robotframework-faker==1.1
robotframework-hub==0.8.3
robotframework-imaplibrary==0.1.4
robotframework-lint==0.5
robotframework-pageobjects==1.2.1
robotframework-requests==0.3.8
robotframework-rfdoc==0.5
robotframework-ride==1.3
robotframework-selenium2library==1.6.0
robotframework-sudslibrary==0.8
robotframeworklexer==0.2
rsa==3.1.4
salt==0.17.4
sauceclient==0.1.0
selenium==2.45.0
simplejson==3.7.3
six==1.9.0
stevedore==0.15
suds==0.4
tornado==4.2
uritemplate==0.6
urllib3==1.10.4
virtualenv==1.11.6
virtualenv-clone==0.2.5
virtualenvwrapper==4.3.1
vnc2flv==20100207
watchdog==0.8.3
Werkzeug==0.10.4
wheel==0.24.0
WsgiDAV==1.1.0
wxPython==2.8.12.1
wxPython-common==2.8.12.1
hellmanj commented 9 years ago

Please update to robotframework-pageobjects==1.3.2 and try again.

boakley commented 9 years ago

I guess I'm a bit confused about your tests -- do they test the installed version, or the development version? I completely uninstalled robotframework-pageobjects, did a fresh fork and checkout of the trunk, and all the tests fail when I try to run them. That tells me it tests the installed version.

So, I created a new virtualenv, installed 1.3.2 via pip, and I now I get just a couple errors, so there's some progress. It still fails a couple of tests:

======================================================================
FAIL: test_go_to_outside_robot (test_functional.ActionsTestCase)
----------------------------------------------------------------------
Traceback (most recent call last):
  File
"/Users/bryanoakley/Dropbox/git/robotframework-pageobjects/tests/test_functional.py",
line 191, in test_go_to_outside_robot
    self.assert_run(run, expected_returncode=0, search_output="OK")
  File
"/Users/bryanoakley/Dropbox/git/robotframework-pageobjects/tests/basetestcase.py",
line 234, in assert_run
    returncode, expected_returncode, run.cmd, run.output))
AssertionError: Return code was 1, expecting 0 with the command: 'python
 test_go_to.py'
The message was:
 F.
======================================================================
FAIL: test_no_uri_template (__main__.TestWidgetItem)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "test_go_to.py", line 18, in test_no_uri_template
    self.p.title_should_be('Google')
  File "<string>", line 2, in title_should_be
  File
"/Users/bryanoakley/Dropbox/git/robotframework-pageobjects/env/lib/python2.7/site-packages/Selenium2Library/keywords/keywordgroup.py",
line 15, in _run_on_failure_decorator
    return method(*args, **kwargs)
  File
"/Users/bryanoakley/Dropbox/git/robotframework-pageobjects/env/lib/python2.7/site-packages/Selenium2Library/keywords/_browsermanagement.py",
line 398, in title_should_be
    % (title, actual))
AssertionError: Title should have been 'Google' but was ''

Here's the results of 'pip freeze' in this new environment:

decorator==3.4.2
docutils==0.12
funcsigs==0.4
mock==1.0.1
nose==1.3.7
pbr==1.3.0
requests==2.1.0
robotframework==2.8.7
robotframework-pageobjects==1.3.2
robotframework-selenium2library==1.7.0
selenium==2.46.0
simplejson==3.7.3
six==1.9.0
uritemplate==0.6
wsgiref==0.1.2