-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_python_search.py
More file actions
37 lines (29 loc) · 1.2 KB
/
test_python_search.py
File metadata and controls
37 lines (29 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
"""
Test Case
"""
import unittest
from pages.main_page import MainPage
from pages.search_page import SearchResultsPage
from tests.base_test import BaseTest
class TestPythonOrgSearch(BaseTest):
"""A sample test class to show how page object works"""
def test_search_in_python_org(self):
"""
Tests python.org search feature.
Searches for the word "pycon" then verified that some results show up.
Note that it does not look for any particular text in search results page.
This test verifies that the results were not empty.
"""
# Load the main page. In this case the home page of Python.org.
main_page = MainPage(self.driver)
main_page.load()
# Checks if the word "Python" is in title
assert main_page.is_title_matches(), "python.org title doesn't match."
# Sets the text of search textbox to "pycon"
main_page.search_text_element = "pycon"
main_page.click_go_button()
search_results_page = SearchResultsPage(self.driver)
# Verifies that the results page is not empty
assert search_results_page.is_results_found(), "No results found."
if __name__ == "__main__":
unittest.main()