diff --git a/script/browser_test/utils.py b/script/browser_test/utils.py index df07eb1fa..fd72f97dc 100644 --- a/script/browser_test/utils.py +++ b/script/browser_test/utils.py @@ -20,3 +20,45 @@ def tearDown(self): def get(self, url): return self.driver.get("https://localhost" + url) + + def create_account(self, name, email, password); + self.get("/users/new") + + inp = self.driver.find_element_by_id("username") + inp.send_keys(name) + + inp = self.driver.find_element_by_id("email") + inp.send_keys(email) + + inp = self.driver.find_element_by_id("password") + inp.send_keys(password) + + inp = self.driver.find_element_by_id("password_confirmation") + inp.send_keys(password) + + + driver.find_element_by_xpath("//input[@type='submit']").click() + + def delete_account(self): + self.get("/me") + self.get("{}/edit".format(self.driver.current_url)) + + self.driver.find_element_by_xpath("//input[@type='submit' and contains(@class, 'destructive')]").click() + + def login(self, name, password): + self.get("/login") + + inp = self.driver.find_element_by_id("eamil_or_name") + inp.send_keys(name) + + inp = self.driver.find_element_by_id("password") + inp.send_keys(password) + + driver.find_element_by_xpath("//input[@type='submit']").click() + + def logout(self): + self.get("/logout") + + def follow(self, other): + self.get("/@/"+other) + driver.find_element_by_xpath("//input[@type='submit']").click()