예제 #1
0
    def test_new_a_topic_success(self):
        '''
        测试成功创建一篇文章
        :return:
        '''
        login_page = LoginPage(self.driver)
        dashboard_page = login_page.login_as_pyse17()
        topic_list_page = dashboard_page.navigate_to_topic_list_page()
        new_topic_page = topic_list_page.navigate_to_write_topic_page()

        # 创建新文章
        topic_title = "Pansc Tests Creating a new topic: time: {}".format(
            time.ctime())
        topic_content = topic_title + "\n this is the content"
        post_id = new_topic_page.write_and_push_a_new_topic(
            topic_title, topic_content)  #获取创建的新文章的post_id

        # 到topiclistpage页面验证新发布的topic已经展示在list上
        topic_list_page = TopicListPage(self.driver)
        save_screenshot_wrapper(self.driver, 1)

        topic_list_text = topic_list_page.get_topic_text_by_post_id(post_id)
        print("post_id :" + topic_title)
        print("topic_list_text :" + topic_list_text)
        self.assertEqual(topic_title, topic_list_text)
예제 #2
0
    def _new_a_topic(self):
        login_page = LoginPage(self.driver)
        dashboard_page = login_page.login_as_pyse17()
        topic_list_page = dashboard_page.navigate_to_topic_list_page()
        new_topic_page = topic_list_page.navigate_to_write_topic_page()

        # 创建新文章
        topic_title = "Pansc Tests Creating a new topic: time: {}".format(
            time.ctime())
        topic_content = topic_title + "\n this is the content"
        post_id = new_topic_page.write_and_push_a_new_topic(
            topic_title, topic_content)  #获取创建的新文章的post_id

        return post_id