-
Notifications
You must be signed in to change notification settings - Fork 170
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
e40e32f
0ef9eaf
0aa0621
d7e6c6a
d0b3c53
6d58c33
bd2436e
30cc6ed
5d79a68
8ae52c7
439c6c9
e3dfd06
100e447
8fa7208
23d7d25
2f6b735
c8453e9
5bf77aa
4b3d20e
db8b80d
8d820c0
7fc2699
b318ba4
e6201a5
8a0394c
9fa038a
4984cb5
dcce051
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. 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 think it would be better not to run verification of storage clients page by default each time we generate a token in the UI. |
||
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 |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
import warnings | ||
|
||
import pandas as pd | ||
from selenium.common.exceptions import TimeoutException | ||
from ocs_ci.framework import config | ||
from ocs_ci.framework.logger_helper import log_step | ||
from ocs_ci.ocs.cluster import ( | ||
|
@@ -21,7 +22,7 @@ | |
from ocs_ci.ocs.resources.storage_cluster import StorageCluster | ||
from ocs_ci.utility import version | ||
from ocs_ci.utility.utils import TimeoutSampler | ||
from selenium.common.exceptions import TimeoutException | ||
from ocs_ci.ocs.ui.base_ui import wait_for_element_to_be_visible | ||
|
||
logger = logging.getLogger(__name__) | ||
|
||
|
@@ -656,20 +657,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", | ||
|
@@ -678,7 +696,6 @@ def verify_storage_clients_page(self): | |
strings_on_page=strings_object_service_tab, | ||
page_name="client_onboarding_token_page", | ||
) | ||
return storage_client_obj | ||
|
||
def calculate_est_days_and_average_manually(self): | ||
""" | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -661,14 +661,19 @@ | |
|
||
storage_clients = { | ||
"generate_client_onboarding_ticket": ( | ||
"//button[normalize-space()='Generate client onboarding token']", | ||
"//button[text()='Generate client onboarding token']", | ||
By.XPATH, | ||
), | ||
"client_onboarding_token": ( | ||
"onboarding_key": ( | ||
"//div[@class='odf-onboarding-modal__text-area']", | ||
By.XPATH, | ||
), | ||
"copy_to_clipboard": ("//button[text()='Copy to clipboard']", By.XPATH), | ||
"close_token_modal": ("//button[@aria-label='Close']", By.XPATH), | ||
"generate_token": ( | ||
"//button[text()='Generate token']", | ||
By.XPATH, | ||
), | ||
} | ||
|
||
page_nav = { | ||
|
@@ -731,6 +736,13 @@ | |
"storageclients_page": ("Storage Clients", By.LINK_TEXT), | ||
} | ||
|
||
page_nav_4_17 = { | ||
"storage_quota_selection_page_for_onboarding_client": ( | ||
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. Do you use it somewhere? Are you sure you'll get to storage quota selection page by clicking "Object Storage"? |
||
"Object Storage", | ||
By.LINK_TEXT, | ||
), | ||
} | ||
|
||
acm_page_nav = { | ||
"Home": ("//button[text()='Home']", By.XPATH), | ||
"Welcome_page": ("Welcome", By.LINK_TEXT), | ||
|
@@ -1765,12 +1777,16 @@ | |
"/ancestor::div[2]//div[@class='ceph-raw-card-legend__text']", | ||
By.XPATH, | ||
), | ||
"generate_client_onboarding_token_button": ( | ||
"//button[text()='Generate client onboarding token']", | ||
} | ||
|
||
validation_4_17 = { | ||
"storage_quota_unlimited": ("storage-quota-unlimited", By.ID), | ||
"storage_quota_custom": ("storage-quota-custom", By.ID), | ||
"allocate_quota_value": ( | ||
"//input[@type='number']", | ||
By.XPATH, | ||
), | ||
"copy to clipboard": ("//button[text()='Copy to clipboard']", By.XPATH), | ||
"onboarding_token": ("//*[@class='odf-onboarding-modal__text-area']", By.XPATH), | ||
"quota_unit_dropdown": ("pf-dropdown-toggle-id-2", By.ID), | ||
} | ||
|
||
validation_4_17 = { | ||
|
@@ -1983,7 +1999,7 @@ | |
locators = { | ||
"4.18": { | ||
"login": {**login, **login_4_11, **login_4_14}, | ||
"page": {**page_nav, **page_nav_4_10, **page_nav_4_14}, | ||
"page": {**page_nav, **page_nav_4_10, **page_nav_4_14, **page_nav_4_17}, | ||
"generic": generic_locators, | ||
"add_capacity": {**add_capacity, **add_capacity_4_11, **add_capacity_4_12}, | ||
"deployment": { | ||
|
@@ -2032,10 +2048,11 @@ | |
"topology": topology, | ||
"mcg_stores": mcg_stores, | ||
"alerting": alerting, | ||
"storage_clients": storage_clients, | ||
}, | ||
"4.17": { | ||
"login": {**login, **login_4_11, **login_4_14}, | ||
"page": {**page_nav, **page_nav_4_10, **page_nav_4_14}, | ||
"page": {**page_nav, **page_nav_4_10, **page_nav_4_14, **page_nav_4_17}, | ||
"generic": generic_locators, | ||
"add_capacity": {**add_capacity, **add_capacity_4_11, **add_capacity_4_12}, | ||
"deployment": { | ||
|
@@ -2084,6 +2101,7 @@ | |
"topology": topology, | ||
"mcg_stores": mcg_stores, | ||
"alerting": alerting, | ||
"storage_clients": storage_clients, | ||
}, | ||
"4.16": { | ||
"login": {**login, **login_4_11, **login_4_14}, | ||
|
@@ -2134,6 +2152,7 @@ | |
"topology": topology, | ||
"mcg_stores": mcg_stores, | ||
"alerting": alerting, | ||
"storage_clients": storage_clients, | ||
}, | ||
"4.15": { | ||
"login": {**login, **login_4_11, **login_4_14}, | ||
|
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