Homework -
Use Python unittest and Selenium WebDriver to create some tests for parts of our university catalog website. We will follow the version of the Page Object.
Copy the page.py, element.py and locators.py files from the readthedocs URL (credit the URL), and edit them to:
Create a child class of BasePage for the catalog home page (URL above) and a base search results page.
Create a child class of the base search results page for the Courses search (for a total of 3 Page object classes)
For the home page, support
Choosing a search location (the pull-down menu at the top left)
Doing a search (the text field that follows)
For the base search results page, support:
Getting a List of Keyword/Phrase search results (you may choose to have another child class of this class and implement different methods that distinguish Program keyword/phrase results from Course keyword/phrase results)
Checking if there are no results found - this seems to show up only when there are no matches for any of the searches done
Choosing Alphabetical order
Choosing Ranked order
For the results page for a Course search, support:
Getting the Best Match
Getting a List of Prefix/Code matches
Modify the element.py and locators.py to support the above
Create a unittest file "test_cat.py" which includes test cases for the following:
Search for "CS 4320" in Courses and confirm that our course is the "Best Match"
Confirm that for the Ranked option on the results page, our course is also listed at the top of the course list displayed after the "best match"
Confirm that if the Alphabetical option is chosen instead, the first course is a BIOL course
Search for "CS" in Courses and confirm that the Prefix/Code results are all courses starting with the CS prefix
Search for "programming" in Programs and confirm that "Computer Science, B. S.", "Computer Science, M. S." and "Computer Science Minor" all show up on the first page of results
Search for "zzz" in "Courses" and confirm that both Prefix/Code and Keyword/Phrase searches return empty lists ("No matches") and you get no results. Look at the results to see the 3 sections
Search for "CS 4320" without choosing a Search location ("Select an option" is shown) and confirming that you get no results
Because the test cases take some time to execute, you may want to use the @unittest.skip() decorator to skip some of you test cases - just remember to remove the skip's when getting ready to submit your assignment.
Attachment:- Assignment File.rar