def test_add_one_element(self):
        Perry = self.actor

        given(Perry).was_able_to(Start.on_the_homepage())
        when(Perry).attempts_to(
            Click.on_the(ADD_REMOVE_ELEMENTS_LINK).then_wait_for(ADD_BUTTON)
        )
        and_(Perry).attempts_to(Click.on_the(ADD_BUTTON).then_wait_for(ADDED_ELEMENTS))
        then(Perry).should_see_the((Number.of(ADDED_ELEMENTS), IsEqualTo(1)))
Пример #2
0
    def test_select_by_value(self):
        Perry = self.actor

        given(Perry).was_able_to(Start.on_the_homepage())
        when(Perry).attempts_to(
            Click.on_the(DROPDOWN_LINK).then_wait_for(THE_DROPDOWN))
        and_(Perry).attempts_to(
            Select.the_option_with_value(2).from_(THE_DROPDOWN))
        then(Perry).should_see_the(
            (Selected.option_from(THE_DROPDOWN), ReadsExactly("Option 2")))
    def test_add_many_elements(self):
        Perry = self.actor
        repeat = random.choice(range(2, 10))

        given(Perry).was_able_to(Start.on_the_homepage())
        when(Perry).attempts_to(
            Click.on_the(ADD_REMOVE_ELEMENTS_LINK).then_wait_for(ADD_BUTTON)
        )
        and_(Perry).attempts_to(
            *(
                Click.on_the(ADD_BUTTON).then_wait_for(ADDED_ELEMENTS)
                for each_time in range(repeat)
            )
        )
        then(Perry).should_see_the((Number.of(ADDED_ELEMENTS), IsEqualTo(repeat)))