Re: [pgAdmin4][Patch] Feature #3270 Add support for runningregression tests against Firefox - Mailing list pgadmin-hackers

From Akshay Joshi
Subject Re: [pgAdmin4][Patch] Feature #3270 Add support for runningregression tests against Firefox
Date
Msg-id CANxoLDdLXYUFjxh5=0OABAmry2j51gSD1brSvdGn9f0xdH6D6g@mail.gmail.com
Whole thread Raw
In response to Re: [pgAdmin4][Patch] Feature #3270 Add support for runningregression tests against Firefox  (Dave Page <dpage@pgadmin.org>)
Responses Re: [pgAdmin4][Patch] Feature #3270 Add support for running regression tests against Firefox  (Anthony Emengo <aemengo@pivotal.io>)
List pgadmin-hackers
Hi Dave

On Thu, May 10, 2018 at 2:03 PM, Dave Page <dpage@pgadmin.org> wrote:
Hi

On Wed, May 9, 2018 at 2:55 PM, Akshay Joshi <akshay.joshi@enterprisedb.com> wrote:
Hi

On Wed, May 9, 2018 at 6:19 PM, Dave Page <dpage@pgadmin.org> wrote:
Hi

On Wed, May 9, 2018 at 8:10 AM, Akshay Joshi <akshay.joshi@enterprisedb.com> wrote:
Thanks Anthony for fixing those two test cases. I have verified it and patch looks good to me. 
Attached is the modified patch where I have remove "import time" which is not required and update the retry message from 10 to 60.

To be honest I have seen some intermittent "Timeout" issues on Chrome and FireFox and those issues are not consistent for any particular test case.

@Hackers, Please review it and if it looks good then commit it. 

I seem to be getting the following failures consistently (screenshots attached):

======================================================================
ERROR: runTest (pgadmin.feature_tests.pg_datatype_validation_test.PGDataypeFeatureTest)
Test checks for PG data-types output
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/pg_datatype_validation_test.py", line 135, in runTest
    self._check_datatype()
  File "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/pg_datatype_validation_test.py", line 169, in _check_datatype
    "contains(.,'{}')]".format(batch['datatype'][0])
  File "/Users/dpage/.virtualenvs/pgadmin4/lib/python2.7/site-packages/selenium/webdriver/support/wait.py", line 80, in until
    raise TimeoutException(message, screen, stacktrace)
TimeoutException: Message: 

    This is the intermittent issue I was highlighted in my previous email.  

Right - except I'm getting it consistently, on every run I've done.

    Today I have tried more than 10 times and every time test case gets passed. Not sure how to fix that. As per the above stack trace line no 169 is wait statement of WebDriverWait().  
 


======================================================================
FAIL: runTest (pgadmin.feature_tests.xss_checks_file_manager_test.CheckFileManagerFeatureTest)
Tests to check if File manager is vulnerable to XSS
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/xss_checks_file_manager_test.py", line 60, in runTest
    self._open_file_manager_and_check_xss_file()
  File "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/xss_checks_file_manager_test.py", line 110, in _open_file_manager_and_check_xss_file
    'File manager'
  File "/Users/dpage/git/pgadmin4/web/pgadmin/feature_tests/xss_checks_file_manager_test.py", line 117, in _check_escaped_characters
    ) != -1, "{0} might be vulnerable to XSS ".format(source)
AssertionError: File manager might be vulnerable to XSS 

    I have removed Anthony's patch and added time.sleep(0.05) before and after reading the content from the file. 

That part works now; however, Anthony's method is the more correct way to handle this. Is the issue with his patch that waiting for the element to load isn't enough, and we have to wait for it to load *and* for something else to become active or dynamically load? In other words, are we waiting for the right thing?

    Yes, Anthony's method is more correct way, but that was not working at all. I have tried a lot with different type of ExpectedCondtions (EC.<condition>) but no success. 
     Problem here is When we open file manager dialog from query tool and select "/tmp" directory and send keys Keys.RETURN that time we need some kind of wait(sleep) so that content of "/tmp" folder should be rendered, and then second wait(sleep) will be required when content should be read from the dialog, but without sleep "Cancel" button has been clicked. Not sure what kind of wait statement required here. 

    @Anthony can you please suggest something.   
  
 

----------------------------------------------------------------------
Ran 11 tests in 475.292s

FAILED (failures=1, errors=1)

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

Regression - PG 9.4:

9 tests passed
2 tests failed:
CheckFileManagerFeatureTest (Tests to check if File manager is vulnerable to XSS)
PGDataypeFeatureTest (Test checks for PG data-types output)
0 tests skipped

======================================================================

Please check output in file: /Users/dpage/git/pgadmin4/web/regression/regression.log

make: *** [check-feature] Error 1



   Attached is the modified patch with all test cases passed on my machine. I have tried couple of times (refer the attached screenshot). 

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

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



--
Akshay Joshi
Sr. Software Architect


Phone: +91 20-3058-9517
Mobile: +91 976-788-8246



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

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



--
Akshay Joshi
Sr. Software Architect


Phone: +91 20-3058-9517
Mobile: +91 976-788-8246

pgadmin-hackers by date:

Previous
From: Dave Page
Date:
Subject: Re: JS Test error on Windows
Next
From: Joao De Almeida Pereira
Date:
Subject: Re: [pgadmin4][patch] Initial patch to decouple from ACI Tree