def test_create_edit_delete(self): """ Create a point, edit it, delete it. """ # read parameter file with open(SCRIPT_DIR + '/data_edit_entry_valid.csv') as f: testData = f.readlines() # run subtests for paramList in testData: params = paramList.split(',') with self.subTest(params=params): # reload page for each subtest self.driver.get(GeopostEntryPage.URL) self.page = GeopostEntryPage(self.driver) # make new entry self.page.toggle_draw() self.page.draw_point() self.page.enter_title(params[0]) self.page.enter_body(params[1]) self.page.choose_photo(SCRIPT_DIR + params[2].strip()) self.page.submit_form() # verify that entry was created successfully self.page = GeopostHomePage(self.driver) self.assertTrue(self.page.verify_path(time=12)) self.assertTrue( self.page.verify_entry_exists_by_title(params[0]) ) # edit the entry self.page.edit_by_title(params[0]) self.page = GeopostEntryPage(self.driver) self.assertTrue(self.page.verify_path(time=8)) self.assertEqual(self.page.get_title(), params[0]) self.assertEqual(self.page.get_body(), params[1]) self.page.draw_point() self.page.enter_title(params[3]) self.page.enter_body(params[4]) self.page.choose_photo(SCRIPT_DIR + params[5].strip()) self.page.submit_form() # verify that entry was edited successfully self.page = GeopostHomePage(self.driver) self.assertTrue(self.page.verify_path(time=8)) self.assertTrue( self.page.verify_entry_exists_by_title(params[3]) ) # Delete the newly created post self.page.delete_by_title(params[3]) # Verify that the delete worked self.assertFalse( self.page.verify_entry_exists_by_title(params[3]) )
def test_follow_new_entry_link(self): """ Click on the 'New Entry' button in the toolbar, verify that it leads to entry page. """ self.page.click_new_entry_button() self.page = GeopostEntryPage(self.driver) self.assertTrue(self.page.verify_path())
def setUp(self): """ Make driver, page, sign in. """ with open('/etc/zachsite_test_creds.txt') as f: testCreds = f.readlines() self.driver = webdriver.Firefox() self.driver.get(LoginPage.URL) self.page = LoginPage(self.driver) self.page.enter_username(testCreds[0].strip()) self.page.enter_password(testCreds[1].strip()) self.page.login() self.driver.get(GeopostEntryPage.URL) self.page = GeopostEntryPage(self.driver)