Example #1
0
    def test_existing_people(self):
        # one line expected
        self.setOptionValueByIdAndValue("show_anketa_status-selector", "all")
        person = xsm.Person(self)
        person.last_name = u"Вельтищев"
        person.first_name = u"Михаил"
        person.patronymic = u"Николаевич"
        self.check_filter(
            person.full_alias(), person.short_alias(), 1,
            "Found more than one anketa with exact FIO. "
        )

        # 2 lines expected
        short_aliases = [
            u"Вельтищев Михаил",
            u"Вельтищев Дмитрий",
        ]
        alias = u"Вельтищев"
        for short_alias in short_aliases:
            self.check_filter(alias, short_alias, 1, u"Expected link {} not found. ".format(short_alias))

        # none lines expected
        alias = "qwerty"
        self.check_filter(alias, alias, 0, "This search should return nothing. ")

        # 1 line expected
        alias = u"Демарин Дмитрий"
        self.check_filter(alias, alias, 1, "This search should return one record. ")
    def run(self):
        self.ensure_logged_off()
        self.perform_login_as_admin()
        self.goto_xsm()
        self.gotoUrlByLinkText(u"Лес")
        self.clear_filters()

        self.goto_xsm_add_person()
        person = xsm.Person(self)
        person.input(
            first_name=u"Бруно",
            last_name=u"Понтекорво",
            anketa_status="less",
            forest_1="maybe",
            forest_2="no",
            random=True,
        )

        self.gotoUrlByLinkText(u"Лес")
        self.assertBodyTextPresent(u"ХЗ")
        self.assertBodyTextPresent(u"Не идёт")

        self.clickElementById("clear_forest-submit")
        self.assertBodyTextNotPresent(u"ХЗ")
        self.assertBodyTextNotPresent(u"Не идёт")
Example #3
0
    def run(self):
        self.ensure_logged_off()
        self.perform_login_as_manager()
        self.goto_xsm()
        school = xsm.add_test_school(self)

        self.goto_xsm_all_people()
        self.goto_xsm_add_person()
        teacher = xsm.Person(self)
        teacher.input(
            last_name=u"Мертвая",
            first_name=u"Душа",
            patronymic=u"препода",
            random=True,
            is_teacher=True,
        )
        teacher.back_to_person_view()
        teacher.add_to_school(school)

        self.assertBodyTextPresent(u"Курсы")

        course = self.add_course_to_teacher(teacher)

        self.goto_xsm_courses()
        self.gotoUrlByLinkText(course.course_title)
        self.gotoUrlByLinkText(u"Редактировать преподов")
        self.clickElementById('delete-teacher-submit')
        self.goto_xsm_courses()
        self.assertPhpErrors()
Example #4
0
    def test_department_selector(self):
        self.goto_xsm_all_people()
        self.goto_xsm_add_person()
        department_id = 3  # Математическое
        person = xsm.Person(self)
        person.input(
            last_name=u"Гуглов",
            first_name=u"Индекс",
            patronymic=u"Яхович",
            department_id=department_id,
            is_student=True,
            random=True,
        )
        person.back_to_person_view()

        self.goto_xsm_all_people()
        self.setOptionValueByIdAndValue("show_department_id-selector", department_id)
        alias = person.short_alias()
        self.check_filter(alias, alias, 1, "Search with proper department selection return 1 record. ")

        other_department_id = 2  # Другое
        self.setOptionValueByIdAndValue("show_department_id-selector", other_department_id)
        self.check_filter(
            alias, alias, 1,
            "Search with wrong department should return 1 records with hint about extended search.  ",
            extended_search=True,
        )
Example #5
0
    def test_bulk_archive_impl(self, admin_mode):
        self.ensure_logged_off()
        self.goto_root()
        self._login_as_admin_or_manager(admin_mode)
        self.goto_root()
        self.goto_xsm()
        self.goto_xsm_all_people()
        self.goto_xsm_add_person()
        person = xsm.Person(self)
        person.input(
            last_name=u"Архивариус",
            first_name=u"Пётр",
            patronymic=u"Семёнович",
            anketa_status="declined",
            random=True,
        )
        person.back_to_person_view()
        self.assertElementTextById("anketa_status-span", u"Отклонён")
        self.goto_xsm_anketas()

        self.clickElementById("bulk_archive-submit")
        self.wait(5, "Wait while form resubmits")
        self.check_page_errors()

        self.goto_xsm_anketas()
        if admin_mode:
            self.assertTextNotPresent(
                xpath="//span[@class='anketa-status xe-declined']",
                text=u"Отклонён",
            )
        else:
            self.assertTextPresent(
                xpath="//span[@class='anketa-status xe-declined']",
                text=u"Отклонён",
            )
Example #6
0
    def run(self):
        self.ensure_logged_off()

        self.perform_login_as_manager()

        self.goto_xsm()
        self.goto_xsm_active()
        self.goto_xsm_add_person()

        person = xsm.Person(self)
        person.input(
            last_name=u"Статусов",
            first_name=u"Иннокентий",
            patronymic=u"Петрович",
            random=True,
        )
        person.back_to_person_view()

        self.assertElementTextById("anketa_status-span", u"Активный")

        self.goto_xsm_change_person_status()

        self.setOptionValueByIdAndValue("anketa_status-selector", "discuss")
        comment_text = u"Комментарий к смене статуса " + random_crap.randomCrap(
            5)
        comment_text = self.fillElementById("comment_text-text", comment_text)

        self.clickElementById("update-person_comment-submit")
        self.goto_back_to_person_view()

        self.assertBodyTextPresent(u"Статус Активный изменён на Обсуждается")
        self.assertBodyTextPresent(comment_text)
Example #7
0
    def run(self):
        self.ensure_logged_off()

        inp_login = "******" + rc.random_text(4)
        inp_name = u"XSM-Юзер-"
        u = user.User(self)
        u.create_new_user(
            login=inp_login,
            name=inp_name,
            random=True,
            logout_admin=False,
            manager_rights=True,
        )

        self.closeAdminPanel()
        self.goto_xsm()
        self.goto_xsm_active()
        self.goto_xsm_add_person()
        person = xsm.Person(self)
        person.input(
            last_name=u"ИксЭсЭмов",
            first_name=u"Юзер",
            patronymic=u"Ламерович",
            email=u.email,
            random=True,
        )

        self.goto_root()
        self.performLogoutFromSite()

        if not self.perform_login(u.login, u.password):
            self.failTest("Cannot login as newly created user. ")

        self.gotoCabinet()
        self.assertBodyTextPresent("XSM")
        card_caption = u"Карточка участника в XSM"
        self.assertBodyTextPresent(card_caption)
        xsm_url_text = person.short_alias()
        self.gotoUrlByLinkText(xsm_url_text)
        self.assertBodyTextPresent(person.full_alias(),
                                   "We should get into our XSM person card. ")

        self.goto_root()
        self.performLogoutFromSite()

        self.perform_login_as_admin()
        self.gotoAdminPanel()
        self.gotoUserList()

        self.gotoUrlByPartialLinkText(inp_login,
                                      "Click on user name in the list")

        self.assertBodyTextPresent(card_caption,
                                   "We should see XSM card link. ")
        self.gotoUrlByLinkText(person.short_alias(), "Click on XSM card link")
Example #8
0
 def add_teacher(self):
     self.goto_xsm_all_people()
     self.goto_xsm_add_person()
     teacher = xsm.Person(self)
     teacher.input(
         last_name=u"Мультипреподов",
         first_name=u"Сергей",
         patronymic=u"Викторович",
         random=True,
         is_teacher=True,
     )
     teacher.back_to_person_view()
Example #9
0
    def run(self):
        self.ensure_logged_off()

        self.perform_login_as_manager()

        self.goto_xsm()
        self.goto_xsm_active()
        self.goto_xsm_add_person()

        person = xsm.Person(self)
        person.input(
            last_name=u"Телефонов",
            first_name=u"Самсунг",
            patronymic=u"Нокиевич",
            random=True,
            cellular_list=["+7(900)000-00-00", "+7(900)999-99-99"],
            phone_list=["8-900-000-00-00", "+7-900-999-99-99"],
        )
        person.back_to_person_view()

        person_id = self.get_current_person_id()

        for i in range(0, 2):
            site_cellular_phone = person.get_row_value(person_id, 'cellular',
                                                       i)
            site_phone = person.get_row_value(person_id, 'phone', i)
            self.assert_equal(person.cellular_list[i], site_cellular_phone,
                              "Cell phones #{} do not match. ".format(i))
            self.assert_equal(person.phone_list[i], site_phone,
                              "Phones #{} do not match. ".format(i))

        self.gotoEditPerson()
        person.input(
            phone="+79261112233",
            cellular="89261112233",
        )
        self.goto_back_to_person_view()

        site_cellular_phone = person.get_row_value(person_id, 'cellular', 0)
        site_phone = person.get_row_value(person_id, 'phone', 0)

        self.assert_equal(site_phone, "8(926)111-22-33",
                          "Phone was not autoformatted. ")
        self.assert_equal(site_cellular_phone, "8(926)111-22-33",
                          "Cellular phone was not autoformatted. ")
Example #10
0
    def run(self):
        self.ensure_logged_off()
        self.perform_login_as_manager()
        self.goto_xsm()
        self.goto_xsm_all_people()
        self.goto_xsm_add_person()

        person = xsm.Person(self)
        person.input(
            last_name=u"Аватаров",
            first_name=u"Пётр",
            patronymic=u"Палыч",
            social_profile="https://vk.com/vdm_p",
            random=True,
        )
        person.back_to_person_view()
        self.check_avatar(person, default=False)

        # ok, now let's test xyz100 avatar.
        self.gotoEditPerson()
        person.input(social_profile="http://vk.com/vasya10")
        person.back_to_person_view()
        self.check_avatar(person, default=False)

        # ok, now let's test id123456 avatar.
        self.gotoEditPerson()
        person.input(social_profile="http://vk.com/id777314")
        person.back_to_person_view()
        self.check_avatar(person, default=False)

        # ok, now let's test default avatar.
        self.gotoEditPerson()
        person.input(social_profile="")
        person.back_to_person_view()
        self.check_avatar(person, default=True)

        # ok, now let's test non-existing VK page.
        self.gotoEditPerson()
        person.input(social_profile="http://vk.com/id12345678901234567890")
        person.back_to_person_view()
        self.check_avatar(person, default=True)
    def run(self):
        self.ensure_logged_off()
        person = xsm.Person(self)
        # set some const fields
        person.last_name = u"Спамеров" + random_crap.randomWord(5)
        person.phone = random_crap.phone()
        person.cellular = random_crap.phone()
        person.email = random_crap.email()

        for iteration in range(0, 5):
            self.add_anketa(person, iteration)
            if iteration == 0:
                self.assertBodyTextPresent(
                    self.get_anketa_success_submit_message())
            else:
                self.assertBodyTextNotPresent(
                    self.get_anketa_success_submit_message())
                self.assertBodyTextPresent(
                    self.get_anketa_duplicate_submit_message())

        self.check_unique_anketa(person)
    def run(self):
        self.ensure_logged_off()
        person = xsm.Person(self)
        person.last_name = u"Дубликатов" + random_crap.random_text(5)
        person.phone = random_crap.phone()
        person.cellular = random_crap.phone()
        person.email = random_crap.email()

        self.add_anketa(person)
        self.assertBodyTextPresent(self.get_anketa_success_submit_message())
        self.add_anketa(person)
        self.assertBodyTextNotPresent(self.get_anketa_success_submit_message())
        self.assertBodyTextPresent(self.get_anketa_duplicate_submit_message())
        self.anketa_drilldown(person, jump_into=False)

        self.change_status(person)

        self.add_anketa(person)
        self.assertBodyTextNotPresent(self.get_anketa_success_submit_message())
        self.assertBodyTextPresent(self.get_anketa_duplicate_submit_message())

        self.check_status(person)
Example #13
0
    def test_comments(self):
        # TODO(mvel): в этом месте несколько раз всплывала бага, что текст комментария
        # двоится. Надо добавить код, проверяющий, что этот текст встречается 1 раз на странице.
        self.goto_xsm_all_people()
        self.clear_filters()

        comment_was_set = False
        person = xsm.Person(self)
        # FIXME(mvel): очень неудобный инструментарий работы с checkbox-ами. Нет интерфейса
        # "убедиться, что включено". Надо его добавить и потом проверять, что комментарии есть
        # только тогда, когда включено.
        for i in xrange(2):
            if self.checkBodyTextPresent(u"Добавить комментарий"):
                comment_was_set = True
                comment_text = person.add_comment()
                self.goto_xsm_all_people()
                self.checkBodyTextPresent(comment_text)

            self.clickElementById("show_comments-checkbox")
            self.wait(3, "Wait while form resubmits")
            self.check_page_errors()

        self.assert_equal(comment_was_set, True, "No comment can be added: no links. ")
Example #14
0
    def run(self):
        self.ensure_logged_off()
        self.perform_login_as_manager()
        self.goto_xsm()
        school = xsm.add_test_school(self)

        self.goto_xsm_all_people()
        self.goto_xsm_add_person()
        teacher = xsm.Person(self)
        teacher.input(
            last_name=u"Преподов",
            first_name=u"Александр",
            patronymic=u"Ильич",
            random=True,
            is_teacher=True,
        )
        teacher.back_to_person_view()
        teacher.add_to_school(school)

        self.assertBodyTextPresent(u"Курсы")

        for i in range(0, 3):
            self.add_course_to_teacher(teacher)
Example #15
0
    def test_increase_class_impl(self, admin_mode):
        self.ensure_logged_off()
        self.goto_root()
        self._login_as_admin_or_manager(admin_mode)
        self.goto_root()
        self.goto_xsm()
        self.goto_xsm_all_people()
        self.goto_xsm_add_person()
        raisable_person = xsm.Person(self)
        raisable_person.input(
            last_name=u"Классный",
            first_name=u"Увеличитель",
            patronymic=u"Петрович",
            ank_class=u"7",
            current_class=u"8",
            anketa_status="cont",
            department_id=1,  # поднимаем только физиков пока что
            is_student=True,  # raise only scholars
            random=True,
        )
        raisable_person.back_to_person_view()

        self.goto_xsm_all_people()
        self.goto_xsm_add_person()
        non_raisable_person = xsm.Person(self)
        non_raisable_person.input(
            last_name=u"Классный",
            first_name=u"Подросток",
            patronymic=u"Выпускнович",
            ank_class=u"10",
            current_class=u"11",
            anketa_status="cont",
            department_id=1,  # поднимаем только физиков пока что
            is_student=True,  # raise only scholars
            random=True,
        )
        non_raisable_person.back_to_person_view()

        self.goto_xsm_all_people()
        self.goto_xsm_add_person()
        non_raisable_teacher = xsm.Person(self)
        non_raisable_teacher.input(
            last_name=u"Препод",
            first_name=u"Склассом",
            patronymic=u"Забытович",
            ank_class=u"10",
            current_class=u"3курс",
            anketa_status="cont",
            department_id=1,  # поднимаем только физиков пока что
            is_teacher=True,  # should not be raised
            random=True,
        )
        non_raisable_teacher.back_to_person_view()
        self.goto_xsm_all_people()
        self.clickElementById("increase_class_numbers-submit")
        self.wait(5, "Wait while form resubmits")
        self.check_page_errors()
        if admin_mode:
            # FIXME: wtf??? two commands for link title navigation???
            list_href = self.get_url_by_link_data(u"Вернуться к списку")

        self.gotoSite(list_href)

        self.anketa_drilldown(raisable_person,
                              do_login=False,
                              drilldown_to=xsm.DrilldownTo.ALL_LIST)
        current_class = self.getElementTextById("span-person_current_class")
        if admin_mode:
            self.assert_equal(current_class, "9",
                              "Class was not raised from 8 to 9. ")
        else:
            self.assert_equal(
                current_class, "8",
                "Class should remain the same in non-admin mode. ")

        # test 11 class scholar
        self.goto_xsm_all_people()
        self.anketa_drilldown(non_raisable_person,
                              do_login=False,
                              drilldown_to=xsm.DrilldownTo.ALL_LIST)
        current_class = self.getElementTextById("span-person_current_class")
        if admin_mode:
            self.assert_equal(current_class, "n/a", "Class should be n/a. ")
        else:
            self.assert_equal(
                current_class, "11",
                "Class should remain the same in non-admin mode, not n/a. ")

        # test non-scholar (same effect for both admin/non-admin mode)
        self.goto_xsm_all_people()
        self.anketa_drilldown(non_raisable_teacher,
                              do_login=False,
                              drilldown_to=xsm.DrilldownTo.ALL_LIST)
        current_class = self.getElementTextById("span-person_current_class")
        self.assert_equal(current_class, u"3курс",
                          "Teachers should not be raised. ")
Example #16
0
    def run(self):
        self.ensure_logged_off()

        # anketa fill positive test:
        # all fields are filled with correct values.
        self.goto_root()
        self.goto_anketa()

        person = xsm.Person(self)
        person.input(
            last_name=u"Чапаев",
            first_name=u"Василий",
            patronymic=u"Иваныч",
            birth_date=random_crap.date(),
            school=u"Тестовая школа им. В.Е.Бдрайвера №",
            school_city=u"Школа находится в /var/opt/" + random_crap.random_text(5),
            ank_class=random_crap.randomDigits(1) + u" Гэ",
            cellular="+7" + random_crap.randomDigits(9),
            phone="+7" + random_crap.randomDigits(9),
            email=random_crap.random_text(10) + "@" + random_crap.random_text(6) + ".ru",
            skype=random_crap.random_text(12),
            social_profile=random_crap.randomVkontakte(),
            favourites=random_crap.randomCrap(20, ["multiline"]),
            achievements=random_crap.randomCrap(15, ["multiline"]),
            hobby=random_crap.randomCrap(10, ["multiline"]),
            lesh_ref=random_crap.randomCrap(10, ["multiline"]),
            control_question=u"ампер",
            ank_mode=True,
            random=True,
        )
        self.assertBodyTextPresent(self.get_anketa_success_submit_message())
        inp_social_show = bawlib.cut_http(person.social_profile)

        self.anketa_drilldown(person)

        full_alias = person.full_alias()
        # just check text is on the page.
        logging.info("Checking that all filled fields are displayed on the page")

        self.checkPersonAliasInPersonView(full_alias)

        # TODO(mvel): Extract common checks to module
        self.assertBodyTextPresent(person.birth_date)
        self.assertBodyTextPresent(person.school)
        self.assertBodyTextPresent(person.school_city)
        self.assertBodyTextPresent(person.ank_class)
        self.assertBodyTextPresent(person.phone)
        self.assertBodyTextPresent(person.cellular)
        self.assertBodyTextPresent(person.email)
        self.assertBodyTextPresent(person.skype)
        self.assertBodyTextPresent(inp_social_show)
        self.clickElementById("show-extra-person-info")
        self.wait(1)
        self.assertElementSubTextById("extra-person-info", person.favourites)
        self.assertElementSubTextById("extra-person-info", person.achievements)
        self.assertElementSubTextById("extra-person-info", person.hobby)
        self.assertElementSubTextById("extra-person-info", person.lesh_ref)

        self.add_comments_to_person(person)

        # now, let's change anketa status to "Ждет собеседования"

        self.gotoEditPerson()

        # first, check that values in opened form match entered in anketa.
        self.assertElementValueById("last_name-input", person.last_name)
        self.assertElementValueById("first_name-input", person.first_name)
        self.assertElementValueById("patronymic-input", person.patronymic)
        self.assertElementValueById("birth_date-input", person.birth_date)
        self.assertElementValueById("school-input", person.school)
        self.assertElementValueById("school_city-input", person.school_city)
        self.assertElementValueById("ank_class-input", person.ank_class)
        # current_class should now be equal to ank_class (fresh anketa)
        self.assertElementValueById("current_class-input", person.ank_class)
        self.assertElementValueById("phone-input", person.phone)
        self.assertElementValueById("cellular-input", person.cellular)
        self.assertElementValueById("email-input", person.email)
        self.assertElementValueById("skype-input", person.skype)
        self.assertElementValueById("social_profile-input", person.social_profile)
        self.assertElementValueById("favourites-text", person.favourites)
        self.assertElementValueById("achievements-text", person.achievements)
        self.assertElementValueById("hobby-text", person.hobby)
        self.assertElementValueById("lesh_ref-text", person.lesh_ref)

        self.assertElementValueById("anketa_status-selector", "new")

        # change anketa status and save it.
        self.setOptionValueByIdAndValue("anketa_status-selector", "progress")

        self.clickElementById("update-person-submit")

        self.assertBodyTextPresent(u"Участник успешно сохранён")
        self.goto_back_to_anketa_view()

        self.assertElementTextById("anketa_status-span", u"Ждёт собес.")
Example #17
0
    def run(self):
        self.ensure_logged_off()

        self.listened_status = u"Прослушан"

        self.perform_login_as_manager()
        self.goto_xsm()
        school = xsm.add_test_school(self)

        # add two teachers: 1st with 2 and 2nd with 3 courses
        teachers = []
        for ti in [1, 2]:
            self.goto_xsm_all_people()
            self.goto_xsm_add_person()
            teacher = xsm.Person(self)
            teacher.input(
                last_name=u"Препод_{}ый".format(ti),
                first_name=u"Александр" if ti == 1 else u"Иван",
                patronymic=u"Ильич" if ti == 1 else u"Петрович",
                random=True,
                is_teacher=True,
            )
            teacher.back_to_person_view()
            teacher.add_to_school(school)

            self.assertBodyTextPresent(u"Курсы")

            courses = [
                self.add_course_to_teacher(teacher) for _ in range(0, 1 + ti)
            ]
            # store as custom property
            teacher.courses = courses

            teachers.append(teacher)

        self.goto_xsm_all_people()

        self.goto_xsm_add_person()
        student = xsm.Person(self)
        student.input(
            last_name=u"Зачётов",
            first_name=u"Андрей",
            patronymic=u"Михалыч",
            random=True,
            is_student=True,
        )
        student.back_to_person_view()
        student.add_to_school(school)

        self.assertBodyTextPresent(u"Зачёты")

        course_ids = []
        for teacher in teachers:
            for course in teacher.courses:
                course_ids.append(course.course_id)
        logging.info(course_ids)

        # take some id
        dup_id = course_ids[3]
        self.add_exams_by_id(course_ids)

        self.set_exam_passed([1, 2, 2])
        self.set_exam_not_passed([1, 0])

        # test duplicate exam
        self.add_exam_by_id(dup_id)
        self.assertBodyTextPresent(self.get_exam_already_exists_message())
Example #18
0
    def run(self):
        self.ensure_logged_off()
        self.goto_root()
        self.goto_anketa()

        person = xsm.Person(self)
        # try to submit empty form.
        person.input(ank_mode=True)
        self.ensure_not_submitted("Empty form should not be submitted. ")
        last_name_too_short = u"Поле 'Фамилия' слишком короткое"
        self.assertBodyTextPresent(last_name_too_short)

        # generate some text
        person.last_name = u"Криворучкин" + random_crap.random_text(5)
        person.first_name = u"Хакер" + random_crap.random_text(3)
        person.patronymic = u"Ламерович" + random_crap.random_text(3)
        person.birth_date = random_crap.date()
        person.school = u"Хакерская школа им. К.Митника №" + random_crap.randomDigits(
            4)
        person.school_city = u"Школа находится в /dev/brain/" + random_crap.random_text(
            5)
        person.ank_class = random_crap.randomDigits(1) + u"Х"
        person.phone = random_crap.phone()
        person.cellular = random_crap.phone()
        person.email = random_crap.email()
        person.skype = random_crap.random_text(12)
        person.social_profile = random_crap.randomVkontakte()
        social_profile_show = bawlib.cut_http(person.social_profile)

        favourites = random_crap.randomCrap(20, ["multiline"])
        achievements = random_crap.randomCrap(15, ["multiline"])
        hobby = random_crap.randomCrap(10, ["multiline"])

        # try fill only surname
        person.input(last_name=person.last_name, ank_mode=True)
        self.ensure_not_submitted("Only Last name was filled. ")
        self.assertBodyTextPresent(u"Поле 'Имя' слишком короткое")

        person.input(first_name=person.first_name, ank_mode=True)
        self.ensure_not_submitted("Only Last name and First name was filled. ")
        self.assertBodyTextPresent(u"Поле 'Отчество' слишком короткое")

        person.input(patronymic=person.patronymic, ank_mode=True)
        self.ensure_not_submitted("Only FIO values were filled. ")
        self.assertBodyTextPresent(u"Класс не указан")

        person.input(
            birth_date=person.birth_date,
            school=person.school,
            school_city=person.school_city,
            ank_class=person.ank_class,
            ank_mode=True,
        )
        self.ensure_not_submitted("Phone fields were not filled. ")
        self.assertBodyTextPresent(
            u"Укажите правильно хотя бы один из телефонов")

        person.input(
            phone=person.phone,
            cellular=person.cellular,
            email=person.email,
            skype=person.skype,
            social_profile=person.social_profile,
            ank_mode=True,
        )
        self.ensure_not_submitted("Invalid control question answer. ")
        self.assertBodyTextPresent(u"Неправильный ответ на контрольный вопрос")

        person.input(control_question=u"ампер", ank_mode=True)
        self.ensure_not_submitted("Favourites were not filled")
        are_you_sure = u"Если Вы уверены, что не хотите указывать эту информацию"
        self.assertBodyTextPresent(are_you_sure)

        person.input(favourites=favourites, ank_mode=True)
        self.ensure_not_submitted("Achievements were not filled")
        self.assertBodyTextPresent(are_you_sure)

        person.input(achievements=achievements, ank_mode=True)
        self.ensure_not_submitted("Hobbies were not filled")
        self.assertBodyTextPresent(are_you_sure)

        # and now fill last optional field and erase one of very important fields.
        person.input(
            last_name="",
            hobby=hobby,
            ank_mode=True,
        )
        self.ensure_not_submitted("Empty last name is not allowed. ")
        self.assertBodyTextPresent(last_name_too_short)

        # fill it again.
        person.input(
            last_name=u"НаученныйГорькимОпытом" + random_crap.random_text(5),
            hobby="",
            ank_mode=True,
        )
        self.ensure_not_submitted("Hobbies were erased")
        self.assertBodyTextPresent(are_you_sure)

        # now erase achievements.
        person.input(
            achievements="",
            ank_mode=True,
        )
        self.ensure_not_submitted(
            "Enter confirmation mode with erased field 'A' "
            "and remove another field 'B'. Revalidation check after bug #529")
        person.input(
            hobby=hobby,
            achievements=achievements,
            ank_mode=True,
        )

        self.anketa_drilldown(person)

        # just check text is on the page.
        logging.info(
            "Checking that all filled fields are displayed on the page. ")
        self.checkPersonAliasInPersonView(person.full_alias())

        self.assertBodyTextPresent(person.birth_date)
        self.assertBodyTextPresent(person.school)
        self.assertBodyTextPresent(person.school_city)
        self.assertBodyTextPresent(person.ank_class)
        self.assertBodyTextPresent(person.phone)
        self.assertBodyTextPresent(person.cellular)
        self.assertBodyTextPresent(person.email)
        self.assertBodyTextPresent(person.skype)
        self.assertBodyTextPresent(social_profile_show)
        self.clickElementById("show-extra-person-info")
        self.wait(1)
        self.assertElementSubTextById("extra-person-info", favourites)
        self.assertElementSubTextById("extra-person-info", achievements)
        self.assertElementSubTextById("extra-person-info", hobby)
Example #19
0
    def run(self):
        return
        # TODO(nata-skr): finish
        self.ensure_logged_off()

        # anketa fill positive test:
        # all fields are filled with correct values.
        self.goto_root()
        self.goto_anketa()

        person = xsm.Person(self)
        person.input(
            last_name=u"Ландау",
            first_name=u"Лев",
            patronymic=u"Давидович",
            birth_date=random_crap.date(),
            school=u"Тестовая школа им. В.Е.Бдрайвера №",
            school_city=u"Школа находится в /var/opt/" + random_crap.random_text(5),
            ank_class=random_crap.randomDigits(1) + u" Гэ",
            cellular="+7" + random_crap.randomDigits(9),
            phone="+7" + random_crap.randomDigits(9),
            email=random_crap.random_text(10) + "@" + random_crap.random_text(6) + ".ru",
            skype=random_crap.random_text(12),
            social_profile=random_crap.randomVkontakte(),
            favourites=random_crap.randomCrap(20, ["multiline"]),
            achievements=random_crap.randomCrap(15, ["multiline"]),
            hobby=random_crap.randomCrap(10, ["multiline"]),
            lesh_ref=random_crap.randomCrap(10, ["multiline"]),
            control_question=u"ампер",
            ank_mode=True,
        )
        self.assertBodyTextPresent(self.get_anketa_success_submit_message())
        # inp_social_show = bawlib.cut_http(person.social_profile)

        # now login as admin
        inp_last_name = person.last_name
        self.anketa_drilldown(person)
        # now, let's change anketa status to "Ждет собеседования"

        self.gotoEditPerson()

        # change anketa status and save it.
        self.setOptionValueByIdAndValue("anketa_status-selector", "progress")

        self.clickElementById("update-person-submit")

        self.assertBodyTextPresent(u"Участник успешно сохранён")

        self.gotoUrlByLinkText(u"Лес")

        # create new person
        """self.clickElementById("clear_forest-submit")
        self.gotoUrlByLinkText(u"Добавить участника")
        self.setOptionValueByIdAndValue("anketa_status-selector", "less")
        inp_first_name = u"Ричард" + random_crap.random_text(6)
        inp_last_name = u"Фейнман" + random_crap.random_text(6)

        inp_first_name = self.fillElementByName("first_name", inp_first_name)
        inp_last_name = self.fillElementByName("last_name", inp_last_name)

        self.setOptionValueByIdAndValue("forest_1-selector", "maybe")
        self.clickElementById("update-person-submit")
        self.assertBodyTextPresent(u"Участник успешно сохранён")

        self.gotoUrlByLinkText(u"Лес")"""

        self.filter_person(fio=inp_last_name)
        # self.assertBodyTextPresent(u"ХЗ")
        time.sleep(5)
        self.doubeClickElementById("p1-forest_1-span")
        val = selenium_test.get_value(self.getElementById("forest_1-selector"))
        if val != "undef":
            self.failTest("Incorrect value in forest selector")
        logging.info("Element value: {0}".format(val))
        self.setOptionValueByIdAndValue("forest_1-selector", "no")

        self.assertBodyTextPresent(u"Не идёт")
        time.sleep(5)
        self.doubeClickElementById("p1-forest_1-span")
        val = selenium_test.get_value(self.getElementById("forest_1-selector"))
        if val != "no":
            self.failTest("Incorrect value in forest selector")
    def run(self):
        """
        Look for the class documentation
        :return: None
        """
        self.ensure_logged_off()
        self.perform_login_as_manager()
        self.goto_xsm()

        self.goto_xsm_all_people()
        self.clear_filters()

        # obtain fresh member
        person_unique = 0
        base_name = u"Анкеткин_"
        page_content = self.getPageContent()
        while base_name + str(person_unique) in page_content:
            person_unique += 1

        self.goto_xsm_schools()
        school = xsm.add_named_school(self, _SCHOOL_NAME)
        school_id = xsm.get_school_id(self, _SCHOOL_NAME)
        self.gotoUrlByLinkText(u"Участники школ")
        if not self.get_url_by_link_data(school.school_title, fail=False):
            # school is hidden in school selector
            self.setOptionValueByIdAndValue("view-school-selector", school_id)

        self.gotoUrlByLinkText(school.school_title)
        self.gotoUrlByLinkText(u"Добавить нового участника")
        person = xsm.Person(self)
        last_name = base_name + str(person_unique)
        first_name = u"Егор"
        person.input(
            last_name=last_name,
            first_name=first_name,
            patronymic=u"Петрович",
            birth_date=u"11.11.1111",
            school=u"Какая-то школа №0000",
            school_city=u"Магадан-23",
            ank_class=u"15 В",
            phone=u"8800" + str(random.randint(100000, 899999)),
            cellular=u"8800" + str(random.randint(100000, 899999)),
            email=u"spaminatro" + str(random.randint(10000, 89999)) +
            "@10minutemail.com",
            ank_mode=False,
        )
        self.assertBodyTextPresent(u"Участник успешно сохранён")
        self.gotoUrlByLinkText(school.school_title)
        self.gotoUrlByLinkText(u"Добавить нового участника")
        person.input(
            last_name=last_name,
            first_name=first_name,
            ank_mode=False,
            expect=person.EXP_DUPLICATE,
        )
        self.gotoUrlByLinkText(school.school_title)
        self.gotoUrlByLinkText(person.last_name + u" " + person.first_name)
        self.gotoUrlByLinkTitle(u"Отчислить с " + school.school_title)
        self.clickElementById("confirm-delete-person_school-submit")
        self.gotoUrlByLinkText(u"Участники школ")
        if not self.get_url_by_link_data(school.school_title, fail=False):
            # school is hidden in school selector
            self.setOptionValueByIdAndValue("view-school-selector", school_id)

        self.gotoUrlByLinkText(school.school_title)
        self.gotoUrlByLinkText(u"Добавить нового участника")
        person.input(
            last_name=last_name,
            first_name=first_name,
            ank_mode=False,
            expect=person.EXP_NOT_AT_SCHOOL,
        )
        self.clickElementById("update-person-submit")
        self.assertBodyTextPresent(u"Участник успешно сохранён")
Example #21
0
    def run(self):
        self.ensure_logged_off()
        # anketa fill/edit positive test:
        # fields are filled with correct values.
        self.goto_root()
        self.goto_anketa()

        person = xsm.Person(self)
        person.input(
            last_name=u"Анкеткин",
            first_name=u"Егор",
            patronymic=u"Петрович",
            birth_date=random_crap.date(),
            school=u"Какая-то школа №" + random_crap.randomDigits(4),
            school_city=u"Магадан-" + random_crap.random_text(5),
            ank_class=random_crap.randomDigits(1) + u" В",
            phone=random_crap.phone(),
            cellular=random_crap.phone(),
            email=random_crap.email(),
            control_question=u"ампер",
            ank_mode=True,
            random=True,
        )
        # we will be warned about unfilled fields
        self.assertBodyTextPresent(u"ещё раз")
        self.clickElementById("submit_anketa-submit")
        self.assertBodyTextPresent(self.get_anketa_success_submit_message())

        self.anketa_drilldown(person)

        # just check text is on the page.
        print "Checking that filled fields are displayed on the page. "

        self.checkPersonAliasInPersonView(person.full_alias())

        self.assertBodyTextPresent(person.birth_date)
        self.assertBodyTextPresent(person.school)
        self.assertBodyTextPresent(person.school_city)
        self.assertBodyTextPresent(person.ank_class)
        self.assertBodyTextPresent(person.phone)
        self.assertBodyTextPresent(person.cellular)
        self.assertBodyTextPresent(person.email)

        # now, let's edit anketa.
        self.gotoEditPerson()

        # first, check that values in opened form match entered in anketa.
        self.assertElementValueById("last_name-input", person.last_name)
        self.assertElementValueById("first_name-input", person.first_name)
        self.assertElementValueById("patronymic-input", person.patronymic)
        self.assertElementValueById("birth_date-input", person.birth_date)
        self.assertElementValueById("school-input", person.school)
        self.assertElementValueById("school_city-input", person.school_city)
        self.assertElementValueById("ank_class-input", person.ank_class)
        # current_class should now be equal to ank_class (fresh anketa)
        self.assertElementValueById("current_class-input", person.ank_class)
        self.assertElementValueById("phone-input", person.phone)
        self.assertElementValueById("cellular-input", person.cellular)
        self.assertElementValueById("email-input", person.email)

        self.assertElementValueById("anketa_status-selector", "new")
        # change anketa field and save it.
        person.input(
            skype=random_crap.random_text(8),
        )
        self.assertBodyTextPresent(u"Участник успешно сохранён")
        self.goto_back_to_anketa_view()

        # check bug
        self.assertElementTextById("anketa_status-span", u"Новый")

        self.anketa_drilldown(person, do_login=False)
Example #22
0
    def run(self):
        self.ensure_logged_off()

        # anketa fill positive test:
        # all fields are filled with correct values.
        self.goto_root()
        self.goto_anketa_teacher()

        person = xsm.Person(self)
        person.input(
            last_name=u"Учитель",
            first_name=u"Алексей",
            patronymic=u"Иваныч",
            birth_date=random_crap.date(),
            school=u"Тестовый ВУЗ им. В.Е.Бдрайвера №",
            cellular="+7" + random_crap.randomDigits(9),
            email=random_crap.random_text(10) + "@" +
            random_crap.random_text(6) + ".ru",
            social_profile=random_crap.randomVkontakte(),
            # опыт преподавания
            achievements=random_crap.randomCrap(15, ["multiline"]),
            control_question=u"пять",
            ank_mode=True,
            random=True,
        )
        self.assertBodyTextPresent(
            self.get_anketa_teacher_success_submit_message())
        inp_social_show = bawlib.cut_http(person.social_profile)

        self.anketa_drilldown(person)

        full_alias = person.full_alias()
        # just check text is on the page.
        logging.info(
            "Checking that all filled fields are displayed on the page")

        self.checkPersonAliasInPersonView(full_alias)

        # TODO(mvel): Extract common checks to module
        self.assertBodyTextPresent(person.birth_date)
        self.assertBodyTextPresent(person.school)
        self.assertBodyTextPresent(person.cellular)
        self.assertBodyTextPresent(person.email)
        self.assertBodyTextPresent(inp_social_show)

        self.clickElementById("show-extra-person-info")
        self.wait(1)

        self.assertElementSubTextById("extra-person-info", person.achievements)

        self.add_comments_to_person(person)

        # now, let's change anketa status to "Ждет собеседования"
        self.gotoEditPerson()

        # first, check that values in opened form match entered in anketa.
        self.assertElementValueById("last_name-input", person.last_name)
        self.assertElementValueById("first_name-input", person.first_name)
        self.assertElementValueById("patronymic-input", person.patronymic)
        self.assertElementValueById("birth_date-input", person.birth_date)
        self.assertElementValueById("school-input", person.school)
        self.assertElementValueById("cellular-input", person.cellular)
        self.assertElementValueById("email-input", person.email)
        self.assertElementValueById("social_profile-input",
                                    person.social_profile)

        self.assertElementValueById("anketa_status-selector", "new")

        # change anketa status and save it.
        self.setOptionValueByIdAndValue("anketa_status-selector", "progress")

        self.clickElementById("update-person-submit")

        self.assertBodyTextPresent(u"Участник успешно сохранён")
        self.goto_back_to_anketa_view()

        self.assertElementTextById("anketa_status-span", u"Ждёт собес.")