Re: [pgAdmin4][Patch] Feature #3270 Add support for running regression tests against Firefox

2018-05-04 Thread Anthony Emengo
Hey Akshay,

Regarding your previous comment:

As I know time.sleep is not a good idea and I am new to feature test and in
> learning phase, can someone correct/suggest the way to fix those issues.

Although the feature tests already have some sleeps, it’s generally not a
best practice for browser automation. The better way is to use Waits that
the selenium API provides, mainly because they can accept a condition to
poll until fulfilled for rather than blocking the main thread of execution.
http://selenium-python.readthedocs.io/waits.html#explicit-waits. With
regards to the  "fe_sendauth" password error . I’d probably would have done
it like so (I haven’t tested this):

WebDriverWait(self.driver, 10)\
.until(EC.text_to_be_present_in_element(
(By.NAME, 'password', server_config['db_password']))
)

In general, I ran the tests with the Firefox option and am seeing more
failures than I usually would with Chrome. I don’t feel particularly
strongly about the patch since our team mostly likely won’t be running it
over the course of our development. But I still couldn’t *run* the tests
without modify the code so that the server is up and running before the
browser automation starts. I think that this should be addressed.

Any thing in particular that I can help with regarding this, please let me
know! 

Anthony
​


pgAdmin 4 commit: Standardise the error handling for parsing of JSON re

2018-05-04 Thread Dave Page
Standardise the error handling for parsing of JSON response messages from the 
server. Fixes #3238

Branch
--
master

Details
---
https://git.postgresql.org/gitweb?p=pgadmin4.git;a=commitdiff;h=893737588509425849b0fde3068d34f4950e9ce2

Modified Files
--
docs/en_US/release_notes_3_1.rst   |  7 +-
.../servers/databases/casts/static/js/cast.js  | 11 +--
.../schemas/synonyms/static/js/synonym.js  | 11 +--
.../check_constraint/static/js/check_constraint.js | 11 +--
.../foreign_key/static/js/foreign_key.js   | 11 +--
.../tables/partitions/static/js/partition.js   | 49 +++--
.../databases/schemas/tables/static/js/table.js| 49 +++--
.../schemas/tables/triggers/static/js/trigger.js   | 22 ++
.../databases/schemas/views/static/js/mview.js |  5 +-
.../servers/databases/static/js/database.js| 11 +--
.../servers/pgagent/static/js/pga_job.js   | 20 +-
.../server_groups/servers/static/js/server.js  | 77 -
.../servers/tablespaces/static/js/tablespace.js| 11 +--
web/pgadmin/browser/static/js/browser.js   | 18 ++---
web/pgadmin/dashboard/static/js/dashboard.js   | 11 +--
web/pgadmin/static/js/alertify.pgadmin.defaults.js | 39 +++
.../javascript/alerts/alertify_wrapper_spec.js | 80 ++
17 files changed, 183 insertions(+), 260 deletions(-)



pgAdmin 4 commit: One day I'll remember to update the version everywher

2018-05-04 Thread Dave Page
One day I'll remember to update the version everywhere...

Branch
--
master

Details
---
https://git.postgresql.org/gitweb?p=pgadmin4.git;a=commitdiff;h=4f79f00d6107f5b6b6e6c48d3bbaecaca483a147

Modified Files
--
runtime/Info.plist   | 4 ++--
runtime/pgAdmin4.pro | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)



pgAdmin 4 commit: Bump version to avoid confusion

2018-05-04 Thread Dave Page
Bump version to avoid confusion

Branch
--
master

Details
---
https://git.postgresql.org/gitweb?p=pgadmin4.git;a=commitdiff;h=554a199fd2875e443a51fdaec9e066b850d54bcc

Modified Files
--
web/config.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)



Re: [pgAdmin4][Patch] Feature #1447 SSH Tunnel

2018-05-04 Thread Dave Page
On Thu, May 3, 2018 at 10:06 AM, Akshay Joshi  wrote:

> Hi
>
> On Thu, May 3, 2018 at 2:20 PM, Dave Page  wrote:
>
>>
>>
>> On Thu, May 3, 2018 at 6:58 AM, Akshay Joshi <
>> akshay.jo...@enterprisedb.com> wrote:
>>
>>> Hi
>>>
>>> On Wed, May 2, 2018 at 9:05 PM, Victoria Henry 
>>> wrote:
>>>
 Hi Akshay,

 Thanks for sending this updated patch.  The linter and tests are all
 passing.

> - utils/driver/psycopg2/server_manager.py
>>   - Do we have Unit Tests around this?
>
>  No.


 In our opinion, server_manager.py and connection.py should have tests.
 Are you finding it difficult to add tests to these files?

>>>
>>>We will have to write test cases from scratch for both the files and
>>> it will take time, there is no point keeping these important feature(SSH
>>> Tunnel) on hold. We can create a separate task for this as we have for
>>> utility(Backup, Maintenance, Restore) modules.
>>>
>>>@Dave your thoughts on this?
>>>
>>
>> I agree. Please add a ticket to add these tests in the future. General
>> tests for those files should not hold up this feature.
>>
>
> Done. Can you please review and commit this feature.
>

Thanks - patch applied with minor changes to the help text, and to change
the Password/Passphrase label to Password.



>
>>
>>>
 Sincerely,

 Victoria & Joao


 On Wed, May 2, 2018 at 5:58 AM, Akshay Joshi <
 akshay.jo...@enterprisedb.com> wrote:

> Hi Joao
>
>
> On Thu, Apr 26, 2018 at 10:26 PM, Joao De Almeida Pereira <
> jdealmeidapere...@pivotal.io> wrote:
>
>> Hi Akshay,
>>
>> Some suggestions:
>> - browser/server_groups/servers/__init__py
>>   This file could have been split into separate functionalities.
>> There is a chunk of changes for connect, why not move that out? Same 
>> thing
>> for create. Do we really need to have full integrationy tests that do a
>> HTTP request and connect to a real database to do make sure the
>> functionalities are working? If we isolate these into their own actions 
>> we
>> can more easily get more coverage on the code with tests that would be 
>> much
>> faster and directed. The big advantage of this is that by reading the 
>> tests
>> we can understand what the functions do. Self documenting code.
>>
>
> If I understood you correctly, you want separate connect and
> create function for SSH Tunnel. If yes I don't think so we should move the
> SSH code and make the rest of the code duplicated in two different
> functions. For "create" function I have just added logic to pass SSH 
> tunnel
> parameter while creating server object, encrypt the tunnel password and
> send it to connect method. For "connect" function encrypt the password and
> send it connect method as parameter. There is no point for such small
> changes we should create two separate functions.
>
>>
>> - utils/driver/psycopg2.py same comments has above
>>
>
>I think you are talking about "utils/driver/psycopg2/connection.py".
> Same comments as above.
>
>>
>> - browser/server_groups/servers/static/js/server.js:
>>   - The patterm of using `m` for `model`? is a bad pattern, so why
>> not change it?
>>
>
>   Fixed.
>
>>   - We could extract the model creation from this file. This will
>> allow us to add some tests around disabled methods that are a bit 
>> everywhere
>>
>Model creation is the main functionality of the "server.js"
> (or any other module file), code readability wise it should be in the same
> file. If we will do it for rest of the modules then there are so many java
> script files where model creation is in separate file.
>
>   - We could also convert this file to ES6
>>
>
>  I am new to this, so will need to learn first. We can create a
> separate task to do this.
>
>>
>> - utils/driver/psycopg2/server_manager.py
>>   - Do we have Unit Tests around this?
>>
>
>   No.
>
>>   - Maybe this SSH part could be isolated into it's own class, as it
>> is not 100% related to the class in question. We need to use it but is is
>> not part of the ServerManager domain
>>
>
>   According to me SSH Tunnel parameters is the part of server
> manager as we do have other parameters of Server dialog. We can
> isolate the SSH part in other class, but most of the modules (including
> Server module) have access to the ServerManager. If we will isolate
> that part then anyways we will have to write wrapper functions in
> ServerManager which will eventually call functions of new SSH class.
>
>   As one ServerManager object belongs to one server, similarly
> one SSH 

pgAdmin 4 commit: Add support for SSH tunneled connections. Fixes #1447

2018-05-04 Thread Dave Page
Add support for SSH tunneled connections. Fixes #1447

Branch
--
master

Details
---
https://git.postgresql.org/gitweb?p=pgadmin4.git;a=commitdiff;h=b7fb01ab04e69fe558f0f2654f9940c549529959
Author: Akshay Joshi 

Modified Files
--
docs/en_US/images/server_advanced.png  | Bin 34067 -> 46133 bytes
docs/en_US/images/server_connection.png| Bin 66243 -> 60400 bytes
docs/en_US/images/server_general.png   | Bin 37276 -> 55022 bytes
docs/en_US/images/server_ssh_tunnel.png| Bin 0 -> 63770 bytes
docs/en_US/images/server_ssl.png   | Bin 42132 -> 56837 bytes
docs/en_US/release_notes_3_1.rst   |   1 +
docs/en_US/server_dialog.rst   |  22 
requirements.txt   |   1 +
web/config.py  |  10 ++
web/migrations/versions/a68b374fe373_.py   |  41 +++
web/pgadmin/browser/__init__.py|   3 +-
.../browser/server_groups/servers/__init__.py  | 127 +--
.../server_groups/servers/static/js/server.js  | 135 +
.../servers/templates/servers/tunnel_password.html |  28 +
.../tests/test_add_server_with_ssh_tunnel.py   |  62 ++
web/pgadmin/browser/templates/browser/js/utils.js  |   1 +
web/pgadmin/model/__init__.py  |  18 +++
.../server_groups/servers/model_validation.js  |   9 ++
web/pgadmin/tools/datagrid/__init__.py |   6 +-
web/pgadmin/tools/sqleditor/__init__.py|   8 +-
.../tools/sqleditor/utils/start_running_query.py   |   6 +-
.../utils/tests/test_start_running_query.py|  31 -
web/pgadmin/utils/driver/psycopg2/connection.py| 133 
.../utils/driver/psycopg2/server_manager.py| 105 +++-
web/pgadmin/utils/exception.py |  32 +
.../server_groups/servers/model_validation_spec.js |  47 ++-
26 files changed, 697 insertions(+), 129 deletions(-)



Re: [pgAdmin4] Update Chrome driver to latest version

2018-05-04 Thread Dave Page
Thanks, applied.

On Fri, May 4, 2018 at 10:09 AM, Murtuza Zabuawala <
murtuza.zabuaw...@enterprisedb.com> wrote:

> Hi,
>
> Please find attached minor patch to update chrome-driver to latest version
> to support Chrome v.66
>
> --
> Regards,
> Murtuza Zabuawala
> EnterpriseDB: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
>


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

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


pgAdmin 4 commit: Scroll cells into the viewport if needed during the C

2018-05-04 Thread Dave Page
Scroll cells into the viewport if needed during the CheckForViewData feature 
test.

Branch
--
master

Details
---
https://git.postgresql.org/gitweb?p=pgadmin4.git;a=commitdiff;h=3ff56b2d497a428ea0d8db32926415e17d9427c8
Author: Anthony Emengo 

Modified Files
--
web/pgadmin/feature_tests/view_data_dml_queries.py | 15 ---
1 file changed, 12 insertions(+), 3 deletions(-)



Re: [pgAdmin4][patch] - Fix CheckForViewDataTest

2018-05-04 Thread Dave Page
Thanks - applied!

On Thu, May 3, 2018 at 7:49 PM, Anthony Emengo  wrote:

> Here's an updated patch that scrolls the cells into view before making an
> assertion.
>
> Joao && Anthony
>



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

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


[pgAdmin4] Update Chrome driver to latest version

2018-05-04 Thread Murtuza Zabuawala
Hi,

Please find attached minor patch to update chrome-driver to latest version
to support Chrome v.66

--
Regards,
Murtuza Zabuawala
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company


update_chrome_driver.diff
Description: Binary data