D61-IA / stellar-gnosis

Gnosis paper management and collaboration tool
Apache License 2.0
0 stars 1 forks source link

Bug/search pagination fix #83

Closed Zhenghao-Zhao closed 4 years ago

Zhenghao-Zhao commented 4 years ago

Features:

  1. Replace POST forms with GET forms for submitting get requests. Applied to Paper, Person, Code, Venue and Dataset.
  2. Search now can also be performed via URL.
  3. Add Selenium tests for pagination.
Zhenghao-Zhao commented 4 years ago

I have no more updates for this branch. Cheers.

PantelisElinas commented 4 years ago

Hi @Zhenghao-Zhao

there is some weird bug in your implementation that affects the index pages for many of the entities.

For example, when I am at the Authors index view, the page buttons are associated with the wrong urls, e.g., http://127.0.0.1:8000/catalog/papers/?page=3 instead of http://127.0.0.1:8000/catalog/authors/?page=3. I noticed the same behavior for Datasets, Codes and Venues. BTW, the "Next" button is always the correct url! I get the same result on Firefox and Chrome.

This is not a problem in the develop branch.

Note again, that the error occurs in the index views but in this branch only.

Can you have a look?

P.

Zhenghao-Zhao commented 4 years ago

Thanks, there was a typo in the js function that used a fixed url. It is now fixed.

PantelisElinas commented 4 years ago

Hi @Zhenghao-Zhao

thank for fixing the above problem.

One of the Selenium tests fails. Can you have a look? The error I get on MacOS is the following,

====================================================================== ERROR: test_search (catalog.tests.selenium_tests.test_pagination.FirefoxTestCase) test pagination on search results

Traceback (most recent call last): File "/Users/eli024/Projects/stellar-gnosis/gnosis/catalog/tests/selenium_tests/test_pagination.py", line 101, in test_search classes = num_items[0].get_attribute('class') File "/Users/eli024/Projects/stellar-gnosis/gnosis-env/lib/python3.6/site-packages/selenium/webdriver/remote/webelement.py", line 141, in get_attribute self, name) File "/Users/eli024/Projects/stellar-gnosis/gnosis-env/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 636, in execute_script 'args': converted_args})['value'] File "/Users/eli024/Projects/stellar-gnosis/gnosis-env/lib/python3.6/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute self.error_handler.check_response(response) File "/Users/eli024/Projects/stellar-gnosis/gnosis-env/lib/python3.6/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.StaleElementReferenceException: Message: The element reference of <li class="page-item num_item active"> is stale; either the element is no longer attached to the DOM, it is not in the current frame context, or the document has been refreshed

Zhenghao-Zhao commented 4 years ago

I think it might have to do with how Firefox performs differently in Mac. I made a change based on what I think the difference might be, but I have no way telling if the problem is resolved since it does not happen to my device.

Let me know if it's now resolved. Thanks!

PantelisElinas commented 4 years ago

I still get the above error. I can't merge this code if a test fails.

There are a few discussions on stackoverflow about this error and some suggestions around it. I don't know if any of it is helpful but maybe have a look. Try it on you Mac if you think it is Firefox/OS specific problem.

P.

Zhenghao-Zhao commented 4 years ago

I suspect the issue originated from a different location than the one indicated by the error message. I have trouble running the app on the given Mac because I need approval for installing anything on that laptop. I have good confidence that this might fix it.

Let me know if it works now. Thanks!

PantelisElinas commented 4 years ago

I now get the following error,

====================================================================== ERROR: test_search (catalog.tests.selenium_tests.test_pagination.FirefoxTestCase) test pagination on search results

Traceback (most recent call last): File "/Users/eli024/Projects/stellar-gnosis/gnosis/catalog/tests/selenium_tests/test_pagination.py", line 101, in test_search classes = num_items[0].get_attribute('class') IndexError: list index out of range

Zhenghao-Zhao commented 4 years ago

I for some reason were also getting the same error. I have applied a fix that solved the issue on my device.

Let me know if it works now. Thanks!

PantelisElinas commented 4 years ago

Hi @Zhenghao-Zhao

the tests now pass, but after all the test finish running, there are Chrome and Firefox windows left open whereas before this was not the case!

P.

Zhenghao-Zhao commented 4 years ago

I forgot to uncomment a line of code. My apologies!