This code installs the application, according to the type of application selected like alpha, beta, and released, also it checks for latest version in each type.
def install(
self,
app_version=None,
timeout=20,
cancel_button_verification=False,
install_type=None,
version_type=None,
latest_check=True,
select_isv_app_path_for_install: str = None,
):
"""install app"""
is_installed = False
is_cancel_button_check = False
assert (
self.open()
), "[ExchangeSearch] Failed to open app detailed card" # open detailed card
app_name = self.app_name
app_version = self.select_version_and_channel(
version_type, app_version, latest_check
)
self.log.info("[ExchangeSearch] {0} version:{1}".format(app_name, app_version))
if self.is_installed:
is_installed = True
self.log.info("[ExchangeSearch] {0} is already installed".format(app_name))
else:
self.install_button.click()
WebDriverWait(self.web_driver.driver, 10).until(
lambda x: self.is_installing
)
assert (
self.is_installing
), "Install button text not updated to 'INSTALLING' "
end = time.time() + timeout * 150
ae_show_all_arrow_click_count = False
ae_installation_list_div_count = False
while time.time() <= end:
if self.is_installing:
if app_name.lower() == "drive":
xpath = "div[contains(@class,'ProgressBar__StyledProgressBar')]//span[@title='Installing - Register']"
if self.elm_by_xpath(xpath):
time.sleep(3)
os.system(
'wmic process where name="drive-setup.exe" delete'
)
if install_type == "Error":
return self.install_app_with_error(app_name, app_version, end)
if (
"INSTALLING" in self.ae_installation_progress_bar_text
and cancel_button_verification
and not is_cancel_button_check
):
try:
self.ae_show_all_arrow.click()
ae_show_all_arrow_click_count = True
ae_installation_list_div_text = (
self.ae_installation_list_div.text.lower()
)
ae_installation_list_div_count = True
self.log.info(
"ae_installation_list_div_text for {0} is {1}".format(
app_name, ae_installation_list_div_text
)
)
assert (
"cancel" not in ae_installation_list_div_text
), "Cancel button present while installing {}".format(
app_name
)
is_cancel_button_check = True
except (
AttributeError,
ElementNotInteractableException,
ElementClickInterceptedException,
) as msg:
if not ae_show_all_arrow_click_count:
assert False, (
"Unable to locate arrow button on Exchange page hence unable "
"to check the cancel button (May be download and installation speed for"
" {} is too fast) during installation. Exception Msg: \n {}".format(
app_name, msg
)
)
elif not ae_installation_list_div_count:
assert False, (
"Unable to locate installation div on Exchange page hence unable "
"to check the cancel button (May be download and installation speed for"
" {} is too fast) during installation. Exception Msg: \n {}".format(
app_name, msg
)
)
if (
"INSTALLING - REGISTER"
in self.ae_installation_progress_bar_text
and "unreal engine" in app_name.lower()
):
self.connector_unreal_engine_installation_additional_steps(app_name)
elif (
"INSTALLING - REGISTER"
in self.ae_installation_progress_bar_text
and "kitware paraview" in app_name.lower()
):
self.connector_paraview_installation_additional_steps(
select_isv_app_path_for_install
)
else:
self.log.info(
"[ExchangeSearch] Finish {0} Installation Process ...".format(
app_name
)
)
is_installed = True
break
self.omniverse.screenshot("after_installing_{0}.png".format(app_name))
if is_installed:
self.log.info(
"[ExchangeSearch] Success to install {0}".format(app_name)
)
else:
self.log.info(
"[ExchangeSearch] {0} is not installed properly after {1} minutes timeout".format(
app_name, timeout
)
)
self.omniverse.screenshot("after_time_out_for_{}.png".format(app_name))
self.close()
return is_installed, app_version, app_name