def setUpClass(cls): user = selenium.get_user('MOBILE_WORKER') cls.username = user.USERNAME cls.password = user.PASSWORD cls.base_url = user.URL super(MobileWorkerTestCase, cls).setUpClass()
def setUpClass(cls): user = selenium.get_user('WEB_USER', exact=cls.force_non_admin_user) cls.username = user.USERNAME cls.password = user.PASSWORD cls.base_url = user.URL cls.project = user.PROJECT cls.is_superuser = user.IS_SUPERUSER super(WebUserTestCase, cls).setUpClass()
def setUpClass(cls): user = selenium.get_user('ADMIN') cls.username = user.USERNAME cls.password = user.PASSWORD cls.base_url = user.URL cls.project = user.PROJECT cls.is_superuser = user.IS_SUPERUSER super(AdminUserTestCase, cls).setUpClass()
from corehq.apps.hqwebapp.testcases import AdminUserTestCase from corehq.apps.hqwebapp import selenium from selenium.webdriver.support.ui import Select from .util import random_letters from .util import SeleniumUtils TEST_PROJECT = selenium.get_user('WEB_USER', exact=False).PROJECT #Uncomment below to define a project different from the one in settings #TEST_PROJECT = "my-test-project" class AppBase(SeleniumUtils, AdminUserTestCase): settings_web_user = selenium.get_user('WEB_USER', exact=False) def setUp(self): """ Hook up webdriver. Login in as Admin User """ super(AppBase, self).setUp() def tearDown(self): super(AppBase, self).tearDown() # self.logout() # self.driver.quit() def login(self, login_name, password): self.assertIn("Sign In", self.driver.page_source, "Not on login page.") self._q("_Sign In").click() self._q("#id_username").clear() self._q("#id_username").send_keys(login_name) self._q("#id_password").clear()
class AppBase(SeleniumUtils, AdminUserTestCase): settings_web_user = selenium.get_user('WEB_USER', exact=False) def setUp(self): """ Hook up webdriver. Login in as Admin User """ super(AppBase, self).setUp() def tearDown(self): super(AppBase, self).tearDown() # self.logout() # self.driver.quit() def login(self, login_name, password): self.assertIn("Sign In", self.driver.page_source, "Not on login page.") self._q("_Sign In").click() self._q("#id_username").clear() self._q("#id_username").send_keys(login_name) self._q("#id_password").clear() self._q("#id_password").send_keys(password) self._q("///button[@type='submit']").click() def logout(self): # click the primary dropdown to reveal 'Sing Out' self._q("///a[@class='btn btn-primary dropdown-toggle']").click() self._q("_Sign Out").click() def go_to_home(self): self.driver.get("/") self._q("///a[@href='/homepage/']").click() def go_to_home_and_select_project(self, project): self.go_to_home() self._q("_%s" % project).click() def go_to_mobile_workers_list(self, project): self.go_to_home_and_select_project(project) self._q("_Settings & Users").click() def go_to_create_mobile_worker_page(self, project): self.go_to_mobile_workers_list(project) self._q("_New Mobile Worker").click() def create_mobile_user(self, name): self.go_to_create_mobile_worker_page(TEST_PROJECT) self._q("@username").send_keys(name) self._q("@password").send_keys(name) self._q("@password_2").send_keys(name) self._q("///button[text()='Create Mobile Worker']").click() def delete_active_mobile_user(self, user): """ Deletes a mobile user whose usernname is user (or rather [email protected]). This method is called by test cases to delete users at will """ self.driver.get("/") self.go_to_mobile_workers_list(TEST_PROJECT) if user not in self.driver.page_source: Select(self._q('#pagination-limit')).select_by_visible_text( "50 users per page") # Show all users (up to 50) self._q("_%s" % user).click() self._q("_Delete Mobile Worker").click() input_field = self._q('///input[@data-bind]') input_field.send_keys("I understand") self._q("///button[text()=' Delete Mobile Worker' and @type='submit']" ).click() def delete_archived_mobile_user(self, user): """ Deletes a mobile user whose usernname is user (or rather [email protected]). This method is called by test cases to delete users at will """ self.driver.get("/") self.go_to_mobile_workers_list(TEST_PROJECT) self._q("_Show Archived Mobile Workers").click() if user not in self.driver.page_source: Select(self._q('#pagination-limit')).select_by_visible_text( "50 users per page") # Show all users (up to 50) self._q("_%s" % user).click() self._q("_Delete Mobile Worker").click() input_field = self._q('///input[@data-bind]') input_field.send_keys("I understand") self._q("///button[text()=' Delete Mobile Worker' and @type='submit']" ).click()
from corehq.apps.hqwebapp.testcases import AdminUserTestCase from corehq.apps.hqwebapp import selenium from selenium.webdriver.support.ui import Select from .util import random_letters from .util import SeleniumUtils TEST_PROJECT = selenium.get_user('WEB_USER', exact=False).PROJECT #Uncomment below to define a project different from the one in settings #TEST_PROJECT = "my-test-project" class AppBase(SeleniumUtils, AdminUserTestCase): settings_web_user = selenium.get_user('WEB_USER', exact=False) def setUp(self): """ Hook up webdriver. Login in as Admin User """ super(AppBase, self).setUp() def tearDown(self): super(AppBase, self).tearDown() # self.logout() # self.driver.quit() def login(self, login_name, password): self.assertIn("Sign In", self.driver.page_source, "Not on login page.") self._q("_Sign In").click() self._q("#id_username").clear() self._q("#id_username").send_keys(login_name)