-
Notifications
You must be signed in to change notification settings - Fork 25
Added test for searching on a QMO post tag #28
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,16 @@ | |||
#!/usr/bin/env python | |||
|
|||
# This Source Code Form is subject to the terms of the Mozilla Public | |||
# License, v. 2.0. If a copy of the MPL was not distributed with this | |||
# file, You can obtain one at http://mozilla.org/MPL/2.0/. | |||
|
|||
from selenium.webdriver.common.by import By | |||
|
|||
from base import BasePage | |||
|
|||
|
|||
class TagResultsPage(BasePage): | |||
|
|||
@property | |||
def results(self): | |||
return self.selenium.find_elements(By.CSS_SELECTOR, "#content-main > article") | |||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should assign a variable to the locator at the beginning of the class: |
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,24 @@ | |||
#!/usr/bin/env python | |||
|
|||
# This Source Code Form is subject to the terms of the Mozilla Public | |||
# License, v. 2.0. If a copy of the MPL was not distributed with this | |||
# file, You can obtain one at http://mozilla.org/MPL/2.0/. | |||
|
|||
import pytest | |||
from unittestzero import Assert | |||
|
|||
from pages.community import CommunityPage | |||
from pages.tag_results import TagResultsPage | |||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't use this import in the test, so we can remove it. |
|||
|
|||
|
|||
class TestTagSearchPage: | |||
|
|||
@pytest.mark.nondestructive | |||
def test_search_tag(self, mozwebqa): | |||
community_page = CommunityPage(mozwebqa) | |||
community_page.go_to_community_page() | |||
|
|||
tag_results_page = community_page.click_first_tag_link | |||
|
|||
Assert.contains('Posts and pages tagged', tag_results_page.page_title) | |||
Assert.greater(len(tag_results_page.results), 0) | |||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You may want to add an assert for the page title, using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. After removing the properties for tag_results.py what can I use for the Assert.contains outside of expected text? I have no page attributes to reference. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You'll need a property in the page object which returns the page's actual title, and then you can compare that to an expected value in the test. I notice that there is a |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this should be marked as a property, as it performs an action. I could be wrong about that so maybe someone else wants to comment on this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call- I saw that earlier and meant to remove it but forgot!