public inbox for [email protected]  
help / color / mirror / Atom feed
[pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases
15+ messages / 4 participants
[nested] [flat]

* [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases
@ 2019-01-28 06:59 Aditya Toshniwal <[email protected]>
  2019-01-28 11:31 ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Dave Page <[email protected]>
  0 siblings, 1 reply; 15+ messages in thread

From: Aditya Toshniwal @ 2019-01-28 06:59 UTC (permalink / raw)
  To: pgadmin-hackers

Hi Hackers,

Attached is the patch to fix failing SQL editor related feature tests.
The failure is occurring mostly because of send_keys function of selenium
which sometimes does not input the complete text. The change will use
Codemirror javascript object to set the text.

I have also added new args flag "--modules" which can be used after --pkg
where you can test a specific module file under the pkg. This is not so
useful for build but definitely helpful for the developers.

Kindly review.

-- 
Thanks and Regards,
Aditya Toshniwal
Software Engineer | EnterpriseDB Software Solutions | Pune
"Don't Complain about Heat, Plant a tree"


Attachments:

  [application/octet-stream] RM3936.patch (6.5K, 3-RM3936.patch)
  download | inline diff:
diff --git a/web/pgadmin/feature_tests/pg_utilities_backup_restore_test.py b/web/pgadmin/feature_tests/pg_utilities_backup_restore_test.py
index 1c89393d..4e11f994 100644
--- a/web/pgadmin/feature_tests/pg_utilities_backup_restore_test.py
+++ b/web/pgadmin/feature_tests/pg_utilities_backup_restore_test.py
@@ -83,6 +83,7 @@ class PGUtilitiesBackupFeatureTest(BaseFeatureTest):
         self.page.find_by_css_selector(
             ".pg-bg-more-details").click()
 
+        backup_file = None
         # Check for XSS in Backup details
         if self.is_xss_check:
             self._check_detailed_window_for_xss('Backup')
@@ -99,7 +100,6 @@ class PGUtilitiesBackupFeatureTest(BaseFeatureTest):
 
             self.assertIn("pg_dump", str(command))
 
-            backup_file = None
             if command:
                 backup_file = command[int(command.find('--file')) +
                                       8:int(command.find('--host')) - 2]
diff --git a/web/pgadmin/utils/route.py b/web/pgadmin/utils/route.py
index e45e06b7..d1c6ce63 100644
--- a/web/pgadmin/utils/route.py
+++ b/web/pgadmin/utils/route.py
@@ -56,7 +56,7 @@ class TestsGeneratorRegistry(ABCMeta):
         ABCMeta.__init__(cls, name, bases, d)
 
     @classmethod
-    def load_generators(cls, pkg_root, exclude_pkgs):
+    def load_generators(cls, pkg_root, exclude_pkgs, for_modules=[]):
 
         cls.registry = dict()
 
@@ -64,6 +64,13 @@ class TestsGeneratorRegistry(ABCMeta):
 
         all_modules += find_modules(pkg_root, False, True)
 
+        # If specific modules are to be tested, exclude others
+        if len(for_modules) > 0:
+            all_modules = [module_name
+                           for module_name in all_modules
+                           for fmod in for_modules
+                           if module_name.endswith(fmod)]
+
         # Check for SERVER mode
         for module_name in all_modules:
             try:
diff --git a/web/regression/README b/web/regression/README
index 7e668cfd..6a68d36f 100644
--- a/web/regression/README
+++ b/web/regression/README
@@ -167,6 +167,14 @@ Python Tests:
      Example 2) Run test framework for 'database' node
      run 'python runtests.py --pkg browser.server_groups.servers.databases.tests'
 
+- Execute test framework for certain modules of a test pkg
+
+     Example 1) Run test framework for 'sqleditor' package and test_start_running_query module
+     run 'python runtests.py --pkg tools.sqleditor --modules test_start_running_query'
+
+     Example 2) Run test framework for 'sqleditor' package and test_start_running_query,test_query_tool_fs_utils modules
+     run 'python runtests.py --pkg tools.sqleditor --modules test_start_running_query,test_query_tool_fs_utils'
+
 - Exclude a package and its subpackages when running tests:
 
     Example: exclude feature tests but run all others:
diff --git a/web/regression/feature_utils/pgadmin_page.py b/web/regression/feature_utils/pgadmin_page.py
index 0c8f0fa3..42d51360 100644
--- a/web/regression/feature_utils/pgadmin_page.py
+++ b/web/regression/feature_utils/pgadmin_page.py
@@ -233,29 +233,39 @@ class PgadminPage:
         field.send_keys(str(field_content))
         self.wait_for_input_field_content(field_name, field_content)
 
-    def fill_codemirror_area_with(self, field_content):
+    def fill_codemirror_area_with(self, field_content, input_keys=False):
         def find_codemirror(driver):
             try:
                 driver.switch_to.default_content()
                 driver.switch_to_frame(
                     driver.find_element_by_tag_name("iframe"))
-                element = driver.find_element_by_xpath(
-                    "//pre[contains(@class,'CodeMirror-line')]/../../../"
-                    "*[contains(@class,'CodeMirror-code')]")
+                element = driver.find_element_by_css_selector(
+                    "#output-panel .CodeMirror")
                 if element.is_displayed() and element.is_enabled():
                     return element
             except (NoSuchElementException, WebDriverException):
                 return False
 
         time.sleep(1)
-        WebDriverWait(self.driver, timeout=self.timeout, poll_frequency=0.01).\
-            until(find_codemirror, "Timed out waiting for codemirror "
-                                   "to appear").click()
+        codemirror_ele = WebDriverWait(
+            self.driver, timeout=self.timeout, poll_frequency=0.01)\
+            .until(find_codemirror,
+                   "Timed out waiting for codemirror to appear")
         time.sleep(1)
 
-        action = ActionChains(self.driver)
-        action.send_keys(field_content)
-        action.perform()
+        codemirror_ele.click()
+
+        # Use send keys if input_keys true, else you javascript to set content
+        if input_keys:
+            action = ActionChains(self.driver)
+            action.send_keys(field_content)
+            action.perform()
+        else:
+            self.driver.execute_script(
+                "arguments[0].CodeMirror.setValue(arguments[1]);"
+                "arguments[0].CodeMirror.setCursor("
+                "arguments[0].CodeMirror.lineCount(),0);",
+                codemirror_ele, field_content)
 
     def click_tab(self, tab_name):
         WebDriverWait(self.driver, 10).until(EC.element_to_be_clickable(
diff --git a/web/regression/runtests.py b/web/regression/runtests.py
index b023703d..116a0a16 100644
--- a/web/regression/runtests.py
+++ b/web/regression/runtests.py
@@ -233,9 +233,14 @@ def get_test_modules(arguments):
     if arguments['pkg'] is None or arguments['pkg'] == "all":
         TestsGeneratorRegistry.load_generators('pgadmin', exclude_pkgs)
     else:
+        for_modules = []
+        if arguments['modules'] is not None:
+            for_modules = arguments['modules'].split(',')
+
         TestsGeneratorRegistry.load_generators('pgadmin.%s' %
                                                arguments['pkg'],
-                                               exclude_pkgs)
+                                               exclude_pkgs,
+                                               for_modules)
 
     # Sort module list so that test suite executes the test cases sequentially
     module_list = TestsGeneratorRegistry.registry.items()
@@ -266,6 +271,10 @@ def add_arguments():
         '--default_browser',
         help='Executes the feature test in specific browser'
     )
+    parser.add_argument(
+        '--modules',
+        help='Executes the feature test for specific modules in pkg'
+    )
     arg = parser.parse_args()
 
     return arg


^ permalink  raw  reply  [nested|flat] 15+ messages in thread

* Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases
  2019-01-28 06:59 [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Aditya Toshniwal <[email protected]>
@ 2019-01-28 11:31 ` Dave Page <[email protected]>
  2019-01-28 12:05   ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Aditya Toshniwal <[email protected]>
  0 siblings, 1 reply; 15+ messages in thread

From: Dave Page @ 2019-01-28 11:31 UTC (permalink / raw)
  To: Aditya Toshniwal <[email protected]>; +Cc: pgadmin-hackers

Hi

On Mon, Jan 28, 2019 at 7:00 AM Aditya Toshniwal
<[email protected]> wrote:
>
> Hi Hackers,
>
> Attached is the patch to fix failing SQL editor related feature tests.
> The failure is occurring mostly because of send_keys function of selenium which sometimes does not input the complete text. The change will use Codemirror javascript object to set the text.
>
> I have also added new args flag "--modules" which can be used after --pkg where you can test a specific module file under the pkg. This is not so useful for build but definitely helpful for the developers.

One of the most common failures I see is failure to fill in the
details on the Add Server dialogue (it might type half of an entry,
then just hang). Should we get rid of all uses of send_keys?

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

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




^ permalink  raw  reply  [nested|flat] 15+ messages in thread

* Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases
  2019-01-28 06:59 [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Aditya Toshniwal <[email protected]>
  2019-01-28 11:31 ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Dave Page <[email protected]>
@ 2019-01-28 12:05   ` Aditya Toshniwal <[email protected]>
  2019-01-28 12:08     ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Dave Page <[email protected]>
  0 siblings, 1 reply; 15+ messages in thread

From: Aditya Toshniwal @ 2019-01-28 12:05 UTC (permalink / raw)
  To: Dave Page <[email protected]>; +Cc: pgadmin-hackers

Hi Dave,

On Mon, Jan 28, 2019 at 5:01 PM Dave Page <[email protected]> wrote:

> Hi
>
> On Mon, Jan 28, 2019 at 7:00 AM Aditya Toshniwal
> <[email protected]> wrote:
> >
> > Hi Hackers,
> >
> > Attached is the patch to fix failing SQL editor related feature tests.
> > The failure is occurring mostly because of send_keys function of
> selenium which sometimes does not input the complete text. The change will
> use Codemirror javascript object to set the text.
> >
> > I have also added new args flag "--modules" which can be used after
> --pkg where you can test a specific module file under the pkg. This is not
> so useful for build but definitely helpful for the developers.
>
> One of the most common failures I see is failure to fill in the
> details on the Add Server dialogue (it might type half of an entry,
> then just hang). Should we get rid of all uses of send_keys?
>
Setting the text using javascript executor can be done. send_keys simulate
an actual person,  so if you try to set a disabled text box using
send_keys, it won't. Places where disabled fields doesn't matter, send_keys
can be removed.

>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>


-- 
Thanks and Regards,
Aditya Toshniwal
Software Engineer | EnterpriseDB Software Solutions | Pune
"Don't Complain about Heat, Plant a tree"


^ permalink  raw  reply  [nested|flat] 15+ messages in thread

* Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases
  2019-01-28 06:59 [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Aditya Toshniwal <[email protected]>
  2019-01-28 11:31 ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Dave Page <[email protected]>
  2019-01-28 12:05   ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Aditya Toshniwal <[email protected]>
@ 2019-01-28 12:08     ` Dave Page <[email protected]>
  2019-01-28 12:14       ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Aditya Toshniwal <[email protected]>
  0 siblings, 1 reply; 15+ messages in thread

From: Dave Page @ 2019-01-28 12:08 UTC (permalink / raw)
  To: Aditya Toshniwal <[email protected]>; +Cc: pgadmin-hackers

On Mon, Jan 28, 2019 at 12:05 PM Aditya Toshniwal
<[email protected]> wrote:
>
> Hi Dave,
>
> On Mon, Jan 28, 2019 at 5:01 PM Dave Page <[email protected]> wrote:
>>
>> Hi
>>
>> On Mon, Jan 28, 2019 at 7:00 AM Aditya Toshniwal
>> <[email protected]> wrote:
>> >
>> > Hi Hackers,
>> >
>> > Attached is the patch to fix failing SQL editor related feature tests.
>> > The failure is occurring mostly because of send_keys function of selenium which sometimes does not input the complete text. The change will use Codemirror javascript object to set the text.
>> >
>> > I have also added new args flag "--modules" which can be used after --pkg where you can test a specific module file under the pkg. This is not so useful for build but definitely helpful for the developers.
>>
>> One of the most common failures I see is failure to fill in the
>> details on the Add Server dialogue (it might type half of an entry,
>> then just hang). Should we get rid of all uses of send_keys?
>
> Setting the text using javascript executor can be done. send_keys simulate an actual person,  so if you try to set a disabled text box using send_keys, it won't. Places where disabled fields doesn't matter, send_keys can be removed.

Can't we just do something like:

if input.disabled == false:
  input.value = 'Foo';
else:
  raise exception ....

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

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




^ permalink  raw  reply  [nested|flat] 15+ messages in thread

* Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases
  2019-01-28 06:59 [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Aditya Toshniwal <[email protected]>
  2019-01-28 11:31 ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Dave Page <[email protected]>
  2019-01-28 12:05   ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Aditya Toshniwal <[email protected]>
  2019-01-28 12:08     ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Dave Page <[email protected]>
@ 2019-01-28 12:14       ` Aditya Toshniwal <[email protected]>
  2019-01-29 13:36         ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Aditya Toshniwal <[email protected]>
  0 siblings, 1 reply; 15+ messages in thread

From: Aditya Toshniwal @ 2019-01-28 12:14 UTC (permalink / raw)
  To: Dave Page <[email protected]>; +Cc: pgadmin-hackers

On Mon, Jan 28, 2019 at 5:39 PM Dave Page <[email protected]> wrote:

> On Mon, Jan 28, 2019 at 12:05 PM Aditya Toshniwal
> <[email protected]> wrote:
> >
> > Hi Dave,
> >
> > On Mon, Jan 28, 2019 at 5:01 PM Dave Page <[email protected]> wrote:
> >>
> >> Hi
> >>
> >> On Mon, Jan 28, 2019 at 7:00 AM Aditya Toshniwal
> >> <[email protected]> wrote:
> >> >
> >> > Hi Hackers,
> >> >
> >> > Attached is the patch to fix failing SQL editor related feature tests.
> >> > The failure is occurring mostly because of send_keys function of
> selenium which sometimes does not input the complete text. The change will
> use Codemirror javascript object to set the text.
> >> >
> >> > I have also added new args flag "--modules" which can be used after
> --pkg where you can test a specific module file under the pkg. This is not
> so useful for build but definitely helpful for the developers.
> >>
> >> One of the most common failures I see is failure to fill in the
> >> details on the Add Server dialogue (it might type half of an entry,
> >> then just hang). Should we get rid of all uses of send_keys?
> >
> > Setting the text using javascript executor can be done. send_keys
> simulate an actual person,  so if you try to set a disabled text box using
> send_keys, it won't. Places where disabled fields doesn't matter, send_keys
> can be removed.
>
> Can't we just do something like:
>
> if input.disabled == false:
>   input.value = 'Foo';
> else:
>   raise exception ....
>
I'll check if this can be done. Will get back.

>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>


-- 
Thanks and Regards,
Aditya Toshniwal
Software Engineer | EnterpriseDB Software Solutions | Pune
"Don't Complain about Heat, Plant a tree"


^ permalink  raw  reply  [nested|flat] 15+ messages in thread

* Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases
  2019-01-28 06:59 [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Aditya Toshniwal <[email protected]>
  2019-01-28 11:31 ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Dave Page <[email protected]>
  2019-01-28 12:05   ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Aditya Toshniwal <[email protected]>
  2019-01-28 12:08     ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Dave Page <[email protected]>
  2019-01-28 12:14       ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Aditya Toshniwal <[email protected]>
@ 2019-01-29 13:36         ` Aditya Toshniwal <[email protected]>
  2019-01-29 13:39           ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Dave Page <[email protected]>
  0 siblings, 1 reply; 15+ messages in thread

From: Aditya Toshniwal @ 2019-01-29 13:36 UTC (permalink / raw)
  To: Dave Page <[email protected]>; +Cc: pgadmin-hackers

Hi Hackers,

Attached is the updated patch. I have changed fill_input_by_field_name
function to use javascript to set values of text boxes and the selector is
changed from xpath to CSS with a :not(:disabled) clause. With this, test
case will fail if tried to set the value of a disabled input.

Kindly review.


On Mon, Jan 28, 2019 at 5:44 PM Aditya Toshniwal <
[email protected]> wrote:

>
>
> On Mon, Jan 28, 2019 at 5:39 PM Dave Page <[email protected]> wrote:
>
>> On Mon, Jan 28, 2019 at 12:05 PM Aditya Toshniwal
>> <[email protected]> wrote:
>> >
>> > Hi Dave,
>> >
>> > On Mon, Jan 28, 2019 at 5:01 PM Dave Page <[email protected]> wrote:
>> >>
>> >> Hi
>> >>
>> >> On Mon, Jan 28, 2019 at 7:00 AM Aditya Toshniwal
>> >> <[email protected]> wrote:
>> >> >
>> >> > Hi Hackers,
>> >> >
>> >> > Attached is the patch to fix failing SQL editor related feature
>> tests.
>> >> > The failure is occurring mostly because of send_keys function of
>> selenium which sometimes does not input the complete text. The change will
>> use Codemirror javascript object to set the text.
>> >> >
>> >> > I have also added new args flag "--modules" which can be used after
>> --pkg where you can test a specific module file under the pkg. This is not
>> so useful for build but definitely helpful for the developers.
>> >>
>> >> One of the most common failures I see is failure to fill in the
>> >> details on the Add Server dialogue (it might type half of an entry,
>> >> then just hang). Should we get rid of all uses of send_keys?
>> >
>> > Setting the text using javascript executor can be done. send_keys
>> simulate an actual person,  so if you try to set a disabled text box using
>> send_keys, it won't. Places where disabled fields doesn't matter, send_keys
>> can be removed.
>>
>> Can't we just do something like:
>>
>> if input.disabled == false:
>>   input.value = 'Foo';
>> else:
>>   raise exception ....
>>
> I'll check if this can be done. Will get back.
>
>>
>> --
>> Dave Page
>> Blog: http://pgsnake.blogspot.com
>> Twitter: @pgsnake
>>
>> EnterpriseDB UK: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>>
>
>
> --
> Thanks and Regards,
> Aditya Toshniwal
> Software Engineer | EnterpriseDB Software Solutions | Pune
> "Don't Complain about Heat, Plant a tree"
>


-- 
Thanks and Regards,
Aditya Toshniwal
Software Engineer | EnterpriseDB Software Solutions | Pune
"Don't Complain about Heat, Plant a tree"


Attachments:

  [application/octet-stream] RM3936_v2.patch (7.6K, 3-RM3936_v2.patch)
  download | inline diff:
diff --git a/web/pgadmin/feature_tests/pg_utilities_backup_restore_test.py b/web/pgadmin/feature_tests/pg_utilities_backup_restore_test.py
index 1c89393d..4e11f994 100644
--- a/web/pgadmin/feature_tests/pg_utilities_backup_restore_test.py
+++ b/web/pgadmin/feature_tests/pg_utilities_backup_restore_test.py
@@ -83,6 +83,7 @@ class PGUtilitiesBackupFeatureTest(BaseFeatureTest):
         self.page.find_by_css_selector(
             ".pg-bg-more-details").click()
 
+        backup_file = None
         # Check for XSS in Backup details
         if self.is_xss_check:
             self._check_detailed_window_for_xss('Backup')
@@ -99,7 +100,6 @@ class PGUtilitiesBackupFeatureTest(BaseFeatureTest):
 
             self.assertIn("pg_dump", str(command))
 
-            backup_file = None
             if command:
                 backup_file = command[int(command.find('--file')) +
                                       8:int(command.find('--host')) - 2]
diff --git a/web/pgadmin/utils/route.py b/web/pgadmin/utils/route.py
index e45e06b7..d1c6ce63 100644
--- a/web/pgadmin/utils/route.py
+++ b/web/pgadmin/utils/route.py
@@ -56,7 +56,7 @@ class TestsGeneratorRegistry(ABCMeta):
         ABCMeta.__init__(cls, name, bases, d)
 
     @classmethod
-    def load_generators(cls, pkg_root, exclude_pkgs):
+    def load_generators(cls, pkg_root, exclude_pkgs, for_modules=[]):
 
         cls.registry = dict()
 
@@ -64,6 +64,13 @@ class TestsGeneratorRegistry(ABCMeta):
 
         all_modules += find_modules(pkg_root, False, True)
 
+        # If specific modules are to be tested, exclude others
+        if len(for_modules) > 0:
+            all_modules = [module_name
+                           for module_name in all_modules
+                           for fmod in for_modules
+                           if module_name.endswith(fmod)]
+
         # Check for SERVER mode
         for module_name in all_modules:
             try:
diff --git a/web/regression/README b/web/regression/README
index 7e668cfd..6a68d36f 100644
--- a/web/regression/README
+++ b/web/regression/README
@@ -167,6 +167,14 @@ Python Tests:
      Example 2) Run test framework for 'database' node
      run 'python runtests.py --pkg browser.server_groups.servers.databases.tests'
 
+- Execute test framework for certain modules of a test pkg
+
+     Example 1) Run test framework for 'sqleditor' package and test_start_running_query module
+     run 'python runtests.py --pkg tools.sqleditor --modules test_start_running_query'
+
+     Example 2) Run test framework for 'sqleditor' package and test_start_running_query,test_query_tool_fs_utils modules
+     run 'python runtests.py --pkg tools.sqleditor --modules test_start_running_query,test_query_tool_fs_utils'
+
 - Exclude a package and its subpackages when running tests:
 
     Example: exclude feature tests but run all others:
diff --git a/web/regression/feature_utils/pgadmin_page.py b/web/regression/feature_utils/pgadmin_page.py
index 0c8f0fa3..cd4370e5 100644
--- a/web/regression/feature_utils/pgadmin_page.py
+++ b/web/regression/feature_utils/pgadmin_page.py
@@ -224,38 +224,60 @@ class PgadminPage:
             "clicking the element not to throw an exception", click_succeeded
         )
 
-    def fill_input_by_field_name(self, field_name, field_content):
-        field = self.find_by_xpath("//input[@name='" + field_name + "']")
+    def fill_input_by_field_name(self, field_name, field_content,
+                                 input_keys=False):
+        field = self.find_by_css_selector(
+            "input[name='" + field_name + "']:not(:disabled)")
         backspaces = [Keys.BACKSPACE] * len(field.get_attribute('value'))
 
         field.click()
-        field.send_keys(backspaces)
-        field.send_keys(str(field_content))
-        self.wait_for_input_field_content(field_name, field_content)
 
-    def fill_codemirror_area_with(self, field_content):
+        # Use send keys if input_keys true, else use javascript to set content
+        if input_keys:
+            field.send_keys(backspaces)
+            field.send_keys(str(field_content))
+            self.wait_for_input_field_content(field_name, field_content)
+        else:
+            self.driver.execute_script(
+                "arguments[0].setAttribute('value', arguments[1])",
+                field, field_content)
+
+            action = ActionChains(self.driver)
+            action.key_down(Keys.ARROW_DOWN)
+            action.perform()
+
+    def fill_codemirror_area_with(self, field_content, input_keys=False):
         def find_codemirror(driver):
             try:
                 driver.switch_to.default_content()
                 driver.switch_to_frame(
                     driver.find_element_by_tag_name("iframe"))
-                element = driver.find_element_by_xpath(
-                    "//pre[contains(@class,'CodeMirror-line')]/../../../"
-                    "*[contains(@class,'CodeMirror-code')]")
+                element = driver.find_element_by_css_selector(
+                    "#output-panel .CodeMirror")
                 if element.is_displayed() and element.is_enabled():
                     return element
             except (NoSuchElementException, WebDriverException):
                 return False
 
+        codemirror_ele = WebDriverWait(
+            self.driver, timeout=self.timeout, poll_frequency=0.01)\
+            .until(find_codemirror,
+                   "Timed out waiting for codemirror to appear")
+
         time.sleep(1)
-        WebDriverWait(self.driver, timeout=self.timeout, poll_frequency=0.01).\
-            until(find_codemirror, "Timed out waiting for codemirror "
-                                   "to appear").click()
-        time.sleep(1)
+        codemirror_ele.click()
 
-        action = ActionChains(self.driver)
-        action.send_keys(field_content)
-        action.perform()
+        # Use send keys if input_keys true, else use javascript to set content
+        if input_keys:
+            action = ActionChains(self.driver)
+            action.send_keys(field_content)
+            action.perform()
+        else:
+            self.driver.execute_script(
+                "arguments[0].CodeMirror.setValue(arguments[1]);"
+                "arguments[0].CodeMirror.setCursor("
+                "arguments[0].CodeMirror.lineCount(),0);",
+                codemirror_ele, field_content)
 
     def click_tab(self, tab_name):
         WebDriverWait(self.driver, 10).until(EC.element_to_be_clickable(
diff --git a/web/regression/runtests.py b/web/regression/runtests.py
index b023703d..116a0a16 100644
--- a/web/regression/runtests.py
+++ b/web/regression/runtests.py
@@ -233,9 +233,14 @@ def get_test_modules(arguments):
     if arguments['pkg'] is None or arguments['pkg'] == "all":
         TestsGeneratorRegistry.load_generators('pgadmin', exclude_pkgs)
     else:
+        for_modules = []
+        if arguments['modules'] is not None:
+            for_modules = arguments['modules'].split(',')
+
         TestsGeneratorRegistry.load_generators('pgadmin.%s' %
                                                arguments['pkg'],
-                                               exclude_pkgs)
+                                               exclude_pkgs,
+                                               for_modules)
 
     # Sort module list so that test suite executes the test cases sequentially
     module_list = TestsGeneratorRegistry.registry.items()
@@ -266,6 +271,10 @@ def add_arguments():
         '--default_browser',
         help='Executes the feature test in specific browser'
     )
+    parser.add_argument(
+        '--modules',
+        help='Executes the feature test for specific modules in pkg'
+    )
     arg = parser.parse_args()
 
     return arg


^ permalink  raw  reply  [nested|flat] 15+ messages in thread

* Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases
  2019-01-28 06:59 [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Aditya Toshniwal <[email protected]>
  2019-01-28 11:31 ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Dave Page <[email protected]>
  2019-01-28 12:05   ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Aditya Toshniwal <[email protected]>
  2019-01-28 12:08     ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Dave Page <[email protected]>
  2019-01-28 12:14       ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Aditya Toshniwal <[email protected]>
  2019-01-29 13:36         ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Aditya Toshniwal <[email protected]>
@ 2019-01-29 13:39           ` Dave Page <[email protected]>
  2019-01-29 14:08             ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Akshay Joshi <[email protected]>
  0 siblings, 1 reply; 15+ messages in thread

From: Dave Page @ 2019-01-29 13:39 UTC (permalink / raw)
  To: Aditya Toshniwal <[email protected]>; +Cc: pgadmin-hackers; Akshay Joshi <[email protected]>

Akshay, can you look at this please?

On Tue, Jan 29, 2019 at 1:36 PM Aditya Toshniwal
<[email protected]> wrote:
>
> Hi Hackers,
>
> Attached is the updated patch. I have changed fill_input_by_field_name function to use javascript to set values of text boxes and the selector is changed from xpath to CSS with a :not(:disabled) clause. With this, test case will fail if tried to set the value of a disabled input.
>
> Kindly review.
>
>
> On Mon, Jan 28, 2019 at 5:44 PM Aditya Toshniwal <[email protected]> wrote:
>>
>>
>>
>> On Mon, Jan 28, 2019 at 5:39 PM Dave Page <[email protected]> wrote:
>>>
>>> On Mon, Jan 28, 2019 at 12:05 PM Aditya Toshniwal
>>> <[email protected]> wrote:
>>> >
>>> > Hi Dave,
>>> >
>>> > On Mon, Jan 28, 2019 at 5:01 PM Dave Page <[email protected]> wrote:
>>> >>
>>> >> Hi
>>> >>
>>> >> On Mon, Jan 28, 2019 at 7:00 AM Aditya Toshniwal
>>> >> <[email protected]> wrote:
>>> >> >
>>> >> > Hi Hackers,
>>> >> >
>>> >> > Attached is the patch to fix failing SQL editor related feature tests.
>>> >> > The failure is occurring mostly because of send_keys function of selenium which sometimes does not input the complete text. The change will use Codemirror javascript object to set the text.
>>> >> >
>>> >> > I have also added new args flag "--modules" which can be used after --pkg where you can test a specific module file under the pkg. This is not so useful for build but definitely helpful for the developers.
>>> >>
>>> >> One of the most common failures I see is failure to fill in the
>>> >> details on the Add Server dialogue (it might type half of an entry,
>>> >> then just hang). Should we get rid of all uses of send_keys?
>>> >
>>> > Setting the text using javascript executor can be done. send_keys simulate an actual person,  so if you try to set a disabled text box using send_keys, it won't. Places where disabled fields doesn't matter, send_keys can be removed.
>>>
>>> Can't we just do something like:
>>>
>>> if input.disabled == false:
>>>   input.value = 'Foo';
>>> else:
>>>   raise exception ....
>>
>> I'll check if this can be done. Will get back.
>>>
>>>
>>> --
>>> Dave Page
>>> Blog: http://pgsnake.blogspot.com
>>> Twitter: @pgsnake
>>>
>>> EnterpriseDB UK: http://www.enterprisedb.com
>>> The Enterprise PostgreSQL Company
>>
>>
>>
>> --
>> Thanks and Regards,
>> Aditya Toshniwal
>> Software Engineer | EnterpriseDB Software Solutions | Pune
>> "Don't Complain about Heat, Plant a tree"
>
>
>
> --
> Thanks and Regards,
> Aditya Toshniwal
> Software Engineer | EnterpriseDB Software Solutions | Pune
> "Don't Complain about Heat, Plant a tree"



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

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




^ permalink  raw  reply  [nested|flat] 15+ messages in thread

* Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases
  2019-01-28 06:59 [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Aditya Toshniwal <[email protected]>
  2019-01-28 11:31 ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Dave Page <[email protected]>
  2019-01-28 12:05   ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Aditya Toshniwal <[email protected]>
  2019-01-28 12:08     ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Dave Page <[email protected]>
  2019-01-28 12:14       ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Aditya Toshniwal <[email protected]>
  2019-01-29 13:36         ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Aditya Toshniwal <[email protected]>
  2019-01-29 13:39           ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Dave Page <[email protected]>
@ 2019-01-29 14:08             ` Akshay Joshi <[email protected]>
  2019-01-30 13:44               ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Akshay Joshi <[email protected]>
  0 siblings, 1 reply; 15+ messages in thread

From: Akshay Joshi @ 2019-01-29 14:08 UTC (permalink / raw)
  To: Dave Page <[email protected]>; +Cc: Aditya Toshniwal <[email protected]>; pgadmin-hackers

On Tue, 29 Jan 2019, 19:09 Dave Page <[email protected] wrote:

> Akshay, can you look at this please?
>

    Sure.

>
> On Tue, Jan 29, 2019 at 1:36 PM Aditya Toshniwal
> <[email protected]> wrote:
> >
> > Hi Hackers,
> >
> > Attached is the updated patch. I have changed fill_input_by_field_name
> function to use javascript to set values of text boxes and the selector is
> changed from xpath to CSS with a :not(:disabled) clause. With this, test
> case will fail if tried to set the value of a disabled input.
> >
> > Kindly review.
> >
> >
> > On Mon, Jan 28, 2019 at 5:44 PM Aditya Toshniwal <
> [email protected]> wrote:
> >>
> >>
> >>
> >> On Mon, Jan 28, 2019 at 5:39 PM Dave Page <[email protected]> wrote:
> >>>
> >>> On Mon, Jan 28, 2019 at 12:05 PM Aditya Toshniwal
> >>> <[email protected]> wrote:
> >>> >
> >>> > Hi Dave,
> >>> >
> >>> > On Mon, Jan 28, 2019 at 5:01 PM Dave Page <[email protected]> wrote:
> >>> >>
> >>> >> Hi
> >>> >>
> >>> >> On Mon, Jan 28, 2019 at 7:00 AM Aditya Toshniwal
> >>> >> <[email protected]> wrote:
> >>> >> >
> >>> >> > Hi Hackers,
> >>> >> >
> >>> >> > Attached is the patch to fix failing SQL editor related feature
> tests.
> >>> >> > The failure is occurring mostly because of send_keys function of
> selenium which sometimes does not input the complete text. The change will
> use Codemirror javascript object to set the text.
> >>> >> >
> >>> >> > I have also added new args flag "--modules" which can be used
> after --pkg where you can test a specific module file under the pkg. This
> is not so useful for build but definitely helpful for the developers.
> >>> >>
> >>> >> One of the most common failures I see is failure to fill in the
> >>> >> details on the Add Server dialogue (it might type half of an entry,
> >>> >> then just hang). Should we get rid of all uses of send_keys?
> >>> >
> >>> > Setting the text using javascript executor can be done. send_keys
> simulate an actual person,  so if you try to set a disabled text box using
> send_keys, it won't. Places where disabled fields doesn't matter, send_keys
> can be removed.
> >>>
> >>> Can't we just do something like:
> >>>
> >>> if input.disabled == false:
> >>>   input.value = 'Foo';
> >>> else:
> >>>   raise exception ....
> >>
> >> I'll check if this can be done. Will get back.
> >>>
> >>>
> >>> --
> >>> Dave Page
> >>> Blog: http://pgsnake.blogspot.com
> >>> Twitter: @pgsnake
> >>>
> >>> EnterpriseDB UK: http://www.enterprisedb.com
> >>> The Enterprise PostgreSQL Company
> >>
> >>
> >>
> >> --
> >> Thanks and Regards,
> >> Aditya Toshniwal
> >> Software Engineer | EnterpriseDB Software Solutions | Pune
> >> "Don't Complain about Heat, Plant a tree"
> >
> >
> >
> > --
> > Thanks and Regards,
> > Aditya Toshniwal
> > Software Engineer | EnterpriseDB Software Solutions | Pune
> > "Don't Complain about Heat, Plant a tree"
>
>
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>


^ permalink  raw  reply  [nested|flat] 15+ messages in thread

* Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases
  2019-01-28 06:59 [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Aditya Toshniwal <[email protected]>
  2019-01-28 11:31 ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Dave Page <[email protected]>
  2019-01-28 12:05   ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Aditya Toshniwal <[email protected]>
  2019-01-28 12:08     ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Dave Page <[email protected]>
  2019-01-28 12:14       ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Aditya Toshniwal <[email protected]>
  2019-01-29 13:36         ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Aditya Toshniwal <[email protected]>
  2019-01-29 13:39           ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Dave Page <[email protected]>
  2019-01-29 14:08             ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Akshay Joshi <[email protected]>
@ 2019-01-30 13:44               ` Akshay Joshi <[email protected]>
  2019-02-04 08:48                 ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Aditya Toshniwal <[email protected]>
  0 siblings, 1 reply; 15+ messages in thread

From: Akshay Joshi @ 2019-01-30 13:44 UTC (permalink / raw)
  To: Aditya Toshniwal <[email protected]>; +Cc: pgadmin-hackers

Hi Aditya

I have applied your patch but following test cases are failing consistently:

   - CopySelectedQueryResultsFeatureTest
   - QueryToolAutoCompleteFeatureTest

I have verified your patch on Mac OSX and Ubuntu. Chrome Version
71.0.3578.98

On Tue, Jan 29, 2019 at 7:38 PM Akshay Joshi <[email protected]>
wrote:

>
>
> On Tue, 29 Jan 2019, 19:09 Dave Page <[email protected] wrote:
>
>> Akshay, can you look at this please?
>>
>
>     Sure.
>
>>
>> On Tue, Jan 29, 2019 at 1:36 PM Aditya Toshniwal
>> <[email protected]> wrote:
>> >
>> > Hi Hackers,
>> >
>> > Attached is the updated patch. I have changed fill_input_by_field_name
>> function to use javascript to set values of text boxes and the selector is
>> changed from xpath to CSS with a :not(:disabled) clause. With this, test
>> case will fail if tried to set the value of a disabled input.
>> >
>> > Kindly review.
>> >
>> >
>> > On Mon, Jan 28, 2019 at 5:44 PM Aditya Toshniwal <
>> [email protected]> wrote:
>> >>
>> >>
>> >>
>> >> On Mon, Jan 28, 2019 at 5:39 PM Dave Page <[email protected]> wrote:
>> >>>
>> >>> On Mon, Jan 28, 2019 at 12:05 PM Aditya Toshniwal
>> >>> <[email protected]> wrote:
>> >>> >
>> >>> > Hi Dave,
>> >>> >
>> >>> > On Mon, Jan 28, 2019 at 5:01 PM Dave Page <[email protected]>
>> wrote:
>> >>> >>
>> >>> >> Hi
>> >>> >>
>> >>> >> On Mon, Jan 28, 2019 at 7:00 AM Aditya Toshniwal
>> >>> >> <[email protected]> wrote:
>> >>> >> >
>> >>> >> > Hi Hackers,
>> >>> >> >
>> >>> >> > Attached is the patch to fix failing SQL editor related feature
>> tests.
>> >>> >> > The failure is occurring mostly because of send_keys function of
>> selenium which sometimes does not input the complete text. The change will
>> use Codemirror javascript object to set the text.
>> >>> >> >
>> >>> >> > I have also added new args flag "--modules" which can be used
>> after --pkg where you can test a specific module file under the pkg. This
>> is not so useful for build but definitely helpful for the developers.
>> >>> >>
>> >>> >> One of the most common failures I see is failure to fill in the
>> >>> >> details on the Add Server dialogue (it might type half of an entry,
>> >>> >> then just hang). Should we get rid of all uses of send_keys?
>> >>> >
>> >>> > Setting the text using javascript executor can be done. send_keys
>> simulate an actual person,  so if you try to set a disabled text box using
>> send_keys, it won't. Places where disabled fields doesn't matter, send_keys
>> can be removed.
>> >>>
>> >>> Can't we just do something like:
>> >>>
>> >>> if input.disabled == false:
>> >>>   input.value = 'Foo';
>> >>> else:
>> >>>   raise exception ....
>> >>
>> >> I'll check if this can be done. Will get back.
>> >>>
>> >>>
>> >>> --
>> >>> Dave Page
>> >>> Blog: http://pgsnake.blogspot.com
>> >>> Twitter: @pgsnake
>> >>>
>> >>> EnterpriseDB UK: http://www.enterprisedb.com
>> >>> The Enterprise PostgreSQL Company
>> >>
>> >>
>> >>
>> >> --
>> >> Thanks and Regards,
>> >> Aditya Toshniwal
>> >> Software Engineer | EnterpriseDB Software Solutions | Pune
>> >> "Don't Complain about Heat, Plant a tree"
>> >
>> >
>> >
>> > --
>> > Thanks and Regards,
>> > Aditya Toshniwal
>> > Software Engineer | EnterpriseDB Software Solutions | Pune
>> > "Don't Complain about Heat, Plant a tree"
>>
>>
>>
>> --
>> 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-9517Mobile: +91 976-788-8246*


^ permalink  raw  reply  [nested|flat] 15+ messages in thread

* Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases
  2019-01-28 06:59 [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Aditya Toshniwal <[email protected]>
  2019-01-28 11:31 ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Dave Page <[email protected]>
  2019-01-28 12:05   ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Aditya Toshniwal <[email protected]>
  2019-01-28 12:08     ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Dave Page <[email protected]>
  2019-01-28 12:14       ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Aditya Toshniwal <[email protected]>
  2019-01-29 13:36         ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Aditya Toshniwal <[email protected]>
  2019-01-29 13:39           ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Dave Page <[email protected]>
  2019-01-29 14:08             ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Akshay Joshi <[email protected]>
  2019-01-30 13:44               ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Akshay Joshi <[email protected]>
@ 2019-02-04 08:48                 ` Aditya Toshniwal <[email protected]>
  2019-02-05 05:10                   ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Akshay Joshi <[email protected]>
  0 siblings, 1 reply; 15+ messages in thread

From: Aditya Toshniwal @ 2019-02-04 08:48 UTC (permalink / raw)
  To: Akshay Joshi <[email protected]>; +Cc: pgadmin-hackers

Hi Akshay,

I tried to simulate, but no luck. It works on my system :(

On Wed, Jan 30, 2019 at 7:15 PM Akshay Joshi <[email protected]>
wrote:

> Hi Aditya
>
> I have applied your patch but following test cases are failing
> consistently:
>
>    - CopySelectedQueryResultsFeatureTest
>    - QueryToolAutoCompleteFeatureTest
>
> I have verified your patch on Mac OSX and Ubuntu. Chrome Version
> 71.0.3578.98
>
> On Tue, Jan 29, 2019 at 7:38 PM Akshay Joshi <
> [email protected]> wrote:
>
>>
>>
>> On Tue, 29 Jan 2019, 19:09 Dave Page <[email protected] wrote:
>>
>>> Akshay, can you look at this please?
>>>
>>
>>     Sure.
>>
>>>
>>> On Tue, Jan 29, 2019 at 1:36 PM Aditya Toshniwal
>>> <[email protected]> wrote:
>>> >
>>> > Hi Hackers,
>>> >
>>> > Attached is the updated patch. I have changed fill_input_by_field_name
>>> function to use javascript to set values of text boxes and the selector is
>>> changed from xpath to CSS with a :not(:disabled) clause. With this, test
>>> case will fail if tried to set the value of a disabled input.
>>> >
>>> > Kindly review.
>>> >
>>> >
>>> > On Mon, Jan 28, 2019 at 5:44 PM Aditya Toshniwal <
>>> [email protected]> wrote:
>>> >>
>>> >>
>>> >>
>>> >> On Mon, Jan 28, 2019 at 5:39 PM Dave Page <[email protected]> wrote:
>>> >>>
>>> >>> On Mon, Jan 28, 2019 at 12:05 PM Aditya Toshniwal
>>> >>> <[email protected]> wrote:
>>> >>> >
>>> >>> > Hi Dave,
>>> >>> >
>>> >>> > On Mon, Jan 28, 2019 at 5:01 PM Dave Page <[email protected]>
>>> wrote:
>>> >>> >>
>>> >>> >> Hi
>>> >>> >>
>>> >>> >> On Mon, Jan 28, 2019 at 7:00 AM Aditya Toshniwal
>>> >>> >> <[email protected]> wrote:
>>> >>> >> >
>>> >>> >> > Hi Hackers,
>>> >>> >> >
>>> >>> >> > Attached is the patch to fix failing SQL editor related feature
>>> tests.
>>> >>> >> > The failure is occurring mostly because of send_keys function
>>> of selenium which sometimes does not input the complete text. The change
>>> will use Codemirror javascript object to set the text.
>>> >>> >> >
>>> >>> >> > I have also added new args flag "--modules" which can be used
>>> after --pkg where you can test a specific module file under the pkg. This
>>> is not so useful for build but definitely helpful for the developers.
>>> >>> >>
>>> >>> >> One of the most common failures I see is failure to fill in the
>>> >>> >> details on the Add Server dialogue (it might type half of an
>>> entry,
>>> >>> >> then just hang). Should we get rid of all uses of send_keys?
>>> >>> >
>>> >>> > Setting the text using javascript executor can be done. send_keys
>>> simulate an actual person,  so if you try to set a disabled text box using
>>> send_keys, it won't. Places where disabled fields doesn't matter, send_keys
>>> can be removed.
>>> >>>
>>> >>> Can't we just do something like:
>>> >>>
>>> >>> if input.disabled == false:
>>> >>>   input.value = 'Foo';
>>> >>> else:
>>> >>>   raise exception ....
>>> >>
>>> >> I'll check if this can be done. Will get back.
>>> >>>
>>> >>>
>>> >>> --
>>> >>> Dave Page
>>> >>> Blog: http://pgsnake.blogspot.com
>>> >>> Twitter: @pgsnake
>>> >>>
>>> >>> EnterpriseDB UK: http://www.enterprisedb.com
>>> >>> The Enterprise PostgreSQL Company
>>> >>
>>> >>
>>> >>
>>> >> --
>>> >> Thanks and Regards,
>>> >> Aditya Toshniwal
>>> >> Software Engineer | EnterpriseDB Software Solutions | Pune
>>> >> "Don't Complain about Heat, Plant a tree"
>>> >
>>> >
>>> >
>>> > --
>>> > Thanks and Regards,
>>> > Aditya Toshniwal
>>> > Software Engineer | EnterpriseDB Software Solutions | Pune
>>> > "Don't Complain about Heat, Plant a tree"
>>>
>>>
>>>
>>> --
>>> 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-9517Mobile: +91 976-788-8246*
>


-- 
Thanks and Regards,
Aditya Toshniwal
Software Engineer | EnterpriseDB Software Solutions | Pune
"Don't Complain about Heat, Plant a tree"


^ permalink  raw  reply  [nested|flat] 15+ messages in thread

* Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases
  2019-01-28 06:59 [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Aditya Toshniwal <[email protected]>
  2019-01-28 11:31 ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Dave Page <[email protected]>
  2019-01-28 12:05   ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Aditya Toshniwal <[email protected]>
  2019-01-28 12:08     ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Dave Page <[email protected]>
  2019-01-28 12:14       ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Aditya Toshniwal <[email protected]>
  2019-01-29 13:36         ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Aditya Toshniwal <[email protected]>
  2019-01-29 13:39           ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Dave Page <[email protected]>
  2019-01-29 14:08             ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Akshay Joshi <[email protected]>
  2019-01-30 13:44               ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Akshay Joshi <[email protected]>
  2019-02-04 08:48                 ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Aditya Toshniwal <[email protected]>
@ 2019-02-05 05:10                   ` Akshay Joshi <[email protected]>
  2019-02-05 05:12                     ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Aditya Toshniwal <[email protected]>
  2019-02-05 05:18                     ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Khushboo Vashi <[email protected]>
  0 siblings, 2 replies; 15+ messages in thread

From: Akshay Joshi @ 2019-02-05 05:10 UTC (permalink / raw)
  To: Aditya Toshniwal <[email protected]>; +Cc: pgadmin-hackers

Hi Aditya

On Mon, Feb 4, 2019 at 2:18 PM Aditya Toshniwal <
[email protected]> wrote:

> Hi Akshay,
>
> I tried to simulate, but no luck. It works on my system :(
>

   I have tried and Feature test are failing randomly for each run. I have
verified it on OSX and Ubuntu both.

>
> On Wed, Jan 30, 2019 at 7:15 PM Akshay Joshi <
> [email protected]> wrote:
>
>> Hi Aditya
>>
>> I have applied your patch but following test cases are failing
>> consistently:
>>
>>    - CopySelectedQueryResultsFeatureTest
>>    - QueryToolAutoCompleteFeatureTest
>>
>> I have verified your patch on Mac OSX and Ubuntu. Chrome Version
>> 71.0.3578.98
>>
>> On Tue, Jan 29, 2019 at 7:38 PM Akshay Joshi <
>> [email protected]> wrote:
>>
>>>
>>>
>>> On Tue, 29 Jan 2019, 19:09 Dave Page <[email protected] wrote:
>>>
>>>> Akshay, can you look at this please?
>>>>
>>>
>>>     Sure.
>>>
>>>>
>>>> On Tue, Jan 29, 2019 at 1:36 PM Aditya Toshniwal
>>>> <[email protected]> wrote:
>>>> >
>>>> > Hi Hackers,
>>>> >
>>>> > Attached is the updated patch. I have changed
>>>> fill_input_by_field_name function to use javascript to set values of text
>>>> boxes and the selector is changed from xpath to CSS with a :not(:disabled)
>>>> clause. With this, test case will fail if tried to set the value of a
>>>> disabled input.
>>>> >
>>>> > Kindly review.
>>>> >
>>>> >
>>>> > On Mon, Jan 28, 2019 at 5:44 PM Aditya Toshniwal <
>>>> [email protected]> wrote:
>>>> >>
>>>> >>
>>>> >>
>>>> >> On Mon, Jan 28, 2019 at 5:39 PM Dave Page <[email protected]> wrote:
>>>> >>>
>>>> >>> On Mon, Jan 28, 2019 at 12:05 PM Aditya Toshniwal
>>>> >>> <[email protected]> wrote:
>>>> >>> >
>>>> >>> > Hi Dave,
>>>> >>> >
>>>> >>> > On Mon, Jan 28, 2019 at 5:01 PM Dave Page <[email protected]>
>>>> wrote:
>>>> >>> >>
>>>> >>> >> Hi
>>>> >>> >>
>>>> >>> >> On Mon, Jan 28, 2019 at 7:00 AM Aditya Toshniwal
>>>> >>> >> <[email protected]> wrote:
>>>> >>> >> >
>>>> >>> >> > Hi Hackers,
>>>> >>> >> >
>>>> >>> >> > Attached is the patch to fix failing SQL editor related
>>>> feature tests.
>>>> >>> >> > The failure is occurring mostly because of send_keys function
>>>> of selenium which sometimes does not input the complete text. The change
>>>> will use Codemirror javascript object to set the text.
>>>> >>> >> >
>>>> >>> >> > I have also added new args flag "--modules" which can be used
>>>> after --pkg where you can test a specific module file under the pkg. This
>>>> is not so useful for build but definitely helpful for the developers.
>>>> >>> >>
>>>> >>> >> One of the most common failures I see is failure to fill in the
>>>> >>> >> details on the Add Server dialogue (it might type half of an
>>>> entry,
>>>> >>> >> then just hang). Should we get rid of all uses of send_keys?
>>>> >>> >
>>>> >>> > Setting the text using javascript executor can be done. send_keys
>>>> simulate an actual person,  so if you try to set a disabled text box using
>>>> send_keys, it won't. Places where disabled fields doesn't matter, send_keys
>>>> can be removed.
>>>> >>>
>>>> >>> Can't we just do something like:
>>>> >>>
>>>> >>> if input.disabled == false:
>>>> >>>   input.value = 'Foo';
>>>> >>> else:
>>>> >>>   raise exception ....
>>>> >>
>>>> >> I'll check if this can be done. Will get back.
>>>> >>>
>>>> >>>
>>>> >>> --
>>>> >>> Dave Page
>>>> >>> Blog: http://pgsnake.blogspot.com
>>>> >>> Twitter: @pgsnake
>>>> >>>
>>>> >>> EnterpriseDB UK: http://www.enterprisedb.com
>>>> >>> The Enterprise PostgreSQL Company
>>>> >>
>>>> >>
>>>> >>
>>>> >> --
>>>> >> Thanks and Regards,
>>>> >> Aditya Toshniwal
>>>> >> Software Engineer | EnterpriseDB Software Solutions | Pune
>>>> >> "Don't Complain about Heat, Plant a tree"
>>>> >
>>>> >
>>>> >
>>>> > --
>>>> > Thanks and Regards,
>>>> > Aditya Toshniwal
>>>> > Software Engineer | EnterpriseDB Software Solutions | Pune
>>>> > "Don't Complain about Heat, Plant a tree"
>>>>
>>>>
>>>>
>>>> --
>>>> 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-9517Mobile: +91 976-788-8246*
>>
>
>
> --
> Thanks and Regards,
> Aditya Toshniwal
> Software Engineer | EnterpriseDB Software Solutions | Pune
> "Don't Complain about Heat, Plant a tree"
>


-- 
*Akshay Joshi*

*Sr. Software Architect *



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


^ permalink  raw  reply  [nested|flat] 15+ messages in thread

* Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases
  2019-01-28 06:59 [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Aditya Toshniwal <[email protected]>
  2019-01-28 11:31 ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Dave Page <[email protected]>
  2019-01-28 12:05   ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Aditya Toshniwal <[email protected]>
  2019-01-28 12:08     ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Dave Page <[email protected]>
  2019-01-28 12:14       ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Aditya Toshniwal <[email protected]>
  2019-01-29 13:36         ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Aditya Toshniwal <[email protected]>
  2019-01-29 13:39           ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Dave Page <[email protected]>
  2019-01-29 14:08             ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Akshay Joshi <[email protected]>
  2019-01-30 13:44               ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Akshay Joshi <[email protected]>
  2019-02-04 08:48                 ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Aditya Toshniwal <[email protected]>
  2019-02-05 05:10                   ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Akshay Joshi <[email protected]>
@ 2019-02-05 05:12                     ` Aditya Toshniwal <[email protected]>
  1 sibling, 0 replies; 15+ messages in thread

From: Aditya Toshniwal @ 2019-02-05 05:12 UTC (permalink / raw)
  To: Akshay Joshi <[email protected]>; +Cc: pgadmin-hackers

Urgh. Will try to reproduce and explore possible causes of failure.

On Tue, Feb 5, 2019 at 10:40 AM Akshay Joshi <[email protected]>
wrote:

> Hi Aditya
>
> On Mon, Feb 4, 2019 at 2:18 PM Aditya Toshniwal <
> [email protected]> wrote:
>
>> Hi Akshay,
>>
>> I tried to simulate, but no luck. It works on my system :(
>>
>
>    I have tried and Feature test are failing randomly for each run. I have
> verified it on OSX and Ubuntu both.
>
>>
>> On Wed, Jan 30, 2019 at 7:15 PM Akshay Joshi <
>> [email protected]> wrote:
>>
>>> Hi Aditya
>>>
>>> I have applied your patch but following test cases are failing
>>> consistently:
>>>
>>>    - CopySelectedQueryResultsFeatureTest
>>>    - QueryToolAutoCompleteFeatureTest
>>>
>>> I have verified your patch on Mac OSX and Ubuntu. Chrome Version
>>> 71.0.3578.98
>>>
>>> On Tue, Jan 29, 2019 at 7:38 PM Akshay Joshi <
>>> [email protected]> wrote:
>>>
>>>>
>>>>
>>>> On Tue, 29 Jan 2019, 19:09 Dave Page <[email protected] wrote:
>>>>
>>>>> Akshay, can you look at this please?
>>>>>
>>>>
>>>>     Sure.
>>>>
>>>>>
>>>>> On Tue, Jan 29, 2019 at 1:36 PM Aditya Toshniwal
>>>>> <[email protected]> wrote:
>>>>> >
>>>>> > Hi Hackers,
>>>>> >
>>>>> > Attached is the updated patch. I have changed
>>>>> fill_input_by_field_name function to use javascript to set values of text
>>>>> boxes and the selector is changed from xpath to CSS with a :not(:disabled)
>>>>> clause. With this, test case will fail if tried to set the value of a
>>>>> disabled input.
>>>>> >
>>>>> > Kindly review.
>>>>> >
>>>>> >
>>>>> > On Mon, Jan 28, 2019 at 5:44 PM Aditya Toshniwal <
>>>>> [email protected]> wrote:
>>>>> >>
>>>>> >>
>>>>> >>
>>>>> >> On Mon, Jan 28, 2019 at 5:39 PM Dave Page <[email protected]>
>>>>> wrote:
>>>>> >>>
>>>>> >>> On Mon, Jan 28, 2019 at 12:05 PM Aditya Toshniwal
>>>>> >>> <[email protected]> wrote:
>>>>> >>> >
>>>>> >>> > Hi Dave,
>>>>> >>> >
>>>>> >>> > On Mon, Jan 28, 2019 at 5:01 PM Dave Page <[email protected]>
>>>>> wrote:
>>>>> >>> >>
>>>>> >>> >> Hi
>>>>> >>> >>
>>>>> >>> >> On Mon, Jan 28, 2019 at 7:00 AM Aditya Toshniwal
>>>>> >>> >> <[email protected]> wrote:
>>>>> >>> >> >
>>>>> >>> >> > Hi Hackers,
>>>>> >>> >> >
>>>>> >>> >> > Attached is the patch to fix failing SQL editor related
>>>>> feature tests.
>>>>> >>> >> > The failure is occurring mostly because of send_keys function
>>>>> of selenium which sometimes does not input the complete text. The change
>>>>> will use Codemirror javascript object to set the text.
>>>>> >>> >> >
>>>>> >>> >> > I have also added new args flag "--modules" which can be used
>>>>> after --pkg where you can test a specific module file under the pkg. This
>>>>> is not so useful for build but definitely helpful for the developers.
>>>>> >>> >>
>>>>> >>> >> One of the most common failures I see is failure to fill in the
>>>>> >>> >> details on the Add Server dialogue (it might type half of an
>>>>> entry,
>>>>> >>> >> then just hang). Should we get rid of all uses of send_keys?
>>>>> >>> >
>>>>> >>> > Setting the text using javascript executor can be done.
>>>>> send_keys simulate an actual person,  so if you try to set a disabled text
>>>>> box using send_keys, it won't. Places where disabled fields doesn't matter,
>>>>> send_keys can be removed.
>>>>> >>>
>>>>> >>> Can't we just do something like:
>>>>> >>>
>>>>> >>> if input.disabled == false:
>>>>> >>>   input.value = 'Foo';
>>>>> >>> else:
>>>>> >>>   raise exception ....
>>>>> >>
>>>>> >> I'll check if this can be done. Will get back.
>>>>> >>>
>>>>> >>>
>>>>> >>> --
>>>>> >>> Dave Page
>>>>> >>> Blog: http://pgsnake.blogspot.com
>>>>> >>> Twitter: @pgsnake
>>>>> >>>
>>>>> >>> EnterpriseDB UK: http://www.enterprisedb.com
>>>>> >>> The Enterprise PostgreSQL Company
>>>>> >>
>>>>> >>
>>>>> >>
>>>>> >> --
>>>>> >> Thanks and Regards,
>>>>> >> Aditya Toshniwal
>>>>> >> Software Engineer | EnterpriseDB Software Solutions | Pune
>>>>> >> "Don't Complain about Heat, Plant a tree"
>>>>> >
>>>>> >
>>>>> >
>>>>> > --
>>>>> > Thanks and Regards,
>>>>> > Aditya Toshniwal
>>>>> > Software Engineer | EnterpriseDB Software Solutions | Pune
>>>>> > "Don't Complain about Heat, Plant a tree"
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> 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-9517Mobile: +91 976-788-8246*
>>>
>>
>>
>> --
>> Thanks and Regards,
>> Aditya Toshniwal
>> Software Engineer | EnterpriseDB Software Solutions | Pune
>> "Don't Complain about Heat, Plant a tree"
>>
>
>
> --
> *Akshay Joshi*
>
> *Sr. Software Architect *
>
>
>
> *Phone: +91 20-3058-9517Mobile: +91 976-788-8246*
>


-- 
Thanks and Regards,
Aditya Toshniwal
Software Engineer | EnterpriseDB Software Solutions | Pune
"Don't Complain about Heat, Plant a tree"


^ permalink  raw  reply  [nested|flat] 15+ messages in thread

* Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases
  2019-01-28 06:59 [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Aditya Toshniwal <[email protected]>
  2019-01-28 11:31 ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Dave Page <[email protected]>
  2019-01-28 12:05   ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Aditya Toshniwal <[email protected]>
  2019-01-28 12:08     ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Dave Page <[email protected]>
  2019-01-28 12:14       ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Aditya Toshniwal <[email protected]>
  2019-01-29 13:36         ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Aditya Toshniwal <[email protected]>
  2019-01-29 13:39           ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Dave Page <[email protected]>
  2019-01-29 14:08             ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Akshay Joshi <[email protected]>
  2019-01-30 13:44               ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Akshay Joshi <[email protected]>
  2019-02-04 08:48                 ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Aditya Toshniwal <[email protected]>
  2019-02-05 05:10                   ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Akshay Joshi <[email protected]>
@ 2019-02-05 05:18                     ` Khushboo Vashi <[email protected]>
  2019-02-05 11:57                       ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Aditya Toshniwal <[email protected]>
  1 sibling, 1 reply; 15+ messages in thread

From: Khushboo Vashi @ 2019-02-05 05:18 UTC (permalink / raw)
  To: Akshay Joshi <[email protected]>; +Cc: Aditya Toshniwal <[email protected]>; pgadmin-hackers

On Tue, Feb 5, 2019 at 10:40 AM Akshay Joshi <[email protected]>
wrote:

> Hi Aditya
>
> On Mon, Feb 4, 2019 at 2:18 PM Aditya Toshniwal <
> [email protected]> wrote:
>
>> Hi Akshay,
>>
>> I tried to simulate, but no luck. It works on my system :(
>>
>
>    I have tried and Feature test are failing randomly for each run. I have
> verified it on OSX and Ubuntu both.
>
>>
>> +1

> On Wed, Jan 30, 2019 at 7:15 PM Akshay Joshi <
>> [email protected]> wrote:
>>
>>> Hi Aditya
>>>
>>> I have applied your patch but following test cases are failing
>>> consistently:
>>>
>>>    - CopySelectedQueryResultsFeatureTest
>>>    - QueryToolAutoCompleteFeatureTest
>>>
>>> I have verified your patch on Mac OSX and Ubuntu. Chrome Version
>>> 71.0.3578.98
>>>
>>> On Tue, Jan 29, 2019 at 7:38 PM Akshay Joshi <
>>> [email protected]> wrote:
>>>
>>>>
>>>>
>>>> On Tue, 29 Jan 2019, 19:09 Dave Page <[email protected] wrote:
>>>>
>>>>> Akshay, can you look at this please?
>>>>>
>>>>
>>>>     Sure.
>>>>
>>>>>
>>>>> On Tue, Jan 29, 2019 at 1:36 PM Aditya Toshniwal
>>>>> <[email protected]> wrote:
>>>>> >
>>>>> > Hi Hackers,
>>>>> >
>>>>> > Attached is the updated patch. I have changed
>>>>> fill_input_by_field_name function to use javascript to set values of text
>>>>> boxes and the selector is changed from xpath to CSS with a :not(:disabled)
>>>>> clause. With this, test case will fail if tried to set the value of a
>>>>> disabled input.
>>>>> >
>>>>> > Kindly review.
>>>>> >
>>>>> >
>>>>> > On Mon, Jan 28, 2019 at 5:44 PM Aditya Toshniwal <
>>>>> [email protected]> wrote:
>>>>> >>
>>>>> >>
>>>>> >>
>>>>> >> On Mon, Jan 28, 2019 at 5:39 PM Dave Page <[email protected]>
>>>>> wrote:
>>>>> >>>
>>>>> >>> On Mon, Jan 28, 2019 at 12:05 PM Aditya Toshniwal
>>>>> >>> <[email protected]> wrote:
>>>>> >>> >
>>>>> >>> > Hi Dave,
>>>>> >>> >
>>>>> >>> > On Mon, Jan 28, 2019 at 5:01 PM Dave Page <[email protected]>
>>>>> wrote:
>>>>> >>> >>
>>>>> >>> >> Hi
>>>>> >>> >>
>>>>> >>> >> On Mon, Jan 28, 2019 at 7:00 AM Aditya Toshniwal
>>>>> >>> >> <[email protected]> wrote:
>>>>> >>> >> >
>>>>> >>> >> > Hi Hackers,
>>>>> >>> >> >
>>>>> >>> >> > Attached is the patch to fix failing SQL editor related
>>>>> feature tests.
>>>>> >>> >> > The failure is occurring mostly because of send_keys function
>>>>> of selenium which sometimes does not input the complete text. The change
>>>>> will use Codemirror javascript object to set the text.
>>>>> >>> >> >
>>>>> >>> >> > I have also added new args flag "--modules" which can be used
>>>>> after --pkg where you can test a specific module file under the pkg. This
>>>>> is not so useful for build but definitely helpful for the developers.
>>>>> >>> >>
>>>>> >>> >> One of the most common failures I see is failure to fill in the
>>>>> >>> >> details on the Add Server dialogue (it might type half of an
>>>>> entry,
>>>>> >>> >> then just hang). Should we get rid of all uses of send_keys?
>>>>> >>> >
>>>>> >>> > Setting the text using javascript executor can be done.
>>>>> send_keys simulate an actual person,  so if you try to set a disabled text
>>>>> box using send_keys, it won't. Places where disabled fields doesn't matter,
>>>>> send_keys can be removed.
>>>>> >>>
>>>>> >>> Can't we just do something like:
>>>>> >>>
>>>>> >>> if input.disabled == false:
>>>>> >>>   input.value = 'Foo';
>>>>> >>> else:
>>>>> >>>   raise exception ....
>>>>> >>
>>>>> >> I'll check if this can be done. Will get back.
>>>>> >>>
>>>>> >>>
>>>>> >>> --
>>>>> >>> Dave Page
>>>>> >>> Blog: http://pgsnake.blogspot.com
>>>>> >>> Twitter: @pgsnake
>>>>> >>>
>>>>> >>> EnterpriseDB UK: http://www.enterprisedb.com
>>>>> >>> The Enterprise PostgreSQL Company
>>>>> >>
>>>>> >>
>>>>> >>
>>>>> >> --
>>>>> >> Thanks and Regards,
>>>>> >> Aditya Toshniwal
>>>>> >> Software Engineer | EnterpriseDB Software Solutions | Pune
>>>>> >> "Don't Complain about Heat, Plant a tree"
>>>>> >
>>>>> >
>>>>> >
>>>>> > --
>>>>> > Thanks and Regards,
>>>>> > Aditya Toshniwal
>>>>> > Software Engineer | EnterpriseDB Software Solutions | Pune
>>>>> > "Don't Complain about Heat, Plant a tree"
>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> 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-9517Mobile: +91 976-788-8246*
>>>
>>
>>
>> --
>> Thanks and Regards,
>> Aditya Toshniwal
>> Software Engineer | EnterpriseDB Software Solutions | Pune
>> "Don't Complain about Heat, Plant a tree"
>>
>
>
> --
> *Akshay Joshi*
>
> *Sr. Software Architect *
>
>
>
> *Phone: +91 20-3058-9517Mobile: +91 976-788-8246*
>


^ permalink  raw  reply  [nested|flat] 15+ messages in thread

* Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases
  2019-01-28 06:59 [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Aditya Toshniwal <[email protected]>
  2019-01-28 11:31 ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Dave Page <[email protected]>
  2019-01-28 12:05   ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Aditya Toshniwal <[email protected]>
  2019-01-28 12:08     ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Dave Page <[email protected]>
  2019-01-28 12:14       ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Aditya Toshniwal <[email protected]>
  2019-01-29 13:36         ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Aditya Toshniwal <[email protected]>
  2019-01-29 13:39           ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Dave Page <[email protected]>
  2019-01-29 14:08             ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Akshay Joshi <[email protected]>
  2019-01-30 13:44               ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Akshay Joshi <[email protected]>
  2019-02-04 08:48                 ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Aditya Toshniwal <[email protected]>
  2019-02-05 05:10                   ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Akshay Joshi <[email protected]>
  2019-02-05 05:18                     ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Khushboo Vashi <[email protected]>
@ 2019-02-05 11:57                       ` Aditya Toshniwal <[email protected]>
  2019-02-06 05:40                         ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Akshay Joshi <[email protected]>
  0 siblings, 1 reply; 15+ messages in thread

From: Aditya Toshniwal @ 2019-02-05 11:57 UTC (permalink / raw)
  To: Khushboo Vashi <[email protected]>; +Cc: Akshay Joshi <[email protected]>; pgadmin-hackers

Hi Hackers,

Attached is the updated patch to fix possible causes of failure.
Kindly review (fingers crossed)


On Tue, Feb 5, 2019 at 10:48 AM Khushboo Vashi <
[email protected]> wrote:

>
>
> On Tue, Feb 5, 2019 at 10:40 AM Akshay Joshi <
> [email protected]> wrote:
>
>> Hi Aditya
>>
>> On Mon, Feb 4, 2019 at 2:18 PM Aditya Toshniwal <
>> [email protected]> wrote:
>>
>>> Hi Akshay,
>>>
>>> I tried to simulate, but no luck. It works on my system :(
>>>
>>
>>    I have tried and Feature test are failing randomly for each run. I
>> have verified it on OSX and Ubuntu both.
>>
>>>
>>> +1
>
>> On Wed, Jan 30, 2019 at 7:15 PM Akshay Joshi <
>>> [email protected]> wrote:
>>>
>>>> Hi Aditya
>>>>
>>>> I have applied your patch but following test cases are failing
>>>> consistently:
>>>>
>>>>    - CopySelectedQueryResultsFeatureTest
>>>>    - QueryToolAutoCompleteFeatureTest
>>>>
>>>> I have verified your patch on Mac OSX and Ubuntu. Chrome Version
>>>> 71.0.3578.98
>>>>
>>>> On Tue, Jan 29, 2019 at 7:38 PM Akshay Joshi <
>>>> [email protected]> wrote:
>>>>
>>>>>
>>>>>
>>>>> On Tue, 29 Jan 2019, 19:09 Dave Page <[email protected] wrote:
>>>>>
>>>>>> Akshay, can you look at this please?
>>>>>>
>>>>>
>>>>>     Sure.
>>>>>
>>>>>>
>>>>>> On Tue, Jan 29, 2019 at 1:36 PM Aditya Toshniwal
>>>>>> <[email protected]> wrote:
>>>>>> >
>>>>>> > Hi Hackers,
>>>>>> >
>>>>>> > Attached is the updated patch. I have changed
>>>>>> fill_input_by_field_name function to use javascript to set values of text
>>>>>> boxes and the selector is changed from xpath to CSS with a :not(:disabled)
>>>>>> clause. With this, test case will fail if tried to set the value of a
>>>>>> disabled input.
>>>>>> >
>>>>>> > Kindly review.
>>>>>> >
>>>>>> >
>>>>>> > On Mon, Jan 28, 2019 at 5:44 PM Aditya Toshniwal <
>>>>>> [email protected]> wrote:
>>>>>> >>
>>>>>> >>
>>>>>> >>
>>>>>> >> On Mon, Jan 28, 2019 at 5:39 PM Dave Page <[email protected]>
>>>>>> wrote:
>>>>>> >>>
>>>>>> >>> On Mon, Jan 28, 2019 at 12:05 PM Aditya Toshniwal
>>>>>> >>> <[email protected]> wrote:
>>>>>> >>> >
>>>>>> >>> > Hi Dave,
>>>>>> >>> >
>>>>>> >>> > On Mon, Jan 28, 2019 at 5:01 PM Dave Page <[email protected]>
>>>>>> wrote:
>>>>>> >>> >>
>>>>>> >>> >> Hi
>>>>>> >>> >>
>>>>>> >>> >> On Mon, Jan 28, 2019 at 7:00 AM Aditya Toshniwal
>>>>>> >>> >> <[email protected]> wrote:
>>>>>> >>> >> >
>>>>>> >>> >> > Hi Hackers,
>>>>>> >>> >> >
>>>>>> >>> >> > Attached is the patch to fix failing SQL editor related
>>>>>> feature tests.
>>>>>> >>> >> > The failure is occurring mostly because of send_keys
>>>>>> function of selenium which sometimes does not input the complete text. The
>>>>>> change will use Codemirror javascript object to set the text.
>>>>>> >>> >> >
>>>>>> >>> >> > I have also added new args flag "--modules" which can be
>>>>>> used after --pkg where you can test a specific module file under the pkg.
>>>>>> This is not so useful for build but definitely helpful for the developers.
>>>>>> >>> >>
>>>>>> >>> >> One of the most common failures I see is failure to fill in the
>>>>>> >>> >> details on the Add Server dialogue (it might type half of an
>>>>>> entry,
>>>>>> >>> >> then just hang). Should we get rid of all uses of send_keys?
>>>>>> >>> >
>>>>>> >>> > Setting the text using javascript executor can be done.
>>>>>> send_keys simulate an actual person,  so if you try to set a disabled text
>>>>>> box using send_keys, it won't. Places where disabled fields doesn't matter,
>>>>>> send_keys can be removed.
>>>>>> >>>
>>>>>> >>> Can't we just do something like:
>>>>>> >>>
>>>>>> >>> if input.disabled == false:
>>>>>> >>>   input.value = 'Foo';
>>>>>> >>> else:
>>>>>> >>>   raise exception ....
>>>>>> >>
>>>>>> >> I'll check if this can be done. Will get back.
>>>>>> >>>
>>>>>> >>>
>>>>>> >>> --
>>>>>> >>> Dave Page
>>>>>> >>> Blog: http://pgsnake.blogspot.com
>>>>>> >>> Twitter: @pgsnake
>>>>>> >>>
>>>>>> >>> EnterpriseDB UK: http://www.enterprisedb.com
>>>>>> >>> The Enterprise PostgreSQL Company
>>>>>> >>
>>>>>> >>
>>>>>> >>
>>>>>> >> --
>>>>>> >> Thanks and Regards,
>>>>>> >> Aditya Toshniwal
>>>>>> >> Software Engineer | EnterpriseDB Software Solutions | Pune
>>>>>> >> "Don't Complain about Heat, Plant a tree"
>>>>>> >
>>>>>> >
>>>>>> >
>>>>>> > --
>>>>>> > Thanks and Regards,
>>>>>> > Aditya Toshniwal
>>>>>> > Software Engineer | EnterpriseDB Software Solutions | Pune
>>>>>> > "Don't Complain about Heat, Plant a tree"
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> 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-9517Mobile: +91 976-788-8246*
>>>>
>>>
>>>
>>> --
>>> Thanks and Regards,
>>> Aditya Toshniwal
>>> Software Engineer | EnterpriseDB Software Solutions | Pune
>>> "Don't Complain about Heat, Plant a tree"
>>>
>>
>>
>> --
>> *Akshay Joshi*
>>
>> *Sr. Software Architect *
>>
>>
>>
>> *Phone: +91 20-3058-9517Mobile: +91 976-788-8246*
>>
>

-- 
Thanks and Regards,
Aditya Toshniwal
Software Engineer | EnterpriseDB Software Solutions | Pune
"Don't Complain about Heat, Plant a tree"


Attachments:

  [application/octet-stream] RM3936_v3.patch (13.2K, 3-RM3936_v3.patch)
  download | inline diff:
diff --git a/web/pgadmin/feature_tests/pg_utilities_backup_restore_test.py b/web/pgadmin/feature_tests/pg_utilities_backup_restore_test.py
index 1c89393d..4e11f994 100644
--- a/web/pgadmin/feature_tests/pg_utilities_backup_restore_test.py
+++ b/web/pgadmin/feature_tests/pg_utilities_backup_restore_test.py
@@ -83,6 +83,7 @@ class PGUtilitiesBackupFeatureTest(BaseFeatureTest):
         self.page.find_by_css_selector(
             ".pg-bg-more-details").click()
 
+        backup_file = None
         # Check for XSS in Backup details
         if self.is_xss_check:
             self._check_detailed_window_for_xss('Backup')
@@ -99,7 +100,6 @@ class PGUtilitiesBackupFeatureTest(BaseFeatureTest):
 
             self.assertIn("pg_dump", str(command))
 
-            backup_file = None
             if command:
                 backup_file = command[int(command.find('--file')) +
                                       8:int(command.find('--host')) - 2]
diff --git a/web/pgadmin/feature_tests/view_data_dml_queries.py b/web/pgadmin/feature_tests/view_data_dml_queries.py
index 1be9dcfa..36d224a8 100644
--- a/web/pgadmin/feature_tests/view_data_dml_queries.py
+++ b/web/pgadmin/feature_tests/view_data_dml_queries.py
@@ -309,6 +309,7 @@ CREATE TABLE public.defaults_{0}
 
             if (idx != 1 and not is_new_row) or is_new_row:
                 self.assertEquals(element.text, config_data[str(idx)][1])
+                self.assertEquals(element.text, config_data[str(idx)][1])
 
         # scroll browser back to the left
         # to reset position so other assertions can succeed
diff --git a/web/pgadmin/feature_tests/xss_checks_panels_and_query_tool_test.py b/web/pgadmin/feature_tests/xss_checks_panels_and_query_tool_test.py
index 27ac8c2c..365d109b 100644
--- a/web/pgadmin/feature_tests/xss_checks_panels_and_query_tool_test.py
+++ b/web/pgadmin/feature_tests/xss_checks_panels_and_query_tool_test.py
@@ -55,10 +55,12 @@ class CheckForXssFeatureTest(BaseFeatureTest):
         self._check_xss_in_dependents_tab()
 
         # Query tool
+        self.page.open_query_tool()
         self._check_xss_in_query_tool()
         self.page.close_query_tool()
 
         # Explain module
+        self.page.open_query_tool()
         self._check_xss_in_explain_module()
         self.page.close_query_tool()
 
@@ -142,17 +144,11 @@ class CheckForXssFeatureTest(BaseFeatureTest):
             "Dependents tab (BackGrid)"
         )
 
-    def _open_query_tool(self):
-        self.page.driver.find_element_by_link_text("Tools").click()
-        self.page.find_by_partial_link_text("Query Tool").click()
-        self.page.click_tab('Query -')
-
     def _check_xss_in_query_tool(self):
         print(
             "\n\tChecking the SlickGrid cell for the XSS",
             file=sys.stderr, end=""
         )
-        self._open_query_tool()
         self.page.fill_codemirror_area_with(
             "select '<img src=\"x\" onerror=\"console.log(1)\">'"
         )
@@ -179,14 +175,10 @@ class CheckForXssFeatureTest(BaseFeatureTest):
             "\n\tChecking the Graphical Explain plan for the XSS ...",
             file=sys.stderr, end=""
         )
-        self._open_query_tool()
         self.page.fill_codemirror_area_with(
             'select * from "{0}"'.format(self.test_table_name)
         )
 
-        query_op = self.page.find_by_id("btn-query-dropdown")
-        query_op.click()
-
         self.page.find_by_id("btn-explain").click()
         self.page.wait_for_query_tool_loading_indicator_to_disappear()
         self.page.click_tab('Explain')
diff --git a/web/pgadmin/tools/datagrid/static/js/datagrid.js b/web/pgadmin/tools/datagrid/static/js/datagrid.js
index df16d0bb..259d2a2a 100644
--- a/web/pgadmin/tools/datagrid/static/js/datagrid.js
+++ b/web/pgadmin/tools/datagrid/static/js/datagrid.js
@@ -54,14 +54,7 @@ define('pgadmin.datagrid', [
           self.preferences = pgBrowser.get_preferences_for_module('sqleditor');
         });
 
-        this.spinner_el =
-          `<div class="pg-sp-container">
-              <div class="pg-sp-content">
-                  <div class="row">
-                      <div class="col-12 pg-sp-icon"></div>
-                  </div>
-              </div>
-          </div>`;
+
         // Define list of nodes on which view data option appears
         var supported_nodes = [
             'table', 'view', 'mview',
@@ -514,17 +507,26 @@ define('pgadmin.datagrid', [
 
           var openQueryToolURL = function(j) {
             // add spinner element
-            $(j).data('embeddedFrame').$container.append(pgAdmin.DataGrid.spinner_el);
-            setTimeout(function() {
+            let $spinner_el =
+              $(`<div class="pg-sp-container">
+                    <div class="pg-sp-content">
+                        <div class="row">
+                            <div class="col-12 pg-sp-icon"></div>
+                        </div>
+                    </div>
+                </div>`).appendTo($(j).data('embeddedFrame').$container);
+
+            let init_poller_id = setInterval(function() {
               var frameInitialized = $(j).data('frameInitialized');
               if (frameInitialized) {
+                clearInterval(init_poller_id);
                 var frame = $(j).data('embeddedFrame');
                 if (frame) {
+                  frame.onLoaded(()=>{
+                    $spinner_el.remove();
+                  });
                   frame.openURL(baseUrl);
-                  frame.$container.find('.pg-sp-container').delay(1000).hide(1);
                 }
-              } else {
-                openQueryToolURL(j);
               }
             }, 100);
           };
diff --git a/web/pgadmin/utils/route.py b/web/pgadmin/utils/route.py
index e67f0195..b206cb2e 100644
--- a/web/pgadmin/utils/route.py
+++ b/web/pgadmin/utils/route.py
@@ -53,7 +53,7 @@ class TestsGeneratorRegistry(ABCMeta):
         ABCMeta.__init__(cls, name, bases, d)
 
     @classmethod
-    def load_generators(cls, pkg_root, exclude_pkgs):
+    def load_generators(cls, pkg_root, exclude_pkgs, for_modules=[]):
 
         cls.registry = dict()
 
@@ -61,6 +61,13 @@ class TestsGeneratorRegistry(ABCMeta):
 
         all_modules += find_modules(pkg_root, False, True)
 
+        # If specific modules are to be tested, exclude others
+        if len(for_modules) > 0:
+            all_modules = [module_name
+                           for module_name in all_modules
+                           for fmod in for_modules
+                           if module_name.endswith(fmod)]
+
         # Check for SERVER mode
         for module_name in all_modules:
             try:
diff --git a/web/regression/README b/web/regression/README
index 7e668cfd..6a68d36f 100644
--- a/web/regression/README
+++ b/web/regression/README
@@ -167,6 +167,14 @@ Python Tests:
      Example 2) Run test framework for 'database' node
      run 'python runtests.py --pkg browser.server_groups.servers.databases.tests'
 
+- Execute test framework for certain modules of a test pkg
+
+     Example 1) Run test framework for 'sqleditor' package and test_start_running_query module
+     run 'python runtests.py --pkg tools.sqleditor --modules test_start_running_query'
+
+     Example 2) Run test framework for 'sqleditor' package and test_start_running_query,test_query_tool_fs_utils modules
+     run 'python runtests.py --pkg tools.sqleditor --modules test_start_running_query,test_query_tool_fs_utils'
+
 - Exclude a package and its subpackages when running tests:
 
     Example: exclude feature tests but run all others:
diff --git a/web/regression/feature_utils/pgadmin_page.py b/web/regression/feature_utils/pgadmin_page.py
index 0c8f0fa3..1fb525ee 100644
--- a/web/regression/feature_utils/pgadmin_page.py
+++ b/web/regression/feature_utils/pgadmin_page.py
@@ -94,6 +94,7 @@ class PgadminPage:
 
         self.find_by_partial_link_text("Query Tool").click()
         self.click_tab('Query -')
+        self.find_by_css_selector('iframe')
 
     def enable_menu_item(self, menu_item, wait_time):
         start_time = time.time()
@@ -224,38 +225,60 @@ class PgadminPage:
             "clicking the element not to throw an exception", click_succeeded
         )
 
-    def fill_input_by_field_name(self, field_name, field_content):
-        field = self.find_by_xpath("//input[@name='" + field_name + "']")
+    def fill_input_by_field_name(self, field_name, field_content,
+                                 input_keys=False):
+        field = self.find_by_css_selector(
+            "input[name='" + field_name + "']:not(:disabled)")
         backspaces = [Keys.BACKSPACE] * len(field.get_attribute('value'))
 
         field.click()
-        field.send_keys(backspaces)
-        field.send_keys(str(field_content))
-        self.wait_for_input_field_content(field_name, field_content)
 
-    def fill_codemirror_area_with(self, field_content):
+        # Use send keys if input_keys true, else use javascript to set content
+        if input_keys:
+            field.send_keys(backspaces)
+            field.send_keys(str(field_content))
+            self.wait_for_input_field_content(field_name, field_content)
+        else:
+            self.driver.execute_script(
+                "arguments[0].setAttribute('value', arguments[1])",
+                field, field_content)
+
+            action = ActionChains(self.driver)
+            action.key_down(Keys.ARROW_DOWN)
+            action.perform()
+
+    def fill_codemirror_area_with(self, field_content, input_keys=False):
         def find_codemirror(driver):
             try:
                 driver.switch_to.default_content()
                 driver.switch_to_frame(
                     driver.find_element_by_tag_name("iframe"))
-                element = driver.find_element_by_xpath(
-                    "//pre[contains(@class,'CodeMirror-line')]/../../../"
-                    "*[contains(@class,'CodeMirror-code')]")
+                element = driver.find_element_by_css_selector(
+                    "#output-panel .CodeMirror")
                 if element.is_displayed() and element.is_enabled():
                     return element
             except (NoSuchElementException, WebDriverException):
                 return False
 
+        codemirror_ele = WebDriverWait(
+            self.driver, timeout=self.timeout, poll_frequency=0.01)\
+            .until(find_codemirror,
+                   "Timed out waiting for codemirror to appear")
+
         time.sleep(1)
-        WebDriverWait(self.driver, timeout=self.timeout, poll_frequency=0.01).\
-            until(find_codemirror, "Timed out waiting for codemirror "
-                                   "to appear").click()
-        time.sleep(1)
+        codemirror_ele.click()
 
-        action = ActionChains(self.driver)
-        action.send_keys(field_content)
-        action.perform()
+        # Use send keys if input_keys true, else use javascript to set content
+        if input_keys:
+            action = ActionChains(self.driver)
+            action.send_keys(field_content)
+            action.perform()
+        else:
+            self.driver.execute_script(
+                "arguments[0].CodeMirror.setValue(arguments[1]);"
+                "arguments[0].CodeMirror.setCursor("
+                "arguments[0].CodeMirror.lineCount(),0);",
+                codemirror_ele, field_content)
 
     def click_tab(self, tab_name):
         WebDriverWait(self.driver, 10).until(EC.element_to_be_clickable(
@@ -329,10 +352,10 @@ class PgadminPage:
     def wait_for_query_tool_loading_indicator_to_disappear(self):
         def spinner_has_disappeared(driver):
             try:
-                driver.find_element_by_xpath(
-                    "//*[@id='fetching_data' and @class='hide']"
+                spinner = driver.find_element_by_css_selector(
+                    "#editor-panel .pg-sp-container"
                 )
-                return False
+                return "d-none" in spinner.get_attribute("class")
             except NoSuchElementException:
                 # wait for loading indicator disappear animation to complete.
                 time.sleep(0.5)
diff --git a/web/regression/runtests.py b/web/regression/runtests.py
index 48d3749f..6f95370f 100644
--- a/web/regression/runtests.py
+++ b/web/regression/runtests.py
@@ -230,9 +230,14 @@ def get_test_modules(arguments):
     if arguments['pkg'] is None or arguments['pkg'] == "all":
         TestsGeneratorRegistry.load_generators('pgadmin', exclude_pkgs)
     else:
+        for_modules = []
+        if arguments['modules'] is not None:
+            for_modules = arguments['modules'].split(',')
+
         TestsGeneratorRegistry.load_generators('pgadmin.%s' %
                                                arguments['pkg'],
-                                               exclude_pkgs)
+                                               exclude_pkgs,
+                                               for_modules)
 
     # Sort module list so that test suite executes the test cases sequentially
     module_list = TestsGeneratorRegistry.registry.items()
@@ -263,6 +268,10 @@ def add_arguments():
         '--default_browser',
         help='Executes the feature test in specific browser'
     )
+    parser.add_argument(
+        '--modules',
+        help='Executes the feature test for specific modules in pkg'
+    )
     arg = parser.parse_args()
 
     return arg


^ permalink  raw  reply  [nested|flat] 15+ messages in thread

* Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases
  2019-01-28 06:59 [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Aditya Toshniwal <[email protected]>
  2019-01-28 11:31 ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Dave Page <[email protected]>
  2019-01-28 12:05   ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Aditya Toshniwal <[email protected]>
  2019-01-28 12:08     ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Dave Page <[email protected]>
  2019-01-28 12:14       ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Aditya Toshniwal <[email protected]>
  2019-01-29 13:36         ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Aditya Toshniwal <[email protected]>
  2019-01-29 13:39           ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Dave Page <[email protected]>
  2019-01-29 14:08             ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Akshay Joshi <[email protected]>
  2019-01-30 13:44               ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Akshay Joshi <[email protected]>
  2019-02-04 08:48                 ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Aditya Toshniwal <[email protected]>
  2019-02-05 05:10                   ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Akshay Joshi <[email protected]>
  2019-02-05 05:18                     ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Khushboo Vashi <[email protected]>
  2019-02-05 11:57                       ` Re: [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Aditya Toshniwal <[email protected]>
@ 2019-02-06 05:40                         ` Akshay Joshi <[email protected]>
  0 siblings, 0 replies; 15+ messages in thread

From: Akshay Joshi @ 2019-02-06 05:40 UTC (permalink / raw)
  To: Aditya Toshniwal <[email protected]>; +Cc: Khushboo Vashi <[email protected]>; pgadmin-hackers

Hi Aditya

Some improvement, 1 test case is still failing but not consistent. I have
run the test cases 3 times out of which one time all runs successfully.

On Tue, Feb 5, 2019 at 5:28 PM Aditya Toshniwal <
[email protected]> wrote:

> Hi Hackers,
>
> Attached is the updated patch to fix possible causes of failure.
> Kindly review (fingers crossed)
>
>
> On Tue, Feb 5, 2019 at 10:48 AM Khushboo Vashi <
> [email protected]> wrote:
>
>>
>>
>> On Tue, Feb 5, 2019 at 10:40 AM Akshay Joshi <
>> [email protected]> wrote:
>>
>>> Hi Aditya
>>>
>>> On Mon, Feb 4, 2019 at 2:18 PM Aditya Toshniwal <
>>> [email protected]> wrote:
>>>
>>>> Hi Akshay,
>>>>
>>>> I tried to simulate, but no luck. It works on my system :(
>>>>
>>>
>>>    I have tried and Feature test are failing randomly for each run. I
>>> have verified it on OSX and Ubuntu both.
>>>
>>>>
>>>> +1
>>
>>> On Wed, Jan 30, 2019 at 7:15 PM Akshay Joshi <
>>>> [email protected]> wrote:
>>>>
>>>>> Hi Aditya
>>>>>
>>>>> I have applied your patch but following test cases are failing
>>>>> consistently:
>>>>>
>>>>>    - CopySelectedQueryResultsFeatureTest
>>>>>    - QueryToolAutoCompleteFeatureTest
>>>>>
>>>>> I have verified your patch on Mac OSX and Ubuntu. Chrome Version
>>>>> 71.0.3578.98
>>>>>
>>>>> On Tue, Jan 29, 2019 at 7:38 PM Akshay Joshi <
>>>>> [email protected]> wrote:
>>>>>
>>>>>>
>>>>>>
>>>>>> On Tue, 29 Jan 2019, 19:09 Dave Page <[email protected] wrote:
>>>>>>
>>>>>>> Akshay, can you look at this please?
>>>>>>>
>>>>>>
>>>>>>     Sure.
>>>>>>
>>>>>>>
>>>>>>> On Tue, Jan 29, 2019 at 1:36 PM Aditya Toshniwal
>>>>>>> <[email protected]> wrote:
>>>>>>> >
>>>>>>> > Hi Hackers,
>>>>>>> >
>>>>>>> > Attached is the updated patch. I have changed
>>>>>>> fill_input_by_field_name function to use javascript to set values of text
>>>>>>> boxes and the selector is changed from xpath to CSS with a :not(:disabled)
>>>>>>> clause. With this, test case will fail if tried to set the value of a
>>>>>>> disabled input.
>>>>>>> >
>>>>>>> > Kindly review.
>>>>>>> >
>>>>>>> >
>>>>>>> > On Mon, Jan 28, 2019 at 5:44 PM Aditya Toshniwal <
>>>>>>> [email protected]> wrote:
>>>>>>> >>
>>>>>>> >>
>>>>>>> >>
>>>>>>> >> On Mon, Jan 28, 2019 at 5:39 PM Dave Page <[email protected]>
>>>>>>> wrote:
>>>>>>> >>>
>>>>>>> >>> On Mon, Jan 28, 2019 at 12:05 PM Aditya Toshniwal
>>>>>>> >>> <[email protected]> wrote:
>>>>>>> >>> >
>>>>>>> >>> > Hi Dave,
>>>>>>> >>> >
>>>>>>> >>> > On Mon, Jan 28, 2019 at 5:01 PM Dave Page <[email protected]>
>>>>>>> wrote:
>>>>>>> >>> >>
>>>>>>> >>> >> Hi
>>>>>>> >>> >>
>>>>>>> >>> >> On Mon, Jan 28, 2019 at 7:00 AM Aditya Toshniwal
>>>>>>> >>> >> <[email protected]> wrote:
>>>>>>> >>> >> >
>>>>>>> >>> >> > Hi Hackers,
>>>>>>> >>> >> >
>>>>>>> >>> >> > Attached is the patch to fix failing SQL editor related
>>>>>>> feature tests.
>>>>>>> >>> >> > The failure is occurring mostly because of send_keys
>>>>>>> function of selenium which sometimes does not input the complete text. The
>>>>>>> change will use Codemirror javascript object to set the text.
>>>>>>> >>> >> >
>>>>>>> >>> >> > I have also added new args flag "--modules" which can be
>>>>>>> used after --pkg where you can test a specific module file under the pkg.
>>>>>>> This is not so useful for build but definitely helpful for the developers.
>>>>>>> >>> >>
>>>>>>> >>> >> One of the most common failures I see is failure to fill in
>>>>>>> the
>>>>>>> >>> >> details on the Add Server dialogue (it might type half of an
>>>>>>> entry,
>>>>>>> >>> >> then just hang). Should we get rid of all uses of send_keys?
>>>>>>> >>> >
>>>>>>> >>> > Setting the text using javascript executor can be done.
>>>>>>> send_keys simulate an actual person,  so if you try to set a disabled text
>>>>>>> box using send_keys, it won't. Places where disabled fields doesn't matter,
>>>>>>> send_keys can be removed.
>>>>>>> >>>
>>>>>>> >>> Can't we just do something like:
>>>>>>> >>>
>>>>>>> >>> if input.disabled == false:
>>>>>>> >>>   input.value = 'Foo';
>>>>>>> >>> else:
>>>>>>> >>>   raise exception ....
>>>>>>> >>
>>>>>>> >> I'll check if this can be done. Will get back.
>>>>>>> >>>
>>>>>>> >>>
>>>>>>> >>> --
>>>>>>> >>> Dave Page
>>>>>>> >>> Blog: http://pgsnake.blogspot.com
>>>>>>> >>> Twitter: @pgsnake
>>>>>>> >>>
>>>>>>> >>> EnterpriseDB UK: http://www.enterprisedb.com
>>>>>>> >>> The Enterprise PostgreSQL Company
>>>>>>> >>
>>>>>>> >>
>>>>>>> >>
>>>>>>> >> --
>>>>>>> >> Thanks and Regards,
>>>>>>> >> Aditya Toshniwal
>>>>>>> >> Software Engineer | EnterpriseDB Software Solutions | Pune
>>>>>>> >> "Don't Complain about Heat, Plant a tree"
>>>>>>> >
>>>>>>> >
>>>>>>> >
>>>>>>> > --
>>>>>>> > Thanks and Regards,
>>>>>>> > Aditya Toshniwal
>>>>>>> > Software Engineer | EnterpriseDB Software Solutions | Pune
>>>>>>> > "Don't Complain about Heat, Plant a tree"
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> 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-9517Mobile: +91 976-788-8246*
>>>>>
>>>>
>>>>
>>>> --
>>>> Thanks and Regards,
>>>> Aditya Toshniwal
>>>> Software Engineer | EnterpriseDB Software Solutions | Pune
>>>> "Don't Complain about Heat, Plant a tree"
>>>>
>>>
>>>
>>> --
>>> *Akshay Joshi*
>>>
>>> *Sr. Software Architect *
>>>
>>>
>>>
>>> *Phone: +91 20-3058-9517Mobile: +91 976-788-8246*
>>>
>>
>
> --
> Thanks and Regards,
> Aditya Toshniwal
> Software Engineer | EnterpriseDB Software Solutions | Pune
> "Don't Complain about Heat, Plant a tree"
>


-- 
*Akshay Joshi*

*Sr. Software Architect *



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


^ permalink  raw  reply  [nested|flat] 15+ messages in thread


end of thread, other threads:[~2019-02-06 05:40 UTC | newest]

Thread overview: 15+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2019-01-28 06:59 [pgAdmin4][RM3936] Feature tests failing intermittently for SQL editor related test cases Aditya Toshniwal <[email protected]>
2019-01-28 11:31 ` Dave Page <[email protected]>
2019-01-28 12:05   ` Aditya Toshniwal <[email protected]>
2019-01-28 12:08     ` Dave Page <[email protected]>
2019-01-28 12:14       ` Aditya Toshniwal <[email protected]>
2019-01-29 13:36         ` Aditya Toshniwal <[email protected]>
2019-01-29 13:39           ` Dave Page <[email protected]>
2019-01-29 14:08             ` Akshay Joshi <[email protected]>
2019-01-30 13:44               ` Akshay Joshi <[email protected]>
2019-02-04 08:48                 ` Aditya Toshniwal <[email protected]>
2019-02-05 05:10                   ` Akshay Joshi <[email protected]>
2019-02-05 05:12                     ` Aditya Toshniwal <[email protected]>
2019-02-05 05:18                     ` Khushboo Vashi <[email protected]>
2019-02-05 11:57                       ` Aditya Toshniwal <[email protected]>
2019-02-06 05:40                         ` Akshay Joshi <[email protected]>

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox