Esempio n. 1
0
    def Create_case(self, Case_number, Case_name, delete=False):

        if self.driver.current_url == First_time.Locators.Page_adresses.CASES_PAGE:
            Actions.click_the_button(
                self,
                locator=First_time.Locators.Case_Page_Locators.ADD_CASE_BUTTON)
            Actions.add_text_to_the_field(
                self,
                locator=First_time.Locators.Case_Page_Locators.NUMBER_FIELD,
                text=Case_number)
            Actions.add_text_to_the_field(
                self,
                locator=First_time.Locators.Case_Page_Locators.NAME_FIELD,
                text=Case_name)
            Actions.click_the_button(
                self,
                locator=First_time.Locators.Case_Page_Locators.ADD_BUTTON)
            Actions.wait_time(self, time_to_wait=1)

            # остановился тут
            if Actions.verify_alert_existence(self) == True:
                if self.driver.switch_to_alert(
                ).text == 'Данное дело уже существует':
                    return print('Данное дело уже существует')

            # Задержка на время создания
            #Actions.implicit_time(self)
            Actions.wait_time(self, time_to_wait=10)

            # перед тем как выводить лог сделать проверку + учесть счетчик
            print('Дело создано')

            if delete == True:
                print('Удаляем созданное тестовое дело')
                Actions.click_the_button(self,
                                         locator=First_time.Locators.
                                         Case_Page_Locators.THREE_DOT_BUTTON)
                Actions.click_the_button(self,
                                         locator=First_time.Locators.
                                         Case_Page_Locators.DELETE_CASE_BUTTON)
                Actions.accept_alarm(self)
                Actions.wait_time(self, time_to_wait=5)
                print('Удалено')

        else:
            print("Пользователь не находится на странице /cases")
Esempio n. 2
0
    def Create_person(self, Surname, Name, delete=False):

        if self.driver.current_url == First_time.Locators.Page_adresses.PERSONS_PAGE:
            Actions.click_the_button(self,
                                     locator=First_time.Locators.
                                     Person_Page_Locators.ADD_PERSON_BUTTON)
            Actions.add_text_to_the_field(
                self,
                locator=First_time.Locators.Person_Page_Locators.SURNAME_FIELD,
                text=Surname)
            Actions.add_text_to_the_field(
                self,
                locator=First_time.Locators.Person_Page_Locators.NAME_FIELD,
                text=Name)
            Actions.click_the_button(
                self,
                locator=First_time.Locators.Person_Page_Locators.ADD_BUTTON)
            # Задержка на время создания персоны
            Actions.wait_time(self, time_to_wait=10)

            #перед тем как выводить лог сделать проверку
            print('Персона создана')

            if delete == True:
                print('Удаляем созданную тестовую персону')
                Actions.click_the_button(self,
                                         locator=First_time.Locators.
                                         Person_Page_Locators.THREE_DOT_BUTTON)
                Actions.wait_time(self, time_to_wait=1)
                Actions.click_the_button(
                    self,
                    locator=First_time.Locators.Person_Page_Locators.
                    DELETE_PERSON_BUTTON)
                Actions.wait_time(self, time_to_wait=5)
                Actions.accept_alarm(self)
                Actions.wait_time(self, time_to_wait=7)
                print('Удалено')

        else:
            print("Пользователь не находится на странице /persons")