本文整理汇总了Python中staxing.helper.Teacher类的典型用法代码示例。如果您正苦于以下问题:Python Teacher类的具体用法?Python Teacher怎么用?Python Teacher使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Teacher类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestEpicName
class TestEpicName(unittest.TestCase):
"""Product.Epic - Epic Text."""
def setUp(self):
"""Pretest settings."""
self.ps = PastaSauce()
self.desired_capabilities['name'] = self.id()
self.teacher = Teacher(
use_env_vars=True,
pasta_user=self.ps,
capabilities=self.desired_capabilities
)
def tearDown(self):
"""Test destructor."""
self.ps.update_job(
job_id=str(self.teacher.driver.session_id),
**self.ps.test_updates
)
try:
self.teacher.delete()
except:
pass
# Case CaseID - Story# - UserType
@pytest.mark.skipif(str(CaseID) not in TESTS, reason='Excluded')
def test_usertype_storytext_CaseID(self):
"""Story Text.
Steps:
Expected Result:
"""
self.ps.test_updates['name'] = 'product.epic.story' \
+ inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates['tags'] = [
'product',
'product.epic',
'product.epic.story',
'CaseID'
]
self.ps.test_updates['passed'] = False
# Test steps and verification assertions
raise NotImplementedError(inspect.currentframe().f_code.co_name)
self.ps.test_updates['passed'] = True
示例2: TestStaxingConceptCoachTeacher
class TestStaxingConceptCoachTeacher(unittest.TestCase):
"""Staxing case tests."""
def setUp(self):
"""Pretest settings."""
self.teacher = Teacher(username='', password='', site='')
self.teacher.set_window_size(height=700, width=1200)
def tearDown(self):
"""Test destructor."""
try:
self.teacher.driver.quit()
except:
pass
示例3: test_teacher_bypass_the_course_picker_8257
def test_teacher_bypass_the_course_picker_8257(self):
"""Bypass the course picker.
Steps:
Go to Tutor
Click on the 'Login' button
Enter the teacher user account [ qateacher | password ] in the
username and password text boxes
Click on the 'Sign in' button
Expected Result:
The user bypasses the course picker and is presented with the
calendar dashboard (because qateacher only has one course)
"""
self.ps.test_updates['name'] = 't1.38.004' \
+ inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates['tags'] = [
't1',
't1.38',
't1.38.004',
'8257'
]
self.ps.test_updates['passed'] = False
# Test steps and verification assertions
self.user = Teacher(
use_env_vars=True,
pasta_user=self.ps,
capabilities=self.desired_capabilities
)
self.user.login(username="qateacher")
assert('calendar' in self.user.current_url()), \
'Not in a course'
self.ps.test_updates['passed'] = True
示例4: setUp
def setUp(self):
"""Pretest settings."""
self.ps = PastaSauce()
self.desired_capabilities['name'] = self.id()
self.admin = Admin(
use_env_vars=True,
pasta_user=self.ps,
capabilities=self.desired_capabilities
)
self.content = ContentQA(
existing_driver=self.admin.driver,
use_env_vars=True,
pasta_user=self.ps,
capabilities=self.desired_capabilities
)
self.student = Student(
existing_driver=self.admin.driver,
use_env_vars=True,
pasta_user=self.ps,
capabilities=self.desired_capabilities
)
self.teacher = Teacher(
existing_driver=self.admin.driver,
use_env_vars=True,
pasta_user=self.ps,
capabilities=self.desired_capabilities
)
示例5: setUp
def setUp(self):
"""Pretest settings."""
self.teacher = Teacher(use_env_vars=True)
self.teacher.username = os.getenv('TEACHER_USER_MULTI',
self.teacher.username)
self.teacher.set_window_size(height=700, width=1200)
self.teacher.login()
self.teacher.select_course(title='High School Physics')
示例6: setUp
def setUp(self):
"""Pretest settings."""
self.ps = PastaSauce()
self.desired_capabilities['name'] = self.id()
self.teacher = Teacher(
use_env_vars=True,
pasta_user=self.ps,
capabilities=self.desired_capabilities
)
示例7: setUp
def setUp(self):
"""Pretest settings."""
self.ps = PastaSauce()
self.desired_capabilities['name'] = self.id()
self.teacher = Teacher(
use_env_vars=True,
pasta_user=self.ps,
capabilities=self.desired_capabilities
)
self.teacher.login()
self.teacher.select_course(title='HS Physics')
示例8: setUp
def setUp(self):
"""Pretest settings."""
self.ps = PastaSauce()
self.desired_capabilities['name'] = self.id()
self.teacher = Teacher(
use_env_vars=True,
pasta_user=self.ps,
capabilities=self.desired_capabilities
)
self.teacher.login()
self.teacher.select_course(appearance='biology')
self.teacher.find(By.PARTIAL_LINK_TEXT, 'Performance Forecast').click()
示例9: test_teacher_clicks_openstax_logo_to_return_to_dashboard_7991
def test_teacher_clicks_openstax_logo_to_return_to_dashboard_7991(self):
"""CLick in the OpenStax logo to return to the dashboard.
Steps:
Click on the 'Performance Forecast' button
Click on the OpenStax logo in the header
Expected Result:
The teacher is presented with their calendar dashboard
"""
self.ps.test_updates['name'] = 't1.13.014' \
+ inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates['tags'] = ['t1', 't1.13', 't1.13.014', '7991']
self.ps.test_updates['passed'] = False
self.teacher.logout()
teacher2 = Teacher(
username=os.getenv('TEACHER_USER_ONE_COURSE'),
password=os.getenv('TEACHER_PASSWORD'),
site='https://tutor-qa.openstax.org',
existing_driver=self.teacher.driver,
pasta_user=self.ps,
capabilities=self.desired_capabilities,
)
print(teacher2.username)
print(teacher2.password)
teacher2.login()
self.teacher.open_user_menu()
self.teacher.driver.find_element(
By.CLASS_NAME,
'viewTeacherPerformanceForecast'
).click()
self.teacher.driver.find_element(
By.CLASS_NAME,
'ui-brand-logo'
).click()
assert('calendar' in self.teacher.current_url()), \
'Not viewing the calendar dashboard'
self.ps.test_updates['passed'] = True
示例10: setUp
def setUp(self):
"""Pretest settings."""
self.ps = PastaSauce()
self.desired_capabilities['name'] = self.id()
self.teacher = Teacher(
use_env_vars=True,
pasta_user=self.ps,
capabilities=self.desired_capabilities
)
self.teacher.login()
self.teacher.driver.find_element(
By.XPATH, '//a[contains(@href,"/cc-dashboard")]'
).click()
示例11: setUp
def setUp(self):
"""Pretest settings."""
self.ps = PastaSauce()
self.desired_capabilities['name'] = self.id()
self.teacher = Teacher(
username=os.getenv('TEACHER_USER_CC'),
password=os.getenv('TEACHER_PASSWORD'),
pasta_user=self.ps,
capabilities=self.desired_capabilities
)
self.teacher.login()
if 'cc-dashboard' not in self.teacher.current_url():
courses = self.teacher.find_all(
By.CLASS_NAME,
'tutor-booksplash-course-item'
)
assert(courses), 'No courses found.'
if not isinstance(courses, list):
courses = [courses]
course_id = randint(0, len(courses) - 1)
self.course = courses[course_id].get_attribute('data-title')
self.teacher.select_course(title=self.course)
self.teacher.goto_course_roster()
try:
section = self.teacher.find_all(
By.XPATH,
'//*[contains(@class,"nav-tabs")]//a'
)
if isinstance(section, list):
section = '%s' % section[randint(0, len(section) - 1)].text
else:
section = '%s' % section.text
except Exception:
section = '%s' % randint(100, 999)
self.teacher.add_course_section(section)
self.code = self.teacher.get_enrollment_code(section)
print('Course Phrase: ' + self.code)
self.book_url = self.teacher.find(
By.XPATH, '//a[span[contains(text(),"Online Book")]]'
).get_attribute('href')
self.teacher.find(By.CSS_SELECTOR, 'button.close').click()
self.teacher.sleep(0.5)
self.teacher.logout()
self.teacher.sleep(1)
self.student = Student(use_env_vars=True,
existing_driver=self.teacher.driver)
self.first_name = Assignment.rword(6)
self.last_name = Assignment.rword(8)
self.email = self.first_name + '.' \
+ self.last_name \
+ '@tutor.openstax.org'
示例12: setUp
def setUp(self):
"""Pretest settings."""
self.ps = PastaSauce()
self.desired_capabilities['name'] = self.id()
self.teacher = Teacher(
use_env_vars=True,
pasta_user=self.ps,
capabilities=self.desired_capabilities
)
self.teacher.login()
self.teacher.select_course(appearance='physics')
self.teacher.open_user_menu()
self.teacher.wait.until(
expect.element_to_be_clickable(
(By.LINK_TEXT, 'Course Settings and Roster')
)
).click()
self.teacher.page.wait_for_page_load()
示例13: setUp
def setUp(self):
"""Pretest settings."""
self.ps = PastaSauce()
self.desired_capabilities["name"] = self.id()
self.teacher = Teacher(use_env_vars=True, pasta_user=self.ps, capabilities=self.desired_capabilities)
# create a reading for the student to work
self.teacher.login()
self.assignment_name = "t1.18 reading-%s" % randint(100, 999)
today = datetime.date.today()
begin = today.strftime("%m/%d/%Y")
end = (today + datetime.timedelta(days=randint(1, 10))).strftime("%m/%d/%Y")
self.teacher.add_assignment(
assignment="reading",
args={
"title": self.assignment_name,
"description": chomsky(),
"periods": {"all": (begin, end)},
"reading_list": ["1.1", "1.2"],
"status": "publish",
},
)
self.teacher.wait.until(
expect.visibility_of_element_located((By.XPATH, '//div[contains(@class,"calendar-container")]'))
)
self.teacher.logout()
# login as a student to work the reading
self.student = Student(
existing_driver=self.teacher.driver,
use_env_vars=True,
pasta_user=self.ps,
capabilities=self.desired_capabilities,
)
self.student.login()
self.student.wait.until(expect.visibility_of_element_located((By.LINK_TEXT, "This Week")))
reading = self.student.driver.find_element(By.XPATH, '//span[text()="%s"]' % self.assignment_name)
self.teacher.driver.execute_script("return arguments[0].scrollIntoView();", reading)
self.teacher.driver.execute_script("window.scrollBy(0, -80);")
reading.click()
示例14: test_teacher_able_to_search_within_the_book_7629
def test_teacher_able_to_search_within_the_book_7629(self):
"""Able to search within the book.
Steps:
Go to tutor-qa
Click on the 'Login' button
Enter the teacher user account in the username and password text boxes
Click on the 'Sign in' button
If the user has more than one course, click on a CC course name
Click "Online Book" in the header
Enter search words into the search engine next to the "Contents" button
Expected Result:
The search word is highlighted in yellow within the text and is bolded
within the table of contents
"""
self.ps.test_updates["name"] = "cc1.05.005" + inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates["tags"] = ["cc1", "cc1.05", "cc1.05.005", "7629"]
self.ps.test_updates["passed"] = False
# Test steps and verification assertions
teacher = Teacher(
existing_driver=self.student.driver,
username=os.getenv("TEACHER_USER"),
password=os.getenv("TEACHER_PASSWORD"),
pasta_user=self.ps,
capabilities=self.desired_capabilities,
)
teacher.login()
teacher.driver.find_element(By.XPATH, '//a[contains(@href,"/cc-dashboard/")]').click()
teacher.wait.until(
expect.visibility_of_element_located((By.XPATH, '//a//span[contains(text(),"Online Book")]'))
).click()
window_with_book = teacher.driver.window_handles[1]
teacher.driver.switch_to_window(window_with_book)
assert "cnx" in teacher.current_url(), "Not viewing the textbook PDF"
teacher.page.wait_for_page_load()
teacher.wait.until(
expect.visibility_of_element_located((By.XPATH, '//input[@placeholder="Search this book"]'))
).send_keys("balance" + Keys.ENTER)
# make sure the search worked
# still passes if no results found and it says: No matching results...
teacher.wait.until(expect.visibility_of_element_located((By.XPATH, '//div[@class="result-count"]')))
teacher.delete()
self.ps.test_updates["passed"] = True
示例15: TestGuideMonitorSupportAndTrainUsers
class TestGuideMonitorSupportAndTrainUsers(unittest.TestCase):
"""T2.18 - Guide, Monitor, Support, and Train Users."""
def setUp(self):
"""Pretest settings."""
self.ps = PastaSauce()
self.desired_capabilities["name"] = self.id()
self.teacher = Teacher(use_env_vars=True, pasta_user=self.ps, capabilities=self.desired_capabilities)
def tearDown(self):
"""Test destructor."""
self.ps.update_job(job_id=str(self.teacher.driver.session_id), **self.ps.test_updates)
try:
self.teacher.delete()
except:
pass
# 14752 - 001 - User | In-app Notification of downtime
@pytest.mark.skipif(str(14752) not in TESTS, reason="Excluded")
def test_user_inapp_notification_of_downtime_14752(self):
"""In-app Notification of downtime.
Steps:
Go to Tutor
Log in as admin
Click "Admin" from the user menu
Click "System Setting"
Click "Notifications"
Enter a new notification into the text box
Click "Add"
Log out of admin
Log in as teacher01
Expected Result:
An orange header with the notification pops up when you sign in
"""
self.ps.test_updates["name"] = "t2.18.001" + inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates["tags"] = ["t2", "t2.18", "t2.18.001", "14752"]
self.ps.test_updates["passed"] = False
# Test steps and verification assertions
raise NotImplementedError(inspect.currentframe().f_code.co_name)
self.ps.test_updates["passed"] = True
# 14751 - 002 - Teacher | Directed to a "No Courses" page when not in any
# courses yet
@pytest.mark.skipif(str(14751) not in TESTS, reason="Excluded")
def test_teacher_directed_to_a_no_courses_page_when_not_in_any_14751(self):
"""Directed to a "No Courses" page when not in any courses yet.
Steps:
Go to tutor-qa.openstax.org
Sign in as demo_teacher; password
Expected Result:
The message "We cannot find an OpenStax course associated with your
account" displays with help links below
"""
self.ps.test_updates["name"] = "t2.18.002" + inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates["tags"] = ["t2", "t2.18", "t2.18.002", "14751"]
self.ps.test_updates["passed"] = False
# Test steps and verification assertions
raise NotImplementedError(inspect.currentframe().f_code.co_name)
self.ps.test_updates["passed"] = True
# 58279 - 003 - Teacher | View "Getting Started with Tutor" Guide
@pytest.mark.skipif(str(58279) not in TESTS, reason="Excluded")
def test_teacher_view_getting_started_with_tutor_guide_58279(self):
"""View "Getting Started with Tutor" Guide.
Steps:
Click "Tutor Instructors. Get help"
Expected Result:
Tutor Help Center opens in another tab with the Getting Started guide
"""
self.ps.test_updates["name"] = "t2.18.003" + inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates["tags"] = ["t2", "t2.18", "t2.18.003", "58279"]
self.ps.test_updates["passed"] = False
# Test steps and verification assertions
raise NotImplementedError(inspect.currentframe().f_code.co_name)
self.ps.test_updates["passed"] = True
# 58280 - 004 - Teacher | Access Tutor Help Center after registering for
# a course
@pytest.mark.skipif(str(58280) not in TESTS, reason="Excluded")
def test_teacher_access_tutor_help_center_after_registering_58280(self):
"""Access Tutor Help Center after registering for a course.
Steps:
Go to Tutor
Sign in as teacher01
Click on a Tutor course if the user is in more than one
Click "Get Help" from the user menu in the upper right corner of the
#.........这里部分代码省略.........