本文整理汇总了Python中staxing.helper.Teacher.delete方法的典型用法代码示例。如果您正苦于以下问题:Python Teacher.delete方法的具体用法?Python Teacher.delete怎么用?Python Teacher.delete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类staxing.helper.Teacher
的用法示例。
在下文中一共展示了Teacher.delete方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestEpicName
# 需要导入模块: from staxing.helper import Teacher [as 别名]
# 或者: from staxing.helper.Teacher import delete [as 别名]
class TestEpicName(unittest.TestCase):
"""Product.Epic - Epic Text."""
def setUp(self):
"""Pretest settings."""
self.ps = PastaSauce()
self.desired_capabilities['name'] = self.id()
self.teacher = Teacher(
use_env_vars=True,
pasta_user=self.ps,
capabilities=self.desired_capabilities
)
def tearDown(self):
"""Test destructor."""
self.ps.update_job(
job_id=str(self.teacher.driver.session_id),
**self.ps.test_updates
)
try:
self.teacher.delete()
except:
pass
# Case CaseID - Story# - UserType
@pytest.mark.skipif(str(CaseID) not in TESTS, reason='Excluded')
def test_usertype_storytext_CaseID(self):
"""Story Text.
Steps:
Expected Result:
"""
self.ps.test_updates['name'] = 'product.epic.story' \
+ inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates['tags'] = [
'product',
'product.epic',
'product.epic.story',
'CaseID'
]
self.ps.test_updates['passed'] = False
# Test steps and verification assertions
raise NotImplementedError(inspect.currentframe().f_code.co_name)
self.ps.test_updates['passed'] = True
示例2: test_teacher_able_to_search_within_the_book_7629
# 需要导入模块: from staxing.helper import Teacher [as 别名]
# 或者: from staxing.helper.Teacher import delete [as 别名]
def test_teacher_able_to_search_within_the_book_7629(self):
"""Able to search within the book.
Steps:
Go to tutor-qa
Click on the 'Login' button
Enter the teacher user account in the username and password text boxes
Click on the 'Sign in' button
If the user has more than one course, click on a CC course name
Click "Online Book" in the header
Enter search words into the search engine next to the "Contents" button
Expected Result:
The search word is highlighted in yellow within the text and is bolded
within the table of contents
"""
self.ps.test_updates["name"] = "cc1.05.005" + inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates["tags"] = ["cc1", "cc1.05", "cc1.05.005", "7629"]
self.ps.test_updates["passed"] = False
# Test steps and verification assertions
teacher = Teacher(
existing_driver=self.student.driver,
username=os.getenv("TEACHER_USER"),
password=os.getenv("TEACHER_PASSWORD"),
pasta_user=self.ps,
capabilities=self.desired_capabilities,
)
teacher.login()
teacher.driver.find_element(By.XPATH, '//a[contains(@href,"/cc-dashboard/")]').click()
teacher.wait.until(
expect.visibility_of_element_located((By.XPATH, '//a//span[contains(text(),"Online Book")]'))
).click()
window_with_book = teacher.driver.window_handles[1]
teacher.driver.switch_to_window(window_with_book)
assert "cnx" in teacher.current_url(), "Not viewing the textbook PDF"
teacher.page.wait_for_page_load()
teacher.wait.until(
expect.visibility_of_element_located((By.XPATH, '//input[@placeholder="Search this book"]'))
).send_keys("balance" + Keys.ENTER)
# make sure the search worked
# still passes if no results found and it says: No matching results...
teacher.wait.until(expect.visibility_of_element_located((By.XPATH, '//div[@class="result-count"]')))
teacher.delete()
self.ps.test_updates["passed"] = True
示例3: TestIImproveQuestionManagement
# 需要导入模块: from staxing.helper import Teacher [as 别名]
# 或者: from staxing.helper.Teacher import delete [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
#.........这里部分代码省略.........
示例4: TestViewTheCalendarDashboard
# 需要导入模块: from staxing.helper import Teacher [as 别名]
# 或者: from staxing.helper.Teacher import delete [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
#.........这里部分代码省略.........
示例5: TestViewClassPerformance
# 需要导入模块: from staxing.helper import Teacher [as 别名]
# 或者: from staxing.helper.Teacher import delete [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.
#.........这里部分代码省略.........
示例6: TestImproveLoginRegistrationEnrollment
# 需要导入模块: from staxing.helper import Teacher [as 别名]
# 或者: from staxing.helper.Teacher import delete [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'
#.........这里部分代码省略.........
示例7: TestAnalyzeCollegeWorkflow
# 需要导入模块: from staxing.helper import Teacher [as 别名]
# 或者: from staxing.helper.Teacher import delete [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:
#.........这里部分代码省略.........
示例8: TestTeacherViews
# 需要导入模块: from staxing.helper import Teacher [as 别名]
# 或者: from staxing.helper.Teacher import delete [as 别名]
class TestTeacherViews(unittest.TestCase):
"""CC1.13 - Teacher Views."""
def setUp(self):
"""Pretest settings."""
self.ps = PastaSauce()
self.desired_capabilities['name'] = self.id()
self.teacher = Teacher(
use_env_vars=True,
pasta_user=self.ps,
capabilities=self.desired_capabilities
)
self.teacher.login()
self.teacher.driver.find_element(
By.XPATH, '//a[contains(@href,"/cc-dashboard")]'
).click()
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 C7609 - 001 - Teacher | View the Concept Coach dashboard
@pytest.mark.skipif(str(7609) not in TESTS, reason='Excluded')
def test_teacher_view_the_concept_coach_dashboard_7609(self):
"""View the Concept Coach dashboard.
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:
The user is presented with the Concept Coach dashbaord
"""
self.ps.test_updates['name'] = 'cc1.13.001' \
+ inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates['tags'] = ['cc1', 'cc1.13', 'cc1.13.001', '7609']
self.ps.test_updates['passed'] = False
# Test steps and verification assertions
assert('cc-dashboard' in self.teacher.current_url()), \
'not at Concept Coach Dashboard'
self.ps.test_updates['passed'] = True
# Case C7610 - 002 - Teacher | Switch between concurrently running courses
@pytest.mark.skipif(str(7610) not in TESTS, reason='Excluded')
def test_teacher_switch_between_concurrently_running_courses_7610(self):
"""Able to switch between concurrently running courses.
Steps:
Click on the OpenStax logo in the left corner of the header
Expected Result:
The user is presented with a list of Concept Coach courses
Is able to switch to another course
"""
self.ps.test_updates['name'] = 'cc1.13.002' \
+ inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates['tags'] = ['cc1', 'cc1.13', 'cc1.13.002', '7610']
self.ps.test_updates['passed'] = False
# Test steps and verification assertions
url1 = self.teacher.current_url().split('courses')[1]
self.teacher.driver.find_element(
By.XPATH, '//a//i[@class="ui-brand-logo"]'
).click()
try:
self.teacher.driver.find_element(
By.XPATH,
'//a[contains(@href,"/cc-dashboard") ' +
'and not(contains(@href,"'+str(url1)+'"))]'
).click()
except NoSuchElementException:
print('Only one CC course, cannot go to another')
raise Exception
assert('cc-dashboard' in self.teacher.current_url()), \
'not at Concept Coach Dashboard'
assert(url1 != self.teacher.current_url()), \
'went to same course'
self.ps.test_updates['passed'] = True
# Case C7611 - 003 - Teacher | View links on dashboard to course materials
@pytest.mark.skipif(str(7611) not in TESTS, reason='Excluded')
def test_teacher_view_links_on_dashboard_to_course_materials_7611(self):
"""View links on dashboard to course materials.
Steps:
Go to Tutor
Click on the 'Login' button
#.........这里部分代码省略.........
示例9: TestTutorWorksWithCNX
# 需要导入模块: from staxing.helper import Teacher [as 别名]
# 或者: from staxing.helper.Teacher import delete [as 别名]
class TestTutorWorksWithCNX(unittest.TestCase):
"""T1.27 - Tutor works with CNX."""
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 C8182 - 001 - System | CNX needs to handle LaTeX in Exercises
@pytest.mark.skipif(str(8182) not in TESTS, reason='Excluded')
def test_system_cnx_needs_to_handle_latex_in_exercises_8182(self):
"""CNX needs to handle LaTeX in Exercises.
Steps:
Expected Result:
"""
self.ps.test_updates['name'] = 't1.27.001' \
+ inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates['tags'] = [
't1',
't1.27',
't1.27.001',
'8182'
]
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 C8183 - 002 - System | CNX pulls exercises from Tutor
@pytest.mark.skipif(str(8183) not in TESTS, reason='Excluded')
def test_system_cnx_pulls_exercises_from_tutor_8183(self):
"""Story Text.
Steps:
Expected Result:
"""
self.ps.test_updates['name'] = 't1.27.002' \
+ inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates['tags'] = [
't1',
't1.27',
't1.27.002',
'8183'
]
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
示例10: TestStudentsWorkAssignments
# 需要导入模块: from staxing.helper import Teacher [as 别名]
# 或者: from staxing.helper.Teacher import delete [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')
#.........这里部分代码省略.........
示例11: TestSimplifyAndImproveReadings
# 需要导入模块: from staxing.helper import Teacher [as 别名]
# 或者: from staxing.helper.Teacher import delete [as 别名]
class TestSimplifyAndImproveReadings(unittest.TestCase):
"""T2.13 - Simplify and Improve Readings."""
def setUp(self):
"""Pretest settings."""
self.ps = PastaSauce()
self.desired_capabilities["name"] = self.id()
self.teacher = Teacher(use_env_vars=True, pasta_user=self.ps, capabilities=self.desired_capabilities)
# create a reading for the student to work
self.teacher.login()
self.assignment_name = "t1.18 reading-%s" % randint(100, 999)
today = datetime.date.today()
begin = today.strftime("%m/%d/%Y")
end = (today + datetime.timedelta(days=randint(1, 10))).strftime("%m/%d/%Y")
self.teacher.add_assignment(
assignment="reading",
args={
"title": self.assignment_name,
"description": chomsky(),
"periods": {"all": (begin, end)},
"reading_list": ["1.1", "1.2"],
"status": "publish",
},
)
self.teacher.wait.until(
expect.visibility_of_element_located((By.XPATH, '//div[contains(@class,"calendar-container")]'))
)
self.teacher.logout()
# login as a student to work the reading
self.student = Student(
existing_driver=self.teacher.driver,
use_env_vars=True,
pasta_user=self.ps,
capabilities=self.desired_capabilities,
)
self.student.login()
self.student.wait.until(expect.visibility_of_element_located((By.LINK_TEXT, "This Week")))
reading = self.student.driver.find_element(By.XPATH, '//span[text()="%s"]' % self.assignment_name)
self.teacher.driver.execute_script("return arguments[0].scrollIntoView();", reading)
self.teacher.driver.execute_script("window.scrollBy(0, -80);")
reading.click()
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
# 14745 - 001 - Student | Relative size and progress are displayed while
# working a reading assignment
@pytest.mark.skipif(str(14745) not in TESTS, reason="Excluded")
def test_student_relative_size_and_progress_are_displayed_whil_14745(self):
"""Size and progress are displayed while working a reading.
Steps:
Go to Tutor
Click on the 'Login' button
Enter the student 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 Tutor course name
Click on a reading assignment
Click on the right arrow
Expected Result:
The progress bar at the top reflects how far along you are as you work
through the reading assignment
"""
self.ps.test_updates["name"] = "t2.13.001" + inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates["tags"] = ["t2", "t2.13", "t2.13.001", "14745"]
self.ps.test_updates["passed"] = False
# Test steps and verification assertions
self.student.driver.find_element(By.XPATH, '//div[contains(@class,"progress-bar progress-bar-success")]')
self.ps.test_updates["passed"] = True
# 14746 - 002 - Student | Access prior milestones in the reading assignment
# with breadcrumbs
@pytest.mark.skipif(str(14746) not in TESTS, reason="Excluded")
def test_student_access_prior_milestones_in_the_reading_assign_14746(self):
"""Access prior milestones in the reading assignment with breadcrumbs.
Steps:
If the user has more than one course, click on a Tutor course name
Click on a reading assignment
Click on the icon next to the calendar on the header
Expected Result:
The user is presented with prior milestones
"""
self.ps.test_updates["name"] = "t2.13.002" + inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates["tags"] = ["t2", "t2.13", "t2.13.002", "14746"]
self.ps.test_updates["passed"] = False
# Test steps and verification assertions
self.student.find(By.CSS_SELECTOR, "a.paging-control.next").click()
self.student.sleep(1)
#.........这里部分代码省略.........
示例12: TestImprovePracticeAndForecast
# 需要导入模块: from staxing.helper import Teacher [as 别名]
# 或者: from staxing.helper.Teacher import delete [as 别名]
class TestImprovePracticeAndForecast(unittest.TestCase):
"""T2.14 - Improve Practice and Forecast."""
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
# 14747 - 001 - Teacher | View how much students have practiced
@pytest.mark.skipif(str(14747) not in TESTS, reason="Excluded")
def test_teacher_view_how_much_students_have_practiced_14747(self):
"""View how much students have practiced.
Steps:
Expected Result:
"""
self.ps.test_updates["name"] = "t2.14.001" + inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates["tags"] = ["t2", "t2.14", "t2.14.001", "14747"]
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
# 14748 - 002 - Student | View changes in Performance Forecast at the end
# of a retrieval practice in readings, hw, and previous practice
@pytest.mark.skipif(str(14748) not in TESTS, reason="Excluded")
def test_student_view_changes_in_performance_forecast_at_the_14748(self):
"""View changes in Performance Forecast at end of retrieval practice.
Steps:
Expected Result:
"""
self.ps.test_updates["name"] = "t2.14.002" + inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates["tags"] = ["t2", "t2.14", "t2.14.002", "14748"]
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
# 14749 - 003 - Teacher | Assign practice
@pytest.mark.skipif(str(14749) not in TESTS, reason="Excluded")
def test_teacher_assign_practice_14749(self):
"""Assign practice.
Steps:
Expected Result:
"""
self.ps.test_updates["name"] = "t2.14.003" + inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates["tags"] = ["t2", "t2.14", "t2.14.003", "14749"]
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
示例13: TestConceptCoachWidgetMechanicsAndInfrastructure
# 需要导入模块: from staxing.helper import Teacher [as 别名]
# 或者: from staxing.helper.Teacher import delete [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: TestCreateNewQuestionAndAssignmentTypes
# 需要导入模块: from staxing.helper import Teacher [as 别名]
# 或者: from staxing.helper.Teacher import delete [as 别名]
class TestCreateNewQuestionAndAssignmentTypes(unittest.TestCase):
"""T2.12 - Create New Question and Assignment Types."""
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
# 14739 - 001 - Teacher | Vocabulary question is a question type
@pytest.mark.skipif(str(14739) not in TESTS, reason='Excluded')
def test_teacher_vocabulary_question_is_a_question_type_14739(self):
"""Vocabulary question is a question type.
Steps:
Go to Tutor
Click on the 'Login' button
Enter the teacher account in the username and password text boxes
Click on the 'Sign in' button
Click "Write a new exercise"
Click "New Vocabulary Term"
Expected Result:
The user is presented with a page where a new vocabulary question can
be created
"""
self.ps.test_updates['name'] = 't2.12.001' \
+ inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates['tags'] = ['t2', 't2.12', 't2.12.001', '14739']
self.ps.test_updates['passed'] = False
# Test steps and verification assertions
self.teacher.get("https://exercises-qa.openstax.org/")
# login
self.teacher.find(
By.XPATH, '//div[@id="account-bar-content"]//a[text()="Sign in"]'
).click()
self.teacher.page.wait_for_page_load()
self.teacher.find(
By.ID, 'auth_key'
).send_keys(self.teacher.username)
self.teacher.find(
By.ID, 'password'
).send_keys(self.teacher.password)
self.teacher.find(
By.XPATH, '//button[text()="Sign in"]'
).click()
# create new vocab
self.teacher.page.wait_for_page_load()
self.teacher.find(
By.XPATH, '//a[@href="/exercises/new"]'
).click()
self.teacher.wait.until(
expect.visibility_of_element_located(
(By.XPATH, '//a[text()="New Vocabulary Term"]')
)
).click()
assert('/vocabulary/new' in self.teacher.current_url()), \
'not at new vocab page'
self.ps.test_updates['passed'] = True
# 14741 - 002 - Teacher | True/False is a question type
@pytest.mark.skipif(str(14741) not in TESTS, reason='Excluded')
def test_teacher_truefalse_is_a_question_type_14741(self):
"""True/False is a question type.
Steps:
Click "Write a new exercise"
Click on the "True/False" radio button
Expected Result:
The user is presented with a page where a True/False question can be
created
"""
self.ps.test_updates['name'] = 't2.12.002' \
+ inspect.currentframe().f_code.co_name[4:]
#.........这里部分代码省略.........
示例15: TestTeacherLoginAndAuthentification
# 需要导入模块: from staxing.helper import Teacher [as 别名]
# 或者: from staxing.helper.Teacher import delete [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):
#.........这里部分代码省略.........