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_viewVoidRequest(self): # To view void top up requests(only applicable to new card) lp = LoginPage(self.driver) hp = Homepage(self.driver) vvp = ViewVoidRequest(self.driver) lp.setUsername(self.username) lp.setPassword(self.password) lp.clickLogin() hp.clickutil() hp.clickviewVoidRequest() vvp.viewVoidRequest()
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 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