def test_that_article_can_be_created(self, mozwebqa):
        """
           Creates a new knowledge base article.
           Verifies creation.
           Deletes the article
        """
        kb_new_article = KnowledgeBaseNewArticle(mozwebqa)
        kb_article_history = KnowledgeBaseShowHistory(mozwebqa)
        kb_edit_article = KnowledgeBaseEditArticle(mozwebqa)
        login_pg = LoginPage(mozwebqa)

        # Admin account is used as he can delete the article
        login_pg.log_in('admin')

        article_info_dict = self._create_new_generic_article(kb_new_article)
        kb_new_article.submit_article()
        kb_new_article.set_article_comment_box()

        # verify article history
        Assert.true(kb_article_history.is_the_current_page)

        # verify article contents
        kb_article_history.navigation.click_edit_article()

        actual_summary_text = kb_edit_article.article_summary_text
        Assert.equal(article_info_dict['summary'], actual_summary_text)

        actual_contents_text = kb_edit_article.article_contents_text
        Assert.equal(article_info_dict['content'], actual_contents_text)

        # delete the same article
        kb_edit_article.navigation.click_show_history()
        kb_article_history.delete_entire_article_document()
    def test_that_article_can_be_deleted(self, mozwebqa):
        """
           Creates a new knowledge base article.
           Deletes the article.
           Verifies the deletion.
        """
        kb_new_article = KnowledgeBaseNewArticle(mozwebqa)
        kb_article = KnowledgeBaseArticle(mozwebqa)
        kb_article_history = KnowledgeBaseShowHistory(mozwebqa)
        login_pg = LoginPage(mozwebqa)

        # Admin account is used as he can delete the article
        login_pg.log_in('admin')

        article_info_dict = self._create_new_generic_article(kb_new_article)

        kb_new_article.submit_article()
        kb_new_article.set_article_comment_box()

        # go to article and get URL
        kb_article_history.navigation.click_article()
        article_url = kb_article.url_current_page

        # delete the same article
        kb_article.navigation.click_show_history()
        kb_article_history.delete_entire_article_document()

        kb_article_history.selenium.open(article_url)
        actual_page_title = kb_article_history.page_title
        Assert.contains("Page Not Found", actual_page_title)
Example #3
0
    def test_logout_from_new_kb_article_page(self, base_url, selenium, variables):
        user = variables["users"]["default"]
        page = KnowledgeBaseNewArticle(base_url, selenium).open(user["username"], user["password"])
        assert page.header.is_user_logged_in, "User not shown to be logged in"

        # sign out
        login_page = page.sign_out()
        assert login_page.canonical_url in selenium.current_url
        assert login_page.header.is_user_logged_out
Example #4
0
    def test_logout_from_new_kb_article_page(self, base_url, selenium,
                                             variables):
        user = variables['users']['default']
        page = KnowledgeBaseNewArticle(base_url,
                                       selenium).open(user['username'],
                                                      user['password'])
        assert page.header.is_user_logged_in, 'User not shown to be logged in'

        # sign out
        login_page = page.sign_out()
        assert login_page.canonical_url in selenium.current_url
        assert login_page.header.is_user_logged_out
    def test_that_article_can_be_previewed_before_submitting(self, mozwebqa):

        kb_new_article = KnowledgeBaseNewArticle(mozwebqa)
        login_pg = LoginPage(mozwebqa)

        # Admin account is used as he can delete the article
        login_pg.log_in('admin')

        article_info_dict = self._create_new_generic_article(kb_new_article)

        kb_new_article.click_article_preview_button()
        actual_preview_text = kb_new_article.get_article_preview_text()

        Assert.equal(article_info_dict['content'], actual_preview_text)
    def test_that_article_can_be_edited(self, mozwebqa):
        """
           Creates a new knowledge base article.
           Verifies creation.
           Edits the article, verifies the edition.
           Deletes the article
        """
        kb_new_article = KnowledgeBaseNewArticle(mozwebqa)
        kb_article_history = KnowledgeBaseShowHistory(mozwebqa)
        kb_edit_article = KnowledgeBaseEditArticle(mozwebqa)
        login_pg = LoginPage(mozwebqa)

        # Admin account is used as he can delete the article
        login_pg.log_in('admin')

        article_info_dict = self._create_new_generic_article(kb_new_article)
        kb_new_article.submit_article()
        kb_new_article.set_article_comment_box()

        # verify article history
        Assert.true(kb_article_history.is_the_current_page)

        # edit that same article
        timestamp = datetime.datetime.now()
        edited_article_summary = "this is an automated summary__%s_edited" % timestamp
        edited_article_content = "automated content__%s_edited" % timestamp
        article_info_dict_edited = {'title': article_info_dict['title'],\
                                    'category': 'How to', 'keyword': 'test',\
                                    'summary': edited_article_summary, 'content': edited_article_content}

        kb_article_history.navigation.click_edit_article()
        kb_edit_article.edit_article(article_info_dict_edited)

        kb_article_history.navigation.click_edit_article()

        # verify the contents of the edited article
        actual_page_title = kb_edit_article.page_title
        Assert.contains(article_info_dict_edited['title'], actual_page_title)

        actual_summary_text = kb_edit_article.article_summary_text
        Assert.equal(edited_article_summary, actual_summary_text)

        actual_content_text = kb_edit_article.article_contents_text
        Assert.equal(edited_article_content, actual_content_text)

        # delete the same article
        kb_edit_article.navigation.click_show_history()
        kb_article_history.delete_entire_article_document()
Example #7
0
    def test_that_article_can_be_deleted(self, base_url, selenium, variables):
        """
           Creates a new knowledge base article.
           Deletes the article.
           Verifies the deletion.
        """
        user = variables['users']['admin']
        kb_new_article = KnowledgeBaseNewArticle(base_url, selenium).open(
            user['username'], user['password'])

        # create a new article
        mock_article = MockArticle()
        kb_new_article.set_article(mock_article)
        kb_new_article.submit_article()
        kb_article_history = kb_new_article.set_article_comment_box(mock_article['comment'])

        # go to article and get URL
        kb_article = kb_article_history.navigation.click_article()
        article_url = kb_article.url_current_page

        # delete the same article
        kb_article_history = kb_article.navigation.click_show_history()
        kb_article_history.delete_entire_article_document()

        kb_article_history.selenium.get(article_url)
        actual_page_title = kb_article_history.page_title
        assert "Page Not Found" in actual_page_title
Example #8
0
    def test_that_article_can_be_created(self, base_url, selenium, variables):
        """
           Creates a new knowledge base article.
           Verifies creation.
           Deletes the article
        """
        user = variables['users']['admin']
        kb_new_article = KnowledgeBaseNewArticle(base_url, selenium).open(
            user['username'], user['password'])

        # create a new article
        mock_article = MockArticle()
        kb_new_article.set_article(mock_article)
        kb_new_article.submit_article()
        kb_article_history = kb_new_article.set_article_comment_box(mock_article['comment'])

        # verify article contents
        kb_edit_article = kb_article_history.navigation.click_edit_article()

        actual_summary_text = str(kb_edit_article.article_summary_text)
        assert mock_article['summary'] == actual_summary_text

        actual_contents_text = str(kb_edit_article.article_contents_text)
        assert mock_article['content'] == actual_contents_text

        # delete the same article
        kb_article = kb_edit_article.navigation.click_show_history()
        kb_article.delete_entire_article_document()
    def test_that_article_can_be_translated(self, mozwebqa):
        """
           Creates a new knowledge base article.
           Translate article
        """
        kb_new_article = KnowledgeBaseNewArticle(mozwebqa)
        kb_article_history = KnowledgeBaseShowHistory(mozwebqa)
        kb_edit_article = KnowledgeBaseEditArticle(mozwebqa)
        kb_translate_pg = KnowledgeBaseTranslate(mozwebqa)
        login_pg = LoginPage(mozwebqa)
        timestamp = datetime.datetime.now()

        # Admin account is used as he can delete the article
        login_pg.log_in('admin')

        article_info_dict = self._create_new_generic_article(kb_new_article)
        kb_new_article.submit_article()
        kb_new_article.set_article_comment_box()

        # verify article history
        Assert.true(kb_article_history.is_the_current_page)

        kb_article_history.navigation.click_translate_article()
        kb_translate_pg.click_translate_language('Esperanto (eo)')

        kb_translate_pg.type_title('artikolo_titolo%s' % timestamp)
        kb_translate_pg.type_slug('artikolo_limako_%s' % timestamp)
        kb_translate_pg.click_submit_review()

        change_comment = 'artikolo sangoj %s' % timestamp
        kb_translate_pg.type_modal_describe_changes(change_comment)
        kb_translate_pg.click_modal_submit_changes_button()

        Assert.equal(change_comment, kb_article_history.most_recent_revision_comment)
        Assert.equal('Esperanto', kb_article_history.revision_history)

        kb_article_history.delete_entire_article_document()
Example #10
0
    def test_logout_from_edit_kb_article_page(self, base_url, selenium,
                                              variables):
        user = variables['users']['default']
        kb_new_article = KnowledgeBaseNewArticle(base_url, selenium).open(
            user['username'], user['password'])

        # create a new article
        mock_article = MockArticle()
        kb_new_article.set_article(mock_article)
        kb_new_article.submit_article()
        kb_article_history = kb_new_article.set_article_comment_box(
            mock_article['comment'])

        kb_edit_article = kb_article_history.navigation.click_edit_article()

        # sign out
        login_page = kb_edit_article.sign_out()
        assert login_page.canonical_url in selenium.current_url
        assert login_page.header.is_user_logged_out
Example #11
0
    def test_logout_from_edit_kb_article_page(self, base_url, selenium, variables):
        user = variables["users"]["default"]
        kb_new_article = KnowledgeBaseNewArticle(base_url, selenium).open(user["username"], user["password"])

        # create a new article
        mock_article = MockArticle()
        kb_new_article.set_article(mock_article)
        kb_new_article.submit_article()
        kb_article_history = kb_new_article.set_article_comment_box(mock_article["comment"])

        kb_edit_article = kb_article_history.navigation.click_edit_article()

        # sign out
        login_page = kb_edit_article.sign_out()
        assert login_page.canonical_url in selenium.current_url
        assert login_page.header.is_user_logged_out
Example #12
0
    def test_that_article_can_be_previewed_before_submitting(self, base_url, selenium, variables):
        """
            Start a new knowledge base article.
            Preview.
            Verify the contents in the preview
        """
        user = variables['users']['default']
        kb_new_article = KnowledgeBaseNewArticle(base_url, selenium).open(
            user['username'], user['password'])

        # create a new article
        mock_article = MockArticle()
        kb_new_article.set_article(mock_article)

        kb_new_article.click_article_preview_button()
        actual_preview_text = kb_new_article.article_preview_text

        assert mock_article['content'] == actual_preview_text
Example #13
0
    def test_that_article_can_be_edited(self, base_url, selenium, variables):
        """
           Creates a new knowledge base article.
           Verifies creation.
           Edits the article, verifies the edition.
           Deletes the article
        """
        user = variables['users']['admin']
        kb_new_article = KnowledgeBaseNewArticle(base_url, selenium).open(
            user['username'], user['password'])

        # create a new article
        mock_article = MockArticle()
        kb_new_article.set_article(mock_article)
        kb_new_article.submit_article()
        kb_article_history = kb_new_article.set_article_comment_box(mock_article['comment'])

        # edit that same article (keep the title the same as original)
        mock_article_edited = MockArticle(suffix="_edited", title=mock_article['title'])

        kb_edit_article = kb_article_history.navigation.click_edit_article()
        kb_article_history = kb_edit_article.edit_article(mock_article_edited)

        kb_edit_article = kb_article_history.navigation.click_edit_article()

        # verify the contents of the edited article
        actual_page_title = kb_edit_article.page_title
        assert mock_article_edited['title'] in actual_page_title

        actual_summary_text = kb_edit_article.article_summary_text
        assert mock_article_edited['summary'] == actual_summary_text

        actual_content_text = kb_edit_article.article_contents_text
        assert mock_article_edited['content'] == actual_content_text

        # delete the same article
        kb_article_history = kb_edit_article.navigation.click_show_history()
        kb_article_history.delete_entire_article_document()
Example #14
0
    def test_that_article_can_be_translated(self, base_url, selenium, variables):
        """
           Creates a new knowledge base article.
           Translate article
        """
        user = variables['users']['admin']
        kb_new_article = KnowledgeBaseNewArticle(base_url, selenium).open(
            user['username'], user['password'])

        # create a new article
        mock_article = MockArticle()
        kb_new_article.set_article(mock_article)
        kb_new_article.submit_article()
        kb_article_history = kb_new_article.set_article_comment_box(mock_article['comment'])

        # translating
        kb_translate_pg = kb_article_history.navigation.click_translate_article()
        kb_translate_pg.click_translate_language('Deutsch (de)')

        # enter the translation
        mock_article_deutsch = MockArticle(suffix="_deutsch")
        kb_translate_pg.type_title(mock_article_deutsch['title'])
        kb_translate_pg.type_slug(mock_article_deutsch['slug'])
        kb_translate_pg.type_search_result_summary(mock_article_deutsch['summary'])
        kb_translate_pg.click_submit_review()

        change_comment = mock_article_deutsch['comment']
        kb_translate_pg.type_modal_describe_changes(change_comment)
        kb_article_history = kb_translate_pg.click_modal_submit_changes_button()

        # verifying
        assert change_comment == kb_article_history.most_recent_revision_comment
        assert 'Deutsch' in kb_article_history.revision_history

        # deleting
        kb_article_history.delete_entire_article_document()
Example #15
0
 def new_kb_article_page(self, user='******'):
     from pages.desktop.knowledge_base_new_article import KnowledgeBaseNewArticle
     return self._go_to_page_with_login_redirect(
         KnowledgeBaseNewArticle(self.testsetup), user)