def assert_that_poll_question_are_sent_out_to_contacts(self, number_of_contact_for_poll, question):
     SplinterWrapper.open('/router/console')
     rows = rows_of_table_by_class(self.browser, 'messages module')
     total = 0
     for row in rows:
         if row.find_by_tag('td').first.text == question:
             total += 1
     self.assertEqual(total, number_of_contact_for_poll)
 def assert_that_poll_question_are_sent_out_to_contacts(
         self, number_of_contact_for_poll, question):
     SplinterWrapper.open('/router/console')
     rows = rows_of_table_by_class(self.browser, 'messages module')
     total = 0
     for row in rows:
         if row.find_by_tag('td').first.text == question:
             total += 1
     self.assertEqual(total, number_of_contact_for_poll)
    def respond_to_the_started_poll(cls, sender, message):
        SplinterWrapper.open('/router/console/')
        rows_responses = rows_of_table_by_class(cls.browser, "messages module")
        number_of_responses = len(rows_responses)

        form_data = {"text": message, "sender": sender}
        fill_form(cls.browser, form_data, True)
        cls.browser.find_by_css("input[type=submit]").first.click()
        return number_of_responses
    def respond_to_the_started_poll(cls, sender, message):
        SplinterWrapper.open('/router/console/')
        rows_responses = rows_of_table_by_class(cls.browser, "messages module")
        number_of_responses = len(rows_responses)

        form_data = {
            "text": message,
            "sender": sender
        }
        fill_form(cls.browser, form_data, True)
        cls.browser.find_by_css("input[type=submit]").first.click()
        return number_of_responses
    def test_that_polls_can_be_responded(self):
        SplinterWrapper.open('/router/console/')
        number_of_responses = len(rows_of_table_by_class(self.browser, "messages module"))
        self.respond_to_the_started_poll("0794339344", "yes")

        self.assert_that_number_of_responses_increase_by(number_of_responses, 1)
 def assert_that_number_of_responses_increase_by(self, number_of_responses, increment):
     SplinterWrapper.open('/router/console')
     rows_responses = rows_of_table_by_class(self.browser, "messages module")
     self.assertEqual(len(rows_responses), number_of_responses + increment)
 def assert_that_number_of_responses_increase_by(self, number_of_responses,
                                                 increment):
     SplinterWrapper.open('/router/console')
     rows_responses = rows_of_table_by_class(self.browser,
                                             "messages module")
     self.assertEqual(len(rows_responses), number_of_responses + increment)