class Test_Valid_Registration: firstname = Requirement.getValidFistName() lastname = Requirement.getValidLastName() mobileNum = Requirement.getValidMobileNumber() email = Requirement.getValidEmail() password = Requirement.getValidPassword() def testSignUp(self, setUp): self.driver = setUp self.driver.get(ReadConfig.getRegisterPageURL()) Rp = RegisterPage(self.driver) Rp.setFirstName(self.firstname) Rp.setLastName(self.lastname) Rp.setMobileNumber(self.mobileNum) Rp.setEmail(self.email) Rp.setPassword(self.password) Rp.setConfirmPassword(self.password) Rp.clickSignUp() time.sleep(5) currentUrl = self.driver.current_url self.driver.close() if currentUrl == ReadConfig.getHomePageURL(): assert True else: allure.attach(self.driver.get_screenshot_as_png(), name="Failed Registration With Valid Inputs", attachment_type=AttachmentType.PNG) self.driver.close() assert False def testLogin(self, setUp): self.driver = setUp self.driver.get(ReadConfig.getLoginPageURL()) loginp = LoginPage(self.driver) loginp.setUserName(self.email) loginp.setPassword(self.password) loginp.clickLogin() time.sleep(5) currentUrl = self.driver.current_url if currentUrl == ReadConfig.getHomePageURL(): self.driver.close() assert True else: allure.attach(self.driver.get_screenshot_as_png(), name="Failed Login After Registration", attachment_type=AttachmentType.PNG) self.driver.close() assert False
class Test_Invalid_Lastname2: firstname = Requirement.getValidFistName() lastname = firstname mobileNum = Requirement.getValidMobileNumber() email = Requirement.getValidEmail() password = Requirement.getValidPassword() def testURL(self, setUp): self.driver = setUp self.driver.get(ReadConfig.getRegisterPageURL()) currentUrl = self.driver.current_url self.driver.close() if currentUrl == ReadConfig.getRegisterPageURL(): assert True else: assert False def testSignUp(self, setUp): self.driver = setUp self.driver.get(ReadConfig.getRegisterPageURL()) regPage = RegisterPage(self.driver) regPage.setFirstName(self.firstname) regPage.setLastName(self.lastname) regPage.setMobileNumber(self.mobileNum) regPage.setEmail(self.email) regPage.setPassword(self.password) regPage.setConfirmPassword(self.password) befSignUp = self.driver.get_screenshot_as_png() regPage.clickSignUp() time.sleep(5) currentUrl = self.driver.current_url if currentUrl == ReadConfig.getRegisterPageURL(): self.driver.close() assert True else: allure.attach(befSignUp, name="SignUp With LastName Equals FirstName", attachment_type=AttachmentType.PNG) allure.attach(self.driver.get_screenshot_as_png(), name="Login With LastName Equals FirstName", attachment_type=AttachmentType.PNG) self.driver.close() assert False