How to use save_attachment_file method in Lemoncheesecake

Best Python code snippet using lemoncheesecake

test_search_beta.py

Source:test_search_beta.py Github

copy

Full Screen

...121 check_that("Assemblies listed for selected repo", assembly_title_list[i].text,122 contains_string(self.assembly_prefix))123 lcc.log_info("Find the Search beta page preview in the attachment below:")124 self.driver.save_screenshot("search_beta_repo_selected.png")125 lcc.save_attachment_file("search_beta_repo_selected.png")126 @lcc.test("Verify Status and Content Type filter on search page")127 def filters_on_search_page(self):128 utilities.click_element(self.driver, By.CLASS_NAME, locators.STATUS_FILTER_CLASS_NAME)129 utilities.click_element(self.driver, By.CLASS_NAME, locators.DRAFT_STATUS_CLASS_NAME)130 check_that("Draft Status filter chip is displayed on search page",131 utilities.find_element(self.driver, By.CLASS_NAME,132 locators.STATUS_TOOLBAR_CHIP_CLASS_NAME).is_displayed(), is_true())133 last_published_date_list = utilities.find_elements_by_XPATH(self.driver, locators.LAST_PUBLISHED_DATE_XPATH)134 published_date_list = []135 for i in last_published_date_list:136 published_date_list.append(i.text)137 for i in published_date_list:138 check_that("Published date for all titles should be '-' when draft status filter is selected", i,139 contains_string("-"))...

Full Screen

Full Screen

test_view_module.py

Source:test_view_module.py Github

copy

Full Screen

...81 utilities.switch_to_latest_tab(self.driver)82 utilities.wait(7)83 lcc.log_info("Find the CP preview in the attachment below for debugging purposes")84 self.driver.save_screenshot("cp_preview_module.png")85 lcc.save_attachment_file("cp_preview_module.png")86 check_that("View on Portal URL path", self.driver.current_url,87 contains_string(constants.view_on_portal_page_url))88 module_id_regex = re.compile(89 r'^[a-zA-Z0-9]{8}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{4}-[a-zA-Z0-9]{12}$')90 current__module_id = self.driver.current_url.split("/topic/")[1]91 check_that("View on Portal URL id",92 current__module_id, match_pattern(module_id_regex))93 # content_body_on_portal = utilities.find_element(self.driver, By.CSS_SELECTOR, locators.MODULE_BODY_ON_PORTAL_CSS)94 except (TimeoutException, StaleElementReferenceException, NoSuchElementException) as e:95 lcc.log_error("Error finding element!!!")96 lcc.log_error(e)97 finally:98 if (len(self.driver.window_handles) > 1):99 self.driver.close()...

Full Screen

Full Screen

test_git_import.py

Source:test_git_import.py Github

copy

Full Screen

...59 poll(lambda: utilities.find_element(self.driver, By.CSS_SELECTOR,60 locators.GIT_IMPORT_SUCCESS_ALERT_CSS).is_displayed(), step=1, timeout=150)61 # screenshot_filename = "git_import" + utilities.generate_random_string(3) + ".png"62 # self.driver.save_screenshot(screenshot_filename)63 # lcc.save_attachment_file(screenshot_filename)64 text = utilities.get_text(self.driver, By.CSS_SELECTOR, locators.GIT_IMPORT_SUCCESS_ALERT_CSS)65 print(text)66 check_that("Git import successful alert", text, contains_string(constants.success_alert_message))67 check_that("Git import successfully uploaded files count", text,68 contains_string(constants.success_alert_files_uploaded + number_of_files_imported))69 utilities.page_reload(self.driver)70 repo_list = utilities.find_elements_by_css_selector(self.driver, locators.LIST_OF_REPOS_CSS)71 name = []72 for i in repo_list:73 name.append(i.text)74 check_that("Git import repo is listed on search page", name, has_item(git_import_repo_Name))75 # utilities.page_reload(self.driver)76 search_url = fixture.url + 'pantheon/internal/modules.json?repo=' + fixture.git_import_repo \77 + '&search=' + module_title_prefix + '&key=Updated&direction=desc'...

Full Screen

Full Screen

utilities.py

Source:utilities.py Github

copy

Full Screen

...69 lcc.log_info("Find the CP preview in the attachment below for debugging purposes")70 random = generate_random_string(3)71 file_name = "cp_preview_" + random + ".png"72 driver.save_screenshot(file_name)73 lcc.save_attachment_file(file_name)74def switch_to_first_tab(driver):75 driver.switch_to.window(driver.window_handles[0])76# Verifies title for confirmation modal and accept the modal77def verify_and_accept_confirmation_modal(driver, modal_title_xpath, modal_title, confirmation_yes):78 check_that("Confirmation modal", get_text(driver, By.XPATH, modal_title_xpath), contains_string(modal_title))79 click_element(driver, By.CSS_SELECTOR, confirmation_yes)80def page_reload(driver):81 driver.refresh()82def select_value_from_dropdown(driver, locator_type, dropdown, value):83 try:84 select = Select(find_element(driver, locator_type, dropdown))85 select.select_by_visible_text(value)86 except NoSuchElementException as e:87 lcc.log_error(str(e))...

Full Screen

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run Lemoncheesecake automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful