password.send_keys("abcd1234") f.write(str(step_num)+'. '+'Fill in the password\n') step_num+= 1 # Error message is expected signin_button = driver.find_element_by_id("btn_signin") signin_button.click() f.write(str(step_num)+'. '+'Click the Sign In button\n') step_num+= 1 driver.implicitly_wait(3) msgtext = "Please type valid email address." errormsg = driver.find_element_by_id("errormsgSignIn") f.write(str(step_num)+'. '+'Verify the error message - '+msgtext + "\n") f.write(common.compareText(msgtext,errormsg.text,"error message")) step_num+= 1 driver.save_screenshot('./result/signin_case_4_1.png') # End of the test driver.quit() f.write(str(step_num)+'. '+'Close the browser\n\n') step_num+= 1 common.printTestResult(f,result) f.close()
repeatpsw.send_keys("abcd1234") f.write(str(step_num) + '. ' + 'Fill in all signup information\n') step_num += 1 driver.save_screenshot('./result/signup_case_5_1.png') signup_button = driver.find_element_by_id("btn_signup") signup_button.click() f.write(str(step_num) + '. ' + 'Click the Sign Up button\n') step_num += 1 # Feedback from server msgtext = "Successfully created a new user." msgtext2 = "You may try your first login." f.write(str(step_num) + '. ' + 'Sign up a new user - ' + msgtext + "\n") step_num += 1 errormsg = driver.find_element_by_id("errormsgSignUp") loginmsg = driver.find_element_by_id("loginmsg") f.write(common.compareText(msgtext, errormsg.text, "error message")) f.write(common.compareText(msgtext2, loginmsg.text, "login message")) # End of the test driver.quit() f.write(str(step_num) + '. ' + 'Close the browser\n\n') step_num += 1 common.printTestResult(f, result) f.close()
step_num += 1 # Check if the sign in is success # Wait until the username is displayed element_present = EC.presence_of_element_located( (By.NAME, 'home_personalInfo_email')) WebDriverWait(driver, 90).until(element_present) f.write(str(step_num) + '. ' + 'Go to the profile view\n') step_num += 1 driver.save_screenshot('./result/postmsg_case_1_1.png') # To make sure if the user is as same as sign in username email = driver.find_element_by_name("home_personalInfo_email") f.write(str(step_num) + '. ' + 'Verify the username ') f.write(common.compareText("abc@abc", email.text, "username")) step_num += 1 # Post message to own profile postbox = driver.find_element_by_name("postArea") post_button = driver.find_element_by_id("btn_post_home") content = "Testing on 10 Mar 2018" postbox.send_keys(content) f.write(str(step_num) + '. ' + 'Write the message in the post area\n') step_num += 1 post_button.click() # Feedback is expected from the server feedback = driver.find_element_by_id("errormsgPostWall_home")
step_num += 1 # Check if the sign in is success # Wait until the username is displayed element_present = EC.presence_of_element_located( (By.NAME, 'home_personalInfo_email')) WebDriverWait(driver, 90).until(element_present) f.write(str(step_num) + '. ' + 'Go to the profile view\n') step_num += 1 driver.save_screenshot('./result/changepw_case_1_1.png') # To make sure if the user is as same as sign in username email = driver.find_element_by_name("home_personalInfo_email") f.write(str(step_num) + '. ' + 'Verify the username ' + "\n") f.write(common.compareText("abc@abc", email.text, "username")) step_num += 1 # Go to account tab account_tab = driver.find_element_by_id("tab_account") account_tab.click() f.write(str(step_num) + '. ' + 'Go to Account Tab\n') step_num += 1 oldPW = driver.find_element_by_name("oldPW") newPW = driver.find_element_by_name("newPW") confirmPW = driver.find_element_by_name("confirmPW") # Fill in wrong old password oldPW.send_keys("abce1234") newPW.send_keys("qwer1234")
f.write(str(step_num)+'. '+'Click the Sign In button\n') step_num+= 1 # Check if the sign in is success # Wait until the username is displayed element_present = EC.presence_of_element_located((By.NAME,'home_personalInfo_email')) WebDriverWait(driver, 90).until(element_present) f.write(str(step_num)+'. '+'Go to the profile view\n') step_num+= 1 driver.save_screenshot('./result/postmsg_case_3_1.png') # To make sure if the user is as same as sign in username email = driver.find_element_by_name("home_personalInfo_email") f.write(str(step_num)+'. '+'Verify the username ') f.write(common.compareText("abc@abc",email.text,"username")) step_num+= 1 # Post message to own profile postbox_home = driver.find_element_by_name("postArea") post_button_home = driver.find_element_by_id("btn_post_home") content = "This message should be displayed in home and browse tab" postbox_home.send_keys(content) f.write(str(step_num)+'. '+'Write the message in the post area in Home Tab\n') step_num+= 1 post_button_home.click() # Feedback is expected from the server feedback_home = driver.find_element_by_id("errormsgPostWall_home")
step_num += 1 # Check if the sign in is success # Wait until the username is displayed element_present = EC.presence_of_element_located( (By.NAME, 'home_personalInfo_email')) WebDriverWait(driver, 90).until(element_present) f.write(str(step_num) + '. ' + 'Go to the profile view\n') step_num += 1 driver.save_screenshot('./result/changepw_case_4_1.png') # To make sure if the user is as same as sign in username email = driver.find_element_by_name("home_personalInfo_email") f.write(str(step_num) + '. ' + 'Verify the username ') f.write(common.compareText("abc@abc", email.text, "username")) step_num += 1 # Go to account tab account_tab = driver.find_element_by_id("tab_account") account_tab.click() f.write(str(step_num) + '. ' + 'Go to Account Tab\n') step_num += 1 # End of the test driver.quit() f.write(str(step_num) + '. ' + 'Close the browser\n\n') step_num += 1 common.printTestResult(f, result) f.close()