Files
edx-platform/common/test/acceptance/pages/lms/course_page.py
2021-03-09 18:03:34 +05:00

43 lines
1.2 KiB
Python

"""
Base class for pages in courseware.
"""
from bok_choy.page_object import PageObject
from common.test.acceptance.pages.lms import BASE_URL
from common.test.acceptance.pages.lms.tab_nav import TabNavPage
class CoursePage(PageObject): # lint-amnesty, pylint: disable=abstract-method
"""
Abstract base class for page objects within a course.
"""
# Overridden by subclasses to provide the relative path within the course
# Paths should not include the leading forward slash.
url_path = ""
def __init__(self, browser, course_id):
"""
Course ID is currently of the form "edx/999/2013_Spring"
but this format could change.
"""
super().__init__(browser)
self.course_id = course_id
@property
def url(self):
"""
Construct a URL to the page within the course.
"""
return BASE_URL + "/courses/" + self.course_id + "/" + self.url_path
def has_tab(self, tab_name):
"""
Returns true if the current page is showing a tab with the given name.
:return:
"""
tab_nav = TabNavPage(self.browser)
return tab_name in tab_nav.tab_names