Esempio n. 1
0
    def input_person_data(person):
        iteration = 0
        fmt = u"iteration {0}_{1}"
        crap_params = 15, ["multiline"]
        crap_func = random_crap.randomCrap
        crap_end = " CRAP_END"
        fav = crap_func(*crap_params) + crap_end
        ach = crap_func(*crap_params) + crap_end
        hob = crap_func(*crap_params) + crap_end
        src = crap_func(*crap_params) + crap_end

        person.input(
            # const fields
            last_name=person.last_name,
            first_name=u"Пётр",
            patronymic=u"Сергеевич",
            birth_date=random_crap.date(),
            phone=person.phone,
            cellular=person.cellular,
            email=person.email,
            # random crap that can vary from submission to submission
            school=u"Школа дубликатов № " + random_crap.randomDigits(4),
            school_city=u"Дублёво-" + random_crap.randomDigits(2),
            ank_class=random_crap.randomDigits(1) + u" Жэ",
            skype=random_crap.random_text(8),
            social_profile=random_crap.randomVkontakte(),
            favourites=fmt.format(iteration, fav),
            achievements=fmt.format(iteration, ach),
            hobby=fmt.format(iteration, hob),
            lesh_ref=fmt.format(iteration, src),
            control_question=u"Ампер",
            ank_mode=True,
        )
Esempio n. 2
0
    def input_person_data(person):
        iteration = 0
        fmt = u"iteration {0}_{1}"
        crap_params = 15, ["multiline"]
        crap_func = random_crap.randomCrap
        crap_end = " CRAP_END"
        fav = crap_func(*crap_params) + crap_end
        ach = crap_func(*crap_params) + crap_end
        hob = crap_func(*crap_params) + crap_end
        src = crap_func(*crap_params) + crap_end

        person.input(
            # const fields
            last_name=person.last_name,
            first_name=u"Пётр",
            patronymic=u"Сергеевич",
            birth_date=random_crap.date(),
            phone=person.phone,
            cellular=person.cellular,
            email=person.email,
            # random crap that can vary from submission to submission
            school=u"Школа дубликатов № " + random_crap.randomDigits(4),
            school_city=u"Дублёво-" + random_crap.randomDigits(2),
            ank_class=random_crap.randomDigits(1) + u" Жэ",
            skype=random_crap.random_text(8),
            social_profile=random_crap.randomVkontakte(),
            favourites=fmt.format(iteration, fav),
            achievements=fmt.format(iteration, ach),
            hobby=fmt.format(iteration, hob),
            lesh_ref=fmt.format(iteration, src),
            control_question=u"Ампер",
            ank_mode=True,
        )
    def input_person_data(person, iteration, random=False):
        fmt = u"iteration {0}_{1}"
        if not random:
            fav = "my_favourites"
            ach = "some_achievements"
            hob = "different_hobbies"
            src = "wtf_source"
        else:
            crap_params = 15, ["multiline"]
            crap_func = random_crap.randomCrap
            crap_end = " CRAP_END"
            fav = crap_func(*crap_params) + crap_end
            ach = crap_func(*crap_params) + crap_end
            hob = crap_func(*crap_params) + crap_end
            src = crap_func(*crap_params) + crap_end

        person.input(
            # const fields
            last_name=person.last_name,
            first_name=u"Егор",
            patronymic=u"Фёдорович",
            birth_date=random_crap.date(),
            phone=person.phone,
            cellular=person.cellular,
            email=person.email,
            # random crap that can vary from submission to submission
            school=u"Школа спамеров №",
            school_city=u"Спамерово",
            ank_class=random_crap.randomDigits(1) + u" Жэ",
            skype=random_crap.random_text(8),
            social_profile=random_crap.randomVkontakte(),
            favourites=fmt.format(iteration, fav),
            achievements=fmt.format(iteration, ach),
            hobby=fmt.format(iteration, hob),
            lesh_ref=fmt.format(iteration, src),
            control_question=u"Ампер",
            ank_mode=True,
        )
    def input_person_data(person, iteration, random=False):
        fmt = u"iteration {0}_{1}"
        if not random:
            fav = "my_favourites"
            ach = "some_achievements"
            hob = "different_hobbies"
            src = "wtf_source"
        else:
            crap_params = 15, ["multiline"]
            crap_func = random_crap.randomCrap
            crap_end = " CRAP_END"
            fav = crap_func(*crap_params) + crap_end
            ach = crap_func(*crap_params) + crap_end
            hob = crap_func(*crap_params) + crap_end
            src = crap_func(*crap_params) + crap_end

        person.input(
            # const fields
            last_name=person.last_name,
            first_name=u"Егор",
            patronymic=u"Фёдорович",
            birth_date=random_crap.date(),
            phone=person.phone,
            cellular=person.cellular,
            email=person.email,
            # random crap that can vary from submission to submission
            school=u"Школа спамеров №",
            school_city=u"Спамерово",
            ank_class=random_crap.randomDigits(1) + u" Жэ",
            skype=random_crap.random_text(8),
            social_profile=random_crap.randomVkontakte(),
            favourites=fmt.format(iteration, fav),
            achievements=fmt.format(iteration, ach),
            hobby=fmt.format(iteration, hob),
            lesh_ref=fmt.format(iteration, src),
            control_question=u"Ампер",
            ank_mode=True,
        )
    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)
Esempio n. 6
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"Ждёт собес.")
Esempio n. 7
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")
Esempio n. 8
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)
    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"Ждёт собес.")
Esempio n. 10
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"Ждёт собес.")