Beispiel #1
0
 def test_register_page_loads_blank_register_page_after_successful_registration(
         self):
     # after a successful registration, the Register Page should load with all fields blank
     # step 1 - register a user
     gorilla = MikeBookUser(
         "TestGorillaJPG", "TestGorillaJPG", "test", "test",
         "I'm a test gorilla",
         "C:\\xampp\\htdocs\\_python_files\\test_php_socialnetwork\\Test_Images\\_TestGorilla01.jpg",
         self.driver)
     gorilla.Register()
     # step 2 - verify we are on the Register Page and all fields are blank
     time.sleep(1)
     self.assertEqual(
         WebDriverWait(self.driver, 4).until(
             EC.element_to_be_clickable(
                 (By.NAME, 'txtName'))).get_attribute('value'), "")
     self.assertEqual(
         WebDriverWait(self.driver, 4).until(
             EC.element_to_be_clickable(
                 (By.NAME, 'txtUsername'))).get_attribute('value'), "")
     self.assertEqual(
         WebDriverWait(self.driver, 4).until(
             EC.element_to_be_clickable(
                 (By.NAME, 'txtPassword'))).get_attribute('value'), "")
     self.assertEqual(
         WebDriverWait(self.driver, 4).until(
             EC.element_to_be_clickable(
                 (By.NAME, 'txtConfirmPassword'))).get_attribute('value'),
         "")
     self.assertEqual(
         WebDriverWait(self.driver, 4).until(
             EC.element_to_be_clickable(
                 (By.NAME, 'areaAboutMe'))).get_attribute('value'), "")
     # step 3 - delete the test user
     gorilla.Delete()
Beispiel #2
0
 def test_validation_invalid_file_type(self):
     # verify that attempting to upload an image with an invalid file type results in a validation message
     # step 1 - try to register a user with an invalid file type
     gorilla = MikeBookUser(
         "TestGorilla", "TestGorilla", "test", "test", "I'm a test gorilla",
         "C:\\xampp\\htdocs\\_python_files\\test_php_socialnetwork\\Test_Images\\testDoc.txt",
         self.driver)
     gorilla.Register()
     # step 2 - verify the validation message
     WebDriverWait(self.driver, 4).until(
         EC.text_to_be_present_in_element(
             (By.XPATH, "html/body/div/div[4]/div/form/div[6]/span"),
             "* Only JPG, JPEG, and PNG files are allowed"))
Beispiel #3
0
 def setUpClass(inst):
     inst.driver = webdriver.Firefox()
     inst.driver.implicitly_wait(10)
     inst.driver.maximize_window()
     # create test users
     inst.gorilla = MikeBookUser(
         "TestGorilla", "GorillaLovin", "testTwentySix", "testTwentySix",
         "I'm a test gorilla.",
         "C:\\xampp\\htdocs\\_python_files\\test_php_socialnetwork\\Test_Images\\_TestGorilla01.jpg",
         inst.driver)
     inst.rhino = MikeBookUser(
         "TestRhino", "RhinoLovin", "testTwentySeven", "testTwentySeven",
         "I live in Africa.",
         "C:\\xampp\\htdocs\\_python_files\\test_php_socialnetwork\\Test_Images\\_TestRhino01.png",
         inst.driver)
     inst.gorilla.Register()
     inst.rhino.Register()
Beispiel #4
0
 def test_register_page_should_display_success_message_after_registering_user(
         self):
     # after successful registration, the Register Page should load with a success message
     # step 1 - register a user
     gorilla = MikeBookUser(
         "TestGorillaJPG", "TestGorillaJPG", "test", "test",
         "I'm a test gorilla",
         "C:\\xampp\\htdocs\\_python_files\\test_php_socialnetwork\\Test_Images\\_TestGorilla01.jpg",
         self.driver)
     gorilla.Register()
     # step 2 - verify the message is displayed
     WebDriverWait(self.driver, 4).until(
         EC.text_to_be_present_in_element(
             (By.XPATH, 'html/body/div/div[4]/div/form/div[7]/span'),
             'New record created successfully'))
     # step 3 - delete the test user
     gorilla.Delete()
Beispiel #5
0
 def setUpClass(inst):
     inst.driver = webdriver.Firefox()
     inst.driver.implicitly_wait(10)
     inst.driver.maximize_window()
     # create test users
     inst.gorilla = MikeBookUser(
         "TestGorilla", "Gorilla", "testThirtyFive", "testThirtyFive",
         "I'm a test gorilla.",
         "C:\\xampp\\htdocs\\_python_files\\test_php_socialnetwork\\Test_Images\\_TestGorilla01.jpg",
         inst.driver)
     inst.gorilla.Register()
Beispiel #6
0
 def setUpClass(inst):
     inst.driver = webdriver.Firefox()
     inst.driver.implicitly_wait(10)
     inst.driver.maximize_window()
     inst.driver.get("http://localhost/socialnetwork/login.php/")
     # create test users
     inst.gorilla = MikeBookUser(
         "TestGorilla", "Gorilla", "testTwentySix", "testTwentySix",
         "I'm a test gorilla.",
         "C:\\xampp\\htdocs\\_python_files\\test_php_socialnetwork\\Test_Images\\_TestGorilla01.jpg",
         inst.driver)
     inst.bach = MikeBookUser(
         "TestBach", "BachLovin", "testTwentySeven", "testTwentySeven",
         "I'm a test musician.",
         "C:\\xampp\\htdocs\\_python_files\\test_php_socialnetwork\\Test_Images\\_TestBach01.jpeg",
         inst.driver)
     inst.rhino = MikeBookUser(
         "TestRhino", "RhinoLovin", "testTwentyEight", "testTwentyEight",
         "I'm a test rhino.",
         "C:\\xampp\\htdocs\\_python_files\\test_php_socialnetwork\\Test_Images\\_TestRhino01.png",
         inst.driver)
     inst.gorilla.Register()
     inst.bach.Register()
     inst.rhino.Register()
Beispiel #7
0
 def test_validation_username_cannot_already_exist_in_database(self):
     # Validation - Username cannot already exist in the database
     # step 1 = create a user "TestGorilla"
     gorilla = MikeBookUser(
         "TestGorilla", "TestGorilla", "test", "test", "I'm a test gorilla",
         "C:\\xampp\\htdocs\\_python_files\\test_php_socialnetwork\\Test_Images\\_TestGorilla01.jpg",
         self.driver)
     gorilla.Register()
     # step 2 = navigate back to the Register Page and try to create another user with Username "TestGorilla"
     bach = MikeBookUser(
         "TestBach", "TestGorilla", "test", "test", "I'm a musician",
         "C:\\xampp\\htdocs\\_python_files\\test_php_socialnetwork\\Test_Images\\_TestGorilla01.jpg",
         self.driver)
     bach.Register()
     # step 3 = verify the validation message
     WebDriverWait(self.driver, 4).until(
         EC.text_to_be_present_in_element(
             (By.XPATH, "html/body/div/div[4]/div/form/div[2]/span"),
             "* Username cannot already exist"))
     # step 4 = remove the user created for this test
     gorilla.Delete()
Beispiel #8
0
 def test_validation_image_already_exists(self):
     # verify that attempting to upload an image that already exists results in a validation message
     # step 1 = create a new user with image "TestGorilla01.jpg"
     gorilla = MikeBookUser(
         "TestGorilla", "TestGorilla", "test", "test", "I'm a test gorilla",
         "C:\\xampp\\htdocs\\_python_files\\test_php_socialnetwork\\Test_Images\\_TestGorilla01.jpg",
         self.driver)
     gorilla.Register()
     # step 2 = navigate back to the Register Page and try to create another user with "TestGorilla01.jpg"
     self.driver.get("http://localhost/socialnetwork/register.php/")
     bach = MikeBookUser(
         "TestBach", "TestBach", "test", "test", "I'm a musician",
         "C:\\xampp\\htdocs\\_python_files\\test_php_socialnetwork\\Test_Images\\_TestGorilla01.jpg",
         self.driver)
     bach.Register()
     # step 3 = verify the validation message
     WebDriverWait(self.driver, 4).until(
         EC.text_to_be_present_in_element(
             (By.XPATH, "html/body/div/div[4]/div/form/div[6]/span"),
             "* File already exists"))
     # step 4 = remove the user created for this test
     gorilla.Delete()
Beispiel #9
0
 def test_that_PNG_JPG_JPEG_are_accepted_as_valid_types_for_the_image_field(
         self):
     # Verify that PNG, JPEG, and JPG are accepted as valid types for the image field
     # create the test users to verify those image types are accepted
     gorilla = MikeBookUser(
         "TestGorillaJPG", "TestGorillaJPG", "test", "test",
         "I'm a test gorilla",
         "C:\\xampp\\htdocs\\_python_files\\test_php_socialnetwork\\Test_Images\\_TestGorilla01.jpg",
         self.driver)
     rhino = MikeBookUser(
         "TestRhinoPNG", "TestRhinoPNG", "test", "test", "I'm a musician",
         "C:\\xampp\\htdocs\\_python_files\\test_php_socialnetwork\\Test_Images\\_TestRhino01.png",
         self.driver)
     bach = MikeBookUser(
         "TestBachJPEG", "TestBachJPEG", "test", "test", "I'm a musician",
         "C:\\xampp\\htdocs\\_python_files\\test_php_socialnetwork\\Test_Images\\_TestBach01.jpeg",
         self.driver)
     gorilla.Register()
     bach.Register()
     rhino.Register()
     # delete the test users
     gorilla.Delete()
     bach.Delete()
     rhino.Delete()