def test_for_all_options_and_features_under_open_vul_section(self, driver): wait = WebDriverWait(driver, 20, poll_frequency=3, ignored_exceptions=[ NoSuchElementException, ElementNotVisibleException, TimeoutException, ElementClickInterceptedException ]) create_apps(driver, application_name="All options", url="http://demo.com") self.basic_func(driver) # checks per-page dropdown and all its option stop_till_spinner_is_invisible(driver) time.sleep(2) perpage = wait.until( EC.element_to_be_clickable((By.XPATH, PerPageDropdown))) perpage.click() check_perpage_dropdown_all_options = wait.until( EC.presence_of_element_located(( By.XPATH, "//ul[@class='el-scrollbar__view el-select-dropdown__list']"))) time.sleep(1) assert check_perpage_dropdown_all_options.text == perpage_dp_options # checks for 'Search' feature wait.until(EC.presence_of_element_located((By.XPATH, search)))
def test_for_filters_feature(self, driver): wait = WebDriverWait(driver, 20, poll_frequency=3, ignored_exceptions=[ NoSuchElementException, ElementNotVisibleException, TimeoutException, ElementClickInterceptedException ]) create_apps(driver, application_name="All options", url="http://demo.com") self.basic_func(driver) # checks for pagination, search, Name, CWE sections on 'Open vulnerability section' wait.until( EC.presence_of_element_located( (By.XPATH, "//div[@class='col']//ul[@aria-label='Pagination']"))) wait.until( EC.presence_of_element_located(( By.XPATH, "//div[@class='orchy_font_family orchy_font_color orchy_font_md el-input']//input[@placeholder='Search']" ))) wait.until( EC.presence_of_element_located( (By.XPATH, "//th[2]//div[.='Name']"))) wait.until(EC.presence_of_element_located( (By.XPATH, "//div[.='CWE']")))
def test_for_all_options_under_closed_vul_section(self, driver): wait = WebDriverWait(driver, 20, poll_frequency=3, ignored_exceptions=[ NoSuchElementException, ElementNotVisibleException, TimeoutException, ElementClickInterceptedException]) # creates application create_apps(driver, application_name="All options", url="http://demo.com") # goes to 'closed vulnerability' section of desired application self.basic_func(driver) # checks per-page dropdown and all its option stop_till_spinner_is_invisible(driver) time.sleep(2) perpage = wait.until(EC.element_to_be_clickable((By.XPATH, PerPageDropdown))) perpage.click() check_perpage_dropdown_all_options = wait.until(EC.presence_of_element_located((By.XPATH, "//div[@x-placement]//ul"))) time.sleep(1) assert check_perpage_dropdown_all_options.text == perpage_dp_options # checks for pagination, search, Name, CWE, Categorize sections on 'Open vulnerability section' wait.until(EC.presence_of_element_located((By.XPATH, "//div[@class='col']//ul[@aria-label='Pagination']"))) wait.until(EC.presence_of_element_located((By.XPATH, "//div[@class='orchy_font_family orchy_font_color orchy_font_md el-input']//input[@placeholder='Search']"))) wait.until(EC.presence_of_element_located((By.XPATH, "//th[2]//div[.='Name']"))) wait.until(EC.presence_of_element_located((By.XPATH, "//div[.='CWE']"))) wait.until(EC.presence_of_element_located((By.XPATH, "//div[.='Categorize']")))
def test_create_eng(self, driver): create_apps(driver, application_name="demo1", url="http://demo.com") # creates app create_engagement(driver, engagement_name="test basic UI", eng_descrption="demo", which_application="demo1", which_scope_type="All") # creates eng
def test_create_apps(driver): """ These function lets us create new applications with platform type as Python """ for app in apps: create_apps(driver, application_name=app, url="http://demo.com") wait = WebDriverWait(driver, 20, poll_frequency=2, ignored_exceptions=[ NoSuchElementException, ElementNotVisibleException, TimeoutException, ElementClickInterceptedException]) stop_till_spinner_is_invisible(driver) success_msg = wait.until(EC.visibility_of_element_located((By.XPATH, success_msg_for_app_created))) assert success_msg.text == "Application has been created successfully!" wait.until(EC.invisibility_of_element((By.XPATH, success_msg_for_app_created)))
def test_positive_tc_application_boundary_value_analysis(self, driver): for (app_name, urL) in zip(app_names, urls): create_apps(driver, application_name=app_name, url=urL) wait = WebDriverWait(driver, 10, poll_frequency=2) WebDriverWait(driver, 10).until( EC.invisibility_of_element( (By.XPATH, "//div[@class='loading-background']"))) success_msg = wait.until( EC.visibility_of_element_located( (By.XPATH, success_msg_for_app_created))) assert success_msg.text == "Application has been created successfully!" wait.until( EC.invisibility_of_element( (By.XPATH, success_msg_for_app_created)))
def test_if_application_has_all_features_and_options(self, driver): wait = WebDriverWait(driver, 20, poll_frequency=3, ignored_exceptions=[ NoSuchElementException, ElementNotVisibleException, TimeoutException, ElementClickInterceptedException ]) create_apps(driver, application_name="All options", url="https://demo.com") click_on_individual_app = wait.until( EC.element_to_be_clickable( (By.XPATH, "//label[contains(text(), 'All options')]"))) click_on_individual_app.click() # checks for pagination feature visibility on 'List of Application' section stop_till_spinner_is_invisible(driver) wait.until( EC.presence_of_element_located( (By.XPATH, "//ul[@aria-label='Pagination']"))) wait.until( EC.presence_of_element_located( (By.XPATH, "//input[@placeholder='Search']"))) # check if Application has all the required details and options. stop_till_spinner_is_invisible(driver) for (app_label, its_text) in zip(app_labels, its_texts): application_details = wait.until( EC.presence_of_element_located((By.XPATH, app_label))) assert application_details.text == its_text click_on_action_dropdown = wait.until( EC.element_to_be_clickable((By.XPATH, action_dropdown))) click_on_action_dropdown.click() action_dropdown_option = wait.until( EC.presence_of_element_located((By.XPATH, "//ul[@x-placement]"))) assert action_dropdown_option.text == action_dropdown_texts