本文整理汇总了Python中staxing.helper.Teacher.open_user_menu方法的典型用法代码示例。如果您正苦于以下问题:Python Teacher.open_user_menu方法的具体用法?Python Teacher.open_user_menu怎么用?Python Teacher.open_user_menu使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类staxing.helper.Teacher
的用法示例。
在下文中一共展示了Teacher.open_user_menu方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestTeacherViews
# 需要导入模块: from staxing.helper import Teacher [as 别名]
# 或者: from staxing.helper.Teacher import open_user_menu [as 别名]
#.........这里部分代码省略.........
'Not viewing the textbook PDF'
self.teacher.driver.switch_to_window(
self.teacher.driver.window_handles[0])
# assignment links
self.teacher.driver.find_element(
By.XPATH, '//a[contains(text(),"Assignment Links")]'
).click()
assert('assignment-links' in self.teacher.current_url()), \
'not viewing Assignment Links'
self.ps.test_updates['passed'] = True
# Case C7612 - 004 - Teacher | Able to copy a system-generated message
# with a student code, links, and other information
@pytest.mark.skipif(str(7612) not in TESTS, reason='Excluded')
def test_able_to_copy_a_system_generated_message_with_a_student_7612(self):
"""Copy a system-generated message with a student code, links, etc.
Steps:
Click on the user menu in the right corner of the header
Click "Course Roster"
Click "Get Student Enrollment Code"
Copy the system generated message
Expected Result:
The user is able to copy the system generated message
"""
self.ps.test_updates['name'] = 'cc1.13.004' \
+ inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates['tags'] = ['cc1', 'cc1.13', 'cc1.13.004', '7612']
self.ps.test_updates['passed'] = False
# Test steps and verification assertions
self.teacher.open_user_menu()
self.teacher.driver.find_element(
By.XPATH, '//a[contains(text(),"Course Settings and Roster")]'
).click()
self.teacher.driver.find_element(
By.XPATH, '//span[contains(text(),"student enrollment code")]'
).click()
self.teacher.driver.find_element(
By.XPATH,
'//*[contains(text(),"Send the following enrollment instruction")]'
)
element = self.teacher.driver.find_element(
By.XPATH,
'//div[contains(@class,"enrollment-code-modal")]'
)
element.find_element(
By.XPATH,
'.//*[contains(text(),"To register for Concept Coach:")]'
)
self.ps.test_updates['passed'] = True
# Case C7613 - 005 - Teacher | Periods are relabeled as sections for all
# courses
@pytest.mark.skipif(str(7613) not in TESTS, reason='Excluded')
def test_teacher_periods_are_relabeled_as_sections_for_all_cour_7613(self):
"""Period is relabeled as section for college courses.
Steps:
Go to user menu
Click on course roster
Check that there is an '+ add section' button instead
示例2: TestEditCourseSettingsAndRoster
# 需要导入模块: from staxing.helper import Teacher [as 别名]
# 或者: from staxing.helper.Teacher import open_user_menu [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)
)
#.........这里部分代码省略.........
示例3: TestImproveCourseManagement
# 需要导入模块: from staxing.helper import Teacher [as 别名]
# 或者: from staxing.helper.Teacher import open_user_menu [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")
index = 0
示例4: TestTrainingAndSupportingTeachersAndStudents
# 需要导入模块: from staxing.helper import Teacher [as 别名]
# 或者: from staxing.helper.Teacher import open_user_menu [as 别名]
class TestTrainingAndSupportingTeachersAndStudents(unittest.TestCase):
"""CC1.14 - Training and Supporting Teachers and Students."""
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,
existing_driver=self.teacher.driver,
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
)
self.student = None
try:
self.teacher.delete()
except:
pass
# Case C7704 - 001 - System | Concept Coach Zendesk is web-accessible
@pytest.mark.skipif(str(7704) not in TESTS, reason='Excluded')
def test_system_concept_coach_zendesk_is_web_accessible_7704(self):
"""Concept Coach Zendesk is web-accesible.
Steps:
Log in to Tutor as teacher
If more then one course, click on a concept coach course
In user menu in top right of header, click 'Get Help'
Expected Result:
In a new window or tab, zendesk help is opened
"""
self.ps.test_updates['name'] = 'cc1.14.001' \
+ inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates['tags'] = [
'cc1',
'cc1.14',
'cc1.14.001',
'7704'
]
self.ps.test_updates['passed'] = False
# Test steps and verification assertions
self.teacher.login()
self.teacher.find(
By.XPATH, '//a[contains(@href,"/cc-dashboard/")]'
).click()
self.teacher.open_user_menu()
self.teacher.find(
By.LINK_TEXT, 'Get Help'
).click()
# change to window with help center
window_with_help = self.teacher.driver.window_handles[1]
self.teacher.driver.switch_to_window(window_with_help)
self.teacher.find(
By.XPATH, '//center[contains(text(),"Concept Coach Help Center")]'
)
assert('support' in self.teacher.current_url()), 'not at help center'
self.ps.test_updates['passed'] = True
# Case C7705 - 002 - Teacher | Can access user support
@pytest.mark.skipif(str(7705) not in TESTS, reason='Excluded')
def test_teacher_can_access_user_support_7705(self):
"""Can access user support.
Steps:
Click on the user menu
Click on the Get Help option
Expected Result:
In a new tab or window Zendesk is opened
"""
self.ps.test_updates['name'] = 'cc1.14.002' \
+ inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates['tags'] = [
'cc1',
'cc1.14',
'cc1.14.002',
'7705'
]
self.ps.test_updates['passed'] = False
# Test steps and verification assertions
self.teacher.login()
self.teacher.find(
By.XPATH, '//a[contains(@href,"/cc-dashboard/")]'
).click()
#.........这里部分代码省略.........
开发者ID:openstax,项目名称:test-automation,代码行数:103,代码来源:test_cc1_14_TrainingAndSupportingTeachersAndStudents.py
示例5: TestIImproveQuestionManagement
# 需要导入模块: from staxing.helper import Teacher [as 别名]
# 或者: from staxing.helper.Teacher import open_user_menu [as 别名]
class TestIImproveQuestionManagement(unittest.TestCase):
"""CC2.11 - Improve Question Management."""
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,
existing_driver=self.teacher.driver,
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
)
self.student = None
try:
self.teacher.delete()
except:
pass
# 14851 - 001 - Teacher | Review all questions
@pytest.mark.skipif(str(14851) not in TESTS, reason='Excluded')
def test_teacher_review_all_questions_14851(self):
"""Review all questions.
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
Click "Question Library" from the user menu
Select a section or chapter
Click "Show Questions"
Expected Result:
The user is presented with all the questions for the section or chapter
"""
self.ps.test_updates['name'] = 'cc2.11.001' \
+ inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates['tags'] = ['cc2', 'cc2.11', 'cc2.11.001', '14851']
self.ps.test_updates['passed'] = False
# Test steps and verification assertions
self.teacher.login()
self.teacher.find(
By.XPATH, '//a[contains(@href,"/cc-dashboard")]'
).click()
self.teacher.open_user_menu()
self.teacher.find(
By.LINK_TEXT, 'Question Library'
).click()
self.teacher.find(
By.XPATH,
'//div[@class="section"]//span[@class="chapter-section" ' +
'and @data-chapter-section="1.1"]'
).click()
self.teacher.driver.execute_script(
"window.scrollTo(0, document.body.scrollHeight);")
self.teacher.find(
By.XPATH, '//button[text()="Show Questions"]'
).click()
self.teacher.wait.until(
expect.visibility_of_element_located(
(By.XPATH, '//div[@class="exercises"]')
)
)
self.ps.test_updates['passed'] = True
# 14852 - 002 - Teacher | Exclude certain questions
@pytest.mark.skipif(str(14852) not in TESTS, reason='Excluded')
def test_teacher_exclude_certain_questions_14852(self):
"""Exclude certain quesitons.
Steps:
If the user has more than one course, click on a CC course name
Click "Question Library" from the user menu
Select a section or chapter
Click "Show Questions"
Hover over the desired question and click "Exclude question"
Expected Result:
Question is grayed out
"""
self.ps.test_updates['name'] = 'cc2.11.002' \
+ inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates['tags'] = ['cc2', 'cc2.11', 'cc2.11.002', '14852']
self.ps.test_updates['passed'] = False
#.........这里部分代码省略.........
示例6: TestCreateNewQuestionAndAssignmentTypes
# 需要导入模块: from staxing.helper import Teacher [as 别名]
# 或者: from staxing.helper.Teacher import open_user_menu [as 别名]
#.........这里部分代码省略.........
Click "Review"
Expected Result:
There is a breadcrumb for each part of a multipart question
"""
self.ps.test_updates['name'] = 't2.12.004' \
+ inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates['tags'] = ['t2', 't2.12', 't2.12.004', '14743']
self.ps.test_updates['passed'] = False
# Test steps and verification assertions
# create a hw with a multi part question, and gice it a randomized name
# ID: [email protected] is multi part
self.teacher.login()
self.teacher.find(
By.XPATH,
'//div[@data-appearance="intro_sociology"]' +
'//a[not(contains(@href,"/cc-dashboard"))]'
).click()
assignment_name = "homework-%s" % randint(100, 999)
today = datetime.date.today()
begin = (today + datetime.timedelta(days=0)).strftime('%m/%d/%Y')
end = (today + datetime.timedelta(days=100)).strftime('%m/%d/%Y')
self.teacher.add_assignment(
assignment='homework',
args={
'title': assignment_name,
'description': 'description',
'periods': {'all': (begin, end)},
'problems': {'1.1': ['[email protected]'], },
'status': 'publish',
}
)
self.teacher.open_user_menu()
self.teacher.find(
By.LINK_TEXT, 'Student Scores'
).click()
self.teacher.page.wait_for_page_load()
# can just click the first review because assignemnt just created
# and should be the most recent one
self.teacher.find(
By.LINK_TEXT, 'Review'
).click()
cards = self.teacher.find_all(
By.XPATH, '//div[contains(@class,"card-body")]')
questions = self.teacher.find_all(
By.XPATH, '//div[contains(@class,"openstax-question")]')
breadcrumbs = self.teacher.find_all(
By.XPATH, '//span[contains(@class,"openstax-breadcrumb")]')
assert(len(questions) == len(breadcrumbs)), \
'breadcrumbs and questions not equal'
assert(len(cards) < len(breadcrumbs)), \
'multipart question card has multiple questions,' + \
'not matching up with breadcrumbs'
self.ps.test_updates['passed'] = True
# NOT DONE
# same issue as above w/ add_homework helper
# but works for manually created assignemnt
# (add assignemnt gets commented out, manual assignemnt name added)
# 14744 - 005 - Student | Each part of a multi-part question counts as a
# seperate problem when scored
@pytest.mark.skipif(str(14744) not in TESTS, reason='Excluded')
def test_student_each_part_of_a_multipart_question_counts_as_14744(self):
"""Multi-part questions count as seperate problems when scored.
示例7: TestViewClassPerformance
# 需要导入模块: from staxing.helper import Teacher [as 别名]
# 或者: from staxing.helper.Teacher import open_user_menu [as 别名]
#.........这里部分代码省略.........
)
self.ps.test_updates['passed'] = True
# Case C8151 - 004 - Teacher | Return to Dashboard button returns to
# the calendar
@pytest.mark.skipif(str(8151) not in TESTS, reason='Excluded')
def test_teacher_return_to_dashboard_button_returns_to_the_cal_8151(self):
"""Return to Dashboard button returns to the calendar.
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
Click on the "Performance Forecast" button
Expected Result:
The calendar dashboard is presented to the user
"""
self.ps.test_updates['name'] = 't1.22.004' \
+ inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates['tags'] = [
't1',
't1.22',
't1.22.004',
'8151'
]
self.ps.test_updates['passed'] = False
# Test steps and verification assertions
assert('guide' in self.teacher.current_url()), \
'Not viewing performance forecast'
self.teacher.open_user_menu()
self.teacher.wait.until(
expect.presence_of_element_located(
(By.LINK_TEXT, 'Dashboard')
)
).click()
assert('calendar' in self.teacher.current_url()), \
'Not viewing the calendar dashboard'
self.ps.test_updates['passed'] = True
# Case C8152 - 005 - Teacher | Periods tabs are shown
@pytest.mark.skipif(str(8152) not in TESTS, reason='Excluded')
def test_teacher_period_tabs_are_shown_8152(self):
"""Period tabs are shown.
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
click on the "Performance Forecast" button
Expected Result:
The period tabs are shown to the user
(below the "Performance Forecast" header)
"""
self.ps.test_updates['name'] = 't1.22.005' \
+ inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates['tags'] = [
't1',
't1.22',
't1.22.005',
示例8: TestViewTheCalendarDashboard
# 需要导入模块: from staxing.helper import Teacher [as 别名]
# 或者: from staxing.helper.Teacher import open_user_menu [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
#.........这里部分代码省略.........
示例9: TestAdminAndTeacherCourseSetup
# 需要导入模块: from staxing.helper import Teacher [as 别名]
# 或者: from staxing.helper.Teacher import open_user_menu [as 别名]
class TestAdminAndTeacherCourseSetup(unittest.TestCase):
"""CC1.10 - Admin and Teacher Course 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.admin = Admin(
use_env_vars=True,
existing_driver=self.teacher.driver,
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.admin.driver = None
self.teacher.delete()
except:
pass
# Case C7715 - 001 - Admin | Send course setup data from Sales Force
@pytest.mark.skipif(str(7715) not in TESTS, reason='Excluded')
def test_admin_send_course_setup_data_from_sales_force_7715(self):
"""Send course setup data from Sales Force.
Steps:
Go to tutor-staging.openstax.org and login as admin
Click on the user menu
Select the Admin option
Click on Salesforce on the header
Expected Result:
"""
self.ps.test_updates['name'] = 'cc1.10.001' \
+ inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates['tags'] = [
'cc1',
'cc1.10',
'cc1.10.001',
'7715'
]
self.ps.test_updates['passed'] = False
# Test steps and verification assertions
self.admin.login()
self.admin.open_user_menu()
self.teacher.driver.find_element(
By.LINK_TEXT, 'Admin'
).click()
self.admin.wait.until(
expect.visibility_of_element_located(
(By.LINK_TEXT, 'Salesforce')
)
).click()
assert('salesforce' in self.admin.current_url()), 'not at salesforce'
self.ps.test_updates['passed'] = True
# Case C7716 - 002 - System | Course registration codes are emailed to the
# teacher once the course is set up
@pytest.mark.skipif(str(7716) not in TESTS, reason='Excluded')
def test_system_registration_codes_are_emailed_to_teacher_7716(self):
"""Registration codes are emailed to teacher once the course is set up.
Steps:
Expected Result:
"""
self.ps.test_updates['name'] = 'cc1.10.002' \
+ inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates['tags'] = [
'cc1',
'cc1.10',
'cc1.10.002',
'7716'
]
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
# Case C7717 - 003 - Teacher | Use a teacher registration code to access
# their course
@pytest.mark.skipif(str(7717) not in TESTS, reason='Excluded')
def test_teacher_use_teacher_registration_code_to_access_course_7717(self):
"""Use a teacher registration code to access their course.
#.........这里部分代码省略.........
示例10: test_teacher_remove_themself_from_the_course_7725
# 需要导入模块: from staxing.helper import Teacher [as 别名]
# 或者: from staxing.helper.Teacher import open_user_menu [as 别名]
def test_teacher_remove_themself_from_the_course_7725(self):
"""Remove themself from the course.
Steps:
Go to Tutor
Log in as a teacher
Click on a Concept Coach book
Click on the user menu
Select course roster
Click on 'Remove' on the same row as themselves
Click on the 'Remove' button
Expected Result:
Teacher is removed from course and taken back to dashboard
"""
self.ps.test_updates['name'] = 'cc1.10.012' \
+ inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates['tags'] = [
'cc1',
'cc1.10',
'cc1.10.012',
'7725'
]
self.ps.test_updates['passed'] = False
# Test steps and verification assertions
self.admin.login()
self.admin.driver.get(
'https://tutor-qa.openstax.org/admin/courses/8/edit')
self.admin.page.wait_for_page_load()
teacher_name = 'Trent'
self.admin.driver.find_element(
By.XPATH, '//a[contains(text(),"Teachers")]').click()
self.admin.driver.find_element(
By.ID, 'course_teacher').send_keys(teacher_name)
self.admin.wait.until(
expect.visibility_of_element_located(
(By.XPATH, '//li[contains(text(),"%s")]' % teacher_name)
)
).click()
self.admin.sleep(1)
self.admin.driver.find_element(
By.LINK_TEXT, 'Main Dashboard').click()
self.admin.page.wait_for_page_load()
self.admin.logout()
# redo set-up, but make sure to go to course 8
# login as the teacher just added to the course
teacher2 = Teacher(
username='teacher05',
password=os.getenv('TEACHER_PASSWORD'),
existing_driver=self.teacher.driver
)
teacher2.login()
teacher2.driver.get('https://tutor-qa.openstax.org/courses/8')
teacher2.open_user_menu()
teacher2.wait.until(
expect.element_to_be_clickable(
(By.LINK_TEXT, 'Course Settings and Roster')
)
).click()
teacher2.page.wait_for_page_load()
# delete teacher
teachers_list = teacher2.driver.find_elements(
By.XPATH, '//div[@class="teachers-table"]//tbody//tr')
for x in teachers_list:
temp_first = x.find_element(
By.XPATH,
'./td[1]'
).text
if temp_first == teacher_name:
x.find_element(
By.XPATH,
'.//td//span[contains(text(),"Remove")]'
).click()
teacher2.sleep(1)
teacher2.driver.find_element(
By.XPATH, '//div[@class="popover-content"]//button'
).click()
break
if x == teachers_list[-1]:
print('added teacher was not found, and not deleted')
raise Exception
# after removing self from course taken to dashboard
# or course if only 1 other course
assert('/courses/8' not in teacher2.current_url()), \
'teacher not deleted'
teacher2.delete()
self.ps.test_updates['passed'] = True
示例11: TestRecruitingTeachers
# 需要导入模块: from staxing.helper import Teacher [as 别名]
# 或者: from staxing.helper.Teacher import open_user_menu [as 别名]
#.........这里部分代码省略.........
# Case C7770 - 020 - Admin | Add co-instructors to a course
@pytest.mark.skipif(str(7770) not in TESTS, reason='Excluded')
def test_admin_add_coinstructors_to_a_course_7770(self):
"""Add co-instructors to a course.
Steps:
Log into Tutor as an admin
From the user menu, select 'Admin'
From the 'Course Organization' menu, select 'Courses'
In the Courses table, find the correct course and click the 'Edit'
button on the right side of that row
Click on the 'Teachers' tab
In the search box, enter the teacher's name or username
Select the teacher in the list below the search bar or hit the down
arrow followed by the enter/return key
Expected Result:
Co-instructor is linked to the affected course
"""
self.ps.test_updates['name'] = 'cc1.01.020' \
+ inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates['tags'] = [
'cc1',
'cc1.01',
'cc1.01.020',
'7770'
]
self.ps.test_updates['passed'] = False
# Test steps and verification assertions
self.teacher.login(
username=os.getenv('ADMIN_USER'),
password=os.getenv('ADMIN_PASSWORD'))
self.teacher.open_user_menu()
self.teacher.find(
By.XPATH, '//a[@role="menuitem" and contains(text(),"Admin")]'
).click()
self.teacher.wait.until(
expect.visibility_of_element_located(
(By.PARTIAL_LINK_TEXT, 'Course Organization')
)
).click()
self.teacher.wait.until(
expect.visibility_of_element_located(
(By.PARTIAL_LINK_TEXT, 'Courses')
)
).click()
self.teacher.wait.until(
expect.visibility_of_element_located(
(By.PARTIAL_LINK_TEXT, 'Edit')
)
).click()
self.teacher.wait.until(
expect.visibility_of_element_located(
(By.PARTIAL_LINK_TEXT, 'Teachers')
)
).click()
self.teacher.wait.until(
expect.visibility_of_element_located(
(By.ID, 'course_teacher')
)
).send_keys('teacher0')
element = self.teacher.wait.until(
expect.visibility_of_element_located(
(By.XPATH,
'//ul[contains(@class,"ui-autocomplete")]' +
示例12: TestUserLogin
# 需要导入模块: from staxing.helper import Teacher [as 别名]
# 或者: from staxing.helper.Teacher import open_user_menu [as 别名]
#.........这里部分代码省略.........
# click on the sign in button
self.admin.find(
By.XPATH,
'//button[text()="Sign in"]'
).click()
self.admin.page.wait_for_page_load()
assert('dashboard' in self.admin.current_url()), \
'Not taken to dashboard: %s' % self.admin.current_url()
self.ps.test_updates['passed'] = True
# Case C8239 - 002 - Admin | Access the Admin Console
@pytest.mark.skipif(str(8239) not in TESTS, reason='Excluded')
def test_admin_access_the_admin_console_8239(self):
"""Access the Admin console.
Steps:
Click on the 'Login' button
Enter the admin account in the username and password text boxes
Click on the 'Sign in' button
Click on the user menu
Click on the Admin option
Expected Result:
User is presented with the admin console
"""
self.ps.test_updates['name'] = 't1.36.002' \
+ inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates['tags'] = ['t1', 't1.36', 't1.36.002', '8239']
self.ps.test_updates['passed'] = False
# self.user = admin
self.admin.login()
self.admin.open_user_menu()
self.admin.wait.until(
expect.element_to_be_clickable(
(By.LINK_TEXT, 'Admin')
)
).click()
self.admin.page.wait_for_page_load()
self.admin.find(
By.XPATH, '//h1[contains(text(),"Admin Console")]')
self.ps.test_updates['passed'] = True
# Case C8240 - 003 - Admin | Log out
@pytest.mark.skipif(str(8240) not in TESTS, reason='Excluded')
def test_admin_log_out_8240(self):
"""Log out.
Steps:
Click on the 'Login' button
Enter the admin account in the username and password text boxes
Click on the 'Sign in' button
Click on the user menu
Click on the Log out option
Expected Result:
The User is signed out
"""
self.ps.test_updates['name'] = 't1.36.003' \
+ inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates['tags'] = ['t1', 't1.36', 't1.36.003', '8240']
self.ps.test_updates['passed'] = False
self.admin.login()
示例13: TestTeacherLoginAndAuthentification
# 需要导入模块: from staxing.helper import Teacher [as 别名]
# 或者: from staxing.helper.Teacher import open_user_menu [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):
#.........这里部分代码省略.........
示例14: TestImproveLoginRegistrationEnrollment
# 需要导入模块: from staxing.helper import Teacher [as 别名]
# 或者: from staxing.helper.Teacher import open_user_menu [as 别名]
class TestImproveLoginRegistrationEnrollment(unittest.TestCase):
"""CC2.09 - Improve Login, Registration, Enrollment."""
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,
existing_driver=self.teacher.driver,
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.student.delete()
except:
pass
try:
self.teacher.delete()
except:
pass
def get_enrollemnt_code(self, number=0):
"""
Steps:
Sign in as teacher
Click on a Concept Coach course
Click on "Course Settings and Roster" from the user menu
Click "Your Student Enrollment Code"
Return value: code, enrollemnt_url
code - enrollment code
enrollemnt_url - url of book for course
"""
self.teacher.login()
if number != 0:
cc_courses = self.teacher.find_all(
By.XPATH, '//a[contains(@href,"/cc-dashboard")]'
)
cc_courses[number].click()
else:
self.teacher.find(
By.XPATH, '//a[contains(@href,"/cc-dashboard")]'
).click()
self.teacher.open_user_menu()
self.teacher.find(
By.LINK_TEXT, 'Course Settings and Roster'
).click()
self.teacher.find(
By.XPATH, '//span[contains(text(),"Your student enrollment code")]'
).click()
self.teacher.sleep(1)
code = self.teacher.find(
By.XPATH, '//p[@class="code"]'
).text
enrollement_url = self.teacher.find(
By.XPATH, '//textarea'
).text
enrollement_url = enrollement_url.split('\n')[5]
self.teacher.find(
By.XPATH, '//button[@class="close"]'
).click()
self.teacher.sleep(0.5)
self.teacher.logout()
return code, enrollement_url
def create_user(self, start_num, end_num):
"""
creates a new user and return the username
"""
self.student.get("http://accounts-qa.openstax.org")
num = str(randint(start_num, end_num))
self.student.find(By.LINK_TEXT, 'Sign up').click()
self.student.find(
By.ID, 'identity-login-button').click()
self.student.find(
By.ID, 'signup_first_name').send_keys('first_name_001')
self.student.find(
By.ID, 'signup_last_name').send_keys('last_name_001')
self.student.find(
By.ID, 'signup_email_address').send_keys('[email protected]')
self.student.find(
By.ID, 'signup_username').send_keys('automated_09_'+num)
self.student.find(
By.ID, 'signup_password'
).send_keys(os.getenv('STUDENT_PASSWORD'))
self.student.find(
By.ID, 'signup_password_confirmation'
#.........这里部分代码省略.........
示例15: TestImprovesScoresReporting
# 需要导入模块: from staxing.helper import Teacher [as 别名]
# 或者: from staxing.helper.Teacher import open_user_menu [as 别名]
#.........这里部分代码省略.........
self.teacher.sleep(0.75)
self.teacher.find(
By.XPATH,
'//div[contains(@class,"is-descending")]//div[text()="Progress"]'
).click()
self.teacher.sleep(0.75)
self.teacher.find(
By.XPATH,
'//div[contains(@class,"is-ascending")]//div[text()="Progress"]'
)
self.ps.test_updates['passed'] = True
# 14668 - 006 - Teacher | All popups in the roster have an X button
@pytest.mark.skipif(str(14668) not in TESTS, reason='Excluded')
def test_teacher_all_popups_in_the_roster_have_an_x_button_14668(self):
"""All popups in the roster have an X button.
Steps:
If the user has more than one course, click on a CC course name
Click "Course Settings and Roster" from the user menu
Click "Rename Course," "Change Course Timezone,"
"View Archived Period," "Add Period," "Rename," and "Get Student
Enrollment Code"
Expected Result:
All pop ups have an X button
"""
self.ps.test_updates['name'] = 'cc2.08.006' \
+ inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates['tags'] = ['cc2', 'cc2.08', 'cc2.08.006', '14668']
self.ps.test_updates['passed'] = False
# Test steps and verification assertions
self.teacher.open_user_menu()
self.teacher.find(
By.XPATH, '//a[text()="Course Settings and Roster"]'
).click()
self.teacher.sleep(1)
# rename couse
self.teacher.find(
By.XPATH,
'//button//span[contains(text(),"Rename Course")]'
).click()
self.teacher.sleep(0.75)
self.teacher.find(
By.XPATH,
'//div[@class="modal-content"]//button[@class="close"]'
).click()
self.teacher.sleep(0.75)
# course timezone
self.teacher.find(
By.XPATH,
'//button//span[contains(text(),"Change Course Timezone")]'
).click()
self.teacher.sleep(1)
self.teacher.find(
By.XPATH,
'//div[@class="modal-content"]//button[@class="close"]'
).click()
self.teacher.sleep(0.75)
# add period/section
self.teacher.find(
By.XPATH,
'//div[contains(@class,"add-period")]//button'
).click()
self.teacher.sleep(0.75)