def test_insert_image_as_link(self): from_url = u'http://www.zadira.mk.ua/gallery/photos/11530_b.jpg' title = u'Загрузка изображения с внешнего ресурса в качестве ссылки' align = u'right' desctiption = u'Медведь' expected_tag = '<img' expected_align = 'align="' + align + '"' expected_description = 'title="' + desctiption + '"' expected_src = from_url self.create_page.create_simple_topic(self.BLOG, title, u'') self.create_page.form.insert_image(from_url, align, desctiption, as_link=True) self.create_page.form.submit() topic = TopicPage(self.driver).topic topic.open_blog() blog = BlogPage(self.driver).blog inner_html = blog.get_inner_html_text() self.assertIn(expected_tag, inner_html) self.assertIn(expected_src, inner_html) self.assertIn(expected_align, inner_html) self.assertIn(expected_description, inner_html)
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())
def test_cut_tag(self): title = u'Тестирование тега <cut>' short_text = u'Текст в блоге' main_text = u'Текст в топике' text = short_text + u'<cut>' + main_text + u'</cut>' self.create_page.create_simple_topic(self.BLOG, title, text) self.create_page.form.submit() topic = TopicPage(self.driver).topic self.assertEqual(topic.get_title(), title) self.assertEqual(topic.get_text(), short_text + u' ' + main_text) topic.open_blog() blog = BlogPage(self.driver).blog self.assertIn(short_text, blog.get_text()) self.assertNotIn(main_text, blog.get_text())
def test_create_simple_topic(self): title = u'Тестовый заголовок' main_text = u'Основной текст' self.create_page.create_simple_topic(self.BLOG, title, main_text) self.create_page.form.submit() topic = TopicPage(self.driver).topic self.assertEqual(topic.get_title(), title) self.assertEqual(topic.get_text(), main_text) topic.open_blog() blog = BlogPage(self.driver).blog self.assertEqual(blog.get_title(), title) self.assertEqual(blog.get_text(), main_text) topic.delete() self.assertNotEqual(blog.get_title(), title) self.assertNotEqual(blog.get_text(), main_text)