Example #1
0
    def test_code_text(self):
        title = u'Проверка тега <code>'
        main_text = u'printf("test_code");'

        self.create_page.create_simple_topic(self.BLOG, title, main_text)
        self.create_page.form.select_main_text()
        self.create_page.form.code_click()
        self.create_page.form.submit()

        expected_str = '<code>' + main_text + '</code>'

        topic = TopicPage(self.driver).topic
        self.assertIn(expected_str, topic.get_inner_html_text())
Example #2
0
    def test_h6_text(self):
        title = u'Проверка текста H6'
        main_text = u'Заголовок шестого уровня'

        self.create_page.create_simple_topic(self.BLOG, title, main_text)
        self.create_page.form.select_main_text()
        self.create_page.form.h6_text_click()
        self.create_page.form.submit()

        expected_str = '<h6>' + main_text + '</h6>'

        topic = TopicPage(self.driver).topic
        self.assertIn(expected_str, topic.get_inner_html_text())
Example #3
0
    def test_add_link(self):
        title = u'Вставка ссылки'
        main_text = u''

        self.create_page.create_simple_topic(self.BLOG, title, main_text)
        self.create_page.form.add_link_to_main_text(u'http://tech-mail.ru',
                                                    u'Технопарк')
        self.create_page.form.submit()

        topic = TopicPage(self.driver).topic
        self.assertIn('href="http://tech-mail.ru"',
                      topic.get_inner_html_text())
        self.assertEqual(u'Технопарк', topic.get_text())
Example #4
0
    def test_quote_text(self):
        title = u'Проверка цитирования'
        main_text = u'Цитата'

        self.create_page.create_simple_topic(self.BLOG, title, main_text)
        self.create_page.form.select_main_text()
        self.create_page.form.quote_click()
        self.create_page.form.submit()

        expected_str = '<blockquote>' + main_text + '</blockquote>'

        topic = TopicPage(self.driver).topic
        self.assertIn(expected_str, topic.get_inner_html_text())
Example #5
0
    def test_strikethrough_text(self):
        title = u'Проверка перечеркнутого текста'
        main_text = u'Этот текст будет зачеркнут'

        self.create_page.create_simple_topic(self.BLOG, title, main_text)
        self.create_page.form.select_main_text()
        self.create_page.form.strikethrough_text_click()
        self.create_page.form.submit()

        expected_str = '<s>' + main_text + '</s>'

        topic = TopicPage(self.driver).topic
        self.assertIn(expected_str, topic.get_inner_html_text())
Example #6
0
    def test_italic_text(self):
        title = u'Проверка курсива'
        main_text = u'Курсив'

        self.create_page.create_simple_topic(self.BLOG, title, main_text)
        self.create_page.form.select_main_text()
        self.create_page.form.italic_text_click()
        self.create_page.form.submit()

        expected_str = '<em>' + main_text + '</em>'

        topic = TopicPage(self.driver).topic
        self.assertIn(expected_str, topic.get_inner_html_text())
Example #7
0
    def test_bold_text(self):
        title = u'Проверка жирного текста'
        main_text = u'Жирный текст'

        self.create_page.create_simple_topic(self.BLOG, title, main_text)
        self.create_page.form.select_main_text()
        self.create_page.form.bold_text_click()
        self.create_page.form.submit()

        expected_str = '<strong>' + main_text + '</strong>'

        topic = TopicPage(self.driver).topic
        self.assertIn(expected_str, topic.get_inner_html_text())
Example #8
0
    def test_add_user(self):
        title = u'Добавление пользователя'
        main_text = u''
        user = u'Баяндин'

        expected_attr = 'href='

        self.create_page.create_simple_topic(self.BLOG, title, main_text)
        self.create_page.form.add_user(user)
        self.create_page.form.submit()

        topic = TopicPage(self.driver).topic
        inner_html = topic.get_inner_html_text()
        self.assertIn(expected_attr, inner_html)
        self.assertIn(user, inner_html)
Example #9
0
    def test_h4_text(self):
        title = u'Проверка текста H4'
        main_text = u'Заголовок четвертого уровня'

        self.create_page.create_simple_topic(self.BLOG, title, main_text)
        self.create_page.form.select_main_text()
        self.create_page.form.h4_text_click()
        self.create_page.form.submit()

        expected_str = '<h4>' + main_text + '</h4>'

        topic = TopicPage(self.driver).topic
        self.assertIn(expected_str, topic.get_inner_html_text())

        topic.open_blog()
        blog = BlogPage(self.driver).blog
        self.assertIn(expected_str, blog.get_inner_html_text())
Example #10
0
    def test_upload_image(self):
        path_to_image = unicode(
            os.path.dirname(__file__)) + u'/../images/image.png'
        title = u'Загрузка изображения с локального компьютера'
        align = u'left'
        description = u'Кот'

        expected_tag = '<img'
        expected_align = 'align="' + align + '"'
        expected_description = 'title="' + description + '"'

        self.create_page.create_simple_topic(self.BLOG, title, main_text=u'')
        self.create_page.form.upload_image(path_to_image, align, description)
        self.create_page.form.submit()

        topic = TopicPage(self.driver).topic
        inner_html = topic.get_inner_html_text()
        self.assertIn(expected_tag, inner_html)
        self.assertIn(expected_align, inner_html)
        self.assertIn(expected_description, inner_html)
Example #11
0
    def test_marked_list(self):
        title = u'Проверка маркерованного списка'
        first_node = u'Первая строка маркерованного списка'
        second_node = u'Вторая строка маркерованного списка'
        main_text = first_node + u'\n' + second_node

        self.create_page.create_simple_topic(self.BLOG, title, main_text)
        self.create_page.form.select_main_text()
        self.create_page.form.list_click()
        self.create_page.form.submit()

        expected_tag = '<ul>'
        expected_first_node = '<li>' + first_node + '</li>'
        expected_second_node = '<li>' + second_node + '</li>'

        topic = TopicPage(self.driver).topic
        actual_inner_html = topic.get_inner_html_text()
        self.assertIn(expected_tag, actual_inner_html)
        self.assertIn(expected_first_node, actual_inner_html)
        self.assertIn(expected_second_node, actual_inner_html)