本文整理汇总了Python中staxing.helper.Teacher.sleep方法的典型用法代码示例。如果您正苦于以下问题:Python Teacher.sleep方法的具体用法?Python Teacher.sleep怎么用?Python Teacher.sleep使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类staxing.helper.Teacher
的用法示例。
在下文中一共展示了Teacher.sleep方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestWorkAnExternalAssignment
# 需要导入模块: from staxing.helper import Teacher [as 别名]
# 或者: from staxing.helper.Teacher import sleep [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,
#.........这里部分代码省略.........
示例2: TestAnalyzeCollegeWorkflow
# 需要导入模块: from staxing.helper import Teacher [as 别名]
# 或者: from staxing.helper.Teacher import sleep [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:
#.........这里部分代码省略.........
示例3: TestTeacherViews
# 需要导入模块: from staxing.helper import Teacher [as 别名]
# 或者: from staxing.helper.Teacher import sleep [as 别名]
#.........这里部分代码省略.........
Click the user menu in the right corner of the header
Click "Student Scores"
Click on a student's score for the desired assignment
Click "Summary"
Expected Result:
The user is presented with an assignmnent summary
"""
self.ps.test_updates['name'] = 'cc1.13.012' \
+ inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates['tags'] = ['cc1', 'cc1.13', 'cc1.13.012', '7620']
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(),"Student Scores")]'
).click()
self.teacher.wait.until(
expect.visibility_of_element_located(
(By.XPATH, '//span[text()="Student Scores"]')
)
)
self.teacher.driver.find_element(
By.XPATH,
'//div[contains(@class,"scores-cell")]' +
'/div[@class="score"]'
).click()
self.teacher.driver.find_element(
By.XPATH,
'//span[contains(@class,"openstax-breadcrumbs-")' +
'and contains(@data-reactid,"-end-")]'
).click()
self.teacher.sleep(0.5)
breadcrumbs_answered = self.teacher.driver.find_elements(
By.XPATH,
'//span[contains(@class,"openstax-breadcrumbs-")' +
'and contains(@class,"completed")]'
)
question_cards = self.teacher.driver.find_elements(
By.XPATH, '//div[contains(@class,"openstax-exercise-card")]'
)
assert(len(question_cards) == len(breadcrumbs_answered)), \
'all answered questions not in summary'
self.ps.test_updates['passed'] = True
# Case C7622 - 013 - Teacher | Download student scores
@pytest.mark.skipif(str(7622) not in TESTS, reason='Excluded')
def test_teacher_download_student_scores_7622(self):
"""Download student scores.
Steps:
Click the user menu in the right corner of the header
Click "Student Scores"
Click "Export"
Expected Result:
Student scores are downloaded in an excel spreadsheet
"""
self.teacher.open_user_menu()
self.teacher.driver.find_element(
By.XPATH, '//a[contains(text(),"Student Scores")]'
).click()
self.teacher.wait.until(
expect.visibility_of_element_located(
示例4: TestEditCourseSettingsAndRoster
# 需要导入模块: from staxing.helper import Teacher [as 别名]
# 或者: from staxing.helper.Teacher import sleep [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: TestImproveCourseManagement
# 需要导入模块: from staxing.helper import Teacher [as 别名]
# 或者: from staxing.helper.Teacher import sleep [as 别名]
class TestImproveCourseManagement(unittest.TestCase):
"""T2.07 - Improve Course 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.admin = Admin(
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.admin = None
self.teacher.delete()
except:
pass
# 14651 - 001 - Admin | View Student Use Statistics for Concept Coach
# college assessments
@pytest.mark.skipif(str(14651) not in TESTS, reason='Excluded')
def test_admin_view_student_use_statistics_for_cc_college_asse_14651(self):
"""View Student Use Statistics for Concept Coach college assessments.
Steps:
Go to Tutor
Click on the 'Login' button
Enter the admin account in the username and password text boxes
Click on the 'Sign in' button
Click "Admin" in the user menu
Click "Stats"
Click "Concept Coach"
Expected Result:
The user is presented with Concept Coach statistics
"""
self.ps.test_updates['name'] = 't2.07.001' \
+ inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates['tags'] = [
't2',
't2.07',
't2.07.001',
'14651'
]
self.ps.test_updates['passed'] = False
# Test steps and verification assertions
self.admin.login()
self.admin.goto_admin_control()
self.admin.sleep(5)
self.admin.wait.until(
expect.visibility_of_element_located(
(By.PARTIAL_LINK_TEXT, 'Stats')
)
).click()
self.admin.wait.until(
expect.visibility_of_element_located(
(By.PARTIAL_LINK_TEXT, 'Concept Coach')
)
).click()
assert('/stats/concept_coach' in self.admin.current_url()), \
'Not viewing Concept Coach stats'
self.ps.test_updates['passed'] = True
# 14652 - 002 - Teacher | Delegate teaching tasks to supporting instructors
@pytest.mark.skipif(str(14652) not in TESTS, reason='Excluded')
def test_teacher_delegate_teaching_tasks_to_supporting_instruc_14652(self):
"""Delegate teaching tasks to supporting instructors.
Steps:
Expected Result:
"""
self.ps.test_updates['name'] = 't2.07.002' \
+ inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates['tags'] = [
't2',
't2.07',
't2.07.002',
'14652'
]
self.ps.test_updates['passed'] = False
#.........这里部分代码省略.........
示例6: TestTrainingAndSupportingTeachersAndStudents
# 需要导入模块: from staxing.helper import Teacher [as 别名]
# 或者: from staxing.helper.Teacher import sleep [as 别名]
#.........这里部分代码省略.........
By.XPATH, '//center[contains(text(),"Concept Coach Help Center")]'
)
assert('support' in self.student.current_url()), 'not at help center'
self.ps.test_updates['passed'] = True
# Case C7707 - 004 - Non-user | Submit support questions
@pytest.mark.skipif(str(7707) not in TESTS, reason='Excluded')
def test_nonuser_submit_support_questions_7707(self):
"""Submit support questions.
Steps:
Go to the Concept Coach landing page
click support in the header
enter text into the search box
click contact us
fillout form
click Submit
Expected Result:
'Message sent' displayed in help box
"""
self.ps.test_updates['name'] = 'cc1.14.004' \
+ inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates['tags'] = [
'cc1',
'cc1.14',
'cc1.14.004',
'7707'
]
self.ps.test_updates['passed'] = False
# Test steps and verification assertions
self.teacher.get('http://cc.openstax.org/')
self.teacher.sleep(1)
# number hardcoded because condenses at different size than tutor
if self.teacher.driver.get_window_size()['width'] < 1105:
element = self.teacher.wait.until(
expect.visibility_of_element_located(
(By.XPATH, '//label[@for="mobileNavToggle"]')
)
)
actions = ActionChains(self.teacher.driver)
# use action chain because it is clicking to the wrong elemnt
actions.move_to_element(element)
actions.click()
actions.perform()
support = self.teacher.find(
By.LINK_TEXT, 'support'
)
actions = ActionChains(self.teacher.driver)
actions.move_to_element(support)
actions.click()
actions.perform()
window_with_help = self.teacher.driver.window_handles[1]
self.teacher.driver.switch_to_window(window_with_help)
self.teacher.page.wait_for_page_load()
self.teacher.find(
By.ID, 'searchAskInput'
).send_keys('fake_question')
self.teacher.find(
By.ID, 'searchAskButton'
).click()
self.teacher.find(
By.LINK_TEXT, 'Contact Us'
).click()
self.teacher.page.wait_for_page_load()
开发者ID:openstax,项目名称:test-automation,代码行数:70,代码来源:test_cc1_14_TrainingAndSupportingTeachersAndStudents.py
示例7: test_teacher_remove_themself_from_the_course_7725
# 需要导入模块: from staxing.helper import Teacher [as 别名]
# 或者: from staxing.helper.Teacher import sleep [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
示例8: TestIImproveQuestionManagement
# 需要导入模块: from staxing.helper import Teacher [as 别名]
# 或者: from staxing.helper.Teacher import sleep [as 别名]
#.........这里部分代码省略.........
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
# 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.2"]'
).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.teacher.sleep(1)
i = 1
question = None
# loop finding a question that is not yet excleded
# there are 9 question in the exact textbook and chpater this test
# is searching. limiting loop at 7 incase questions are removed.
while i < 8:
question = self.teacher.find(
By.XPATH,
'//div[@class="exercises"]/div[' + str(i) + ']'
)
if ('is-selected' not in question.get_attribute('class')):
break
i += 1
Assignment.scroll_to(self.teacher.driver, question)
self.teacher.sleep(1)
actions = ActionChains(self.teacher.driver)
actions.move_to_element(question)
# way to stall because not sure how to add wait in action chain
for _ in range(50):
actions.move_by_offset(-1, 0)
actions.click()
actions.move_by_offset(-50, -300)
actions.perform()
self.teacher.sleep(0.5)
question_excluded = self.teacher.find(
By.XPATH, '//div[@class="exercises"]/div[' + str(i) + ']'
).get_attribute('class')
assert('is-selected' in question_excluded), 'question not excluded'
self.ps.test_updates['passed'] = True
# 14855 - 003 - Teacher | Pin tabs on top of screen when scrolled
@pytest.mark.skipif(str(14855) not in TESTS, reason='Excluded')
示例9: TestRecruitingTeachers
# 需要导入模块: from staxing.helper import Teacher [as 别名]
# 或者: from staxing.helper.Teacher import sleep [as 别名]
#.........这里部分代码省略.........
"""Can interact with a Concept Coach wire frame for each subject.
Steps:
Go to the recruitment website ( http://cc.openstax.org/)
Hover over "demos" in the header
Click "Interactice Demo"
CLick on a Concept Coach book title
Expected Result:
A new tab or window opens rendering the demo content for the selected
book
"""
self.ps.test_updates['name'] = 'cc1.01.003' \
+ inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates['tags'] = [
'cc1',
'cc1.01',
'cc1.01.003',
'7753'
]
self.ps.test_updates['passed'] = False
# Test steps and verification assertions
self.teacher.get('http://cc.openstax.org/')
self.teacher.page.wait_for_page_load()
demo_link = self.teacher.find(
By.XPATH,
'//section[@id="interactive-demo"]' +
'//a[@class="btn" and contains(@href,"cc-mockup")]'
)
self.teacher.driver.execute_script(
'return arguments[0].scrollIntoView();', demo_link)
self.teacher.driver.execute_script('window.scrollBy(0, -80);')
self.teacher.sleep(1)
demo_link.click()
window_with_book = self.teacher.driver.window_handles[1]
self.teacher.driver.switch_to_window(window_with_book)
self.teacher.page.wait_for_page_load()
assert('http://cc.openstax.org/assets/demos/cc-mockup' in
self.teacher.current_url()), \
'not at demo book'
self.ps.test_updates['passed'] = True
# # NOT DONE
# Case C7754 - 004 - Teacher | View a Concept Coach demo video
@pytest.mark.skipif(str(7754) not in TESTS, reason='Excluded')
def test_teacher_view_a_concept_coach_demo_video_7754(self):
"""View a Concept Coach demo video.
Steps:
Open recruitment website ( http://cc.openstax.org/ )
Hover over "demos" in the header
Click "Interactive Demo"
Click on a Concept Coach book title
Scroll down until an embedded video pane is displayed
Click on the right-pointing arrow to play the video
Expected Result:
The video loads and plays
"""
self.ps.test_updates['name'] = 'cc1.01.004' \
+ inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates['tags'] = [
'cc1',
'cc1.01',
'cc1.01.004',
示例10: TestAdminAndTeacherCourseSetup
# 需要导入模块: from staxing.helper import Teacher [as 别名]
# 或者: from staxing.helper.Teacher import sleep [as 别名]
#.........这里部分代码省略.........
(By.XPATH, '//div[contains(@class,"add-period")]//button')
)
).click()
self.teacher.wait.until(
expect.visibility_of_element_located(
(By.XPATH,
'//div[@class="modal-content"]//input[@type="text"]')
)
).send_keys(section_name)
self.teacher.driver.find_element(
By.XPATH,
'//div[@class="modal-content"]//button/span[text()="Add"]'
).click()
# archive the section just created
self.teacher.wait.until(
expect.visibility_of_element_located(
(By.XPATH,
'//li//a[@role="tab" and text()="' + section_name + '"]')
)
).click()
self.teacher.wait.until(
expect.visibility_of_element_located(
(By.XPATH,
'//a[contains(@class,"archive-period")]')
)
).click()
self.teacher.wait.until(
expect.visibility_of_element_located(
(By.XPATH,
'//div[@role="tooltip"]//button' +
'//span[contains(text(),"Archive")]')
)
).click()
self.teacher.sleep(2)
archived = self.teacher.driver.find_elements(
By.XPATH, '//li//a[@role="tab" and text()="' + section_name + '"]')
assert(len(archived) == 0), ' not archived'
self.ps.test_updates['passed'] = True
# Case C7722 - 008 - Teacher | Archive a non-empty period
@pytest.mark.skipif(str(7722) not in TESTS, reason='Excluded')
def test_teacher_archive_a_nonempty_periods_7722(self):
"""Error message displayed if attempting to remove a non-empty period.
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 tab for selected non-empty section
Click 'Archive section'
Click Archive
Expected Result:
Section is archived
"""
self.ps.test_updates['name'] = 'cc1.10.008' \
+ inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates['tags'] = [
'cc1',
'cc1.10',
'cc1.10.008',
'7722'
]
self.ps.test_updates['passed'] = False
示例11: TestTeacherLoginAndAuthentification
# 需要导入模块: from staxing.helper import Teacher [as 别名]
# 或者: from staxing.helper.Teacher import sleep [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):
#.........这里部分代码省略.........
示例12: TestStudentsWorkAssignments
# 需要导入模块: from staxing.helper import Teacher [as 别名]
# 或者: from staxing.helper.Teacher import sleep [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')
#.........这里部分代码省略.........
示例13: TestConceptCoachWidgetMechanicsAndInfrastructure
# 需要导入模块: from staxing.helper import Teacher [as 别名]
# 或者: from staxing.helper.Teacher import sleep [as 别名]
class TestConceptCoachWidgetMechanicsAndInfrastructure(unittest.TestCase):
"""CC1.06 - Concept Coach Widget Mechanics and Infrastructure."""
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 C7748 - 001 - Student | View a Concept Coach book and see the widget
@pytest.mark.skipif(str(7748) not in TESTS, reason='Excluded')
def test_student_view_a_cc_book_and_see_the_widget_7748(self):
"""View a Concept Coach book and see the widget.
Steps:
go to tutor-qa
login as a student
click on a concept coach book
Click on the 'Contents +' button
Click on the a chapter in the contents
Click on a section other than the introduction
Scroll down
Expected Result:
Concept Coach widget visible
"""
self.ps.test_updates['name'] = 'cc1.06.001' \
+ inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates['tags'] = [
'cc1',
'cc1.06',
'cc1.06.001',
'7748'
]
self.ps.test_updates['passed'] = False
# login and go to cc course
student = Student(
use_env_vars=True,
pasta_user=self.ps,
capabilities=self.desired_capabilities,
username=os.getenv('STUDENT_USER'),
password=os.getenv('STUDENT_PASSWORD')
)
student.login()
student.driver.find_element(
By.XPATH, '//a[contains(@href,"cnx.org/contents")]'
).click()
# go to section 1.1 then cc widget
student.page.wait_for_page_load()
student.driver.find_element(
By.XPATH,
'//button[@class="toggle btn"]//span[contains(text(),"Contents")]'
).click()
student.sleep(0.5)
student.driver.find_element(
By.XPATH,
'//span[@class="chapter-number" and text()="1.1"]'
).click()
student.page.wait_for_page_load()
student.wait.until(
expect.visibility_of_element_located(
(By.LINK_TEXT, 'Jump to Concept Coach')
)
).click()
student.driver.find_element(
By.XPATH,
'//div[@class="concept-coach-launcher"]'
)
student.delete()
self.ps.test_updates['passed'] = True
# Case C7749 - 002 - Teacher | View a Concept Coach book and see the widget
@pytest.mark.skipif(str(7749) not in TESTS, reason='Excluded')
def test_teacher_view_a_cc_book_and_see_the_widget_7749(self):
"""View a Concept Coach book and see the widget.
Steps:
Go to Tutor
Login as a teacher
Click on a concept coach book
Click on 'Online Book' in the header
Click on the 'Contents +' button
Click on the a chapter in the contents
Click on a section other than the introduction
Scroll down
#.........这里部分代码省略.........
开发者ID:openstax,项目名称:test-automation,代码行数:103,代码来源:test_cc1_06_ConceptCoachWidgetMechanicsAndInfrastructure.py
示例14: TestImproveLoginRegistrationEnrollment
# 需要导入模块: from staxing.helper import Teacher [as 别名]
# 或者: from staxing.helper.Teacher import sleep [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 sleep [as 别名]
#.........这里部分代码省略.........
# 14810 - 004 - Teacher | Sort student scores based on score
@pytest.mark.skipif(str(14810) not in TESTS, reason='Excluded')
def test_teacher_sort_student_scores_based_on_score_14810(self):
"""Sort student scores based on score.
Steps:
If the user has more than one course, click on a CC course name
Click "View Detailed Scores"
Click "Score" for the desired assignment
Expected Result:
Students are sorted based on score
"""
self.ps.test_updates['name'] = 'cc2.08.004' \
+ inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates['tags'] = ['cc2', 'cc2.08', 'cc2.08.004', '14810']
self.ps.test_updates['passed'] = False
# Test steps and verification assertions
self.teacher.wait.until(
expect.visibility_of_element_located(
(By.XPATH, '//a[contains(text(),"View Detailed Scores")]')
)
).click()
self.teacher.wait.until(
expect.visibility_of_element_located(
(By.XPATH, '//span[contains(text(),"Student Scores")]')
)
)
self.teacher.find(
By.XPATH,
'//div[contains(@class,"sortable")]//div[text()="Score"]'
).click()
self.teacher.sleep(0.75)
self.teacher.find(
By.XPATH,
'//div[contains(@class,"is-descending")]//div[text()="Score"]'
).click()
self.teacher.sleep(0.75)
self.teacher.find(
By.XPATH,
'//div[contains(@class,"is-ascending")]//div[text()="Score"]'
)
self.ps.test_updates['passed'] = True
# 14811 - 005 - Teacher | Sort student scores based on number complete
@pytest.mark.skipif(str(14811) not in TESTS, reason='Excluded')
def test_teacher_sort_student_scores_based_on_number_completed_14811(self):
"""Sort student scores based on number complete.
Steps:
If the user has more than one course, click on a CC course name
Click "View Detailed Scores"
Click "Progress" for the desired assignment
Expected Result:
Students are sorted based on number completed
"""
self.ps.test_updates['name'] = 'cc2.08.005' \
+ inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates['tags'] = ['cc2', 'cc2.08', 'cc2.08.005', '14811']
self.ps.test_updates['passed'] = False
# Test steps and verification assertions
self.teacher.wait.until(
expect.visibility_of_element_located(