class SummaryPage(BasePage): log = cl.custom_logger(logging.DEBUG) def __init__(self, driver): super().__init__(driver) self.driver = driver self.wait = SeleniumDriver(self.driver) self.navigator = NavigatePage(self.driver) self.fev = FindExistingValuePage(self.driver) self.supplier_id = [""] # LOCATORS _action_button = "pthdr2ActionList" _navbar_button = "pthdr2navbar" _action_list_sign_out = "pthdr2signout" _identifying_info_tab = "//a//span[contains(text(), 'dentifying Information')]" # XPATH _address_tab = "//a//span[contains(text(), 'ddress')]" # XPATH _contacts_tab = "//a//span[contains(text(), 'ontacts')]" # XPATH _location_tab = "//span[contains(text(), 'ocation')]" # XPATH _custom_tab = "//a//span[contains(text(), 'C')]" # XPATH _save_btn = "#ICSave" _return_to_search_btn = "#ICList" _notify_btn = "#ICSendNotify" _add_btn = "#ICAdd" _include_history_btn = "#ICUpdateAll" _correct_history_btn = "#ICCorrection" _new_window_link = "New Window" # LINK_TEXT _help_link = "Help" # LINK_TEXT _personalize_page_link = "Personalize Page" # LINK_TEXT _identifying_info_link = "Identifying Information" # LINK_TEXT _address_link = "CleanAddressPage" # LINK_TEXT _contacts_link = "ContactsPage" # LINK_TEXT _location_link = "Location" # LINK_TEXT _custom_link = "Custom" # LINK_TEXT _master_vendor_id = "//span[@id='VENDOR_VENDOR_ID']" # XPATH def get_supplier_id(self): wait = WebDriverWait(self.driver, 10, poll_frequency=1) wait.until(ec.visibility_of_element_located((By.XPATH, self._master_vendor_id))) master_vendor = self.get_element(self._master_vendor_id, "xpath").text # print("Supplier ID (get_supplier_id): " + master_vendor) return master_vendor def click_actions_list_icon(self): self.element_click(self._action_button) def click_correct_history_btn(self): self.element_click(self._correct_history_btn) wait = WebDriverWait(self.driver, 10, poll_frequency=1) wait.until(ec.visibility_of_element_located((By.XPATH, "//input[@title='Correction mode (inactive button)']"))) def click_navbar_btn(self): self.element_click(self._navbar_button) def click_sign_out(self): self.element_click(self._action_list_sign_out) self.util.sleep(2, "the test to logout AUTOTEST3.") def click_new_window_link(self): self.element_click(self._new_window_link, "link") def click_location_tab(self): self.element_click(self._location_tab, "xpath") wait = WebDriverWait(self.driver, 10, poll_frequency=1) wait.until(ec.visibility_of_element_located((By.LINK_TEXT, "Payables"))) def verify_title(self): return self.verify_page_title("Supplier") def verify_supplier_id_created(self): result = self.is_element_present("//span[@id='VENDOR_VENDOR_ID']", locator_type="xpath") return result def verify_supplier_short_name(self): result = self.is_element_present("//span[@id='VENDOR_VNDR_NAME_SHRT_USR']", locator_type="xpath") return result def sign_out_summary_page(self): self.driver.switch_to.default_content() self.click_actions_list_icon() self.click_sign_out() def search_for_created_supplier(self): supplier_id = self.get_supplier_id() self.driver.switch_to.default_content() self.click_navbar_btn() self.util.sleep(2, "the menu window to open.") self.driver.switch_to.frame("psNavBarIFrame") self.util.sleep(2, "the Navigator button to be visible.") self.navigator.click_navigator() self.util.sleep(2, "the Supplier link to be visible.") self.navigator.click_supplier() self.driver.switch_to.frame("ptifrmtgtframe") self.util.sleep(2, "the 'Find Existing Value' page to open.") self.fev.search_for_supplier(supplier_id)
class TestCreateForeignMV(unittest.TestCase): @pytest.fixture(autouse=True) def class_setup(self): self.ts = TestStatus(self.driver) self.lp = LoginPage(self.driver) self.nav = NavigatePage(self.driver) self.sup_info_fev = FindExistingValuePage(self.driver) self.sup_info_anv = SupplierInformationANV(self.driver) self.summary = SummaryPage(self.driver) self.id_info = IdentifyingInformationPage(self.driver) self.addr = AddressPage(self.driver) self.clean_addr = CleanAddressPage(self.driver) self.loc = LocationPage(self.driver) self.payable_options = PayablesOptionsWindow(self.driver) self.procurement = ProcurementOptionsWindow(self.driver) self.preview = PreviewSupplierAuditWindow(self.driver) @pytest.mark.run(order=1) # @data((os.environ.get('PSFT_USER_ID'), "wrongpassword")) @data(("AUTOTEST3", "wrongpassword")) @unpack def test_invalid_password(self, username, password): self.lp.login(username, password) result_1 = self.lp.verify_login_failed() self.ts.mark(result_1, "Login Failed!\n") @pytest.mark.run(order=2) # @data((os.environ.get('PSFT_USER_ID'), os.environ.get('PSFT_USER_PWD'))) @data(("AUTOTEST3", "Psoft1234!")) @unpack def test_foreign_master_vendor_creation(self, username, password): self.lp.login(username, password) result_1 = self.lp.verify_title() self.ts.mark(result_1, "Title is CORRECT\n") self.nav.navigate_to_supplier_info() self.sup_info_fev.add_a_new_value() self.sup_info_anv.click_add_button() self.id_info.enter_identifying_info() """ FOREIGN CORPORATE INFORMATION """ self.id_info.click_address_tab() self.clean_addr.clean_germany_address("GERMANY", "Corporate Info") self.addr.enter_email_id() self.addr.enter_business_phone() self.addr.enter_fax() self.addr.enter_trilogie_dm_fax() """ FOREIGN REMIT ADDRESS """ self.addr.click_add_new_address_btn() self.clean_addr.clean_french_address("FRANCE", "Remit") self.addr.enter_email_id() self.addr.enter_business_phone() self.addr.enter_fax() self.addr.enter_trilogie_dm_fax() """ FOREIGN TRILOGIE PO ADDRESS """ self.addr.click_add_new_address_btn() self.clean_addr.clean_australian_address("AUSTRALIA", "Trilogie PO Address") self.addr.enter_email_id() self.addr.enter_business_phone() self.addr.enter_fax() self.addr.enter_trilogie_dm_fax() """ ADD LOCATIONS """ self.addr.click_location_tab() self.loc.add_location("MAIN", "Remit to Main") # Add Procurement self.loc.click_procurement_link() self.procurement.select_random_payment_terms_id() """ SAVE RECORD """ self.loc.click_save_btn() self.loc.click_summary_tab() self.summary.get_supplier_id() self.summary.search_for_created_supplier() result_2 = self.summary.verify_supplier_id_created() self.ts.mark(result_2, "Successfully Created Foreign Master Vendor.\n") @pytest.mark.run(order=3) def test_sign_out(self): self.summary.sign_out_summary_page() result_1 = self.lp.verify_title_of_log_out_page() self.ts.mark(result_1, "Successfully Signed Out of Application.\n") @pytest.mark.run(order=4) @data(("AUTOTEST4", "Psoft1234!")) @unpack def test_adding_bank_account_data(self, username, password): self.lp.login(username, password) result_1 = self.lp.verify_title() self.ts.mark(result_1, "Title is CORRECT\n") self.nav.navigate_to_supplier_info() self.driver.switch_to.frame("ptifrmtgtframe") self.sup_info_fev.search_for_supplier("0002000006") self.summary.click_correct_history_btn() self.summary.click_location_tab() self.loc.click_payables_link() self.payable_options.enter_and_save_supplier_bank_account_details() """ Preview Audit, Enter Reason Codes/Comments and Finalize """ self.preview.close_preview_supplier_audit_window_ok() result_1 = self.lp.verify_title_of_log_out_page() # self.ts.mark(result_1, "Successfully Signed Out of Application.\n") self.ts.mark_final( "Test Create Master Vendor", result_1, "Successfully added Banking Information to Master Vendor.\n")