<filename>modules/tests/hrm/hrm_setup_staff.py<gh_stars>1-10
# Set up Staff
from tests.web2unittest import SeleniumUnitTest
from tests import *

class hrm_setup_staff(SeleniumUnitTest):
    def test_setup_staff(self):

        browser = self.browser
        browser.get("%s/hrm" % self.config.url)
        browser.find_element_by_link_text("New Staff Member").click()
        w_autocomplete("Rom",
                       "hrm_human_resource_organisation_id",
                       "Romanian Food Assistance Association (Test) (RFAAT)",
                       False)
        browser.find_element_by_id("pr_person_first_name").clear()
        browser.find_element_by_id("pr_person_first_name").send_keys("Robert")
        browser.find_element_by_id("pr_person_middle_name").clear()
        browser.find_element_by_id("pr_person_middle_name").send_keys("James")
        browser.find_element_by_id("pr_person_last_name").clear()
        browser.find_element_by_id("pr_person_last_name").send_keys("Lemon")
        browser.find_element_by_id("pr_person_date_of_birth").click()
        browser.find_element_by_id("pr_person_date_of_birth").clear()
        browser.find_element_by_id("pr_person_date_of_birth").send_keys("1980-10-14")
        browser.find_element_by_id("pr_person_gender").click()
        browser.find_element_by_id("pr_person_gender").send_keys("male")
        browser.find_element_by_id("pr_person_occupation").clear()
        browser.find_element_by_id("pr_person_occupation").send_keys("Social Worker")
        browser.find_element_by_id("pr_person_email").clear()
        browser.find_element_by_id("pr_person_email").send_keys("<EMAIL>")
        el = browser.find_element_by_id("hrm_human_resource_job_role_id")
        for option in el.find_elements_by_tag_name("option"):
            if option.text == "Administrative Officer":
                option.click()
                #To check afterwards
                #raw_value = int(option.get_attribute("Administrative Officer"))
                break
        browser.find_element_by_id("hrm_human_resource_start_date").click()
        browser.find_element_by_id("hrm_human_resource_start_date").clear()
        browser.find_element_by_id("hrm_human_resource_start_date").send_keys("2012-02-02")
        browser.find_element_by_css_selector("#hrm_human_resource_start_date__row > td").click()
        browser.find_element_by_id("hrm_human_resource_end_date").click()
        browser.find_element_by_id("hrm_human_resource_end_date").clear()
        browser.find_element_by_id("hrm_human_resource_end_date").send_keys("2015-03-02")
        w_autocomplete("Buch",
                       "hrm_human_resource_site_id",
                       "Bucharest RFAAT Centre (Test) (Office)",
                       False)
        browser.find_element_by_css_selector("input[type=\"submit\"]").click()

<filename>modules/tests/hrm/hrm_setup_staff.py<gh_stars>1-10
# Set up Staff
from tests.web2unittest import SeleniumUnitTest
from tests import *

class hrm_setup_staff(SeleniumUnitTest):
    def test_setup_staff(self):

        browser = self.browser
        browser.get("%s/hrm" % self.config.url)
        browser.find_element_by_link_text("New Staff Member").click()
        w_autocomplete("Rom",
                       "hrm_human_resource_organisation_id",
                       "Romanian Food Assistance Association (Test) (RFAAT)",
                       False)
        browser.find_element_by_id("pr_person_first_name").clear()
        browser.find_element_by_id("pr_person_first_name").send_keys("Robert")
        browser.find_element_by_id("pr_person_middle_name").clear()
        browser.find_element_by_id("pr_person_middle_name").send_keys("James")
        browser.find_element_by_id("pr_person_last_name").clear()
        browser.find_element_by_id("pr_person_last_name").send_keys("Lemon")
        browser.find_element_by_id("pr_person_date_of_birth").click()
        browser.find_element_by_id("pr_person_date_of_birth").clear()
        browser.find_element_by_id("pr_person_date_of_birth").send_keys("1980-10-14")
        browser.find_element_by_id("pr_person_gender").click()
        browser.find_element_by_id("pr_person_gender").send_keys("male")
        browser.find_element_by_id("pr_person_occupation").clear()
        browser.find_element_by_id("pr_person_occupation").send_keys("Social Worker")
        browser.find_element_by_id("pr_person_email").clear()
        browser.find_element_by_id("pr_person_email").send_keys("<EMAIL>")
        el = browser.find_element_by_id("hrm_human_resource_job_role_id")
        for option in el.find_elements_by_tag_name("option"):
            if option.text == "Administrative Officer":
                option.click()
                #To check afterwards
                #raw_value = int(option.get_attribute("Administrative Officer"))
                break
        browser.find_element_by_id("hrm_human_resource_start_date").click()
        browser.find_element_by_id("hrm_human_resource_start_date").clear()
        browser.find_element_by_id("hrm_human_resource_start_date").send_keys("2012-02-02")
        browser.find_element_by_css_selector("#hrm_human_resource_start_date__row > td").click()
        browser.find_element_by_id("hrm_human_resource_end_date").click()
        browser.find_element_by_id("hrm_human_resource_end_date").clear()
        browser.find_element_by_id("hrm_human_resource_end_date").send_keys("2015-03-02")
        w_autocomplete("Buch",
                       "hrm_human_resource_site_id",
                       "Bucharest RFAAT Centre (Test) (Office)",
                       False)
        browser.find_element_by_css_selector("input[type=\"submit\"]").click()

# Set up Staff #To check afterwards #raw_value = int(option.get_attribute("Administrative Officer"))