def test_CreateAccount_Successfull(self): homePage = HomePage(self.driver) loginPage = LoginPage(self.driver) createAccount = CreateAccountPage(self.driver) # Click Sign In Button homePage.clickSignIn() # Typing email loginPage.setEmail_Create(self.emailCreate_successfull) # Click button submit loginPage.clickSubmit_Create() # 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.aliasAddress) createAccount.clickRegister() # Check status of creating account time.sleep(5) self.assertEqual(self.myAccountPage_title, self.driver.title, "Create Account Uncessfully")
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_write_a_comment(self): # Feature: Chi tiết sản phẩm; Title: Write a comment emailSignIn = '*****@*****.**' passwordSignIn = '123456' homePage = HomePage(self.driver) homePage.clickSignIn() loginPage = LoginPage(self.driver) loginPage.sign_in(emailSignIn, passwordSignIn) self.driver.implicitly_wait(10) self.driver.get(self.baseURL) homePage.click_product_image(1) productDetailPage = ProductDetailPage(self.driver) productDetailPage.leave_review('Comment', 'Good') send_review_message = productDetailPage.get_send_review_message() self.assertEqual( 'Your comment has been added and will be available once approved by a moderator', send_review_message, "Send review unsuccessfully")
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)