Ejemplo n.º 1
0
    def test_schedule_edition(self, config, setup, teardown):
        global schedule_name
        user = GkrUserSteps(config)
        db_user = GkrDbSteps(config)
        schedule_page = SchedulePage(config)

        schedule = random_schedule()
        schedule_name = schedule.name
        db_user.creates_schedule(schedule)

        user.opens(Urls.ADMIN_SCHEDULE.url)

        user.chooses_from_select(schedule_page.SCHEDULE_LIST, schedule.name)
        tue = schedule_page.SETTINGS_TABLE.get_row_by_name('Вторник')

        time_from = '08:00'
        time_to = '18:00'
        break_from = '13:00'
        break_to = '14:00'
        duration = '45'
        value = 'value'

        user.enters_text(tue.time_from, time_from)
        user.enters_text(tue.time_to, time_to)
        user.enters_text(tue.break_from, break_from)
        user.enters_text(tue.break_to, break_to)
        user.enters_text(tue.duration, duration)
        user.clicks(schedule_page.SAVE)
        user.waits_for_ajax()
        user.should_see_element_with_text(schedule_page.SUCCESS_MESSAGE,
                                          ConfirmationMessages.SCHEDULE_SAVED)
        user.reloads_page()

        user.chooses_from_select(schedule_page.SCHEDULE_LIST, schedule.name)
        user.waits_for_ajax()
        tue = schedule_page.SETTINGS_TABLE.get_row_by_name('Вторник')
        user.should_see_attribute_value(tue.time_from, value, time_from)
        user.should_see_attribute_value(tue.time_to, value, time_to)
        user.should_see_attribute_value(tue.break_from, value, break_from)
        user.should_see_attribute_value(tue.break_to, value, break_to)
        user.should_see_attribute_value(tue.duration, value, duration)
Ejemplo n.º 2
0
    def test_schedule_deletion(self, config, setup):
        user = GkrUserSteps(config)
        db_user = GkrDbSteps(config)
        schedule_page = SchedulePage(config)

        schedule = random_schedule()
        db_user.creates_schedule(schedule)

        user.opens(Urls.ADMIN_SCHEDULE.url)

        user.chooses_from_select(schedule_page.SCHEDULE_LIST, schedule.name)
        user.clicks(schedule_page.DELETE)
        user.waits_for_alert()
        user.accepts_alert()
        user.should_see_element_with_text(
            schedule_page.SUCCESS_MESSAGE,
            ConfirmationMessages.SCHEDULE_REMOVED)

        user.waits_for_ajax()
        user.reloads_page()

        user.should_not_see_text_in_select(schedule_page.SCHEDULE_LIST,
                                           schedule.name)