def test_CreateAccount_Error(self): loginPage = LoginPage(self.driver) homePage = HomePage(self.driver) # Click Sign In button homePage.clickSignIn() # Typing email loginPage.setEmail_Create(self.emailCreate_fail) # Click Submit button loginPage.clickSubmit_Create() # Check the Invalid Email Message (Create Account) create_account_error_message = loginPage.getCreateAccountError_messages( ) self.assertEqual(self.invalidEmailCreate_message, create_account_error_message, "Error Message is not match!")
def test_CreateAccount_Successfull(self): createAccount_path = f'{ROOT_DIR}/files/createAccount.xlsx' rows = ControlExelFile.getRowCount(createAccount_path) # Read data from dataset and register all accounts for row in range(2, rows + 1): #Get information from excel file self.email = f'{ControlExelFile.readData(createAccount_path, row, "email")}@gmail.com' self.firstName = ControlExelFile.readData(createAccount_path, row, 'firstName') self.lastName = ControlExelFile.readData(createAccount_path, row, 'lastName') self.password = ControlExelFile.readData(createAccount_path, row, 'password') self.address = ControlExelFile.readData(createAccount_path, row, 'address') self.postalCode = ControlExelFile.readData(createAccount_path, row, 'postalCode') self.city = ControlExelFile.readData(createAccount_path, row, 'city') self.state = ControlExelFile.readData(createAccount_path, row, 'state') self.phone = ControlExelFile.readData(createAccount_path, row, 'phone') self.aliasAdress = ControlExelFile.readData( createAccount_path, row, 'aliasAdress') homePage = HomePage(self.driver) loginPage = LoginPage(self.driver) createAccount = CreateAccountPage(self.driver) homePage.clickSignIn() loginPage.setEmail_Create(self.email) loginPage.clickSubmit_Create() # Select(self.driver.find_element_by_id('s')).select_by_visible_text() try: # Typing personal information createAccount.setFirstName(self.firstName) createAccount.setLastName(self.lastName) createAccount.setPassword(self.password) createAccount.setAddress(self.address) createAccount.setCity(self.city) createAccount.selectState(self.state) createAccount.setPostalCode(self.postalCode) createAccount.setPhone(self.phone) createAccount.setAliasAdress(self.aliasAdress) createAccount.clickRegister() time.sleep(5) # Write status of creating the account if self.driver.title == self.myAccountPage_title: ControlExelFile.writeData(createAccount_path, row, 'Status', 'Create account Successfully!') else: print() except: # Get message of error message = loginPage.getCreateAccountError_messages() # Write status of creating the account ControlExelFile.writeData(createAccount_path, row, 'Status', message) try: createAccount.log_out() except: self.driver.get(self.baseURL)