pgadmin4/web/regression
Aditya Toshniwal 86ecf9c84e Fixed following:
- Base font size changed from 0.815rem to 0.875rem, for navbar from 0.875rem to 0.925rem.
- Dialog sizes made consistent throughout the application. Now there are 3 size options for width and height each - sm, md, lg. Combination of any of these to be used hereafter
- Alignment fix for controls of Node properties dialogs which includes showing text and label in one line without dialog size change, checkbox alignment, switch control alignment at places and other minor improvements in other dialogs
- Error message design change in dialogs validation
- SQL Editor data grid editor popup design changes which were missed
- Design change for dashboard server activity grid
- Login page language dropdown color fix
- Properties accordion collapse design fix
- Help, Info icon fixed across all dialogs which were not working if clicked exactly on the text
- Added missing icon with buttons at few places
- Shadow behind the dialogs is increased to make it look clearly separated and depth.
- Control Alignment fix in maintenance dialog
- Min height of alertify dialogs set for better UX
- File dialog design fix when no files found
- Grant wizard fixes - Scroll bar visibility on first page, use full space for SQL generated on the last page
- Browser toolbar buttons changed to sync with SQL editor toolbar buttons
- Rounded corners for docker floating dialog (no properties)
- Renaming file in file dialog should show original file name
- SQL data grid text edit popup buttons behaviour was swapped. This is fixed.
- Import/Export dialog changes as per new design.
2019-01-02 15:07:59 +05:30
..
feature_utils Additional feature test fixes: 2018-10-17 11:50:22 +01:00
javascript Fixed following: 2019-01-02 15:07:59 +05:30
python_test_utils Fix utility route check for Windows. 2018-12-04 10:46:59 +00:00
__init__.py Update copyright notices for 2018. 2018-01-05 10:42:50 +00:00
.gitignore Write a JSON file when regression tests run, listing results. 2017-04-06 09:33:29 +01:00
README Support running feature tests against Firefox. Fixes #3270 2018-05-15 15:10:11 +01:00
requirements.txt Update chromedriver version to support Chrome 66. 2018-05-04 10:20:14 +01:00
runtests.py Additional feature test fixes: 2018-10-17 11:50:22 +01:00
test_advanced_config.json.in Introduce a test config database for the regression tests, and track/remove objects that are created during testing. 2016-09-14 16:26:12 +01:00
test_config.json.in Add Python API tests for execution of external utilities such as pg_dump. 2018-06-15 11:36:07 +01:00
test_setup.py Update copyright notices for 2018. 2018-01-05 10:42:50 +00:00

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

pgAdmin 4 Test Framework
========================

This regression framework is designed to execute unit tests for all modules to
help catch regressions in the code.

Assumptions
-----------

- pgAdmin must have SMTP configured if SERVER_MODE == True.
- There should be a single server group present in the browser.
- Currently each module will have testcases related to ONLY GET, POST, PUT,
  and DELETE apis.

Environment
-----------

Regression tests should be run in a Python environment that has all the
pre-requisite packages installed from $PGADMIN4_SRC/requirements.txt. There
are some additional dependencies for running the test suite; these can be
installed with:

(pgadmin4) $ pip install -r $PGADMIN4_SRC/web/regression/requirements.txt

While running in Linux environments install:

(pgadmin4) $ sudo apt-get install xsel

Otherwise the following error happens:
"Pyperclip could not find a copy/paste mechanism for your system"

General Information
-------------------

1) The required test cases should be placed under the /tests directory of the
   respective module.

  - 'pgadmin/browser/tests' directory contains test-cases for following
    modules:

	1. Login Page
	2. Reset Password Page
	3. Change Password Page
	4. Logout Page

  - 'pgAdmin4/web/pgadmin/browser/server_groups/tests/' shows an example of
     tree traversal of the pgAdmin modules and how the test folder is required
     for each individual module.

  - 'pgadmin/browser/server_groups/servers/tests/' directory will have separate
     file for each test-case:

    1. test_server_add.py
    2. test_server_delete.py
    3. test_server_get.py
    4. test_server_update.py

2) The pgAdmin4 source tree includes 2 different configuration file templates.
   One file template for the server configuration
   named test_config.json.in' and another for test configuration named
   'test_advanced_config.json.in' in the pgAdmin4/web/regression directory.
   After completing the pgAdmin4 configuration, you must make a working copy of
   the templates called test_config.json and test_advance_config.json
   before modifying the file contents.

    2a) The following command copies the test_config.json.in file, creating a
        configuration file named test_config.json (same way user can copy
        test_advance_config.json.in file into test_advance_config.json)

             $ cp pgadmin4/web/regression/test_config.json.in \
               pgadmin4/web/regression/test_config.json

    2b) After creating the server and test configuration file, add (or modify)
        parameter values as per requirements. The pgAdmin4 regression framework
        expects to find the files in the  directory
        '/<installation dir>/web/regression/'. If you move the file to another
        location, you must create a symbolic link that specifies the new location.

    2c) Specifying Server Configuration file:

        Server details and connection properties as per their local setup. The
        test_config file is in JSON format and property values are
        case-sensitive.

    2d) Specifying the Test Configuration file:

        The user can add/change test data as per their need. The
        test_advanced_config file is in JSON format and property values are
        case-sensitive.


Test Data Details
-----------------

	"pgAdmin4 Login Credentials" (used to login to pgAdmin):

	 login_username = login id
	 login_password = login password
	 new_password = new login password

	"pgAdmin4 Test User Credentials" (dummy user used for testing user management):

	 login_username = login id
	 login_password = login password
	 new_password = new login password

	 "server_credentials":

     name = Server/database Name
     db_username = Database Username
     host = IP Address of Server
     db_password = Database Password
     db_port = Database Port
     maintenance_db = Maintenance Database
     sslmode = SSL Mode
     comment = Any Comments to add
     tablespace_path = A path under which a tablespace can be created


Execution:
-----------

Python Tests:

- For feature tests to run as part of the entire test suite, Chrome and
  chromedriver need to be installed; get chromedriver from
  https://sites.google.com/a/chromium.org/chromedriver/downloads or a
  package manager and make sure it is in the PATH

- For feature tests to run on Firefox, geckodriver need to be installed;
  - Get geckodriver from https://github.com/mozilla/geckodriver/releases.
  - Extract the binary and run chmod +x geckodriver.
  - Copy geckodriver into /usr/local/bin or make sure path of the
    geckodriver must be specified in the PATH.
  - Set the "default_browser" parameter in test_config file or pass the command
    line option --default_browser. Supported browsers are "Chrome" and
    "Firefox".

- The test framework is modular and pluggable and dynamically locates tests
  for modules which are discovered at runtime. All test cases are found
  and registered automatically by its module name in
  'pgadmin4/web/pgadmin/utils/test.py' file.

- Change to the regression test directory:
     run 'cd web/regression'

- Execute the test framework for all nodes
     run 'python runtests.py --pkg all' or just:
         'python runtests.py'

- Execute test framework for entire package

     Example 1) Run test framework for 'browser' package
     run 'python runtests.py --pkg browser'

     Example 2) Run test framework for 'database' package
     run 'python runtests.py --pkg browser.server_groups.servers.databases'

     Example 3) Run feature tests
     run 'python runtests.py --pkg feature_tests

- Execute test framework for single node at a time

     Example 1) Run test framework for 'browser' node
     run 'python runtests.py --pkg browser.server_groups.tests'

     Example 2) Run test framework for 'database' node
     run 'python runtests.py --pkg browser.server_groups.servers.databases.tests'

- Exclude a package and its subpackages when running tests:

    Example: exclude feature tests but run all others:
    run 'python runtests.py --exclude feature_tests'

    Example: exclude multiple packages:
    run 'python runtests.py --exclude browser.server_groups.servers.databases,browser.server_groups.servers.tablespaces'

Javascript Tests:

- Install node.js and yarn, in the appropriate way for your platform. On macOS with Homebrew you might use:

    brew install nodejs
    brew install yarn

    Whilst with MacPorts:

    sudo port install nodejs7 yarn

- See also the top-level pgadmin/README : Bundling Javascript

- Javascript tests must be run from the web directory (since that is where node_modules and karma.conf reside):

    cd web/

- Install the JS modules required for testing:

    yarn install

- Now run the tests:

   yarn run test:karma
   yarn run test:karma-once