Skip to content

Commit

Permalink
Adjust locators to patternfly5 (#9691)
Browse files Browse the repository at this point in the history
* Adjust locators to patternfly5

Signed-off-by: Elena Bondarenko <[email protected]>

* Fix accidental deletion

Signed-off-by: Elena Bondarenko <[email protected]>

* Fix tox

Signed-off-by: Elena Bondarenko <[email protected]>

* Fix typo

Signed-off-by: Elena Bondarenko <[email protected]>

* Fix locator for actions

Signed-off-by: Elena Bondarenko <[email protected]>

* fix typo

Signed-off-by: Elena Bondarenko <[email protected]>

* Adjust delete locator

Signed-off-by: Elena Bondarenko <[email protected]>

* Fix obc deletion via UI

Signed-off-by: Elena Bondarenko <[email protected]>

* Fix bucketclass search

Signed-off-by: Elena Bondarenko <[email protected]>

* Fix actions locator

Signed-off-by: Elena Bondarenko <[email protected]>

* Add another actions locator

Signed-off-by: Elena Bondarenko <[email protected]>

* Fix wait for disabled button

Signed-off-by: Elena Bondarenko <[email protected]>

---------

Signed-off-by: Elena Bondarenko <[email protected]>
  • Loading branch information
ebondare authored May 15, 2024
1 parent 675fcc7 commit be60a9d
Show file tree
Hide file tree
Showing 4 changed files with 112 additions and 46 deletions.
4 changes: 3 additions & 1 deletion ocs_ci/ocs/ui/page_objects/block_pools.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ def delete_block_pool(self, block_pool_name: str, cannot_be_deleted: bool = Fals
from ocs_ci.ocs.ui.helpers_ui import format_locator

resource_actions = format_locator(
self.generic_locators["actions_of_resource_from_list"], block_pool_name
self.generic_locators["actions_of_resource_from_list"],
block_pool_name,
block_pool_name,
)
self.do_click(resource_actions, enable_screenshot=True)
self.do_click(self.generic_locators["delete_resource"], enable_screenshot=True)
Expand Down
28 changes: 20 additions & 8 deletions ocs_ci/ocs/ui/page_objects/object_buckets_tab.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import requests
from selenium.webdriver.common.by import By
from ocs_ci.ocs.ocp import get_ocp_url
from ocs_ci.ocs import exceptions
from ocs_ci.ocs.ui.page_objects.object_storage import ObjectStorage, logger


Expand All @@ -28,17 +29,28 @@ def _check_three_dots_disabled(text):
# locator of three_dots btn aligned with the specific resource name
locator = (
f"//td[@id='name']//a[contains(text(), '{resource_name}')]"
"/../../..//button[@aria-label='Actions']",
"/../../..//button[@aria-label='Actions'] | "
f"//tr[contains(., '{resource_name}')]//button[@data-test='kebab-button']",
By.XPATH,
)
# when three_dots element is active attribute 'disabled' does not exist
self.wait_for_element_attribute(
locator,
attribute="disabled",
attribute_value="true",
timeout=5,
sleep=1,
)
# it could be disabled="true" or with no value
try:
self.wait_for_element_attribute(
locator,
attribute="disabled",
attribute_value="true",
timeout=5,
sleep=1,
)
except exceptions.TimeoutExpiredError:
self.wait_for_element_attribute(
locator,
attribute="disabled",
attribute_value=None,
timeout=5,
sleep=1,
)

# PopUp is not reachable via Selenium driver. It does not appear in DOM
URL = f"{get_ocp_url()}/locales/resource.json?lng=en&ns=plugin__odf-console"
Expand Down
4 changes: 3 additions & 1 deletion ocs_ci/ocs/ui/page_objects/resource_list.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ def delete_resource(self, delete_via, resource):
self.do_send_keys(self.generic_locators["search_resource_field"], resource)
self.do_click(
format_locator(
self.generic_locators["three_dots_specific_resource"], resource
self.generic_locators["three_dots_specific_resource"],
resource,
resource,
),
enable_screenshot=True,
)
Expand Down
Loading

0 comments on commit be60a9d

Please sign in to comment.