public inbox for [email protected]
help / color / mirror / Atom feedpgadmin_page functions updated
6+ messages / 3 participants
[nested] [flat]
* pgadmin_page functions updated
@ 2018-06-14 09:55 Shubham Agarwal <[email protected]>
2018-06-15 05:32 ` Re: pgadmin_page functions updated Khushboo Vashi <[email protected]>
0 siblings, 1 reply; 6+ messages in thread
From: Shubham Agarwal @ 2018-06-14 09:55 UTC (permalink / raw)
To: pgadmin-hackers
Hi Team,
I have modified following two functions in pgadmin_page.py :-
1. click_tab() -> Added wait till element is clickable, test cases are
failing since the function attempts to click the tab which is not yet in
the state to be clicked.
2. add_server() -> Replaced the sleep statement with wait till element to
be clickable.
Please find the attached patch.
--
Thanks & Regards,
Shubham Agarwal
EnterpriseDB Corporation
The Postgres Database Company
Attachments:
[application/octet-stream] pgadmin_page.patch (1.4K, 3-pgadmin_page.patch)
download | inline diff:
diff --git a/web/regression/feature_utils/pgadmin_page.py b/web/regression/feature_utils/pgadmin_page.py
index 78578a2..80f0ca7 100644
--- a/web/regression/feature_utils/pgadmin_page.py
+++ b/web/regression/feature_utils/pgadmin_page.py
@@ -60,8 +60,8 @@ class PgadminPage:
self.fill_input_by_field_name("port", server_config['port'])
self.fill_input_by_field_name("username", server_config['username'])
self.fill_input_by_field_name("password", server_config['db_password'])
- # Required sleep to avoid "fe_sendauth" password error.
- time.sleep(0.5)
+ WebDriverWait(self.driver, 10).until(EC.element_to_be_clickable(
+ (By.XPATH, "//button[contains(.,'Save')]")))
self.find_by_xpath("//button[contains(.,'Save')]").click()
self.find_by_xpath(
@@ -245,6 +245,11 @@ class PgadminPage:
action.perform()
def click_tab(self, tab_name):
+ WebDriverWait(self.driver, 10).until(EC.element_to_be_clickable(
+ (By.XPATH, "//*[contains(@class,'wcTabTop')]//"
+ "*[contains(@class,'wcPanelTab') "
+ "and contains(.,'" + tab_name + "')]")))
+
tab = self.find_by_xpath("//*[contains(@class,'wcTabTop')]//"
"*[contains(@class,'wcPanelTab') "
"and contains(.,'" + tab_name + "')]")
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: pgadmin_page functions updated
2018-06-14 09:55 pgadmin_page functions updated Shubham Agarwal <[email protected]>
@ 2018-06-15 05:32 ` Khushboo Vashi <[email protected]>
2018-06-15 06:03 ` Re: pgadmin_page functions updated Shubham Agarwal <[email protected]>
2018-06-15 08:11 ` Re: pgadmin_page functions updated Dave Page <[email protected]>
0 siblings, 2 replies; 6+ messages in thread
From: Khushboo Vashi @ 2018-06-15 05:32 UTC (permalink / raw)
To: Shubham Agarwal <[email protected]>; +Cc: pgadmin-hackers
Hi Shubham,
On Thu, Jun 14, 2018 at 3:25 PM, Shubham Agarwal <
[email protected]> wrote:
> Hi Team,
>
> I have modified following two functions in pgadmin_page.py :-
>
> 1. click_tab() -> Added wait till element is clickable, test cases are
> failing since the function attempts to click the tab which is not yet in
> the state to be clicked.
>
> 2. add_server() -> Replaced the sleep statement with wait till element to
> be clickable.
>
> Please find the attached patch.
>
> We should start using CSS selectors instead of xpath, otherwise the patch
works fine and also changes look good to me.
> --
> Thanks & Regards,
> Shubham Agarwal
> EnterpriseDB Corporation
>
> The Postgres Database Company
>
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: pgadmin_page functions updated
2018-06-14 09:55 pgadmin_page functions updated Shubham Agarwal <[email protected]>
2018-06-15 05:32 ` Re: pgadmin_page functions updated Khushboo Vashi <[email protected]>
@ 2018-06-15 06:03 ` Shubham Agarwal <[email protected]>
1 sibling, 0 replies; 6+ messages in thread
From: Shubham Agarwal @ 2018-06-15 06:03 UTC (permalink / raw)
To: Khushboo Vashi <[email protected]>; +Cc: pgadmin-hackers
Hi Khushboo,
Yes i agree, currently we are not changing the functions that are already
written but will use css selectors in all the upcoming new test cases.
Thanks and regards,
Shubham Agarwal
On Fri, Jun 15, 2018 at 11:02 AM, Khushboo Vashi <
[email protected]> wrote:
> Hi Shubham,
>
> On Thu, Jun 14, 2018 at 3:25 PM, Shubham Agarwal <
> [email protected]> wrote:
>
>> Hi Team,
>>
>> I have modified following two functions in pgadmin_page.py :-
>>
>> 1. click_tab() -> Added wait till element is clickable, test cases are
>> failing since the function attempts to click the tab which is not yet in
>> the state to be clicked.
>>
>> 2. add_server() -> Replaced the sleep statement with wait till element to
>> be clickable.
>>
>> Please find the attached patch.
>>
>> We should start using CSS selectors instead of xpath, otherwise the patch
> works fine and also changes look good to me.
>
>> --
>> Thanks & Regards,
>> Shubham Agarwal
>> EnterpriseDB Corporation
>>
>> The Postgres Database Company
>>
>
>
--
Thanks & Regards,
Shubham Agarwal
EnterpriseDB Corporation
The Postgres Database Company
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: pgadmin_page functions updated
2018-06-14 09:55 pgadmin_page functions updated Shubham Agarwal <[email protected]>
2018-06-15 05:32 ` Re: pgadmin_page functions updated Khushboo Vashi <[email protected]>
@ 2018-06-15 08:11 ` Dave Page <[email protected]>
2018-06-26 07:45 ` Re: pgadmin_page functions updated Shubham Agarwal <[email protected]>
1 sibling, 1 reply; 6+ messages in thread
From: Dave Page @ 2018-06-15 08:11 UTC (permalink / raw)
To: Khushboo Vashi <[email protected]>; +Cc: Shubham Agarwal <[email protected]>; pgadmin-hackers
On Fri, Jun 15, 2018 at 6:32 AM, Khushboo Vashi <
[email protected]> wrote:
> Hi Shubham,
>
> On Thu, Jun 14, 2018 at 3:25 PM, Shubham Agarwal <
> [email protected]> wrote:
>
>> Hi Team,
>>
>> I have modified following two functions in pgadmin_page.py :-
>>
>> 1. click_tab() -> Added wait till element is clickable, test cases are
>> failing since the function attempts to click the tab which is not yet in
>> the state to be clicked.
>>
>> 2. add_server() -> Replaced the sleep statement with wait till element to
>> be clickable.
>>
>> Please find the attached patch.
>>
>> We should start using CSS selectors instead of xpath, otherwise the patch
> works fine and also changes look good to me.
>
Yes, and we should update files as and when we touch them as part of our
ongoing refactoring.
Shubham; please go through the files your patch touches, and replace any
xpath selectors with CSS selectors. Aside from that, the patch looked to
me too, and Pivotal's patch-bot seems happy with it.
Thanks.
--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: pgadmin_page functions updated
2018-06-14 09:55 pgadmin_page functions updated Shubham Agarwal <[email protected]>
2018-06-15 05:32 ` Re: pgadmin_page functions updated Khushboo Vashi <[email protected]>
2018-06-15 08:11 ` Re: pgadmin_page functions updated Dave Page <[email protected]>
@ 2018-06-26 07:45 ` Shubham Agarwal <[email protected]>
2018-06-27 15:40 ` Re: pgadmin_page functions updated Dave Page <[email protected]>
0 siblings, 1 reply; 6+ messages in thread
From: Shubham Agarwal @ 2018-06-26 07:45 UTC (permalink / raw)
To: Dave Page <[email protected]>; +Cc: Khushboo Vashi <[email protected]>; pgadmin-hackers
Hi Team,
I have modified the patch and used CSS Selector in add_server() function.
I have also tried different approaches to eliminate XPATH in click_tab()
function but failed to do so due to following reasons-:
1. :contains() function doesnt work with CSS selector in selenium and
since in most of the anchor tags there is no specific attribute present by
which we can make the locator generic so that it can work for any tab.
2. Tried using link_text or partial_link_text locators but since
click_tab() is a generic function which can click on any of the provided
tab name and in our case we do not have every tab having href attribute, we
have span tag as the tab as well (ex. Query tool tab) so link_text is not
the right option for it since it work only with the href attribute or
anchor tag.
I found that in such cases XPATH is the only option to continue with.
If anybody is having some another idea to achieve this using CSS Selector
than please suggest.
Thanks and Regards,
Shubham Agarwal
On Fri, Jun 15, 2018 at 4:11 AM, Dave Page <[email protected]> wrote:
>
>
> On Fri, Jun 15, 2018 at 6:32 AM, Khushboo Vashi <
> [email protected]> wrote:
>
>> Hi Shubham,
>>
>> On Thu, Jun 14, 2018 at 3:25 PM, Shubham Agarwal <
>> [email protected]> wrote:
>>
>>> Hi Team,
>>>
>>> I have modified following two functions in pgadmin_page.py :-
>>>
>>> 1. click_tab() -> Added wait till element is clickable, test cases are
>>> failing since the function attempts to click the tab which is not yet in
>>> the state to be clicked.
>>>
>>> 2. add_server() -> Replaced the sleep statement with wait till element
>>> to be clickable.
>>>
>>> Please find the attached patch.
>>>
>>> We should start using CSS selectors instead of xpath, otherwise the
>> patch works fine and also changes look good to me.
>>
>
> Yes, and we should update files as and when we touch them as part of our
> ongoing refactoring.
>
> Shubham; please go through the files your patch touches, and replace any
> xpath selectors with CSS selectors. Aside from that, the patch looked to
> me too, and Pivotal's patch-bot seems happy with it.
>
> Thanks.
>
> --
> Dave Page
> Blog: http://pgsnake.blogspot.com
> Twitter: @pgsnake
>
> EnterpriseDB UK: http://www.enterprisedb.com
> The Enterprise PostgreSQL Company
>
--
Thanks & Regards,
Shubham Agarwal
EnterpriseDB Corporation
The Postgres Database Company
Attachments:
[text/x-patch] pgadmin_page.patch (1.5K, 3-pgadmin_page.patch)
download | inline diff:
diff --git a/web/regression/feature_utils/pgadmin_page.py b/web/regression/feature_utils/pgadmin_page.py
index 78578a2..ce9bfa3 100644
--- a/web/regression/feature_utils/pgadmin_page.py
+++ b/web/regression/feature_utils/pgadmin_page.py
@@ -60,9 +60,9 @@ class PgadminPage:
self.fill_input_by_field_name("port", server_config['port'])
self.fill_input_by_field_name("username", server_config['username'])
self.fill_input_by_field_name("password", server_config['db_password'])
- # Required sleep to avoid "fe_sendauth" password error.
- time.sleep(0.5)
- self.find_by_xpath("//button[contains(.,'Save')]").click()
+ WebDriverWait(self.driver, 10).until(EC.element_to_be_clickable(
+ (By.CSS_SELECTOR, "button[type='save'].btn.btn-primary")))
+ self.find_by_css_selector("button[type='save'].btn.btn-primary").click()
self.find_by_xpath(
"//*[@id='tree']//*[.='" + server_config['name'] + "']")
@@ -245,6 +245,11 @@ class PgadminPage:
action.perform()
def click_tab(self, tab_name):
+ WebDriverWait(self.driver, 10).until(EC.element_to_be_clickable(
+ (By.XPATH, "//*[contains(@class,'wcTabTop')]//"
+ "*[contains(@class,'wcPanelTab') "
+ "and contains(.,'" + tab_name + "')]")))
+
tab = self.find_by_xpath("//*[contains(@class,'wcTabTop')]//"
"*[contains(@class,'wcPanelTab') "
"and contains(.,'" + tab_name + "')]")
^ permalink raw reply [nested|flat] 6+ messages in thread
* Re: pgadmin_page functions updated
2018-06-14 09:55 pgadmin_page functions updated Shubham Agarwal <[email protected]>
2018-06-15 05:32 ` Re: pgadmin_page functions updated Khushboo Vashi <[email protected]>
2018-06-15 08:11 ` Re: pgadmin_page functions updated Dave Page <[email protected]>
2018-06-26 07:45 ` Re: pgadmin_page functions updated Shubham Agarwal <[email protected]>
@ 2018-06-27 15:40 ` Dave Page <[email protected]>
0 siblings, 0 replies; 6+ messages in thread
From: Dave Page @ 2018-06-27 15:40 UTC (permalink / raw)
To: Shubham Agarwal <[email protected]>; +Cc: Khushboo Vashi <[email protected]>; pgadmin-hackers
On Tue, Jun 26, 2018 at 8:45 AM, Shubham Agarwal <
[email protected]> wrote:
> Hi Team,
>
> I have modified the patch and used CSS Selector in add_server() function.
>
Thanks, applied.
>
> I have also tried different approaches to eliminate XPATH in click_tab()
> function but failed to do so due to following reasons-:
>
> 1. :contains() function doesnt work with CSS selector in selenium and
> since in most of the anchor tags there is no specific attribute present by
> which we can make the locator generic so that it can work for any tab.
>
> 2. Tried using link_text or partial_link_text locators but since
> click_tab() is a generic function which can click on any of the provided
> tab name and in our case we do not have every tab having href attribute, we
> have span tag as the tab as well (ex. Query tool tab) so link_text is not
> the right option for it since it work only with the href attribute or
> anchor tag.
>
> I found that in such cases XPATH is the only option to continue with.
>
> If anybody is having some another idea to achieve this using CSS Selector
> than please suggest.
>
> Thanks and Regards,
> Shubham Agarwal
>
> On Fri, Jun 15, 2018 at 4:11 AM, Dave Page <[email protected]> wrote:
>
>>
>>
>> On Fri, Jun 15, 2018 at 6:32 AM, Khushboo Vashi <
>> [email protected]> wrote:
>>
>>> Hi Shubham,
>>>
>>> On Thu, Jun 14, 2018 at 3:25 PM, Shubham Agarwal <
>>> [email protected]> wrote:
>>>
>>>> Hi Team,
>>>>
>>>> I have modified following two functions in pgadmin_page.py :-
>>>>
>>>> 1. click_tab() -> Added wait till element is clickable, test cases are
>>>> failing since the function attempts to click the tab which is not yet in
>>>> the state to be clicked.
>>>>
>>>> 2. add_server() -> Replaced the sleep statement with wait till element
>>>> to be clickable.
>>>>
>>>> Please find the attached patch.
>>>>
>>>> We should start using CSS selectors instead of xpath, otherwise the
>>> patch works fine and also changes look good to me.
>>>
>>
>> Yes, and we should update files as and when we touch them as part of our
>> ongoing refactoring.
>>
>> Shubham; please go through the files your patch touches, and replace any
>> xpath selectors with CSS selectors. Aside from that, the patch looked to
>> me too, and Pivotal's patch-bot seems happy with it.
>>
>> Thanks.
>>
>> --
>> Dave Page
>> Blog: http://pgsnake.blogspot.com
>> Twitter: @pgsnake
>>
>> EnterpriseDB UK: http://www.enterprisedb.com
>> The Enterprise PostgreSQL Company
>>
>
>
>
> --
> Thanks & Regards,
> Shubham Agarwal
> EnterpriseDB Corporation
>
> The Postgres Database Company
>
--
Dave Page
Blog: http://pgsnake.blogspot.com
Twitter: @pgsnake
EnterpriseDB UK: http://www.enterprisedb.com
The Enterprise PostgreSQL Company
^ permalink raw reply [nested|flat] 6+ messages in thread
end of thread, other threads:[~2018-06-27 15:40 UTC | newest]
Thread overview: 6+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2018-06-14 09:55 pgadmin_page functions updated Shubham Agarwal <[email protected]>
2018-06-15 05:32 ` Khushboo Vashi <[email protected]>
2018-06-15 06:03 ` Shubham Agarwal <[email protected]>
2018-06-15 08:11 ` Dave Page <[email protected]>
2018-06-26 07:45 ` Shubham Agarwal <[email protected]>
2018-06-27 15:40 ` Dave Page <[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