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.""" if not LOCAL_RUN: self.ps.update_job(job_id=str(self.teacher.driver.session_id), **self.ps.test_updates) self.admin = None try: self.teacher.delete() except: pass def test_view_stats_admin(self): """ Log in as Admin Click on User Menu for drop-down Click on 'Admin' on user menu Click "Stats" Click "Concept Coach" ***The user is presented with Concept Coach Statistics (t2.07.01)*** Corresponds to... t2.07.01 :return: """ # t2.07.01 --> The user is presented with Concept Coach Statistics 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'
class TestCourseMaintenance(unittest.TestCase): """T1.57 - Course Maintenance.""" 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.admin.login() self.admin.goto_admin_control() self.admin.sleep(5) def tearDown(self): """Test destructor.""" if not LOCAL_RUN: self.ps.update_job(job_id=str(self.admin.driver.session_id), **self.ps.test_updates) try: self.admin.delete() except: pass # Case C8311 - 001 - Admin | Import courses from Salesforece @pytest.mark.skipif(str(8311) not in TESTS, reason='Excluded') def test_admin_import_courses_from_salesforce_8311(self): """Import courses from Salesforce. Steps: Click on the user menu Click on the Admin option Click on Salesforce on the header Click on the Import Courses button Expected Result: """ self.ps.test_updates['name'] = 't1.57.001' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['t1', 't1.57', 't1.57.001', '8311'] 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 C8312 - 002 - Admin | Update Salesforce Staistics @pytest.mark.skipif(str(8312) not in TESTS, reason='Excluded') def test_admin_update_salesforce_statistice_8312(self): """Update Salesforce statistics. Steps: Click on the user menu Click on the Admin option Click on Salesforce on the header Click on Update Salesforce Expected Result: """ self.ps.test_updates['name'] = 't1.57.002' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['t1', 't1.57', 't1.57.002', '8312'] 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 C8313 - 003 - Admin | Exclude assesments from all courses @pytest.mark.skipif(str(8313) not in TESTS, reason='Excluded') def test_admin_exclude_assesments_from_all_courses_8313(self): """Exclude assesments from all courses. Steps: Expected Result: """ self.ps.test_updates['name'] = 't1.57.003' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['t1', 't1.57', 't1.57.003', '8313'] 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 C8314 - 004 - Admin | Add a system notification @pytest.mark.skipif(str(8314) not in TESTS, reason='Excluded') def test_admin_add_a_system_notification_8314(self): """Add a system notification. Steps: Click on the user menu Click on the Admin option Click on System Setting on the header Click on the Notifications option Enter a notification into the New Notification text box Click on the Add button Expected Result: A system notification is added """ self.ps.test_updates['name'] = 't1.57.004' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['t1', 't1.57', 't1.57.004', '8314'] self.ps.test_updates['passed'] = False # Test steps and verification assertions self.admin.wait.until( expect.visibility_of_element_located( (By.PARTIAL_LINK_TEXT, 'System Setting'))).click() self.admin.wait.until( expect.visibility_of_element_located( (By.PARTIAL_LINK_TEXT, 'Notifications'))).click() self.admin.sleep(5) self.admin.find( By.XPATH, "//input[@id='new_message']").send_keys('automated test') self.admin.find(By.XPATH, "//input[@class='btn btn-default']").click() self.admin.sleep(5) notif = self.admin.driver.find_elements_by_xpath( "//div[@class='col-xs-12']") for index, n in enumerate(notif): if n.text.find('automated test') >= 0: self.admin.driver.find_elements_by_xpath( "//a[@class='btn btn-warning']")[index].click() self.admin.driver.switch_to_alert().accept() self.ps.test_updates['passed'] = True break # Case C8315 - 005 - Admin | Delete a system notification @pytest.mark.skipif(str(8315) not in TESTS, reason='Excluded') def test_admin_delete_a_system_notification_8315(self): """Delete a system notification. Steps: Click on the user menu Click on the Admin option Click on System Setting on the header Click on the Notifications option Click on the Remove button next to a notification Click OK on the dialouge box Expected Result: A system notification is deleted """ self.ps.test_updates['name'] = 't1.57.005' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['t1', 't1.57', 't1.57.005', '8315'] self.ps.test_updates['passed'] = False # Test steps and verification assertions self.admin.wait.until( expect.visibility_of_element_located( (By.PARTIAL_LINK_TEXT, 'System Setting'))).click() self.admin.wait.until( expect.visibility_of_element_located( (By.PARTIAL_LINK_TEXT, 'Notifications'))).click() self.admin.sleep(5) self.admin.find( By.XPATH, "//input[@id='new_message']").send_keys('automated test') self.admin.find(By.XPATH, "//input[@class='btn btn-default']").click() self.admin.sleep(5) notif = self.admin.driver.find_elements_by_xpath( "//div[@class='col-xs-12']") for index, n in enumerate(notif): if n.text.find('automated test') >= 0: self.admin.driver.find_elements_by_xpath( "//a[@class='btn btn-warning']")[index].click() self.admin.driver.switch_to_alert().accept() break deleted = True notif = self.admin.driver.find_elements_by_xpath( "//div[@class='col-xs-12']") for n in notif: if n.text.find('automated test') >= 0: deleted = False break if deleted: self.ps.test_updates['passed'] = True # Case C112519 - 006 - Admin | Add an instructor-only system notification @pytest.mark.skipif(str(112519) not in TESTS, reason='Excluded') def test_admin_add_instructor_notification_112519(self): """Add an instructor-only system notification. Steps: Expected Result: """ self.ps.test_updates['name'] = 't1.57.006' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['t1', 't1.57', 't1.57.006', '112519'] self.ps.test_updates['passed'] = False # Test steps and verification assertions self.admin.wait.until( expect.visibility_of_element_located( (By.PARTIAL_LINK_TEXT, 'System Setting'))).click() self.admin.wait.until( expect.visibility_of_element_located( (By.PARTIAL_LINK_TEXT, 'Notifications'))).click() self.admin.sleep(5) self.admin.find( By.XPATH, "//div[3]//input[@id='message']").send_keys('automated test') self.admin.driver.find_elements_by_xpath( "//input[@class='btn btn-default']")[1].click() self.admin.sleep(5) notif = self.admin.driver.find_elements_by_xpath( "//div[@class='col-xs-12']") for index, n in enumerate(notif): if n.text.find('automated test') >= 0: self.admin.driver.find_elements_by_xpath( "//a[@class='btn btn-warning']")[index].click() self.admin.driver.switch_to_alert().accept() self.ps.test_updates['passed'] = True break self.admin.sleep(5) self.ps.test_updates['passed'] = True # Case C112520 - 007 - Admin | Delete a instructor-only system notification @pytest.mark.skipif(str(112520) not in TESTS, reason='Excluded') def test_admin_delete_instructor_notification_112520(self): """Delete an instructor-only system notification. Steps: Expected Result: """ self.ps.test_updates['name'] = 't1.57.007' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['t1', 't1.57', 't1.57.007', '112520'] self.ps.test_updates['passed'] = False # Test steps and verification assertions self.admin.wait.until( expect.visibility_of_element_located( (By.PARTIAL_LINK_TEXT, 'System Setting'))).click() self.admin.wait.until( expect.visibility_of_element_located( (By.PARTIAL_LINK_TEXT, 'Notifications'))).click() self.admin.sleep(5) self.admin.find( By.XPATH, "//div[3]//input[@id='message']").send_keys('automated test') self.admin.driver.find_elements_by_xpath( "//input[@class='btn btn-default']")[1].click() self.admin.sleep(5) notif = self.admin.driver.find_elements_by_xpath( "//div[@class='col-xs-12']") for index, n in enumerate(notif): if n.text.find('automated test') >= 0: self.admin.driver.find_elements_by_xpath( "//a[@class='btn btn-warning']")[index].click() self.admin.driver.switch_to_alert().accept() self.ps.test_updates['passed'] = True break self.admin.sleep(5) deleted = True notif = self.admin.driver.find_elements_by_xpath( "//div[@class='col-xs-12']") for n in notif: if n.text.find('automated test') >= 0: deleted = False break assert (deleted), 'notification not deleted' self.ps.test_updates['passed'] = True # Case C112521 - 008 - Student | View an active system notification @pytest.mark.skipif(str(112521) not in TESTS, reason='Excluded') def test_student_view_active_notification_112521(self): """View an active system notification. Steps: Expected Result: //div[@class='notification system']/span """ self.ps.test_updates['name'] = 't1.57.008' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['t1', 't1.57', 't1.57.008', '112521'] self.ps.test_updates['passed'] = False # Test steps and verification assertions # Create notification self.admin.wait.until( expect.visibility_of_element_located( (By.PARTIAL_LINK_TEXT, 'System Setting'))).click() self.admin.wait.until( expect.visibility_of_element_located( (By.PARTIAL_LINK_TEXT, 'Notifications'))).click() self.admin.sleep(5) self.admin.find(By.XPATH, "//input[@id='message']").send_keys('automated test') self.admin.driver.find_elements_by_xpath( "//input[@class='btn btn-default']")[0].click() self.admin.sleep(5) # View notification as student student = Student(use_env_vars=True) student.login() student.select_course(appearance='physics') student.sleep(10) notifs = student.driver.find_elements_by_xpath( "//div[@class='notification system']/span") found = False for notif in notifs: if notif.text.find("automated test") >= 0: found = True student.delete() # Delete notification notif = self.admin.driver.find_elements_by_xpath( "//div[@class='col-xs-12']") for index, n in enumerate(notif): if n.text.find('automated test') >= 0: self.admin.driver.find_elements_by_xpath( "//a[@class='btn btn-warning']")[index].click() self.admin.driver.switch_to_alert().accept() self.ps.test_updates['passed'] = True break self.admin.sleep(5) notif = self.admin.driver.find_elements_by_xpath( "//div[@class='col-xs-12']") assert (found), 'notification not seen' self.ps.test_updates['passed'] = True # Case C112522 - 009 - Teacher | View an active system notification @pytest.mark.skipif(str(112522) not in TESTS, reason='Excluded') def test_teacher_view_active_notification_112522(self): """View an active system notification. Steps: Expected Result: """ self.ps.test_updates['name'] = 't1.57.009' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['t1', 't1.57', 't1.57.009', '112522'] self.ps.test_updates['passed'] = False # Test steps and verification assertions self.admin.wait.until( expect.visibility_of_element_located( (By.PARTIAL_LINK_TEXT, 'System Setting'))).click() self.admin.wait.until( expect.visibility_of_element_located( (By.PARTIAL_LINK_TEXT, 'Notifications'))).click() self.admin.sleep(5) self.admin.find(By.XPATH, "//input[@id='message']").send_keys('automated test') self.admin.driver.find_elements_by_xpath( "//input[@class='btn btn-default']")[0].click() self.admin.sleep(5) # View notification as student teacher = Teacher(use_env_vars=True) teacher.login() teacher.select_course(appearance='physics') teacher.sleep(10) notifs = teacher.driver.find_elements_by_xpath( "//div[@class='notification system']/span") found = False for notif in notifs: if notif.text.find("automated test") >= 0: found = True teacher.delete() # Delete notification notif = self.admin.driver.find_elements_by_xpath( "//div[@class='col-xs-12']") for index, n in enumerate(notif): if n.text.find('automated test') >= 0: self.admin.driver.find_elements_by_xpath( "//a[@class='btn btn-warning']")[index].click() self.admin.driver.switch_to_alert().accept() self.ps.test_updates['passed'] = True break self.admin.sleep(5) notif = self.admin.driver.find_elements_by_xpath( "//div[@class='col-xs-12']") assert (found), 'notification not seen' self.ps.test_updates['passed'] = True # Case C112523 - 010 - Teacher | View an active instructor-only # system notification @pytest.mark.skipif(str(112523) not in TESTS, reason='Excluded') def test_teacher_view_instructor_notification_112523(self): """View an active instructor-only system notification. Steps: Expected Result: """ self.ps.test_updates['name'] = 't1.57.010' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['t1', 't1.57', 't1.57.010', '112523'] self.ps.test_updates['passed'] = False # Test steps and verification assertions self.admin.wait.until( expect.visibility_of_element_located( (By.PARTIAL_LINK_TEXT, 'System Setting'))).click() self.admin.wait.until( expect.visibility_of_element_located( (By.PARTIAL_LINK_TEXT, 'Notifications'))).click() self.admin.sleep(5) self.admin.find( By.XPATH, "//div[3]//input[@id='message']").send_keys('automated test') self.admin.driver.find_elements_by_xpath( "//input[@class='btn btn-default']")[1].click() self.admin.sleep(5) # View notification as student teacher = Teacher(use_env_vars=True) teacher.login() teacher.select_course(appearance='physics') teacher.sleep(10) notifs = teacher.driver.find_elements_by_xpath( "//div[@class='notification system']/span") found = False for notif in notifs: if notif.text.find("automated test") >= 0: found = True teacher.delete() # Delete notification notif = self.admin.driver.find_elements_by_xpath( "//div[@class='col-xs-12']") for index, n in enumerate(notif): if n.text.find('automated test') >= 0: self.admin.driver.find_elements_by_xpath( "//a[@class='btn btn-warning']")[index].click() self.admin.driver.switch_to_alert().accept() self.ps.test_updates['passed'] = True break self.admin.sleep(5) notif = self.admin.driver.find_elements_by_xpath( "//div[@class='col-xs-12']") assert (found), 'notification not seen' self.ps.test_updates['passed'] = True
class TestManageDistricsSchoolsAndCourses(unittest.TestCase): """T1.59 - Manage districts, schools, and courses.""" def setUp(self): """Pretest settings.""" # login as admin, go to user menu, click admin option self.ps = PastaSauce() self.desired_capabilities['name'] = self.id() if not LOCAL_RUN: self.admin = Admin(use_env_vars=True, pasta_user=self.ps, capabilities=self.desired_capabilities) else: self.admin = Admin(use_env_vars=True, ) self.wait = WebDriverWait(self.admin.driver, Assignment.WAIT_TIME) self.admin.login() self.admin.goto_admin_control() def tearDown(self): """Test destructor.""" if not LOCAL_RUN: self.ps.update_job(job_id=str(self.admin.driver.session_id), **self.ps.test_updates) try: self.admin.delete() except: pass def test_set_course_details_admin(self): """ Pre-req: "Course-Navigate" Log into Admin Click on user name for drop down Click on 'Admin' option in menu Click on 'Course Organization' for dropdown menu Click on 'Courses' Click on 'Edit' Type new course scholastic year into 'Year' text-book ***(t1.59.21)*** Type new number into number of sections ***(t1.59.22)*** Set the course start date and time under the 'Starts at' text box ***(t1.59.23)*** Set the course end date and time under the 'Ends at' textbox ***(t1.59.24)*** Set the course offering under the 'Catalog Offering' dropdown ***(t1.59.25)*** Set the course offering appearance code under the 'Appearance Code' dropdown ***(t1.59.26)*** Click 'Course duration' ***End and start dates should be displayed (t2.07.11)*** Corresponds to... t1.59 21 --> 26 :return: """ # t1.59.21 --> Type new course scholastic year into 'Year' text-book # Setup() leaves you at the admin control self.admin.goto_course_list() ### # Create the course create_new_course = self.admin.find(By.XPATH, "//a[text()='Add Course']") self.admin.driver.execute_script( 'return arguments[0].scrollIntoView();', create_new_course) create_new_course.click() self.admin.find( By.ID, "course_year").send_keys((Keys.DELETE * 4) + str(datetime.date.today().year)) # t1.59.22 --> Type new number into number of sections self.admin.find(By.ID, "course_num_sections").send_keys((Keys.DELETE) + str(1)) # t1.59.23 -->Set the course start date and time under the 'Starts at' text box self.admin.find(By.ID, "course_starts_at").click() self.admin.sleep(1) next_calendar_arrows = self.admin.find_all( By.XPATH, '//div[contains(@class,"datepicker")]' + '//button[contains(@class,"_next")]') # next_calendar_arrows[0].click() # have to find all because the two right arrows for the # start and end date have identical xpath's --> doing this allows us to pick the first or second #get the date right_now = datetime.datetime.now() hour_plus_one = str(right_now.replace(hour=right_now.hour + 1).hour) month_now = str(right_now.replace(month=right_now.month - 1).month) month_plus_one = str( right_now.month) # months are 1 minus their actual number print(right_now) print(month_now) print(hour_plus_one) print(month_plus_one) self.admin.find( By.XPATH, '//div[contains(@class,"calendar")]' + '//td[@data-date="1" and @data-month="{0}"]'.format(month_now) ).click() # Choose start date self.wait.until( expect.visibility_of_element_located( (By.XPATH, '//div[contains(@class,"timepicker")]//div[@data-hour="{0}"]'. format(hour_plus_one)))).click() # t1.59.24 --> Set the course end date and time under the 'Ends at' textbox # Choose end date self.admin.find(By.ID, "course_ends_at").click() self.admin.sleep(1) next_calendar_arrows[-1].click() self.admin.find_all( By.XPATH, '//div[contains(@class,"calendar")]' + '//td[@data-date="1" and @data-month="{0}"]'.format(month_plus_one) )[-1].click() self.admin.sleep(5) # choose end time self.admin.find_all( By.XPATH, '//div[contains(@class,"timepicker")]//div[@data-hour="{0}"]'. format(hour_plus_one))[-1].click() # t1.59.25 --> Set the course offering under the 'Catalog Offering' dropdown self.admin.find(By.ID, "course_catalog_offering_id").click() self.admin.find( By.XPATH, '//select[@id="course_catalog_offering_id"]/option[2]').click() # t1.59.26 -->Set the course offering appearance code under the 'Appearance Code' dropdown self.admin.find(By.ID, "course_appearance_code").click() self.admin.find( By.XPATH, '//select[@id="course_appearance_code"]/option[2]').click()
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 # Test steps and verification assertions raise NotImplementedError(inspect.currentframe().f_code.co_name) self.ps.test_updates['passed'] = True # 14653 - 003 - Teacher | Move a student and their data to a new section @pytest.mark.skipif(str(14653) not in TESTS, reason='Excluded') def test_teacher_move_a_student_and_their_data_to_new_section_14653(self): """Move a student and their data to a new section. Steps: If the user has more than one course, click on a Tutor course name Click "Course Settings and Roster" from the user menu Click "Change Period" for the desired student and select a period Expected Result: Student is moved to new section with their data """ self.ps.test_updates['name'] = 't2.07.003' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = [ 't2', 't2.07', 't2.07.003', '14653' ] self.ps.test_updates['passed'] = False # Test steps and verification assertions self.teacher.login() self.teacher.select_course(appearance='physics') self.teacher.open_user_menu() self.teacher.find( By.PARTIAL_LINK_TEXT, "Course Settings and Roster").click() self.teacher.sleep(5) # Move the student to another period first = self.teacher.find( By.XPATH, "//div[@class='period']/table[@class='roster table table-striped" + " table-bordered table-condensed table-hover']/tbody/tr[1]/td[1]" ).text last = self.teacher.find( By.XPATH, "//div[@class='period']/table[@class='roster table table-striped" + " table-bordered table-condensed table-hover']/tbody/tr[1]/td[2]" ).text self.teacher.find(By.PARTIAL_LINK_TEXT, "Change Period").click() self.teacher.sleep(1) self.teacher.find( By.XPATH, "//ul[@class='nav nav-pills nav-stacked']/li/a").click() self.teacher.sleep(5) # Verify the move, then move the student back to the original period self.teacher.find( By.XPATH, "//div[@class='roster']/div[@class='settings-section periods']" + "/ul[@class='nav nav-tabs']/li[2]/a").click() roster = self.teacher.driver.find_elements_by_xpath( "//div[@class='period']/table[@class='roster table table-striped" + " table-bordered table-condensed table-hover']/tbody/tr") index = 0 for student in roster: if student.text.find(first) >= 0 and student.text.find(last) >= 0: self.teacher.driver.find_elements_by_partial_link_text( "Change Period")[index].click() self.teacher.sleep(1) self.teacher.find( By.XPATH, "//ul[@class='nav nav-pills nav-stacked']/li/a").click() break index += 1 self.teacher.sleep(2) self.teacher.find( By.XPATH, "//div[@class='roster']/div[@class='settings-section periods']" + "/ul[@class='nav nav-tabs']/li[1]/a").click() roster = self.teacher.driver.find_elements_by_xpath( "//div[@class='period']/table[@class='roster table table-striped" + " table-bordered table-condensed table-hover']/tbody/tr") assert(first in roster[0].text and last in roster[0].text), \ 'error' self.ps.test_updates['passed'] = True # 14655 - 004 - Teacher | Drop a student from a section and hide their data @pytest.mark.skipif(str(14655) not in TESTS, reason='Excluded') def test_teacher_drop_student_from_section_and_hide_their_data_14655(self): """Drop a student from a section and hide their data. Steps: If the user has more than one course, click on a Tutor course name Click "Course Settings and Roster" from the user menu Click "Drop" for the desired student Expected Result: The student appears under the "Dropped Students" section """ self.ps.test_updates['name'] = 't2.07.004' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = [ 't2', 't2.07', 't2.07.004', '14655' ] self.ps.test_updates['passed'] = False # Test steps and verification assertions self.teacher.login() self.teacher.select_course(appearance='physics') self.teacher.open_user_menu() self.teacher.find( By.PARTIAL_LINK_TEXT, "Course Settings and Roster").click() self.teacher.sleep(5) # Drop the student first = self.teacher.find( By.XPATH, "//div[@class='period']/table[@class='roster table table-striped" + " table-bordered table-condensed table-hover']/tbody/tr[1]/td[1]" ).text last = self.teacher.find( By.XPATH, "//div[@class='period']/table[@class='roster table table-striped" + " table-bordered table-condensed table-hover']/tbody/tr[1]/td[2]" ).text self.teacher.find(By.PARTIAL_LINK_TEXT, "Drop").click() self.teacher.sleep(1) self.teacher.find( By.XPATH, "//button[@class='-drop-student btn btn-danger']").click() self.teacher.sleep(5) # Verify the student was dropped and add back to active roster dropped = self.teacher.driver.find_elements_by_xpath( "//div[@class='settings-section dropped-students']/table[@class" + "='roster table table-striped table-bordered table-condensed " + "table-hover']/tbody/tr") index = 0 for student in dropped: if student.text.find(first) >= 0 and student.text.find(last) >= 0: self.teacher.driver.find_elements_by_partial_link_text( "Add Back to Active Roster")[index].click() self.teacher.sleep(1) self.teacher.find( By.XPATH, "//button[@class='-undrop-student btn btn-success']" ).click() self.teacher.sleep(20) break index += 1 self.ps.test_updates['passed'] = True # 14656 - 005 - Teacher | Drop a student from a section and don't hide # their data @pytest.mark.skipif(str(14656) not in TESTS, reason='Excluded') def test_teacher_drop_a_student_from_section_and_dont_hide_dat_14656(self): """Drop a student from a section and don't hide their data. Steps: Expected Result: """ self.ps.test_updates['name'] = 't2.07.005' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = [ 't2', 't2.07', 't2.07.005', '14656' ] 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 # 14657 - 006 - Teacher | In Student Scores dropped students are not # displayed @pytest.mark.skipif(str(14657) not in TESTS, reason='Excluded') def test_teacher_in_student_scores_dropped_students_are_not_14657(self): """In Student Scores dropped students are not displayed. Steps: If the user has more than one course, click on a Tutor course name Click "Course Settings and Roster" from the calendar dashboard Click "Drop" for the desired student Click "Student Scores" from the user menu Click on the period from which you have dropped the student Expected Result: Dropped student should not be displayed in Student Scores """ self.ps.test_updates['name'] = 't2.07.006' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = [ 't2', 't2.07', 't2.07.006', '14657' ] self.ps.test_updates['passed'] = False # Test steps and verification assertions self.teacher.login() self.teacher.select_course(appearance='physics') self.teacher.open_user_menu() self.teacher.find( By.PARTIAL_LINK_TEXT, "Course Settings and Roster").click() self.teacher.sleep(5) # Drop the student first = self.teacher.find( By.XPATH, "//div[@class='period']/table[@class='roster table table-striped" + " table-bordered table-condensed table-hover']/tbody/tr[1]/td[1]" ).text last = self.teacher.find( By.XPATH, "//div[@class='period']/table[@class='roster table table-striped" + " table-bordered table-condensed table-hover']/tbody/tr[1]/td[2]" ).text self.teacher.find(By.PARTIAL_LINK_TEXT, "Drop").click() self.teacher.sleep(1) self.teacher.find( By.XPATH, "//button[@class='-drop-student btn btn-danger']").click() self.teacher.sleep(5) # Go to student scores, verify the student is not seen self.teacher.open_user_menu() self.teacher.find( By.PARTIAL_LINK_TEXT, "Student Scores").click() self.teacher.sleep(10) odd_scores = self.teacher.driver.find_elements_by_xpath( "//div[@class='fixedDataTableRowLayout_main public_fixedData" + "TableRow_main public_fixedDataTableRow_even public_fixedDataTa" + "ble_bodyRow']/div[@class='fixedDataTableRowLayout_body']/div" + "[@class='fixedDataTableCellGroupLayout_cellGroupWrapper'][1]/d" + "iv[@class='fixedDataTableCellGroupLayout_cellGroup']/div[@clas" + "s='fixedDataTableCellLayout_main public_fixedDataTableCell_" + "main'][1]/div[@class='fixedDataTableCellLayout_wrap1 public_fi" + "xedDataTableCell_wrap1']/div[@class='fixedDataTableCellLayout_w" + "rap2 public_fixedDataTableCell_wrap2']/div[@class='fixedDataTab" + "leCellLayout_wrap3 public_fixedDataTableCell_wrap3']/div[@class" + "='name-cell']/a[@class='student-name public_fixedDataTableCell" + "_cellContent']") even_scores = self.teacher.driver.find_elements_by_xpath( "//div[@class='fixedDataTableRowLayout_main public_fixedDataTab" + "leRow_main public_fixedDataTableRow_highlighted public_fixedDa" + "taTableRow_odd public_fixedDataTable_bodyRow']/div[@class='fix" + "edDataTableRowLayout_body']/div[@class='fixedDataTableCellGrou" + "pLayout_cellGroupWrapper'][1]/div[@class='fixedDataTableCellGr" + "oupLayout_cellGroup']/div[@class='fixedDataTableCellLayout_mai" + "n public_fixedDataTableCell_main'][1]/div[@class='fixedDataTab" + "leCellLayout_wrap1 public_fixedDataTableCell_wrap1']/div[@clas" + "s='fixedDataTableCellLayout_wrap2 public_fixedDataTableCell_wr" + "ap2']/div[@class='fixedDataTableCellLayout_wrap3 public_fixedD" + "ataTableCell_wrap3']/div[@class='name-cell']/a[@class='student" + "-name public_fixedDataTableCell_cellContent']") found = False for student in odd_scores: if student.text.find(first) >= 0 and student.text.find(last) >= 0: found = True break if not found: for stud in even_scores: if stud.text.find(first) >= 0 and stud.text.find(last) >= 0: found = True break # Add back to active roster self.teacher.open_user_menu() self.teacher.find( By.PARTIAL_LINK_TEXT, "Course Settings and Roster").click() dropped = self.teacher.driver.find_elements_by_xpath( "//div[@class='settings-section dropped-students']/table[@class" + "='roster table table-striped table-bordered table-condensed ta" + "ble-hover']/tbody/tr") index = 0 for student in dropped: if student.text.find(first) >= 0 and student.text.find(last) >= 0: self.teacher.driver.find_elements_by_partial_link_text( "Add Back to Active Roster")[index].click() self.teacher.sleep(1) self.teacher.find( By.XPATH, "//button[@class='-undrop-student btn btn-success']" ).click() self.teacher.sleep(20) break index += 1 if not found: self.ps.test_updates['passed'] = True # 14850 - 007 - Teacher | In Student Scores view moved students @pytest.mark.skipif(str(14850) not in TESTS, reason='Excluded') def test_teacher_in_student_scores_view_moved_students_14850(self): """In Student Scores view moved students. Steps: If the user has more than one course, click on a Tutor course name Click "Course Settings and Roster" from the calendar dashboard Click "Change Period" for the desired student Click on the desired period Click "Student Scores" from the user menu Click on the period to which the student was moved Expected Result: The user is presented with the moved student under their new period """ self.ps.test_updates['name'] = 't2.07.007' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = [ 't2', 't2.07', 't2.07.007', '14850' ] self.ps.test_updates['passed'] = False # Test steps and verification assertions self.teacher.login() self.teacher.select_course(appearance='physics') self.teacher.open_user_menu() self.teacher.find( By.PARTIAL_LINK_TEXT, "Course Settings and Roster").click() self.teacher.sleep(5) # Move the student to another period first = self.teacher.find( By.XPATH, "//div[@class='period']/table[@class='roster table table-striped" + " table-bordered table-condensed table-hover']/tbody/tr[1]/td[1]" ).text last = self.teacher.find( By.XPATH, "//div[@class='period']/table[@class='roster table table-striped" + " table-bordered table-condensed table-hover']/tbody/tr[1]/td[2]" ).text self.teacher.find(By.PARTIAL_LINK_TEXT, "Change Period").click() self.teacher.sleep(1) self.teacher.find( By.XPATH, "//ul[@class='nav nav-pills nav-stacked']/li/a").click() self.teacher.sleep(5) # Go to student scores, verify the student is seen self.teacher.open_user_menu() self.teacher.find( By.PARTIAL_LINK_TEXT, "Student Scores").click() self.teacher.sleep(10) self.teacher.find( By.XPATH, "//nav[@class='collapse in']/ul[@class='nav nav-tabs']/li[2]/a" ).click() odd_scores = self.teacher.driver.find_elements_by_xpath( "//div[@class='fixedDataTableRowLayout_main public_fixedData" + "TableRow_main public_fixedDataTableRow_even public_fixedDataTa" + "ble_bodyRow']/div[@class='fixedDataTableRowLayout_body']/div" + "[@class='fixedDataTableCellGroupLayout_cellGroupWrapper'][1]/d" + "iv[@class='fixedDataTableCellGroupLayout_cellGroup']/div[@clas" + "s='fixedDataTableCellLayout_main public_fixedDataTableCell_" + "main'][1]/div[@class='fixedDataTableCellLayout_wrap1 public_fi" + "xedDataTableCell_wrap1']/div[@class='fixedDataTableCellLayout_w" + "rap2 public_fixedDataTableCell_wrap2']/div[@class='fixedDataTab" + "leCellLayout_wrap3 public_fixedDataTableCell_wrap3']/div[@class" + "='name-cell']/a[@class='student-name public_fixedDataTableCell" + "_cellContent']") even_scores = self.teacher.driver.find_elements_by_xpath( "//div[@class='fixedDataTableRowLayout_main public_fixedDataTab" + "leRow_main public_fixedDataTableRow_highlighted public_fixedDa" + "taTableRow_odd public_fixedDataTable_bodyRow']/div[@class='fix" + "edDataTableRowLayout_body']/div[@class='fixedDataTableCellGrou" + "pLayout_cellGroupWrapper'][1]/div[@class='fixedDataTableCellGr" + "oupLayout_cellGroup']/div[@class='fixedDataTableCellLayout_mai" + "n public_fixedDataTableCell_main'][1]/div[@class='fixedDataTab" + "leCellLayout_wrap1 public_fixedDataTableCell_wrap1']/div[@clas" + "s='fixedDataTableCellLayout_wrap2 public_fixedDataTableCell_wr" + "ap2']/div[@class='fixedDataTableCellLayout_wrap3 public_fixedD" + "ataTableCell_wrap3']/div[@class='name-cell']/a[@class='student" + "-name public_fixedDataTableCell_cellContent']") found = False for student in odd_scores: if student.text.find(first) >= 0 and student.text.find(last) >= 0: found = True break if found: for stud in even_scores: if stud.text.find(first) >= 0 and stud.text.find(last) >= 0: found = True break # Add student back to original period self.teacher.open_user_menu() self.teacher.find( By.PARTIAL_LINK_TEXT, "Course Settings and Roster").click() self.teacher.sleep(10) self.teacher.find( By.XPATH, "//div[@class='roster']/div[@class='settings-section periods']" + "/ul[@class='nav nav-tabs']/li[2]/a").click() roster = self.teacher.driver.find_elements_by_xpath( "//div[@class='period']/table[@class='roster table table-striped" + " table-bordered table-condensed table-hover']/tbody/tr") index = 0 for student in roster: if student.text.find(first) >= 0 and student.text.find(last) >= 0: self.teacher.driver.find_elements_by_partial_link_text( "Change Period")[index].click() self.teacher.sleep(1) self.teacher.find( By.XPATH, "//ul[@class='nav nav-pills nav-stacked']/li/a").click() break index += 1 if found: self.ps.test_updates['passed'] = True # 14658 - 008 - Teacher | Require emails for all students for roster import @pytest.mark.skipif(str(14658) not in TESTS, reason='Excluded') def test_teacher_require_emails_for_all_students_for_roster_14658(self): """Require emails for all students for roster imports. Steps: Expected Result: """ self.ps.test_updates['name'] = 't2.07.008' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = [ 't2', 't2.07', 't2.07.008', '14658' ] 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 # 14660 - 009 - Teacher | Set time zone for a course @pytest.mark.skipif(str(14660) not in TESTS, reason='Excluded') def test_teacher_set_time_zone_for_a_course_14660(self): """Set time zone for a course. Steps: If the user has more than one course, click on a Tutor course name Click "Course Settings and Roster" Click "Change Course Timezone" Select the desired timezone Click Save Expected Result: The time zone is set """ self.ps.test_updates['name'] = 't2.07.009' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = [ 't2', 't2.07', 't2.07.009', '14660' ] self.ps.test_updates['passed'] = False # Test steps and verification assertions self.teacher.login() self.teacher.select_course(appearance='physics') self.teacher.open_user_menu() self.teacher.find( By.PARTIAL_LINK_TEXT, "Course Settings and Roster").click() self.teacher.sleep(5) # Change the timezone self.teacher.driver.find_elements_by_xpath( "//button[@class='edit-course btn btn-link']")[1].click() self.teacher.sleep(2) self.teacher.find( By.XPATH, "//div[@class='tutor-radio']/label").click() self.teacher.find( By.XPATH, "//button[@class='async-button -edit-course-" + "confirm btn btn-default']").click() self.teacher.sleep(5) # Verify the change and change the time back to Central self.teacher.driver.find_elements_by_xpath( "//button[@class='edit-course btn btn-link']")[1].click() assert('Central Time' not in self.teacher.find( By.XPATH, "//div[@class='tutor-radio active']/label").text), \ 'Not viewing Concept Coach stats' self.teacher.sleep(2) options = self.teacher.driver.find_elements_by_xpath( "//div[@class='tutor-radio']/label") for timezone in options: if timezone.text.find('Central Time') >= 0: timezone.click() break self.teacher.find( By.XPATH, "//button[@class='async-button -edit-course-" + "confirm btn btn-default']").click() self.ps.test_updates['passed'] = True # 14661 - 010 - System | Distinguish between high school and college # courses @pytest.mark.skipif(str(14661) not in TESTS, reason='Excluded') def test_system_distinguish_between_hs_and_college_courses_14661(self): """Distinguish between high school and college courses. Steps: Expected Result: """ self.ps.test_updates['name'] = 't2.07.010' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = [ 't2', 't2.07', 't2.07.010', '14661' ] 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
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.""" if not LOCAL_RUN: self.ps.update_job(job_id=str(self.teacher.driver.session_id), **self.ps.test_updates) self.admin = None try: 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 # Test steps and verification assertions raise NotImplementedError(inspect.currentframe().f_code.co_name) self.ps.test_updates['passed'] = True ''' ''' # 14653 - 003 - Teacher | Move a student and their data to a new section @pytest.mark.skipif(str(14653) not in TESTS, reason='Excluded') def test_teacher_move_a_student_and_their_data_to_new_section_14653(self): """Move a student and their data to a new section. Steps: If the user has more than one course, click on a Tutor course name Click "Course Settings and Roster" from the user menu Click "Change Period" for the desired student and select a period Expected Result: Student is moved to new section with their data """ self.ps.test_updates['name'] = 't2.07.003' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = [ 't2', 't2.07', 't2.07.003', '14653' ] self.ps.test_updates['passed'] = False # Test steps and verification assertions self.teacher.login() self.teacher.select_course(appearance='physics') self.teacher.open_user_menu() self.teacher.find( By.PARTIAL_LINK_TEXT, "Course Settings and Roster").click() self.teacher.sleep(5) # Move the student to another period first = self.teacher.find( By.XPATH, "//div[@class='period']/table[@class='roster table table-striped" + " table-bordered table-condensed table-hover']/tbody/tr[1]/td[1]" ).text last = self.teacher.find( By.XPATH, "//div[@class='period']/table[@class='roster table table-striped" + " table-bordered table-condensed table-hover']/tbody/tr[1]/td[2]" ).text self.teacher.find(By.PARTIAL_LINK_TEXT, "Change Period").click() self.teacher.sleep(1) self.teacher.find( By.XPATH, "//ul[@class='nav nav-pills nav-stacked']/li/a").click() self.teacher.sleep(5) # Verify the move, then move the student back to the original period self.teacher.find( By.XPATH, "//div[@class='roster']/div[@class='settings-section periods']" + "/ul[@class='nav nav-tabs']/li[2]/a").click() roster = self.teacher.driver.find_elements_by_xpath( "//div[@class='period']/table[@class='roster table table-striped" + " table-bordered table-condensed table-hover']/tbody/tr") index = 0 for student in roster: if student.text.find(first) >= 0 and student.text.find(last) >= 0: self.teacher.driver.find_elements_by_partial_link_text( "Change Period")[index].click() self.teacher.sleep(1) self.teacher.find( By.XPATH, "//ul[@class='nav nav-pills nav-stacked']/li/a").click() break index += 1 self.teacher.sleep(2) self.teacher.find( By.XPATH, "//div[@class='roster']/div[@class='settings-section periods']" + "/ul[@class='nav nav-tabs']/li[1]/a").click() roster = self.teacher.driver.find_elements_by_xpath( "//div[@class='period']/table[@class='roster table table-striped" + " table-bordered table-condensed table-hover']/tbody/tr") assert(first in roster[0].text and last in roster[0].text), \ 'error' self.ps.test_updates['passed'] = True # 14655 - 004 - Teacher | Drop a student from a section and hide their data @pytest.mark.skipif(str(14655) not in TESTS, reason='Excluded') def test_teacher_drop_student_from_section_and_hide_their_data_14655(self): """Drop a student from a section and hide their data. Steps: If the user has more than one course, click on a Tutor course name Click "Course Settings and Roster" from the user menu Click "Drop" for the desired student Expected Result: The student appears under the "Dropped Students" section """ self.ps.test_updates['name'] = 't2.07.004' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = [ 't2', 't2.07', 't2.07.004', '14655' ] self.ps.test_updates['passed'] = False # Test steps and verification assertions self.teacher.login() self.teacher.select_course(appearance='physics') self.teacher.open_user_menu() self.teacher.find( By.PARTIAL_LINK_TEXT, "Course Settings and Roster").click() self.teacher.sleep(5) # Drop the student first = self.teacher.find( By.XPATH, "//div[@class='period']/table[@class='roster table table-striped" + " table-bordered table-condensed table-hover']/tbody/tr[1]/td[1]" ).text last = self.teacher.find( By.XPATH, "//div[@class='period']/table[@class='roster table table-striped" + " table-bordered table-condensed table-hover']/tbody/tr[1]/td[2]" ).text self.teacher.find(By.PARTIAL_LINK_TEXT, "Drop").click() self.teacher.sleep(1) self.teacher.find( By.XPATH, "//button[@class='-drop-student btn btn-danger']").click() self.teacher.sleep(5) # Verify the student was dropped and add back to active roster dropped = self.teacher.driver.find_elements_by_xpath( "//div[@class='settings-section dropped-students']/table[@class" + "='roster table table-striped table-bordered table-condensed " + "table-hover']/tbody/tr") index = 0 for student in dropped: if student.text.find(first) >= 0 and student.text.find(last) >= 0: self.teacher.driver.find_elements_by_partial_link_text( "Add Back to Active Roster")[index].click() self.teacher.sleep(1) self.teacher.find( By.XPATH, "//button[@class='-undrop-student btn btn-success']" ).click() self.teacher.sleep(20) break index += 1 self.ps.test_updates['passed'] = True # 14656 - 005 - Teacher | Drop a student from a section and don't hide # their data @pytest.mark.skipif(str(14656) not in TESTS, reason='Excluded') def test_teacher_drop_a_student_from_section_and_dont_hide_dat_14656(self): """Drop a student from a section and don't hide their data. Steps: Expected Result: """ self.ps.test_updates['name'] = 't2.07.005' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = [ 't2', 't2.07', 't2.07.005', '14656' ] 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 ''' # 14657 - 006 - Teacher | In Student Scores dropped students are not # displayed @pytest.mark.skipif(str(14657) not in TESTS, reason='Excluded') def test_teacher_in_student_scores_dropped_students_are_not_14657(self): """In Student Scores dropped students are not displayed. Steps: If the user has more than one course, click on a Tutor course name Click "Course Settings and Roster" from the calendar dashboard Click "Drop" for the desired student Click "Student Scores" from the user menu Click on the period from which you have dropped the student Expected Result: Dropped student should not be displayed in Student Scores """ self.ps.test_updates['name'] = 't2.07.006' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['t2', 't2.07', 't2.07.006', '14657'] self.ps.test_updates['passed'] = False # Test steps and verification assertions self.teacher.login() self.teacher.select_course(appearance='physics') self.teacher.open_user_menu() self.teacher.find(By.PARTIAL_LINK_TEXT, "Course Settings and Roster").click() self.teacher.sleep(5) # Drop the student first = self.teacher.find( By.XPATH, "//div[@class='period']/table[@class='roster table table-striped" + " table-bordered table-condensed table-hover']/tbody/tr[1]/td[1]" ).text last = self.teacher.find( By.XPATH, "//div[@class='period']/table[@class='roster table table-striped" + " table-bordered table-condensed table-hover']/tbody/tr[1]/td[2]" ).text self.teacher.find(By.PARTIAL_LINK_TEXT, "Drop").click() self.teacher.sleep(1) self.teacher.find( By.XPATH, "//button[@class='-drop-student btn btn-danger']").click() self.teacher.sleep(5) # Go to student scores, verify the student is not seen self.teacher.open_user_menu() self.teacher.find(By.PARTIAL_LINK_TEXT, "Student Scores").click() self.teacher.sleep(10) odd_scores = self.teacher.driver.find_elements_by_xpath( "//div[@class='fixedDataTableRowLayout_main public_fixedData" + "TableRow_main public_fixedDataTableRow_even public_fixedDataTa" + "ble_bodyRow']/div[@class='fixedDataTableRowLayout_body']/div" + "[@class='fixedDataTableCellGroupLayout_cellGroupWrapper'][1]/d" + "iv[@class='fixedDataTableCellGroupLayout_cellGroup']/div[@clas" + "s='fixedDataTableCellLayout_main public_fixedDataTableCell_" + "main'][1]/div[@class='fixedDataTableCellLayout_wrap1 public_fi" + "xedDataTableCell_wrap1']/div[@class='fixedDataTableCellLayout_w" + "rap2 public_fixedDataTableCell_wrap2']/div[@class='fixedDataTab" + "leCellLayout_wrap3 public_fixedDataTableCell_wrap3']/div[@class" + "='name-cell']/a[@class='student-name public_fixedDataTableCell" + "_cellContent']") even_scores = self.teacher.driver.find_elements_by_xpath( "//div[@class='fixedDataTableRowLayout_main public_fixedDataTab" + "leRow_main public_fixedDataTableRow_highlighted public_fixedDa" + "taTableRow_odd public_fixedDataTable_bodyRow']/div[@class='fix" + "edDataTableRowLayout_body']/div[@class='fixedDataTableCellGrou" + "pLayout_cellGroupWrapper'][1]/div[@class='fixedDataTableCellGr" + "oupLayout_cellGroup']/div[@class='fixedDataTableCellLayout_mai" + "n public_fixedDataTableCell_main'][1]/div[@class='fixedDataTab" + "leCellLayout_wrap1 public_fixedDataTableCell_wrap1']/div[@clas" + "s='fixedDataTableCellLayout_wrap2 public_fixedDataTableCell_wr" + "ap2']/div[@class='fixedDataTableCellLayout_wrap3 public_fixedD" + "ataTableCell_wrap3']/div[@class='name-cell']/a[@class='student" + "-name public_fixedDataTableCell_cellContent']") found = False for student in odd_scores: if student.text.find(first) >= 0 and student.text.find(last) >= 0: found = True break if not found: for stud in even_scores: if stud.text.find(first) >= 0 and stud.text.find(last) >= 0: found = True break # Add back to active roster self.teacher.open_user_menu() self.teacher.find(By.PARTIAL_LINK_TEXT, "Course Settings and Roster").click() dropped = self.teacher.driver.find_elements_by_xpath( "//div[@class='settings-section dropped-students']/table[@class" + "='roster table table-striped table-bordered table-condensed ta" + "ble-hover']/tbody/tr") index = 0 for student in dropped: if student.text.find(first) >= 0 and student.text.find(last) >= 0: self.teacher.driver.find_elements_by_partial_link_text( "Add Back to Active Roster")[index].click() self.teacher.sleep(1) self.teacher.find( By.XPATH, "//button[@class='-undrop-student btn btn-success']" ).click() self.teacher.sleep(20) break index += 1 if not found: self.ps.test_updates['passed'] = True # 14850 - 007 - Teacher | In Student Scores view moved students @pytest.mark.skipif(str(14850) not in TESTS, reason='Excluded') def test_teacher_in_student_scores_view_moved_students_14850(self): """In Student Scores view moved students. Steps: If the user has more than one course, click on a Tutor course name Click "Course Settings and Roster" from the calendar dashboard Click "Change Period" for the desired student Click on the desired period Click "Student Scores" from the user menu Click on the period to which the student was moved Expected Result: The user is presented with the moved student under their new period """ self.ps.test_updates['name'] = 't2.07.007' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['t2', 't2.07', 't2.07.007', '14850'] self.ps.test_updates['passed'] = False # Test steps and verification assertions self.teacher.login() self.teacher.select_course(appearance='physics') self.teacher.open_user_menu() self.teacher.find(By.PARTIAL_LINK_TEXT, "Course Settings and Roster").click() self.teacher.sleep(5) # Move the student to another period first = self.teacher.find( By.XPATH, "//div[@class='period']/table[@class='roster table table-striped" + " table-bordered table-condensed table-hover']/tbody/tr[1]/td[1]" ).text last = self.teacher.find( By.XPATH, "//div[@class='period']/table[@class='roster table table-striped" + " table-bordered table-condensed table-hover']/tbody/tr[1]/td[2]" ).text self.teacher.find(By.PARTIAL_LINK_TEXT, "Change Period").click() self.teacher.sleep(1) self.teacher.find( By.XPATH, "//ul[@class='nav nav-pills nav-stacked']/li/a").click() self.teacher.sleep(5) # Go to student scores, verify the student is seen self.teacher.open_user_menu() self.teacher.find(By.PARTIAL_LINK_TEXT, "Student Scores").click() self.teacher.sleep(10) self.teacher.find( By.XPATH, "//nav[@class='collapse in']/ul[@class='nav nav-tabs']/li[2]/a" ).click() odd_scores = self.teacher.driver.find_elements_by_xpath( "//div[@class='fixedDataTableRowLayout_main public_fixedData" + "TableRow_main public_fixedDataTableRow_even public_fixedDataTa" + "ble_bodyRow']/div[@class='fixedDataTableRowLayout_body']/div" + "[@class='fixedDataTableCellGroupLayout_cellGroupWrapper'][1]/d" + "iv[@class='fixedDataTableCellGroupLayout_cellGroup']/div[@clas" + "s='fixedDataTableCellLayout_main public_fixedDataTableCell_" + "main'][1]/div[@class='fixedDataTableCellLayout_wrap1 public_fi" + "xedDataTableCell_wrap1']/div[@class='fixedDataTableCellLayout_w" + "rap2 public_fixedDataTableCell_wrap2']/div[@class='fixedDataTab" + "leCellLayout_wrap3 public_fixedDataTableCell_wrap3']/div[@class" + "='name-cell']/a[@class='student-name public_fixedDataTableCell" + "_cellContent']") even_scores = self.teacher.driver.find_elements_by_xpath( "//div[@class='fixedDataTableRowLayout_main public_fixedDataTab" + "leRow_main public_fixedDataTableRow_highlighted public_fixedDa" + "taTableRow_odd public_fixedDataTable_bodyRow']/div[@class='fix" + "edDataTableRowLayout_body']/div[@class='fixedDataTableCellGrou" + "pLayout_cellGroupWrapper'][1]/div[@class='fixedDataTableCellGr" + "oupLayout_cellGroup']/div[@class='fixedDataTableCellLayout_mai" + "n public_fixedDataTableCell_main'][1]/div[@class='fixedDataTab" + "leCellLayout_wrap1 public_fixedDataTableCell_wrap1']/div[@clas" + "s='fixedDataTableCellLayout_wrap2 public_fixedDataTableCell_wr" + "ap2']/div[@class='fixedDataTableCellLayout_wrap3 public_fixedD" + "ataTableCell_wrap3']/div[@class='name-cell']/a[@class='student" + "-name public_fixedDataTableCell_cellContent']") found = False for student in odd_scores: if student.text.find(first) >= 0 and student.text.find(last) >= 0: found = True break if found: for stud in even_scores: if stud.text.find(first) >= 0 and stud.text.find(last) >= 0: found = True break # Add student back to original period self.teacher.open_user_menu() self.teacher.find(By.PARTIAL_LINK_TEXT, "Course Settings and Roster").click() self.teacher.sleep(10) self.teacher.find( By.XPATH, "//div[@class='roster']/div[@class='settings-section periods']" + "/ul[@class='nav nav-tabs']/li[2]/a").click() roster = self.teacher.driver.find_elements_by_xpath( "//div[@class='period']/table[@class='roster table table-striped" + " table-bordered table-condensed table-hover']/tbody/tr") index = 0 for student in roster: if student.text.find(first) >= 0 and student.text.find(last) >= 0: self.teacher.driver.find_elements_by_partial_link_text( "Change Period")[index].click() self.teacher.sleep(1) self.teacher.find( By.XPATH, "//ul[@class='nav nav-pills nav-stacked']/li/a").click() break index += 1 if found: self.ps.test_updates['passed'] = True # 14658 - 008 - Teacher | Require emails for all students for roster import @pytest.mark.skipif(str(14658) not in TESTS, reason='Excluded') def test_teacher_require_emails_for_all_students_for_roster_14658(self): """Require emails for all students for roster imports. Steps: Expected Result: """ self.ps.test_updates['name'] = 't2.07.008' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['t2', 't2.07', 't2.07.008', '14658'] 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 # 14660 - 009 - Teacher | Set time zone for a course @pytest.mark.skipif(str(14660) not in TESTS, reason='Excluded') def test_teacher_set_time_zone_for_a_course_14660(self): """Set time zone for a course. Steps: If the user has more than one course, click on a Tutor course name Click "Course Settings and Roster" Click "Change Course Timezone" Select the desired timezone Click Save Expected Result: The time zone is set """ self.ps.test_updates['name'] = 't2.07.009' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['t2', 't2.07', 't2.07.009', '14660'] self.ps.test_updates['passed'] = False # Test steps and verification assertions self.teacher.login() self.teacher.select_course(appearance='physics') self.teacher.open_user_menu() self.teacher.find(By.PARTIAL_LINK_TEXT, "Course Settings and Roster").click() self.teacher.sleep(5) # Change the timezone self.teacher.driver.find_elements_by_xpath( "//button[@class='edit-course btn btn-link']")[1].click() self.teacher.sleep(2) self.teacher.find(By.XPATH, "//div[@class='tutor-radio']/label").click() self.teacher.find( By.XPATH, "//button[@class='async-button -edit-course-" + "confirm btn btn-default']").click() self.teacher.sleep(5) # Verify the change and change the time back to Central self.teacher.driver.find_elements_by_xpath( "//button[@class='edit-course btn btn-link']")[1].click() assert('Central Time' not in self.teacher.find( By.XPATH, "//div[@class='tutor-radio active']/label").text), \ 'Not viewing Concept Coach stats' self.teacher.sleep(2) options = self.teacher.driver.find_elements_by_xpath( "//div[@class='tutor-radio']/label") for timezone in options: if timezone.text.find('Central Time') >= 0: timezone.click() break self.teacher.find( By.XPATH, "//button[@class='async-button -edit-course-" + "confirm btn btn-default']").click() self.ps.test_updates['passed'] = True # 14661 - 010 - System | Distinguish between high school and college # courses @pytest.mark.skipif(str(14661) not in TESTS, reason='Excluded') def test_system_distinguish_between_hs_and_college_courses_14661(self): """Distinguish between high school and college courses. Steps: Expected Result: """ self.ps.test_updates['name'] = 't2.07.010' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['t2', 't2.07', 't2.07.010', '14661'] 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 # 116648 - 011 - Admin | View the start and end dates from the # admin console course list @pytest.mark.skipif(str(116648) not in TESTS, reason='Excluded') def test_admin_view_start_end_dates_from_course_list_116648(self): """View the start and end dates from the admin console course list. Steps: Expected Result: """ self.ps.test_updates['name'] = 't2.07.011' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['t2', 't2.07', 't2.07.011', '116648'] 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, 'Course Organization'))).click() self.admin.wait.until( expect.visibility_of_element_located( (By.PARTIAL_LINK_TEXT, 'Courses'))).click() self.admin.sleep(3) self.admin.find(By.XPATH, "//div[@class='course-duration']") self.ps.test_updates['passed'] = True
class TestManageDistricsSchoolsAndCourses(unittest.TestCase): def setUp(self): """Pretest settings.""" # login as admin, go to user menu, click admin option self.ps = PastaSauce() self.desired_capabilities['name'] = self.id() if not LOCAL_RUN: self.admin = Admin(use_env_vars=True, pasta_user=self.ps, capabilities=self.desired_capabilities) else: self.admin = Admin(use_env_vars=True, ) self.admin.login() self.admin.goto_admin_control() def tearDown(self): """Test destructor.""" if not LOCAL_RUN: self.ps.update_job(job_id=str(self.admin.driver.session_id), **self.ps.test_updates) try: self.admin.delete() except: pass def test_district_admin(self): """ Go to https://tutor-qa.openstax.org/ Click on the 'Login' button Login to admin account Click on the 'Sign in' button Click on the user menu in the right corner of the header Click "Admin" Click "Course Organization" in the header Click "Districts" Click "Add district" Enter a name for the district in the Name text box Click "Save" ***A new district is added and the user is returned to the 'Districts' section (t1.59.01)*** Click "edit" for a district Enter a new name into the Name text box Click "Save" ***A district's name is changed (t1.59.02) and user should be returned to 'Districts' section*** Click "delete" for the desired district Click "OK" on the dialogue box ***An existing district is deleted (t1.59.03)*** Corresponds to... T1.59 01 --> 3 :return: """ def test_school_admin(self): """ Go to https://tutor-qa.openstax.org/ Login to admin account Click on the 'Sign in' button Click on the user menu in the right corner of the header Click "Admin" Click "Course Organization" in the header Click "Schools" Click "Add school" Enter a name for the school in the Name text box Click "Save" ***A new school is added and the user is returned to the 'Schools' section (t1.59.04)*** Click "edit" for a school Enter a new name into the Name text box Click "Save" ***A school's name is changed (t1.59.05) and user should be returned to 'School' section*** Click "edit" for the desired school Select a new district Click "Save" ***A school's district is changed (t1.59.06)*** Click "delete" for the desired school Click "OK" on the dialogue box ***An existing school is deleted (t1.59.07)*** Corresponds to... T1.59 04 --> 07 :return: """ def test_course_admin(self): """ Pre-req: 'Course-Navigate' Click "Add course" Enter a name in the Name text box Click "Save" ***A new course is added and the user is returned to the 'Courses' section (t1.59.08)*** Click "Edit" for a school Change information in desired text boxes Click "Save" ***The course is edited (t1.59.09) and user should be returned to list of all courses*** Corresponds to... T1.59 08--> 9 :return: """ def test_periods_admin(self): """ Pre-Req "Course-Navigate" Click "Edit" on the desired course Click the "Periods" tab Click "Add Period" Enter a name into the Name text box Click "Save" ***A new empty period is added (t1.59.14)*** Click "Edit" on the desired course Click the "Periods" tab Click "Edit" for the desired period enter new information into the name and enrollment code text boxes Click on the "Save" button ***Period is edited (t1.59.15)*** Click "Edit" on the desired course Click the "Periods" tab Click "Delete" for an empty period ***Empty period is deleted (t1.59.16)*** Click "Edit" on the desired course Click the "Periods" tab Click "Delete" on a non-empty period ***A non-empty period is deleted (t1.59.17)*** Corresponds to... t1.59 14 --> 17 :return: """ def test_teachers_admin(self): """ Click "Edit" on the desired course Click the "Teachers" tab Enter the teacher's name or the username into the search engine Click on the name that matches the teacher's name or the username ***A teacher is added to a course (t1.59.10) and user directed back to the 'Courses' section*** Click "Edit" on the desired course Click the "Teachers" tab Click "Remove from course" for the desired teacher Click "OK" on the dialogue box ***A teacher is removed from a course (t1.59.11)*** Corresponds to... t1.59. 10,11 :return: """ def test_course_ecosystem_admin(self): """ Pre-req: 'Course Navigate' Click "edit" on the desired course Click the "course content" tab Select a course ecosystem Click "Submit" ***Request for course ecosystem update submitted and message displayed (t1.59.12)*** Click "edit" on the desired course Click the "course content" tab Select a course ecosystem Click "Submit" ***The course ecosystem is queued for the course (t1.59.13)*** Check the desired courses to update Scroll to the bottom of the page Select an ecosystem Click "Set ecosystem" ***The message "Course ecosystem update background jobs queued" appears beneath the page title "Courses" (t1.59.19)*** CORRESPONDS TO... T1.59 12,13,19 :return: """ def test_tutor_student_count_admin(self): """
class TestCourseMaintenance(unittest.TestCase): """T1.57 - Course Maintenance.""" 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.admin.login() self.admin.goto_admin_control() self.admin.sleep(5) def tearDown(self): """Test destructor.""" self.ps.update_job( job_id=str(self.admin.driver.session_id), **self.ps.test_updates ) try: self.admin.delete() except: pass # Case C8311 - 001 - Admin | Import courses from Salesforece @pytest.mark.skipif(str(8311) not in TESTS, reason='Excluded') def test_admin_import_courses_from_salesforce_8311(self): """Import courses from Salesforce. Steps: Click on the user menu Click on the Admin option Click on Salesforce on the header Click on the Import Courses button Expected Result: """ self.ps.test_updates['name'] = 't1.57.001' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['t1', 't1.57', 't1.57.001', '8311'] 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 C8312 - 002 - Admin | Update Salesforce Staistics @pytest.mark.skipif(str(8312) not in TESTS, reason='Excluded') def test_admin_update_salesforce_statistice_8312(self): """Update Salesforce statistics. Steps: Click on the user menu Click on the Admin option Click on Salesforce on the header Click on Update Salesforce Expected Result: """ self.ps.test_updates['name'] = 't1.57.002' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['t1', 't1.57', 't1.57.002', '8312'] 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 C8313 - 003 - Admin | Exclude assesments from all courses @pytest.mark.skipif(str(8313) not in TESTS, reason='Excluded') def test_admin_exclude_assesments_from_all_courses_8313(self): """Exclude assesments from all courses. Steps: Expected Result: """ self.ps.test_updates['name'] = 't1.57.003' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['t1', 't1.57', 't1.57.003', '8313'] 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 C8314 - 004 - Admin | Add a system notification @pytest.mark.skipif(str(8314) not in TESTS, reason='Excluded') def test_admin_add_a_system_notification_8314(self): """Add a system notification. Steps: Click on the user menu Click on the Admin option Click on System Setting on the header Click on the Notifications option Enter a notification into the New Notification text box Click on the Add button Expected Result: A system notification is added """ self.ps.test_updates['name'] = 't1.57.004' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['t1', 't1.57', 't1.57.004', '8314'] self.ps.test_updates['passed'] = False # Test steps and verification assertions self.admin.wait.until( expect.visibility_of_element_located( (By.PARTIAL_LINK_TEXT, 'System Setting') ) ).click() self.admin.wait.until( expect.visibility_of_element_located( (By.PARTIAL_LINK_TEXT, 'Notifications') ) ).click() self.admin.sleep(5) self.admin.find(By.XPATH, "//input[@id='new_message']").send_keys( 'automated test') self.admin.find(By.XPATH, "//input[@class='btn btn-default']").click() self.admin.sleep(5) notif = self.admin.driver.find_elements_by_xpath( "//div[@class='col-xs-12']") for index, n in enumerate(notif): if n.text.find('automated test') >= 0: self.admin.driver.find_elements_by_xpath( "//a[@class='btn btn-warning']")[index].click() self.admin.driver.switch_to_alert().accept() self.ps.test_updates['passed'] = True break # Case C8315 - 005 - Admin | Delete a system notification @pytest.mark.skipif(str(8315) not in TESTS, reason='Excluded') def test_admin_delete_a_system_notification_8315(self): """Delete a system notification. Steps: Click on the user menu Click on the Admin option Click on System Setting on the header Click on the Notifications option Click on the Remove button next to a notification Click OK on the dialouge box Expected Result: A system notification is deleted """ self.ps.test_updates['name'] = 't1.57.005' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['t1', 't1.57', 't1.57.005', '8315'] self.ps.test_updates['passed'] = False # Test steps and verification assertions self.admin.wait.until( expect.visibility_of_element_located( (By.PARTIAL_LINK_TEXT, 'System Setting') ) ).click() self.admin.wait.until( expect.visibility_of_element_located( (By.PARTIAL_LINK_TEXT, 'Notifications') ) ).click() self.admin.sleep(5) self.admin.find(By.XPATH, "//input[@id='new_message']").send_keys( 'automated test') self.admin.find(By.XPATH, "//input[@class='btn btn-default']").click() self.admin.sleep(5) notif = self.admin.driver.find_elements_by_xpath( "//div[@class='col-xs-12']") for index, n in enumerate(notif): if n.text.find('automated test') >= 0: self.admin.driver.find_elements_by_xpath( "//a[@class='btn btn-warning']")[index].click() self.admin.driver.switch_to_alert().accept() break deleted = True notif = self.admin.driver.find_elements_by_xpath( "//div[@class='col-xs-12']") for n in notif: if n.text.find('automated test') >= 0: deleted = False break if deleted: self.ps.test_updates['passed'] = True
class TestManageEcosystems(unittest.TestCase): def setUp(self): """Pretest settings.""" self.ps = PastaSauce() self.desired_capabilities['name'] = self.id() if not LOCAL_RUN: 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) else: self.admin = Admin(use_env_vars=True) self.content = ContentQA(use_env_vars=True, existing_driver=self.admin.driver) self.wait = WebDriverWait(self.admin.driver, Assignment.WAIT_TIME) self.admin.login() self.wait.sleep(2) self.admin.goto_admin_control() def tearDown(self): """Test destructor.""" if not LOCAL_RUN: self.ps.update_job(job_id=str(self.admin.driver.session_id), **self.ps.test_updates) try: self.admin.delete() # self.content.delete() except: pass def test_content_tag_search_admin(self): """ Go to https://tutor-qa.openstax.org/ Login to admin account Open the drop down menu by clicking on the user menu link containing the user's name Click on the 'Admin' button Open the drop down menu by clicking 'Content' Click the 'Tags' button Enter text into the text box with 'Search here' Click the 'Search' button ***Results of the search are returned.(t1.58.19)*** Click the 'Edit' button for one of the returned tags Edit the text box labeled 'Name' Edit the text box labeled 'Description' Click the 'Save' button ***The user is returned to the Tags page and the text 'The tag has been updated.' is displayed. (t1.58.20)*** :return: CORRESPONDS TO: t1.58.19,20 """ # t1.58.19 --> Results of the search are returned. content_dropdown = "//a[contains(@class,'dropdown-toggle') and " + \ "contains(text(),'Content')]" content_ecosystems = "//a[contains(text(),'Tags')]" search_term = "bio" search_btn = "//input[contains(@value,'Search')]" # (t1.58.20) --> The user is returned to the Tags page and the text # 'The tag has been updated.' is displayed. edit = "//a[contains(@edit,'Edit')]" # NEED CODE FOR ACTUALLY FILLING IN TEXTBOXES print(content_dropdown, content_ecosystems, search_term, search_btn) print(edit) self.admin.find(By.XPATH, "//div[contains(@class,'alert-info')]") self.admin.find( By.XPATH, "//div[contains(@class,'alert-info')]" + "//*[contains(text(),'The tag has been updated')]")
class TestCourseMaintenance(unittest.TestCase): """T1.57 - Course Maintenance.""" 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.admin.login() self.admin.goto_admin_control() self.admin.sleep(5) def tearDown(self): """Test destructor.""" self.ps.update_job(job_id=str(self.admin.driver.session_id), **self.ps.test_updates) try: self.admin.delete() except: pass # Case C8311 - 001 - Admin | Import courses from Salesforece @pytest.mark.skipif(str(8311) not in TESTS, reason='Excluded') def test_admin_import_courses_from_salesforce_8311(self): """Import courses from Salesforce. Steps: Click on the user menu Click on the Admin option Click on Salesforce on the header Click on the Import Courses button Expected Result: """ self.ps.test_updates['name'] = 't1.57.001' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['t1', 't1.57', 't1.57.001', '8311'] 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 C8312 - 002 - Admin | Update Salesforce Staistics @pytest.mark.skipif(str(8312) not in TESTS, reason='Excluded') def test_admin_update_salesforce_statistice_8312(self): """Update Salesforce statistics. Steps: Click on the user menu Click on the Admin option Click on Salesforce on the header Click on Update Salesforce Expected Result: """ self.ps.test_updates['name'] = 't1.57.002' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['t1', 't1.57', 't1.57.002', '8312'] 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 C8313 - 003 - Admin | Exclude assesments from all courses @pytest.mark.skipif(str(8313) not in TESTS, reason='Excluded') def test_admin_exclude_assesments_from_all_courses_8313(self): """Exclude assesments from all courses. Steps: Expected Result: """ self.ps.test_updates['name'] = 't1.57.003' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['t1', 't1.57', 't1.57.003', '8313'] 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 C8314 - 004 - Admin | Add a system notification @pytest.mark.skipif(str(8314) not in TESTS, reason='Excluded') def test_admin_add_a_system_notification_8314(self): """Add a system notification. Steps: Click on the user menu Click on the Admin option Click on System Setting on the header Click on the Notifications option Enter a notification into the New Notification text box Click on the Add button Expected Result: A system notification is added """ self.ps.test_updates['name'] = 't1.57.004' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['t1', 't1.57', 't1.57.004', '8314'] self.ps.test_updates['passed'] = False # Test steps and verification assertions self.admin.wait.until( expect.visibility_of_element_located( (By.PARTIAL_LINK_TEXT, 'System Setting'))).click() self.admin.wait.until( expect.visibility_of_element_located( (By.PARTIAL_LINK_TEXT, 'Notifications'))).click() self.admin.sleep(5) self.admin.find( By.XPATH, "//input[@id='new_message']").send_keys('automated test') self.admin.find(By.XPATH, "//input[@class='btn btn-default']").click() self.admin.sleep(5) notif = self.admin.driver.find_elements_by_xpath( "//div[@class='col-xs-12']") for index, n in enumerate(notif): if n.text.find('automated test') >= 0: self.admin.driver.find_elements_by_xpath( "//a[@class='btn btn-warning']")[index].click() self.admin.driver.switch_to_alert().accept() self.ps.test_updates['passed'] = True break # Case C8315 - 005 - Admin | Delete a system notification @pytest.mark.skipif(str(8315) not in TESTS, reason='Excluded') def test_admin_delete_a_system_notification_8315(self): """Delete a system notification. Steps: Click on the user menu Click on the Admin option Click on System Setting on the header Click on the Notifications option Click on the Remove button next to a notification Click OK on the dialouge box Expected Result: A system notification is deleted """ self.ps.test_updates['name'] = 't1.57.005' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['t1', 't1.57', 't1.57.005', '8315'] self.ps.test_updates['passed'] = False # Test steps and verification assertions self.admin.wait.until( expect.visibility_of_element_located( (By.PARTIAL_LINK_TEXT, 'System Setting'))).click() self.admin.wait.until( expect.visibility_of_element_located( (By.PARTIAL_LINK_TEXT, 'Notifications'))).click() self.admin.sleep(5) self.admin.find( By.XPATH, "//input[@id='new_message']").send_keys('automated test') self.admin.find(By.XPATH, "//input[@class='btn btn-default']").click() self.admin.sleep(5) notif = self.admin.driver.find_elements_by_xpath( "//div[@class='col-xs-12']") for index, n in enumerate(notif): if n.text.find('automated test') >= 0: self.admin.driver.find_elements_by_xpath( "//a[@class='btn btn-warning']")[index].click() self.admin.driver.switch_to_alert().accept() break deleted = True notif = self.admin.driver.find_elements_by_xpath( "//div[@class='col-xs-12']") for n in notif: if n.text.find('automated test') >= 0: deleted = False break if deleted: self.ps.test_updates['passed'] = True