Example #1
0
class NewLearningUnitPage(pypom.Page):
    _code_0 = SelectField(By.ID, "id_acronym_0")
    _code_1 = InputField(By.ID, "id_acronym_1")

    @property
    def code(self):
        return self._code_0.text + self._code_1.text

    @code.setter
    def code(self, value):
        self._code_0 = value[0]
        self._code_1 = value[1:]

    type = SelectField(By.ID, "id_container_type")
    credit = InputField(By.ID, "id_credits")
    credits = InputField(By.ID, "id_credits")
    lieu_denseignement = SelectField(By.ID, "id_campus")
    intitule_commun = InputField(By.ID, "id_common_title")
    entite_resp_cahier_des_charges = Select2Field(
        By.XPATH,
        "//*[@id='LearningUnitYearForm']/div[2]/div[1]/div[2]/div/div/div[3]/div/span"
    )
    entite_dattribution = Select2Field(
        By.XPATH,
        "//*[@id='LearningUnitYearForm']/div[2]/div[1]/div[2]/div/div/div[4]/div/span"
    )
    save_button = Link("LearningUnitPage", By.ID, 'btn-confirm', 2)
Example #2
0
class SearchEducationGroupPage(CommonPageMixin, pypom.Page):
    URL_TEMPLATE = '/educationgroups/'

    sigleintitule_abrege = InputField(By.ID, 'id_acronym')
    code = InputField(By.ID, 'id_partial_acronym')
    anac = SelectField(By.ID, 'id_academic_year')

    actions = ButtonField(By.ID, 'btn-action')
    new_training = ButtonField(By.CSS_SELECTOR, '#link_create_training > a', 1)
    new_mini_training = ButtonField(By.CSS_SELECTOR, '#link_create_mini_training > a', 1)

    first_row = Link('EducationGroupPage', By.CSS_SELECTOR,
                     '#table_education_groups > tbody > tr:nth-child(1) > td:nth-child(2) > a')

    type_de_formation = SelectField(By.ID, "id_name")
    confirm_modal = Link(NewTrainingPage, By.CSS_SELECTOR, '.modal-footer>input.btn-primary')
    clear_button = ButtonField(By.ID, 'btn_clear_filter')
    search = Link('SearchEducationGroupPage', By.CSS_SELECTOR, 'button.btn-primary', 1)

    quick_search = Link(QuickSearchPage, By.ID, 'quick-search', 1)

    def count_result(self):
        text = self.find_element(
            By.CSS_SELECTOR,
            '#main > div.panel.panel-default > div > div > div.row > div:nth-child(1)').text
        return text.split()[0]
Example #3
0
class SearchLearningUnitPage(CommonPageMixin, pypom.Page):
    URL_TEMPLATE = '/learning_units/by_activity/'

    proposal_search = Link('SearchLearningUnitPage', By.ID,
                           'lnk_proposal_search', 1)

    anac = SelectField(By.ID, 'id_academic_year_id')
    acronym = InputField(By.ID, 'id_acronym')
    code = InputField(By.ID, 'id_acronym')
    tutor = InputField(By.ID, 'id_tutor')
    sigle_dossier = SelectField(By.ID, "id_entity_folder_id")

    requirement_entity = InputField(By.ID, 'id_requirement_entity_acronym')
    ent_charge = InputField(By.ID, 'id_requirement_entity_acronym')
    container_type = SelectField(By.ID, 'id_container_type')
    clear_button = ButtonField(By.ID, 'btn_clear_filter')

    search = Link('SearchLearningUnitPage', By.CSS_SELECTOR,
                  'button.btn-primary', 2)
    export = ButtonField(By.ID, "dLabel")
    list_learning_units = ButtonField(By.ID, "btn_produce_xls_with_parameters")
    with_program = ButtonField(By.ID, "chb_with_grp")
    with_tutor = ButtonField(By.ID, "chb_with_attributions")
    generate_xls = ButtonField(By.ID, "btn_xls_with_parameters")

    actions = ButtonField(By.ID, 'btn-action')
    new_luy = Link(NewLearningUnitPage, By.ID, 'lnk_learning_unit_create')
    create_proposal_url = Link(NewLearningUnitProposalPage, By.ID,
                               'lnk_create_proposal_url')

    # TODO this action is really slow.
    back_to_initial_yes = Link(
        'SearchLearningUnitPage', By.CSS_SELECTOR,
        '#modalBackToInitial > div > div > div.modal-footer > button.btn.btn-primary',
        4)

    consolidate_yes = Link(
        'SearchLearningUnitPage', By.CSS_SELECTOR,
        '#modalConsolidate > div > div > div.modal-footer > button.btn.btn-primary',
        4)

    def count_result(self):
        text = self.find_element(
            By.CSS_SELECTOR,
            "#main > div.panel.panel-default > div > strong").text
        return text.split()[0]

    def find_acronym_in_table(self, row: int = 1):
        selector = '#table_learning_units > tbody > tr:nth-child({}) > td.col-acronym > a'.format(
            row)
        return self.find_element(By.CSS_SELECTOR, selector).text
Example #4
0
class LearningUnitEditPage(pypom.Page):
    actif = Checkbox(By.ID, "id_status")
    periodicite = SelectField(By.ID, "id_periodicity")
    credits = InputField(By.ID, "id_credits")
    volume_q1_pour_la_partie_magistrale = InputField(By.ID, "id_component-0-hourly_volume_partial_q1")
    volume_q1_pour_la_partie_pratique = InputField(By.ID, "id_component-1-hourly_volume_partial_q1")
    volume_q2_pour_la_partie_magistrale = InputField(By.ID, "id_component-0-hourly_volume_partial_q2")
    volume_q2_pour_la_partie_pratique = InputField(By.ID, "id_component-1-hourly_volume_partial_q2")
    quadrimestre = SelectField(By.ID, "id_quadrimester")
    session_derogation = SelectField(By.ID, "id_session")

    save_button = ButtonField(By.CSS_SELECTOR,
                              "#main > div.panel.panel-default > div.panel-heading > div > div > div > button")

    no_postponement = Link(LearningUnitPage, By.ID, "btn_without_postponement")
    with_postponement = Link(LearningUnitPage, By.ID, "btn_with_postponement")
Example #5
0
class NewLearningUnitProposalPage(NewLearningUnitPage):
    etat = SelectField(By.ID, 'id_state')
    periodicite = SelectField(By.ID, "id_periodicity")
    annee_academique = SelectField(By.ID, 'id_academic_year')

    _dossier_0 = SelectField(By.ID, 'id_entity')
    _dossier_1 = InputField(By.ID, 'id_folder_id')

    @property
    def dossier(self):
        return self._dossier_0.text + self._dossier_1.text

    @dossier.setter
    def dossier(self, value):
        value_0 = EntityVersion.objects.get(acronym=value[:3]).pk
        self._dossier_0 = value_0
        self._dossier_1 = value[3:]
Example #6
0
class SearchEntityPage(CommonPageMixin, pypom.Page):
    URL_TEMPLATE = '/entities/'

    acronym = InputField(By.ID, 'id_acronym')
    title = InputField(By.ID, 'id_title')
    entity_type = SelectField(By.ID, "id_entity_type")

    search = ButtonField(By.ID, "bt_submit_entity_search")

    def find_acronym_in_table(self, row: int=1):
        return self.find_element(By.ID, 'td_entity_%d' % row).text
Example #7
0
class SearchOrganizationPage(CommonPageMixin, pypom.Page):

    URL_TEMPLATE = '/organizations/'

    acronym = InputField(By.ID, 'id_acronym')
    name = InputField(By.ID, 'id_name')
    type = SelectField(By.ID, "id_type")

    search = ButtonField(By.ID, "bt_submit_organization_search")

    def find_acronym_in_table(self, row: int=1):
        return self.find_element(By.ID, 'td_organization_%d' % row).text
Example #8
0
class AttachModalPage(AjaxModal):
    type_de_lien = SelectField(By.ID, 'id_link_type')
    save_modal = Link('EducationGroupPage', By.CSS_SELECTOR, '.modal-footer > .btn-primary', 6)
Example #9
0
class LearningUnitProposalEndYearPage(NewLearningUnitProposalPage):
    anac_de_fin = SelectField(By.ID, "id_academic_year")
    type = SelectField(By.ID, 'id_type')