def test_newcard(self): lp = LoginPage(self.driver) hp = Homepage(self.driver) np = NewCard(self.driver) vp = ViewRequest(self.driver) lp.setUsername(self.username) lp.setPassword(self.password) lp.clickLogin() hp.clickutil() hp.clickreqNewCard() np.createReqNewCard(expected_price=6.00) hp.clickviewRequest() # vp.approveReqNewCard(expected_status="Topup_Completed") vp.rejectReqNewCard(expected_status="Returned")
def approveVoidReq(self, expected_status1, expected_status2): hp = Homepage(self.driver) np = NewCard(self.driver) vp = ViewRequest(self.driver) self.driver.find_element_by_xpath(self.filter_textbox_xpath).send_keys( np.jobReqNewCard) time.sleep(5) self.driver.find_element_by_xpath(self.filter_result_xpath).click() self.driver.find_element_by_xpath(self.approve_button_xpath).click() self.driver.find_element_by_xpath( self.approveConfirmation_xpath).click() time.sleep(5) hp.clickviewVoidRequest() self.driver.find_element_by_xpath(self.filter_textbox_xpath).send_keys( np.jobReqNewCard) time.sleep(5) self.driver.refresh() self.driver.find_element_by_xpath(self.filter_textbox_xpath).send_keys( np.jobReqNewCard) time.sleep(5) status = self.driver.find_element_by_xpath(np.verifyStatus_xpath).text assert status == expected_status1, "Status mismatch! Expected status is %s" % expected_status1 hp.clickutil() hp.clickviewRequest() self.driver.find_element_by_xpath(vp.filter_textbox_xpath).send_keys( np.jobReqNewCard) time.sleep(5) status = self.driver.find_element_by_xpath(np.verifyStatus_xpath).text assert status == expected_status2, "Status mismatch! Expected status is %s" % expected_status2
def test_voidnewcard(self): # This is scenario 1- to create request for new card in tandem with voiding request lp = LoginPage(self.driver) hp = Homepage(self.driver) np = NewCard(self.driver) vp = ViewRequest(self.driver) vvp = ViewVoidRequest(self.driver) lp.setUsername(self.username) lp.setPassword(self.password) lp.clickLogin() hp.clickutil() hp.clickreqNewCard() np.createReqNewCard(expected_price=6.00) hp.clickviewRequest() vp.approveReqNewCard(expected_status="Topup_Completed") vp.createVoidReq() hp.clickutil() hp.clickviewVoidRequest() vvp.approveVoidReq(expected_status1="void_topup_incomplete", expected_status2="Voided")
def recheckApprovedStatusExistingCard(self): hp = Homepage(self.driver) ExistingCard(self.driver) np = NewCard(self.driver) expected_status = "Approved" hp.clickviewRequest() self.driver.find_element_by_xpath(self.filter_textbox_xpath).send_keys(np.jobReqNewCard) time.sleep(5) status = self.driver.find_element_by_xpath(self.verifyStatus_xpath).text assert status == expected_status, "Incorrect status, Expected status is %s" % expected_status
def viewVoidRequest(self): np = NewCard(self.driver) self.driver.find_element_by_xpath(self.filter_textbox_xpath).send_keys( np.jobReqNewCard) time.sleep(5) self.driver.find_element_by_xpath(self.filter_result_xpath).click() self.driver.find_element_by_xpath(self.approve_button_xpath).click() self.driver.find_element_by_xpath( self.approveConfirmation_xpath).click() self.driver.find_element_by_xpath( self.cancelRequest_button_xpath).click() self.driver.find_element_by_xpath( self.cancelRequest_reason_xpath).send_keys( "Request is valid for top up") self.driver.find_element_by_xpath(self.submitReason_xpath).click()
def checkRequestInfo(self): ep = ExistingCard(self.driver) np = NewCard(self.driver) expected_jobOrder = np.jobReqNewCard card_quantity = "6" total_amt = 6.00 job_order = self.driver.find_element_by_xpath( "//body[1]/div[1]/div[3]/div[1]/div[1]/div[1]/div[1]/div[2]/b[1]").text no_of_cards = self.driver.find_element_by_xpath( "//body[1]/div[1]/div[3]/div[1]/div[1]/div[1]/div[5]/div[2]/b[1]").text topup_amt = self.driver.find_element_by_xpath( "//body[1]/div[1]/div[3]/div[1]/div[1]/div[1]/div[4]/div[2]/b[1]").text assert job_order == expected_jobOrder, "Incorrect job order number, expected job order number is %s" % expected_jobOrder assert no_of_cards == card_quantity, "Incorrect number of cards, expected number of cards is %s" % card_quantity assert float(topup_amt) == total_amt, "Incorrect topup amount, expected topup amount is %s" % total_amt
def viewTopUpRequest(self, rownum): np = NewCard(self.driver) ep = ExistingCard(self.driver) hp = Homepage(self.driver) self.driver.find_element_by_xpath(self.filter_textbox_xpath).send_keys(ep.jobReqExistCard) time.sleep(5) self.driver.find_element_by_xpath(self.filter_result_xpath).click() time.sleep(5) self.driver.find_element_by_xpath(self.approve_button_xpath).click() self.driver.find_element_by_xpath(self.approveConfirmation_xpath).click() time.sleep(5) hp.clickviewRequest() self.driver.find_element_by_xpath(self.filter_textbox_xpath).send_keys(ep.jobReqExistCard) time.sleep(20) self.driver.refresh() self.driver.find_element_by_xpath(self.filter_textbox_xpath).send_keys(ep.jobReqExistCard)
def rejectReqNewCard(self, expected_status): np = NewCard(self.driver) hp = Homepage(self.driver) self.driver.find_element_by_xpath(self.filter_textbox_xpath).send_keys(np.jobReqNewCard) time.sleep(5) self.driver.find_element_by_xpath(self.filter_result_xpath).click() time.sleep(5) self.driver.find_element_by_xpath(self.rejectnc_button_xpath).click() self.driver.find_element_by_xpath(self.rejectncReason_xpath).send_keys("Invalid Excel File used") self.driver.find_element_by_xpath(self.reject1_button_xpath).click() self.driver.find_element_by_xpath(self.reject1_button_xpath).click() hp.clickviewRequest() self.driver.find_element_by_xpath(self.filter_textbox_xpath).send_keys(np.jobReqNewCard) time.sleep(25) self.driver.refresh() self.driver.find_element_by_xpath(self.filter_textbox_xpath).send_keys(np.jobReqNewCard) time.sleep(5) status = self.driver.find_element_by_xpath(np.verifyStatus_xpath).text assert status == expected_status, "Status mismatch! Expected status is %s" % expected_status
def rejectVoidReq(self, expected_status3): hp = Homepage(self.driver) np = NewCard(self.driver) self.driver.find_element_by_xpath(self.filter_textbox_xpath).send_keys( np.jobReqNewCard) time.sleep(5) self.driver.find_element_by_xpath(self.filter_result_xpath).click() self.driver.find_element_by_xpath( self.cancelRequest_button_xpath).click() self.driver.find_element_by_xpath( self.cancelRequest_reason_xpath).send_keys( "Top Up Request is valid for Top Up") self.driver.find_element_by_xpath(self.submitReason_xpath).click() self.driver.find_element_by_xpath( self.submitReasonConfirmation_xpath).click() self.driver.find_element_by_xpath(self.closeReason_xpath).click() hp.clickviewVoidRequest() self.driver.find_element_by_xpath(self.filter_textbox_xpath).send_keys( np.jobReqNewCard) time.sleep(5) status = self.driver.find_element_by_xpath(np.verifyStatus_xpath).text assert status == expected_status3, "Status mismatch! Expected status is %s" % expected_status3
def searchJobOrder(self): ep = ExistingCard(self.driver) np = NewCard(self.driver) self.driver.find_element_by_xpath(self.filter_textbox_xpath).send_keys(ep.jobReqExistCard) time.sleep(5)