本文整理匯總了Python中staxing.helper.Teacher.select_course方法的典型用法代碼示例。如果您正苦於以下問題:Python Teacher.select_course方法的具體用法?Python Teacher.select_course怎麽用?Python Teacher.select_course使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類staxing.helper.Teacher
的用法示例。
在下文中一共展示了Teacher.select_course方法的10個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: TestStaxingTutorTeacher
# 需要導入模塊: from staxing.helper import Teacher [as 別名]
# 或者: from staxing.helper.Teacher import select_course [as 別名]
class TestStaxingTutorTeacher(unittest.TestCase):
"""Staxing case tests."""
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')
def tearDown(self):
"""Test destructor."""
try:
self.teacher.driver.quit()
except:
pass
@pytest.mark.skipif(str(301) not in TESTS, reason='Excluded')
def test_add_reading_assignment_individual_publish(self):
"""Build reading assignments."""
# Reading, individual periods, publish
assignment_title = 'Reading-%s' % Assignment.rword(5)
left = randint(5, 20)
right = left + randint(1, 10)
start_date_1 = self.teacher.date_string(day_delta=left)
end_date_1 = self.teacher.date_string(day_delta=left + right)
start_date_2 = self.teacher.date_string(day_delta=left + 1)
end_date_2 = self.teacher.date_string(day_delta=left + right + 1)
start_time_2 = '6:30 am'
end_time_2 = '11:59 pm'
start_date_3 = self.teacher.date_string(day_delta=left + 2)
end_date_3 = self.teacher.date_string(day_delta=left + right + 2)
reading_options = self.teacher.get_book_sections()
reading_start = randint(0, (len(reading_options) - 1))
reading_end = reading_start + randint(1, 5)
reading_list = reading_options[reading_start:reading_end]
self.teacher.add_assignment(
assignment='reading',
args={
'title': assignment_title,
'description': 'Staxing test reading - individual periods - ' +
'publish',
'periods': {
'First': (start_date_1, end_date_1),
'Second': ((start_date_2, start_time_2),
(end_date_2, end_time_2)),
'Third': (start_date_3, end_date_3),
},
'reading_list': reading_list,
'status': 'publish',
'break_point': None,
}
)
assert('courses' in self.teacher.current_url()), \
'Not at dashboard'
self.teacher.rotate_calendar(end_date_1)
reading = self.teacher.find(
By.XPATH,
'//label[text()="%s"]' % assignment_title
)
time.sleep(5.0)
assert(reading), '%s not publishing on %s' % (assignment_title,
end_date_3)
@pytest.mark.skipif(str(302) not in TESTS, reason='Excluded')
def test_add_reading_assignment_all_publish(self):
"""Build reading assignments."""
# Reading, all periods, publish
assignment_title = 'Reading-%s' % Assignment.rword(5)
left = randint(5, 20)
right = left + randint(1, 10)
start_date_1 = self.teacher.date_string(day_delta=left)
end_date_1 = self.teacher.date_string(day_delta=left + right)
start_date_2 = self.teacher.date_string(day_delta=left + 1)
end_date_2 = self.teacher.date_string(day_delta=left + right + 1)
reading_options = self.teacher.get_book_sections()
reading_start = randint(0, (len(reading_options) - 1))
reading_end = reading_start + randint(1, 5)
reading_list = reading_options[reading_start:reading_end]
self.teacher.add_assignment(
assignment='reading',
args={
'title': assignment_title,
'description': 'Staxing test reading - all periods - publish',
'periods': {
'First': (start_date_1, end_date_1),
'all': (start_date_2, end_date_2),
},
'reading_list': reading_list,
'status': 'publish',
'break_point': None,
}
)
assert('courses' in self.teacher.current_url()), \
'Not at dashboard'
self.teacher.rotate_calendar(end_date_1)
reading = self.teacher.find(
By.XPATH,
#.........這裏部分代碼省略.........
示例2: TestWorkAnExternalAssignment
# 需要導入模塊: from staxing.helper import Teacher [as 別名]
# 或者: from staxing.helper.Teacher import select_course [as 別名]
class TestWorkAnExternalAssignment(unittest.TestCase):
"""T1.48 - Work an external assignment."""
def setUp(self):
"""Pretest settings."""
self.ps = PastaSauce()
self.desired_capabilities['name'] = self.id()
self.student = Student(
use_env_vars=True,
pasta_user=self.ps,
capabilities=self.desired_capabilities
)
self.teacher = Teacher(
use_env_vars=True,
existing_driver=self.student.driver,
pasta_user=self.ps,
capabilities=self.desired_capabilities
)
self.teacher.login()
# Create an external assignment for the student to work
self.teacher.select_course(appearance='physics')
self.teacher.wait.until(
expect.visibility_of_element_located(
(By.ID, 'add-assignment')
)
).click()
self.teacher.find(
By.PARTIAL_LINK_TEXT, 'Add External Assignment').click()
assert('externals/new' in self.teacher.current_url()), \
'Not on the add an external assignment page'
self.teacher.find(
By.XPATH, "//input[@id = 'reading-title']").send_keys('Epic 48')
self.teacher.find(
By.XPATH, "//textarea[@class='form-control empty']").send_keys(
"instructions go here")
self.teacher.find(
By.XPATH, "//input[@id = 'hide-periods-radio']").click()
# Choose the first date calendar[0], second is calendar[1]
# and set the open date to today
self.teacher.driver.find_elements_by_xpath(
"//div[@class = 'datepicker__input-container']")[0].click()
self.teacher.driver.find_element_by_xpath(
"//div[@class = 'datepicker__day datepicker__day--today']").click()
# Choose the second date calendar[1], first is calendar[0]
self.teacher.driver.find_elements_by_xpath(
"//div[@class = 'datepicker__input-container']")[1].click()
while(self.teacher.find(
By.XPATH,
"//span[@class = 'datepicker__current-month']"
).text != 'December 2016'):
self.teacher.find(
By.XPATH,
"//a[@class = 'datepicker__navigation datepicker__" +
"navigation--next']").click()
# Choose the due date of December 31, 2016
weekends = self.teacher.driver.find_elements_by_xpath(
"//div[@class = 'datepicker__day datepicker__day--weekend']")
for day in weekends:
if day.text == '31':
due = day
due.click()
break
self.teacher.find(By.XPATH, "//input[@id='external-url']").send_keys(
"google.com")
self.teacher.sleep(5)
# Publish the assignment
self.teacher.find(
By.XPATH,
"//button[@class='async-button -publish btn btn-primary']").click()
self.teacher.sleep(60)
self.student.login()
def tearDown(self):
"""Test destructor."""
self.ps.update_job(
job_id=str(self.student.driver.session_id),
**self.ps.test_updates
)
try:
# Delete the assignment
assert('calendar' in self.teacher.current_url()), \
'Not viewing the calendar dashboard'
spans = self.teacher.driver.find_elements_by_tag_name('span')
for element in spans:
if element.text.endswith('2016'):
month = element
# Change the calendar date if necessary
while (month.text != 'December 2016'):
self.teacher.find(
By.XPATH,
#.........這裏部分代碼省略.........
示例3: TestAnalyzeCollegeWorkflow
# 需要導入模塊: from staxing.helper import Teacher [as 別名]
# 或者: from staxing.helper.Teacher import select_course [as 別名]
class TestAnalyzeCollegeWorkflow(unittest.TestCase):
"""T2.05 - Analyze College Workflow."""
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.student = Student(
use_env_vars=True,
pasta_user=self.ps,
capabilities=self.desired_capabilities,
existing_driver=self.teacher.driver
)
def tearDown(self):
"""Test destructor."""
self.ps.update_job(
job_id=str(self.teacher.driver.session_id),
**self.ps.test_updates
)
try:
self.student = None
self.teacher.delete()
except:
pass
# 14645 - 001 - Student | All work is visible for college students
# not just "This Week"
@pytest.mark.skipif(str(14645) not in TESTS, reason='Excluded')
def test_student_all_work_is_visible_for_college_students_14645(self):
"""All work is visible for college students, not just 'This Week'.
Steps:
Log into tutor-qa as student
Click on a college course
Expected Result:
Can view assignments due later than this week
"""
self.ps.test_updates['name'] = 't2.05.001' \
+ inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates['tags'] = [
't2',
't2.05',
't2.05.001',
'14645'
]
self.ps.test_updates['passed'] = False
# Test steps and verification assertions
self.student.login()
self.student.select_course(appearance='physics')
assert('list/' in self.student.current_url()), \
'Not viewing the calendar dashboard'
self.student.sleep(5)
page = self.student.driver.page_source
assert('Coming Up' in page or 'No upcoming events' in page), \
'No Coming Up/No upcoming events text is visible/present'
self.ps.test_updates['passed'] = True
# 14646 - 002 - Teacher | Create a link to the OpenStax Dashboard
@pytest.mark.skipif(str(14646) not in TESTS, reason='Excluded')
def test_teacher_create_a_link_to_the_openstax_dashboard_14646(self):
"""Create a link to the OpenStax Dashboard.
Steps:
Expected Result:
"""
self.ps.test_updates['name'] = 't2.05.002' \
+ inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates['tags'] = [
't2',
't2.05',
't2.05.002',
'14646'
]
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
# 14647 - 003 - Teacher | Create a link to the OpenStax Dashboard
@pytest.mark.skipif(str(14647) not in TESTS, reason='Excluded')
def test_teacher_create_a_link_to_the_openstax_dashboard_14647(self):
"""Create a link to the OpenStax Dashboard.
Steps:
#.........這裏部分代碼省略.........
示例4: TestEditCourseSettingsAndRoster
# 需要導入模塊: from staxing.helper import Teacher [as 別名]
# 或者: from staxing.helper.Teacher import select_course [as 別名]
class TestEditCourseSettingsAndRoster(unittest.TestCase):
"""T1.42 - Edit Course Settings and Roster."""
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()
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 C8258 - 001 - Teacher | Edit the course name
@pytest.mark.skipif(str(8258) not in TESTS, reason='Excluded')
def test_teacher_edit_the_course_name_8258(self):
"""Edit the course name.
Steps:
Click the "Rename Course" button that is next to the course name
Enter a new course name
Click the "Rename" button
Click the X that is on the upper right corner of the dialogue box
Expected Result:
The course name is edited.
(then put it back at the end)
"""
self.ps.test_updates['name'] = 't1.42.001' \
+ inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates['tags'] = ['t1', 't1.42', 't1.42.001', '8258']
self.ps.test_updates['passed'] = False
# Test steps and verification assertions
course_name = self.teacher.driver.find_element(
By.XPATH,
'//div[@class="course-settings-title"]/span'
).text
self.teacher.find(
By.XPATH, '//button[contains(@class,"edit-course")]' +
'//span[contains(text(),"Rename Course")]'
).click()
self.teacher.wait.until(
expect.element_to_be_clickable(
(By.XPATH, '//input[contains(@class,"form-control")]')
)
).send_keys('_EDIT')
self.teacher.find(
By.XPATH,
'//button[contains(@class,"edit-course-confirm")]'
).click()
# check that it was edited
self.teacher.wait.until(
expect.visibility_of_element_located(
(By.XPATH, '//div[@class="course-settings-title"]' +
'/span[contains(text(),"%s_EDIT")]' % course_name)
)
)
# set it back
self.teacher.sleep(1)
self.teacher.driver.find_element(
By.XPATH,
'//button[contains(@class,"edit-course")]' +
'//span[contains(text(),"Rename Course")]'
).click()
for _ in range(len('_EDIT')):
self.teacher.wait.until(
expect.element_to_be_clickable(
(By.XPATH, '//input[contains(@class,"form-control")]')
)
).send_keys(Keys.BACK_SPACE)
self.teacher.find(
By.XPATH,
'//button[contains(@class,"edit-course-confirm")]'
).click()
self.teacher.wait.until(
expect.visibility_of_element_located(
(By.XPATH, '//div[@class="course-settings-title"]' +
'/span[text()="%s"]' % course_name)
)
#.........這裏部分代碼省略.........
示例5: TestChooseCourse
# 需要導入模塊: from staxing.helper import Teacher [as 別名]
# 或者: from staxing.helper.Teacher import select_course [as 別名]
class TestChooseCourse(unittest.TestCase):
"""T1.38 - Choose Course."""
def setUp(self):
"""Pretest settings."""
self.ps = PastaSauce()
self.desired_capabilities['name'] = self.id()
self.user = None
def tearDown(self):
"""Test destructor."""
self.ps.update_job(
job_id=str(self.user.driver.session_id),
**self.ps.test_updates
)
try:
self.user.delete()
except:
pass
# Case C8254 - 001 - Student | Select a course
@pytest.mark.skipif(str(8254) not in TESTS, reason='Excluded')
def test_student_select_a_course_8254(self):
"""Select a course.
Steps:
Click on a Tutor course name
Expected Result:
The user selects a course and is presented with the dashboard.
"""
self.ps.test_updates['name'] = 't1.38.001' \
+ inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates['tags'] = [
't1',
't1.38',
't1.38.001',
'8254'
]
self.ps.test_updates['passed'] = False
# Test steps and verification assertions
self.user = Student(
use_env_vars=True,
pasta_user=self.ps,
capabilities=self.desired_capabilities
)
self.user.login()
self.user.select_course(appearance='physics')
assert('list' in self.user.current_url()), \
'Not in a course'
self.ps.test_updates['passed'] = True
# Case C8255 - 002 - Student | Bypass the course picker
@pytest.mark.skipif(str(8255) not in TESTS, reason='Excluded')
def test_student_bypass_the_course_picker_8255(self):
"""Bypass the course picker.
Steps:
Go to Tutor
Click on the 'Login' button
Enter the student user account qas_01
Click on the 'Sign in' button
Expected Result:
The user bypasses the course picker and is presented with the
dashboard (because qas_01 is only enrolled in one course)
"""
self.ps.test_updates['name'] = 't1.38.002' \
+ inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates['tags'] = [
't1',
't1.38',
't1.38.002',
'8255'
]
self.ps.test_updates['passed'] = False
# Test steps and verification assertions
self.user = Student(
use_env_vars=True,
pasta_user=self.ps,
capabilities=self.desired_capabilities
)
self.user.login(username="qas_01")
assert('list' in self.user.current_url()), \
'Not in a course'
self.ps.test_updates['passed'] = True
# Case C8256 - 003 - Teacher | Select a course
@pytest.mark.skipif(str(8256) not in TESTS, reason='Excluded')
def test_teacher_select_a_course_8256(self):
"""Select a course.
Steps:
Click on a Tutor course name
#.........這裏部分代碼省略.........
示例6: TestImproveCourseManagement
# 需要導入模塊: from staxing.helper import Teacher [as 別名]
# 或者: from staxing.helper.Teacher import select_course [as 別名]
#.........這裏部分代碼省略.........
]
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
# 14653 - 003 - Teacher | Move a student and their data to a new section
@pytest.mark.skipif(str(14653) not in TESTS, reason='Excluded')
def test_teacher_move_a_student_and_their_data_to_new_section_14653(self):
"""Move a student and their data to a new section.
Steps:
If the user has more than one course, click on a Tutor course name
Click "Course Settings and Roster" from the user menu
Click "Change Period" for the desired student and select a period
Expected Result:
Student is moved to new section with their data
"""
self.ps.test_updates['name'] = 't2.07.003' \
+ inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates['tags'] = [
't2',
't2.07',
't2.07.003',
'14653'
]
self.ps.test_updates['passed'] = False
# Test steps and verification assertions
self.teacher.login()
self.teacher.select_course(appearance='physics')
self.teacher.open_user_menu()
self.teacher.find(
By.PARTIAL_LINK_TEXT, "Course Settings and Roster").click()
self.teacher.sleep(5)
# Move the student to another period
first = self.teacher.find(
By.XPATH,
"//div[@class='period']/table[@class='roster table table-striped" +
" table-bordered table-condensed table-hover']/tbody/tr[1]/td[1]"
).text
last = self.teacher.find(
By.XPATH,
"//div[@class='period']/table[@class='roster table table-striped" +
" table-bordered table-condensed table-hover']/tbody/tr[1]/td[2]"
).text
self.teacher.find(By.PARTIAL_LINK_TEXT, "Change Period").click()
self.teacher.sleep(1)
self.teacher.find(
By.XPATH, "//ul[@class='nav nav-pills nav-stacked']/li/a").click()
self.teacher.sleep(5)
# Verify the move, then move the student back to the original period
self.teacher.find(
By.XPATH,
"//div[@class='roster']/div[@class='settings-section periods']" +
"/ul[@class='nav nav-tabs']/li[2]/a").click()
roster = self.teacher.driver.find_elements_by_xpath(
"//div[@class='period']/table[@class='roster table table-striped" +
" table-bordered table-condensed table-hover']/tbody/tr")
示例7: TestViewTheCalendarDashboard
# 需要導入模塊: from staxing.helper import Teacher [as 別名]
# 或者: from staxing.helper.Teacher import select_course [as 別名]
class TestViewTheCalendarDashboard(unittest.TestCase):
"""T1.13 - View the calendar."""
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')
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 C7978 - 001 - Teacher | View the calendar dashboard
@pytest.mark.skipif(str(7978) not in TESTS, reason='Excluded')
def test_teacher_view_the_calendar_dashboard_7978(self):
"""View the calendar dashboard.
Steps:
If the user has more than one course, click on a Tutor course name
Expected Result:
The teacher is presented their calendar dashboard.
"""
self.ps.test_updates['name'] = 't1.13.001' + \
inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates['tags'] = ['t1', 't1.13', 't1.13.001', '7978']
self.ps.test_updates['passed'] = False
# self.teacher.select_course(title='HS Physics')
assert('calendar' in self.teacher.current_url()), \
'Not viewing the calendar dashboard'
self.ps.test_updates['passed'] = True
# Case C7979 - 002 - Teacher | View student scores using dashboard button
@pytest.mark.skipif(str(7979) not in TESTS, reason='Excluded')
def test_teacher_view_student_scores_using_the_dashboard_button_7979(self):
"""View student scores using the dashboard button.
Steps:
If the user has more than one course, click on a Tutor course name
Click on the 'Student Scores' button
Expected Result:
The teacher is presented with the student scores
"""
self.ps.test_updates['name'] = 't1.13.002' + \
inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates['tags'] = ['t1', 't1.13', 't1.13.002', '7979']
self.ps.test_updates['passed'] = False
# self.teacher.select_course(title='HS Physics')
self.teacher.find(By.LINK_TEXT, 'Student Scores').click()
assert('scores' in self.teacher.current_url()), \
'Not viewing student scores'
self.ps.test_updates['passed'] = True
# Case C7980 - 003 - Teacher | View student scores using the user menu link
@pytest.mark.skipif(str(7980) not in TESTS, reason='Excluded')
def test_teacher_view_student_scores_using_the_user_menu_link_7980(self):
"""View student scores using the user menu link.
Steps:
If the user has more than one course, click on a Tutor course name
Click on the user menu
Click on the 'Student Scores' link
Expected Result:
The teacher is presented with the student scores
"""
self.ps.test_updates['name'] = 't1.13.003' \
+ inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates['tags'] = ['t1', 't1.13', 't1.13.003', '7980']
self.ps.test_updates['passed'] = False
# self.teacher.select_course(title='HS Physics')
self.teacher.open_user_menu()
self.teacher.find(By.CLASS_NAME, 'viewScores'). \
find_element_by_tag_name('a'). \
click()
assert('scores' in self.teacher.current_url()), \
'Not viewing the student scores'
self.ps.test_updates['passed'] = True
#.........這裏部分代碼省略.........
示例8: TestViewClassPerformance
# 需要導入模塊: from staxing.helper import Teacher [as 別名]
# 或者: from staxing.helper.Teacher import select_course [as 別名]
class TestViewClassPerformance(unittest.TestCase):
"""T1.22 - View Class Performance."""
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()
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 C8148 - 001 - Teacher | View the period Performance Forecast
@pytest.mark.skipif(str(8148) not in TESTS, reason='Excluded')
def test_teacher_view_the_period_performance_forecast_8148(self):
"""View the period Performance Forecast.
Steps:
On the calendar dashboard, click on the "Performance Forecast" button
on the upper right corner of the calendar OR
click on the user drop down menu then click on the
"Performance Forecast" button
Click on the desired period
Expected Result:
The period Performance Forecast is presented to the user
"""
self.ps.test_updates['name'] = 't1.22.001' \
+ inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates['tags'] = [
't1',
't1.22',
't1.22.001',
'8148'
]
self.ps.test_updates['passed'] = False
# Test steps and verification assertions
assert('guide' in self.teacher.current_url()), \
'Not viewing performance forecast'
self.ps.test_updates['passed'] = True
# Case C8149 - 002 - Teacher | Info icon shows an explanation of the data
@pytest.mark.skipif(str(8149) not in TESTS, reason='Excluded')
def test_teacher_info_icon_shows_an_explanation_of_the_data_8149(self):
"""Info icon shows an explanation of the data.
Steps:
On the calendar dashboard, click on the "Performance Forecast" button
on the upper right corner of the calendar
OR
Click on the user drop down menu then click on the
"Performance Forecast" button
Hover the cursor over the info icon that is next to the
"Performance Forecast" header
Expected Result:
Info icon shows an explanation of the data
"""
self.ps.test_updates['name'] = 't1.22.002' \
+ inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates['tags'] = [
't1',
't1.22',
't1.22.002',
'8149'
]
self.ps.test_updates['passed'] = False
# Test steps and verification assertions
assert('guide' in self.teacher.current_url()), \
'Not viewing performance forecast'
self.teacher.wait.until(
expect.visibility_of_element_located(
(By.CLASS_NAME, 'info-link')
)
).click()
self.ps.test_updates['passed'] = True
# Case C8150 - 003 - Teacher | View the performance color key
@pytest.mark.skipif(str(8150) not in TESTS, reason='Excluded')
def test_teacher_view_the_performance_color_key_8150(self):
"""View the performance color key.
#.........這裏部分代碼省略.........
示例9: TestTeacherLoginAndAuthentification
# 需要導入模塊: from staxing.helper import Teacher [as 別名]
# 或者: from staxing.helper.Teacher import select_course [as 別名]
class TestTeacherLoginAndAuthentification(unittest.TestCase):
"""CC1.11 - Teacher Login and Authentification."""
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()
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 C7688 - 001 - Teacher | Log into Concept Coach
@pytest.mark.skipif(str(7688) not in TESTS, reason='Excluded')
def test_teacher_log_into_concept_coach_7688(self):
"""Log into Concept Coach.
Steps:
Go to Tutor
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
Expected Result:
User is taken to the class dashboard.
"""
self.ps.test_updates['name'] = 'cc1.11.001' \
+ inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates['tags'] = [
'cc1',
'cc1.11',
'cc1.11.001',
'7688'
]
self.ps.test_updates['passed'] = False
# Test steps and verification assertions
self.teacher.select_course(appearance='macro_economics')
self.teacher.sleep(5)
assert('cc-dashboard' in self.teacher.current_url()), \
'Not viewing the cc dashboard'
self.ps.test_updates['passed'] = True
# Case C7689 - 002 - Teacher | Logging out returns to the login page
@pytest.mark.skipif(str(7689) not in TESTS, reason='Excluded')
def test_teacher_loggin_out_returns_to_the_login_page_7689(self):
"""Logging out returns to the login page.
Steps:
Click the user menu containing the user's name
Click the 'Log Out' button
Expected Result:
User is taken to cc.openstax.org
"""
self.ps.test_updates['name'] = 'cc1.11.002' \
+ inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates['tags'] = [
'cc1',
'cc1.11',
'cc1.11.002',
'7689'
]
self.ps.test_updates['passed'] = False
# Test steps and verification assertions
self.teacher.select_course(appearance='macro_economics')
self.teacher.sleep(5)
assert('dashboard' in self.teacher.current_url()), \
'Not viewing the cc dashboard'
self.teacher.open_user_menu()
self.teacher.sleep(1)
self.teacher.find(By.XPATH, "//a/form[@class='-logout-form']").click()
assert('cc.openstax.org' in self.teacher.current_url()), \
'Not viewing the calendar dashboard'
self.ps.test_updates['passed'] = True
# Case C7690 - 003 - Teacher | Can log into Tutor and be redirected to CC
@pytest.mark.skipif(str(7690) not in TESTS, reason='Excluded')
def test_teacher_can_log_into_tutor_and_be_redirected_to_cc_7690(self):
#.........這裏部分代碼省略.........
示例10: TestStudentsWorkAssignments
# 需要導入模塊: from staxing.helper import Teacher [as 別名]
# 或者: from staxing.helper.Teacher import select_course [as 別名]
class TestStudentsWorkAssignments(unittest.TestCase):
"""CC1.08 - Students Work Assignments."""
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'
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 C7691 - 001 - Student | Selects an exercise answer
@pytest.mark.skipif(str(7691) not in TESTS, reason='Excluded')
def test_student_select_an_exercise_answer_7691(self):
"""Select an exercise answer."""
self.ps.test_updates['name'] = 'cc1.08.001' \
+ inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates['tags'] = [
'cc1',
'cc1.08',
'cc1.08.001',
'7691'
]
self.ps.test_updates['passed'] = False
# Test steps and verification assertions
self.student.get(self.book_url)
self.student.sleep(2)
self.student.find_all(By.XPATH, '//a[@class="nav next"]')[0].click()
self.student.page.wait_for_page_load()
try:
widget = self.student.find(By.ID, 'coach-wrapper')
except:
self.student.find_all(By.XPATH,
'//a[@class="nav next"]')[0].click()
self.student.page.wait_for_page_load()
try:
self.student.sleep(1)
widget = self.student.find(By.ID, 'coach-wrapper')
except:
self.student.find_all(By.XPATH,
'//a[@class="nav next"]')[0].click()
self.student.page.wait_for_page_load()
self.student.sleep(1)
widget = self.student.find(By.ID, 'coach-wrapper')
#.........這裏部分代碼省略.........