Re: Some fixes for api and features tests - Mailing list pgadmin-hackers

From Dave Page
Subject Re: Some fixes for api and features tests
Date
Msg-id CA+OCxozA7VbJdAgg0C2OSKsZmyEuPG8vOppW1CEhm7SBE=zLOA@mail.gmail.com
Whole thread Raw
In response to Some fixes for api and features tests  (Usman Muzaffar <usman.muzaffar@enterprisedb.com>)
List pgadmin-hackers
Hi

On Tue, Apr 2, 2019 at 1:33 PM Usman Muzaffar <usman.muzaffar@enterprisedb.com> wrote:
Hi Hackers,

Please find here attached patch for following
  • usage of randomised name for database/role creation(unit test, feature test).
  • code to maximised browser window before start of execution
  • reduce the default time to wait for element if user does not implicitly provide the information.
  • Correction in comment for toggle_open_tables_node function
Please review the patch and apply.

Running with this, I got a couple of errors in the PGUtilitiesMaintenanceFeatureTest, which ended up leaving their notification dialogues present for the remainder of the run, as well as an error in CopySelectedQueryResultsFeatureTest:

======================================================================
ERROR: runTest (pgadmin.feature_tests.copy_selected_query_results_feature_test.CopySelectedQueryResultsFeatureTest)
Copy rows, column using button and keyboard shortcut
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/copy_selected_query_results_feature_test.py", line 51, in runTest
    self._copies_rows()
  File "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/copy_selected_query_results_feature_test.py", line 63, in _copies_rows
    "//*[contains(@class, 'slick-row')]/*[1]").click()
  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python3.7/site-packages/selenium/webdriver/remote/webelement.py", line 80, in click
    self._execute(Command.CLICK_ELEMENT)
  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python3.7/site-packages/selenium/webdriver/remote/webelement.py", line 628, in _execute
    return self._parent.execute(command, params)
  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python3.7/site-packages/selenium/webdriver/remote/webdriver.py", line 312, in execute
    self.error_handler.check_response(response)
  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python3.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response
    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: Element <iframe cd_frame_id_="a974f016fd26d5c74da2fd1daf8083f4">...</iframe> is not clickable at point (318, 800). Other element would receive the click: <div style="position:absolute;top:0 !important;width:100%;height:100%;display:table;z-index:0;"></div>
  (Session info: chrome=73.0.3683.86)
  (Driver info: chromedriver=2.45.615355 (d5698f682d8b2742017df6c81e0bd8e6a3063189),platform=Mac OS X 10.14.3 x86_64)


======================================================================
FAIL: runTest (pgadmin.feature_tests.pg_utilities_maintenance_test.PGUtilitiesMaintenanceFeatureTest)
Test for PG maintenance: database
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/pg_utilities_maintenance_test.py", line 69, in runTest
    self._verify_command()
  File "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/pg_utilities_maintenance_test.py", line 88, in _verify_command
    self.assertEquals(status, "Successfully completed.")
AssertionError: 'Started' != 'Successfully completed.'
- Started
+ Successfully completed.


======================================================================
FAIL: runTest (pgadmin.feature_tests.pg_utilities_maintenance_test.PGUtilitiesMaintenanceFeatureTest)
Test for PG maintenance: table
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/pg_utilities_maintenance_test.py", line 69, in runTest
    self._verify_command()
  File "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/pg_utilities_maintenance_test.py", line 88, in _verify_command
    self.assertEquals(status, "Successfully completed.")
AssertionError: 'Failed (exit code: 2).' != 'Successfully completed.'
- Failed (exit code: 2).
+ Successfully completed.


======================================================================
FAIL: runTest (pgadmin.feature_tests.pg_utilities_maintenance_test.PGUtilitiesMaintenanceFeatureTest)
Test for XSS in maintenance dialog
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/pg_utilities_maintenance_test.py", line 69, in runTest
    self._verify_command()
  File "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/pg_utilities_maintenance_test.py", line 104, in _verify_command
    'Maintenance detailed window'
  File "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/pg_utilities_maintenance_test.py", line 131, in _check_escaped_characters
    1, "{0} might be vulnerable to XSS ".format(source)
AssertionError: Maintenance detailed window might be vulnerable to XSS 

----------------------------------------------------------------------
Ran 18 tests in 314.841s

FAILED (failures=3, errors=1)

======================================================================
Test Result Summary
======================================================================

Regression - PG 9.6:

16 tests passed
2 tests failed:
PGUtilitiesMaintenanceFeatureTest (Test for PG maintenance: database,
Test for PG maintenance: table,
Test for XSS in maintenance dialog)
CopySelectedQueryResultsFeatureTest (Copy rows, column using button and keyboard shortcut)
0 tests skipped

======================================================================
 
--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake

EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

pgadmin-hackers by date:

Previous
From: Khushboo Vashi
Date:
Subject: Re: [pgAdmin4][Patch] - RM 4048 - Disable auto-fill on all dialogues
Next
From: Dave Page
Date:
Subject: Re: [pgAdmin4][Patch] - RM 4048 - Disable auto-fill on all dialogues