本文整理汇总了Python中staxing.helper.Teacher.current_url方法的典型用法代码示例。如果您正苦于以下问题:Python Teacher.current_url方法的具体用法?Python Teacher.current_url怎么用?Python Teacher.current_url使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类staxing.helper.Teacher
的用法示例。
在下文中一共展示了Teacher.current_url方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_teacher_able_to_search_within_the_book_7629
# 需要导入模块: from staxing.helper import Teacher [as 别名]
# 或者: from staxing.helper.Teacher import current_url [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
示例2: TestWorkAnExternalAssignment
# 需要导入模块: from staxing.helper import Teacher [as 别名]
# 或者: from staxing.helper.Teacher import current_url [as 别名]
class TestWorkAnExternalAssignment(unittest.TestCase):
"""T1.48 - Work an external assignment."""
def setUp(self):
"""Pretest settings."""
self.ps = PastaSauce()
self.desired_capabilities['name'] = self.id()
self.student = Student(
use_env_vars=True,
pasta_user=self.ps,
capabilities=self.desired_capabilities
)
self.teacher = Teacher(
use_env_vars=True,
existing_driver=self.student.driver,
pasta_user=self.ps,
capabilities=self.desired_capabilities
)
self.teacher.login()
# Create an external assignment for the student to work
self.teacher.select_course(appearance='physics')
self.teacher.wait.until(
expect.visibility_of_element_located(
(By.ID, 'add-assignment')
)
).click()
self.teacher.find(
By.PARTIAL_LINK_TEXT, 'Add External Assignment').click()
assert('externals/new' in self.teacher.current_url()), \
'Not on the add an external assignment page'
self.teacher.find(
By.XPATH, "//input[@id = 'reading-title']").send_keys('Epic 48')
self.teacher.find(
By.XPATH, "//textarea[@class='form-control empty']").send_keys(
"instructions go here")
self.teacher.find(
By.XPATH, "//input[@id = 'hide-periods-radio']").click()
# Choose the first date calendar[0], second is calendar[1]
# and set the open date to today
self.teacher.driver.find_elements_by_xpath(
"//div[@class = 'datepicker__input-container']")[0].click()
self.teacher.driver.find_element_by_xpath(
"//div[@class = 'datepicker__day datepicker__day--today']").click()
# Choose the second date calendar[1], first is calendar[0]
self.teacher.driver.find_elements_by_xpath(
"//div[@class = 'datepicker__input-container']")[1].click()
while(self.teacher.find(
By.XPATH,
"//span[@class = 'datepicker__current-month']"
).text != 'December 2016'):
self.teacher.find(
By.XPATH,
"//a[@class = 'datepicker__navigation datepicker__" +
"navigation--next']").click()
# Choose the due date of December 31, 2016
weekends = self.teacher.driver.find_elements_by_xpath(
"//div[@class = 'datepicker__day datepicker__day--weekend']")
for day in weekends:
if day.text == '31':
due = day
due.click()
break
self.teacher.find(By.XPATH, "//input[@id='external-url']").send_keys(
"google.com")
self.teacher.sleep(5)
# Publish the assignment
self.teacher.find(
By.XPATH,
"//button[@class='async-button -publish btn btn-primary']").click()
self.teacher.sleep(60)
self.student.login()
def tearDown(self):
"""Test destructor."""
self.ps.update_job(
job_id=str(self.student.driver.session_id),
**self.ps.test_updates
)
try:
# Delete the assignment
assert('calendar' in self.teacher.current_url()), \
'Not viewing the calendar dashboard'
spans = self.teacher.driver.find_elements_by_tag_name('span')
for element in spans:
if element.text.endswith('2016'):
month = element
# Change the calendar date if necessary
while (month.text != 'December 2016'):
self.teacher.find(
By.XPATH,
#.........这里部分代码省略.........
示例3: TestChooseCourse
# 需要导入模块: from staxing.helper import Teacher [as 别名]
# 或者: from staxing.helper.Teacher import current_url [as 别名]
class TestChooseCourse(unittest.TestCase):
"""T1.38 - Choose Course."""
def setUp(self):
"""Pretest settings."""
self.ps = PastaSauce()
self.desired_capabilities['name'] = self.id()
self.user = None
def tearDown(self):
"""Test destructor."""
self.ps.update_job(
job_id=str(self.user.driver.session_id),
**self.ps.test_updates
)
try:
self.user.delete()
except:
pass
# Case C8254 - 001 - Student | Select a course
@pytest.mark.skipif(str(8254) not in TESTS, reason='Excluded')
def test_student_select_a_course_8254(self):
"""Select a course.
Steps:
Click on a Tutor course name
Expected Result:
The user selects a course and is presented with the dashboard.
"""
self.ps.test_updates['name'] = 't1.38.001' \
+ inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates['tags'] = [
't1',
't1.38',
't1.38.001',
'8254'
]
self.ps.test_updates['passed'] = False
# Test steps and verification assertions
self.user = Student(
use_env_vars=True,
pasta_user=self.ps,
capabilities=self.desired_capabilities
)
self.user.login()
self.user.select_course(appearance='physics')
assert('list' in self.user.current_url()), \
'Not in a course'
self.ps.test_updates['passed'] = True
# Case C8255 - 002 - Student | Bypass the course picker
@pytest.mark.skipif(str(8255) not in TESTS, reason='Excluded')
def test_student_bypass_the_course_picker_8255(self):
"""Bypass the course picker.
Steps:
Go to Tutor
Click on the 'Login' button
Enter the student user account qas_01
Click on the 'Sign in' button
Expected Result:
The user bypasses the course picker and is presented with the
dashboard (because qas_01 is only enrolled in one course)
"""
self.ps.test_updates['name'] = 't1.38.002' \
+ inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates['tags'] = [
't1',
't1.38',
't1.38.002',
'8255'
]
self.ps.test_updates['passed'] = False
# Test steps and verification assertions
self.user = Student(
use_env_vars=True,
pasta_user=self.ps,
capabilities=self.desired_capabilities
)
self.user.login(username="qas_01")
assert('list' in self.user.current_url()), \
'Not in a course'
self.ps.test_updates['passed'] = True
# Case C8256 - 003 - Teacher | Select a course
@pytest.mark.skipif(str(8256) not in TESTS, reason='Excluded')
def test_teacher_select_a_course_8256(self):
"""Select a course.
Steps:
Click on a Tutor course name
#.........这里部分代码省略.........
示例4: TestTeacherViews
# 需要导入模块: from staxing.helper import Teacher [as 别名]
# 或者: from staxing.helper.Teacher import current_url [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
#.........这里部分代码省略.........
示例5: TestTrainingAndSupportingTeachersAndStudents
# 需要导入模块: from staxing.helper import Teacher [as 别名]
# 或者: from staxing.helper.Teacher import current_url [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
示例6: TestCreateNewQuestionAndAssignmentTypes
# 需要导入模块: from staxing.helper import Teacher [as 别名]
# 或者: from staxing.helper.Teacher import current_url [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:]
#.........这里部分代码省略.........
示例7: TestViewTheCalendarDashboard
# 需要导入模块: from staxing.helper import Teacher [as 别名]
# 或者: from staxing.helper.Teacher import current_url [as 别名]
class TestViewTheCalendarDashboard(unittest.TestCase):
"""T1.13 - View the calendar."""
def setUp(self):
"""Pretest settings."""
self.ps = PastaSauce()
self.desired_capabilities['name'] = self.id()
self.teacher = Teacher(
use_env_vars=True,
pasta_user=self.ps,
capabilities=self.desired_capabilities
)
self.teacher.login()
self.teacher.select_course(title='HS Physics')
def tearDown(self):
"""Test destructor."""
self.ps.update_job(
job_id=str(self.teacher.driver.session_id),
**self.ps.test_updates
)
try:
self.teacher.delete()
except:
pass
# Case C7978 - 001 - Teacher | View the calendar dashboard
@pytest.mark.skipif(str(7978) not in TESTS, reason='Excluded')
def test_teacher_view_the_calendar_dashboard_7978(self):
"""View the calendar dashboard.
Steps:
If the user has more than one course, click on a Tutor course name
Expected Result:
The teacher is presented their calendar dashboard.
"""
self.ps.test_updates['name'] = 't1.13.001' + \
inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates['tags'] = ['t1', 't1.13', 't1.13.001', '7978']
self.ps.test_updates['passed'] = False
# self.teacher.select_course(title='HS Physics')
assert('calendar' in self.teacher.current_url()), \
'Not viewing the calendar dashboard'
self.ps.test_updates['passed'] = True
# Case C7979 - 002 - Teacher | View student scores using dashboard button
@pytest.mark.skipif(str(7979) not in TESTS, reason='Excluded')
def test_teacher_view_student_scores_using_the_dashboard_button_7979(self):
"""View student scores using the dashboard button.
Steps:
If the user has more than one course, click on a Tutor course name
Click on the 'Student Scores' button
Expected Result:
The teacher is presented with the student scores
"""
self.ps.test_updates['name'] = 't1.13.002' + \
inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates['tags'] = ['t1', 't1.13', 't1.13.002', '7979']
self.ps.test_updates['passed'] = False
# self.teacher.select_course(title='HS Physics')
self.teacher.find(By.LINK_TEXT, 'Student Scores').click()
assert('scores' in self.teacher.current_url()), \
'Not viewing student scores'
self.ps.test_updates['passed'] = True
# Case C7980 - 003 - Teacher | View student scores using the user menu link
@pytest.mark.skipif(str(7980) not in TESTS, reason='Excluded')
def test_teacher_view_student_scores_using_the_user_menu_link_7980(self):
"""View student scores using the user menu link.
Steps:
If the user has more than one course, click on a Tutor course name
Click on the user menu
Click on the 'Student Scores' link
Expected Result:
The teacher is presented with the student scores
"""
self.ps.test_updates['name'] = 't1.13.003' \
+ inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates['tags'] = ['t1', 't1.13', 't1.13.003', '7980']
self.ps.test_updates['passed'] = False
# self.teacher.select_course(title='HS Physics')
self.teacher.open_user_menu()
self.teacher.find(By.CLASS_NAME, 'viewScores'). \
find_element_by_tag_name('a'). \
click()
assert('scores' in self.teacher.current_url()), \
'Not viewing the student scores'
self.ps.test_updates['passed'] = True
#.........这里部分代码省略.........
示例8: TestConceptCoachWidgetMechanicsAndInfrastructure
# 需要导入模块: from staxing.helper import Teacher [as 别名]
# 或者: from staxing.helper.Teacher import current_url [as 别名]
#.........这里部分代码省略.........
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
Expected Result:
Concept Coach widget visible
"""
self.ps.test_updates['name'] = 'cc1.06.002' \
+ inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates['tags'] = [
'cc1',
'cc1.06',
'cc1.06.002',
'7749'
]
self.ps.test_updates['passed'] = False
# login and go to cc course
self.teacher.login()
self.teacher.driver.find_element(
By.XPATH, '//a[contains(@href,"/cc-dashboard")]'
).click()
# open online book
self.teacher.driver.find_element(
By.XPATH, '//a//span[contains(text(),"Online Book")]'
).click()
window_with_book = self.teacher.driver.window_handles[1]
self.teacher.driver.switch_to_window(window_with_book)
assert('cnx' in self.teacher.current_url()), \
'Not viewing the textbook PDF'
# go to section 1.1 then cc widget
self.teacher.page.wait_for_page_load()
self.teacher.driver.find_element(
By.XPATH,
'//button[@class="toggle btn"]//span[contains(text(),"Contents")]'
).click()
self.teacher.sleep(0.5)
self.teacher.driver.find_element(
By.XPATH,
'//span[@class="chapter-number" and text()="1.1"]'
).click()
self.teacher.page.wait_for_page_load()
self.teacher.wait.until(
expect.visibility_of_element_located(
(By.LINK_TEXT, 'Jump to Concept Coach')
)
).click()
self.teacher.driver.find_element(
By.XPATH,
'//div[@class="concept-coach-launcher"]'
)
self.ps.test_updates['passed'] = True
# Case C7750 - 003 - Student | Doesn't see end-of-page exercise sections
@pytest.mark.skipif(str(7750) not in TESTS, reason='Excluded')
def test_student_doesnt_see_end_of_page_exercise_sections_7750(self):
"""Doesn't see end-of-page exercise sections.
Steps:
Go to Tutor
Login as a student
开发者ID:openstax,项目名称:test-automation,代码行数:70,代码来源:test_cc1_06_ConceptCoachWidgetMechanicsAndInfrastructure.py
示例9: test_teacher_remove_themself_from_the_course_7725
# 需要导入模块: from staxing.helper import Teacher [as 别名]
# 或者: from staxing.helper.Teacher import current_url [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
示例10: TestRecruitingTeachers
# 需要导入模块: from staxing.helper import Teacher [as 别名]
# 或者: from staxing.helper.Teacher import current_url [as 别名]
#.........这里部分代码省略.........
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',
'7754'
]
self.ps.test_updates['passed'] = False
raise NotImplementedError(inspect.currentframe().f_code.co_name)
# Test steps and verification assertions
示例11: TestUserLogin
# 需要导入模块: from staxing.helper import Teacher [as 别名]
# 或者: from staxing.helper.Teacher import current_url [as 别名]
class TestUserLogin(unittest.TestCase):
"""T1.36 - User login."""
def setUp(self):
"""Pretest settings."""
self.ps = PastaSauce()
self.desired_capabilities['name'] = self.id()
self.admin = Admin(
use_env_vars=True,
pasta_user=self.ps,
capabilities=self.desired_capabilities
)
self.content = ContentQA(
existing_driver=self.admin.driver,
use_env_vars=True,
pasta_user=self.ps,
capabilities=self.desired_capabilities
)
self.student = Student(
existing_driver=self.admin.driver,
use_env_vars=True,
pasta_user=self.ps,
capabilities=self.desired_capabilities
)
self.teacher = Teacher(
existing_driver=self.admin.driver,
use_env_vars=True,
pasta_user=self.ps,
capabilities=self.desired_capabilities
)
def tearDown(self):
"""Test destructor."""
self.ps.update_job(
job_id=str(self.admin.driver.session_id),
**self.ps.test_updates
)
try:
self.teacher = None
self.student = None
self.content = None
self.admin.delete()
except:
pass
# Case C8238 - 001 - Admin | Log into Tutor
@pytest.mark.skipif(str(8238) not in TESTS, reason='Excluded')
def test_admin_log_into_tutor_8238(self):
"""Log into Tutor.
Steps:
Click on the 'Login' button
Enter the admin account in the username and password text boxes
Click on the 'Sign in' button
Expected Result:
User is logged in
"""
self.ps.test_updates['name'] = 't1.36.001' \
+ inspect.currentframe().f_code.co_name[4:]
self.ps.test_updates['tags'] = ['t1', 't1.36', 't1.36.001', '8238']
self.ps.test_updates['passed'] = False
self.admin.get(self.admin.url)
self.admin.page.wait_for_page_load()
# check to see if the screen width is normal or condensed
if self.admin.driver.get_window_size()['width'] <= \
self.admin.CONDENSED_WIDTH:
# get small-window menu toggle
is_collapsed = self.admin.find(
By.XPATH,
'//button[contains(@class,"navbar-toggle")]'
)
# check if the menu is collapsed and, if yes, open it
if('collapsed' in is_collapsed.get_attribute('class')):
is_collapsed.click()
self.admin.wait.until(
expect.visibility_of_element_located(
(By.LINK_TEXT, 'Login')
)
).click()
self.admin.page.wait_for_page_load()
self.admin.find(
By.ID, 'auth_key'
).send_keys(self.admin.username)
self.admin.find(
By.ID, 'password'
).send_keys(self.admin.password)
# 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
#.........这里部分代码省略.........
示例12: TestTeacherLoginAndAuthentification
# 需要导入模块: from staxing.helper import Teacher [as 别名]
# 或者: from staxing.helper.Teacher import current_url [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):
#.........这里部分代码省略.........
示例13: TestStudentsWorkAssignments
# 需要导入模块: from staxing.helper import Teacher [as 别名]
# 或者: from staxing.helper.Teacher import current_url [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')
#.........这里部分代码省略.........
示例14: TestAnalyzeCollegeWorkflow
# 需要导入模块: from staxing.helper import Teacher [as 别名]
# 或者: from staxing.helper.Teacher import current_url [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:
#.........这里部分代码省略.........
示例15: TestViewClassPerformance
# 需要导入模块: from staxing.helper import Teacher [as 别名]
# 或者: from staxing.helper.Teacher import current_url [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.
#.........这里部分代码省略.........