-
Notifications
You must be signed in to change notification settings - Fork 166
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
WIP: Added onboarding token generation related functional tests for provider-client feature #9938
base: master
Are you sure you want to change the base?
Changes from all commits
d457768
6fe28fd
bede2dd
a2f2cac
021a287
16e8644
33d0b36
acb877a
23a2576
a4d1846
0e63039
6cdad7f
c243c1f
2b0d5f9
b9a9883
88dd7ff
ddd6b7c
42f27a4
6bf355d
b9bb5f6
6de6253
8b6e710
3f17617
ea98930
a9ac0cb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
import logging | ||
|
||
from ocs_ci.ocs.ui.base_ui import take_screenshot, copy_dom, BaseUI | ||
from ocs_ci.utility import version | ||
from ocs_ci.ocs.ui.validation_ui import ValidationUI | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
@@ -12,15 +14,34 @@ class StorageClients(BaseUI): | |
|
||
def __init__(self): | ||
super().__init__() | ||
self.ocs_version = version.get_semantic_ocs_version_from_config() | ||
|
||
def generate_client_onboarding_ticket(self): | ||
def generate_client_onboarding_ticket_ui(self, storage_quota=None): | ||
""" | ||
Generate a client onboarding ticket | ||
|
||
Returns: | ||
str: onboarding_key | ||
""" | ||
logger.info("Generating onboarding token from ui") | ||
self.do_click(self.storage_clients_loc["generate_client_onboarding_ticket"]) | ||
ValidationUI().verify_storage_clients_page() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know you merged it before, but is it possible to move the method verify_storage_clients_page to this class? It really belongs to StorageClients, so you would not create ValidationUI instance here but use self. |
||
if storage_quota and self.ocs_version >= version.VERSION_4_17: | ||
self.do_click( | ||
self.validation_loc["storage_quota_custom"], | ||
enable_screenshot=True, | ||
) | ||
self.do_clear(self.validation_loc["allocate_quota_value"]) | ||
self.do_send_keys( | ||
locator=self.validation_loc["allocate_quota_value"], text=storage_quota | ||
) | ||
self.do_click( | ||
self.validation_loc["quota_unit_dropdown"], enable_screenshot=True | ||
) | ||
self.do_click( | ||
self.storage_clients_loc["generate_token"], enable_screenshot=True | ||
) | ||
|
||
onboarding_key = self.get_element_text( | ||
self.storage_clients_loc["onboarding_key"] | ||
) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,6 +17,7 @@ | |
from ocs_ci.ocs import constants | ||
from ocs_ci.ocs.resources.storage_cluster import StorageCluster | ||
from ocs_ci.framework.logger_helper import log_step | ||
from ocs_ci.ocs.ui.base_ui import wait_for_element_to_be_visible | ||
|
||
|
||
logger = logging.getLogger(__name__) | ||
|
@@ -654,20 +655,37 @@ def verify_storage_clients_page(self): | |
""" | ||
Verify storage clients page in UI | ||
|
||
Returns: | ||
StorageClients: Storage Clients page object | ||
|
||
""" | ||
self.refresh_web_console() | ||
storage_client_obj = self.nav_to_storageclients_page() | ||
self.nav_to_storageclients_page() | ||
strings_storage_clients_tab = ["Storage clients", "Name"] | ||
self.verify_page_contain_strings( | ||
strings_on_page=strings_storage_clients_tab, page_name="storage clients" | ||
) | ||
self.do_click( | ||
self.validation_loc["generate_client_onboarding_token_button"], | ||
self.storage_clients_loc["generate_client_onboarding_ticket"], | ||
enable_screenshot=True, | ||
) | ||
# Starting from ODF 4.17 custom storage amount select option is available | ||
if self.ocs_version_semantic >= version.VERSION_4_17: | ||
select_storage_quota_window = [ | ||
"Add storage capacity for the client cluster to consume from the provider cluster." | ||
"Storage quota: Unlimited", | ||
"Unlimited", | ||
"Custom", | ||
] | ||
self.verify_page_contain_strings( | ||
strings_on_page=select_storage_quota_window, | ||
page_name="client_onboarding_token_page", | ||
) | ||
# Check default storage quota selected as 'Unlimited' | ||
assert wait_for_element_to_be_visible( | ||
self.validation_loc["storage_quota_unlimited"] | ||
).is_selected(), "Default value unlimited quota is not selected" | ||
|
||
# Take screenshot | ||
self.take_screenshot() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. pls use description param, this way we will identify screenshot by name in the UI logs dir |
||
|
||
strings_object_service_tab = [ | ||
"Client onboarding token", | ||
"How to use this token", | ||
|
@@ -676,4 +694,3 @@ def verify_storage_clients_page(self): | |
strings_on_page=strings_object_service_tab, | ||
page_name="client_onboarding_token_page", | ||
) | ||
return storage_client_obj |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
due to implementation of wait_for_element_to_be_visible, it will fail if element not found.
The if not not find_element will not work.
Also "not" has been used 2 times