Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unit test failure - test_archive_license_requests_feature #200

Open
goneall opened this issue Jul 15, 2020 · 4 comments
Open

Unit test failure - test_archive_license_requests_feature #200

goneall opened this issue Jul 15, 2020 · 4 comments
Labels
good-first-issue Begineer issue gsoc Submit New License Issues related to the submit new license feature

Comments

@goneall
Copy link
Member

goneall commented Jul 15, 2020

The test_archive_license_requests_feature unit test is failing on the current master branch:

======================================================================
ERROR: test_archive_license_requests_feature (app.tests.ArchiveLicenseRequestsViewsTestCase)
Check if the license is shifted to archive requests when archive button is pressed
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/home/runner/work/spdx-online-tools/spdx-online-tools/src/app/tests.py", line 1123, in test_archive_license_requests_feature
    if driver.find_element_by_id('archive_button' + str(license_obj.id)):
  File "/opt/hostedtoolcache/Python/2.7.18/x64/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 360, in find_element_by_id
    return self.find_element(by=By.ID, value=id_)
  File "/opt/hostedtoolcache/Python/2.7.18/x64/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 978, in find_element
    'value': value})['value']
  File "/opt/hostedtoolcache/Python/2.7.18/x64/lib/python2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "/opt/hostedtoolcache/Python/2.7.18/x64/lib/python2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
NoSuchElementException: Message: Unable to locate element: [id="archive_button1"]
@goneall goneall changed the title Unit test failure Unit test failure - test_archive_license_requests_feature Jul 15, 2020
@rtgdk
Copy link
Collaborator

rtgdk commented Jul 16, 2020

This was introduced after #154 got merged and has already been raised at #177 @anshuldutt21 Would you please fix this? Looks like if..else won't work. You would have to use try..catch. Also, please ensure that this test runs for admin user.

@rtgdk rtgdk added good-first-issue Begineer issue gsoc labels Mar 21, 2021
@nishantc7
Copy link

@rtgdk Could you please help me out, I was trying to work on this but can't seem to work it through. I tried logging in first using socialauth, but the webdriver still can't locate the archive button. It should work once logged in right?

@rtgdk
Copy link
Collaborator

rtgdk commented Mar 25, 2021

@nishantc7 Can you check the output html from selenium? If selenium is not able to find, most likely either the page is not detecting signed in and showing the default page. From code looks like we need to be github logged and auuthorised. You can mock both of these. Also, the archive button will only be present if the license gets added, confirm that the html shows the license added by the test. You don't need to run the test, open up the django shell/python shell and start webdriver testing their. From shell you can do a lot more debugging.

{% if github_login and authorized %}
<button id='archive_button{{elem.id}}' class='btn btn-success' width='25px' value='Archive'>Archive</button>
{% endif %}

BanulaKumarage added a commit to BanulaKumarage/spdx-online-tools that referenced this issue Mar 11, 2023
BanulaKumarage added a commit to BanulaKumarage/spdx-online-tools that referenced this issue Apr 1, 2023
…chive_license_requests_feature

Mocked utils.checkPermissionto retrurn true
@jlovejoy
Copy link
Member

@rtgdk - did this get fixed and we can close?

@jlovejoy jlovejoy added the Submit New License Issues related to the submit new license feature label Jun 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good-first-issue Begineer issue gsoc Submit New License Issues related to the submit new license feature
Projects
None yet
Development

No branches or pull requests

4 participants