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) 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) else: self.admin = Admin(use_env_vars=True, ) self.content = ContentQA( existing_driver=self.admin.driver, use_env_vars=True, ) self.student = Student( existing_driver=self.admin.driver, use_env_vars=True, ) self.teacher = Teacher( existing_driver=self.admin.driver, use_env_vars=True, )
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 setUp(self): """Pretest settings.""" self.ps = PastaSauce() self.desired_capabilities['name'] = self.id() self.content = ContentQA( use_env_vars=True, pasta_user=self.ps, capabilities=self.desired_capabilities, )
class TestStaxingContentQA(unittest.TestCase): """Staxing case tests.""" def setUp(self): """Pretest settings.""" self.content = ContentQA(use_env_vars=True, driver_type=DRIVER) self.content.set_window_size(height=700, width=1200) def tearDown(self): """Test destructor.""" try: self.content.delete() except Exception: pass
class TestStaxingContentQA(unittest.TestCase): """Staxing case tests.""" def setUp(self): """Pretest settings.""" self.content = ContentQA(use_env_vars=True) self.content.set_window_size(height=700, width=1200) def tearDown(self): """Test destructor.""" try: self.content.driver.quit() except: pass
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 setUp(self): """Pretest settings.""" self.content = ContentQA(use_env_vars=True) self.content.set_window_size(height=700, width=1200)
class TestContentPreparationAndImport(unittest.TestCase): """CC1.03 - Content Preparation and Import.""" def setUp(self): """Pretest settings.""" self.ps = PastaSauce() self.desired_capabilities['name'] = self.id() if not LOCAL_RUN: self.content = ContentQA(use_env_vars=True, pasta_user=self.ps, capabilities=self.desired_capabilities) else: self.content = ContentQA(use_env_vars=True) def tearDown(self): """Test destructor.""" if not LOCAL_RUN: self.ps.update_job(job_id=str(self.content.driver.session_id), **self.ps.test_updates) try: self.content.delete() except: pass # Case C7603 - 001 - Content Analyst | Import content into Tutor @pytest.mark.skipif(str(7603) not in TESTS, reason='Excluded') def test_content_analyst_import_content_into_tutor_7603(self): """Import content into Tutor. Steps: Go to tutor-qa login as content Select Content Analyst from the dropdown menu on the name Click on Ecosystems in the header Click "Download Manifest" for the desired course Scroll down and click Import a new Ecosystem button. Click "Choose File" Select the downloaded In comment section add today's date and your name. Eg: 2016-03-03 Kajal Click on the button Import Now wait for at most 5 mins. Expected Result: The message "Ecosystem import job queued" appears at the top """ self.ps.test_updates['name'] = 'cc1.03.001' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['cc1', 'cc1.03', 'cc1.03.001', '7603'] self.ps.test_updates['passed'] = False # Test steps and verification assertions self.content.login() self.content.open_user_menu() self.content.driver.find_element(By.LINK_TEXT, "Content Analyst").click() self.content.page.wait_for_page_load() self.content.driver.find_element(By.LINK_TEXT, "Ecosystems").click() # download a manifest to test with self.content.wait.until( expect.visibility_of_element_located( (By.LINK_TEXT, "Download Manifest"))).click() # import a new ecosystem self.content.driver.execute_script( "window.scrollTo(0, document.body.scrollHeight);") self.content.driver.find_element(By.LINK_TEXT, "Import a new Ecosystem").click() # find a downloaded manifest home = os.getenv("HOME") files = os.listdir(home + '/Downloads') file = '' for i in range(len(files)): if (files[i][-4:] == '.yml'): file = files[i] break else: if i == len(files) - 1: print('no .yml file found in downloads') raise Exception self.content.wait.until( expect.visibility_of_element_located( (By.ID, "ecosystem_manifest"))).send_keys(home + '/Downloads/' + file) self.content.wait.until( expect.visibility_of_element_located( (By.ID, "ecosystem_comments"))).send_keys( str(datetime.date.today()) + ' automated-contentqa') self.content.driver.find_element(By.XPATH, "//input[@type='submit']").click() self.content.wait.until( expect.visibility_of_element_located( (By.XPATH, '//div[contains(@class,"alert-info")]'))) self.ps.test_updates['passed'] = True # Case C7604 - 002 - Admin | Import content into Tutor @pytest.mark.skipif(str(7604) not in TESTS, reason='Excluded') def test_admin_import_content_into_tutor_7604(self): """Import content into Tutor. Steps: Select Customer Analyst from the dropdown menu on the name Click on Ecosystems in the header Click "Download Manifest" for the desired course Scroll down and click Import a new Ecosystem button. Click "Choose File" Select the downloaded file In comment section add today's date and your name. Eg: 2016-03-03 Kajal Click on the button Import Now wait for at most 5 mins. Expected Result: The message "Ecosystem import job queued" appears at the top """ self.ps.test_updates['name'] = 'cc1.03.002' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['cc1', 'cc1.03', 'cc1.03.002', '7604'] self.ps.test_updates['passed'] = False # Test steps and verification assertions if not LOCAL_RUN: admin = Admin( use_env_vars=True, existing_driver=self.content.driver, pasta_user=self.ps, capabilities=self.desired_capabilities, ) else: admin = Admin( use_env_vars=True, existing_driver=self.content.driver, ) admin.login() admin.open_user_menu() admin.driver.find_element(By.LINK_TEXT, "Content Analyst").click() admin.page.wait_for_page_load() admin.driver.find_element(By.LINK_TEXT, "Ecosystems").click() # download a manifest to test with admin.wait.until( expect.visibility_of_element_located( (By.LINK_TEXT, "Download Manifest"))).click() # import a new ecosystem admin.driver.execute_script( "window.scrollTo(0, document.body.scrollHeight);") admin.driver.find_element(By.LINK_TEXT, "Import a new Ecosystem").click() # find a downloaded manifest home = os.getenv("HOME") files = os.listdir(home + '/Downloads') file = '' for i in range(len(files)): if (files[i][-4:] == '.yml'): file = files[i] break else: if i == len(files) - 1: print('no .yml file found in downloads') raise Exception admin.wait.until( expect.visibility_of_element_located( (By.ID, "ecosystem_manifest"))).send_keys(home + '/Downloads/' + file) admin.wait.until( expect.visibility_of_element_located( (By.ID, "ecosystem_comments"))).send_keys( str(datetime.date.today()) + ' automated-admin') admin.driver.find_element(By.XPATH, "//input[@type='submit']").click() admin.wait.until( expect.visibility_of_element_located( (By.XPATH, '//div[contains(@class,"alert-info")]'))) admin.delete() self.ps.test_updates['passed'] = True # Case C7962 - 003 - Content Analyst| Verify question availability for # CC-Derived Biology @pytest.mark.skipif(str(7962) not in TESTS, reason='Excluded') def test_content_analyst_verify_question_availability_for_bio_7962(self): """Verify question availability for CC-Derived Biology. Steps: Click QA content Click Available Books Select CC-Derived Biology Click on a section in the table of contents Expected Result: Questions are available """ self.ps.test_updates['name'] = 'cc1.03.003' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['cc1', 'cc1.03', 'cc1.03.003', '7962'] self.ps.test_updates['passed'] = False # Test steps and verification assertions self.content.login() self.content.open_user_menu() self.content.driver.find_element(By.PARTIAL_LINK_TEXT, "QA Content").click() self.content.page.wait_for_page_load() self.content.driver.find_element(By.ID, "available-books").click() element = self.content.driver.find_element( By.XPATH, "//span[contains(text(),'Biology with Concept Coach')]") self.content.sleep(0.5) self.content.driver.execute_script( 'return arguments[0].scrollIntoView();', element) self.content.driver.execute_script('window.scrollBy(0, -80);') element.click() self.content.sleep(0.5) self.content.driver.find_element( By.XPATH, "//span[@class='section-number' and text()='1.1']").click() self.content.wait.until( expect.visibility_of_element_located( (By.XPATH, "//div[contains(@class,'openstax-exercise-preview')]" ))).click() self.ps.test_updates['passed'] = True # Case C7963 - 004 - Content Analyst| Verify question availability for # CC-Derived College Physics @pytest.mark.skipif(str(7963) not in TESTS, reason='Excluded') def test_content_analyst_verify_question_availability_for_phys_7963(self): """Verify question availability for CC-Derived College Physics. Steps: Click QA content Click Available Books Select CC-Derived College Physics Click on a section in the table of contents Expected Result: Questions are available """ self.ps.test_updates['name'] = 'cc1.03.004' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['cc1', 'cc1.03', 'cc1.03.004', '7963'] self.ps.test_updates['passed'] = False # Test steps and verification assertions self.content.login() self.content.open_user_menu() self.content.driver.find_element(By.PARTIAL_LINK_TEXT, "QA Content").click() self.content.page.wait_for_page_load() self.content.driver.find_element(By.ID, "available-books").click() element = self.content.driver.find_element( By.XPATH, "//span[contains(text(),'Physics with Concept Coach')]") self.content.sleep(0.5) self.content.driver.execute_script( 'return arguments[0].scrollIntoView();', element) self.content.driver.execute_script('window.scrollBy(0, -80);') element.click() self.content.sleep(0.5) self.content.driver.find_element( By.XPATH, "//span[@class='section-number' and text()='1.1']").click() self.content.wait.until( expect.visibility_of_element_located( (By.XPATH, "//div[contains(@class,'openstax-exercise-preview')]" ))).click() self.ps.test_updates['passed'] = True # Case C7964 - 005 - Content Analyst| Verify question availability for # CC-Derived Concepts of Biology @pytest.mark.skipif(str(7964) not in TESTS, reason='Excluded') def test_content_analyst_verify_question_avilability_for_concep_7964(self): """Verify question availability for CC-Derived Concepts of Biology. Steps: Click QA content Click Available Books Select CC-Derived Concepts of Biology Click on a section in the table of contents Expected Result: Questions are available """ self.ps.test_updates['name'] = 'cc1.03.005' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['cc1', 'cc1.03', 'cc1.03.005', '7964'] self.ps.test_updates['passed'] = False # Test steps and verification assertions self.content.login() self.content.open_user_menu() self.content.driver.find_element(By.PARTIAL_LINK_TEXT, "QA Content").click() self.content.page.wait_for_page_load() self.content.driver.find_element(By.ID, "available-books").click() element = self.content.driver.find_element( By.XPATH, "//span[contains(text(),'Concepts of Biology with Concept Coach')]" ) self.content.sleep(0.5) self.content.driver.execute_script( 'return arguments[0].scrollIntoView();', element) self.content.driver.execute_script('window.scrollBy(0, -80);') element.click() self.content.sleep(0.5) self.content.driver.find_element( By.XPATH, "//span[@class='section-number' and text()='1.1']").click() self.content.wait.until( expect.visibility_of_element_located( (By.XPATH, "//div[contains(@class,'openstax-exercise-preview')]" ))).click() self.ps.test_updates['passed'] = True # Case C7965 - 006 - Content Analyst| Verify question availability for # CC-Derived Anatomy & Physiology @pytest.mark.skipif(str(7965) not in TESTS, reason='Excluded') def test_content_analyst_verify_question_availability_for_ap_7965(self): """Verify question availability for CC-Derived Anatomy & Physiology. Steps: Click QA content Click Available Books Select CC-Derived Anatomy and Physiology Click on a section in the table of contents Expected Result: Questions are available """ self.ps.test_updates['name'] = 'cc1.03.006' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['cc1', 'cc1.03', 'cc1.03.006', '7965'] self.ps.test_updates['passed'] = False # Test steps and verification assertions self.content.login() self.content.open_user_menu() self.content.driver.find_element(By.PARTIAL_LINK_TEXT, "QA Content").click() self.content.page.wait_for_page_load() self.content.driver.find_element(By.ID, "available-books").click() element = self.content.driver.find_element( By.XPATH, "//span[contains(text()," + "'Anatomy & Physiology with Concept Coach')]") self.content.sleep(0.5) self.content.driver.execute_script( 'return arguments[0].scrollIntoView();', element) self.content.driver.execute_script('window.scrollBy(0, -80);') element.click() self.content.sleep(0.5) self.content.driver.find_element( By.XPATH, "//span[@class='section-number' and text()='1.1']").click() self.content.wait.until( expect.visibility_of_element_located( (By.XPATH, "//div[contains(@class,'openstax-exercise-preview')]" ))).click() self.ps.test_updates['passed'] = True # Case C7966 - 007 - Content Analyst| Verify question availability for # CC-Derived Macroeconomics @pytest.mark.skipif(str(7966) not in TESTS, reason='Excluded') def test_content_analyst_verify_question_availability_for_macro_7966(self): """Verify question availability for CC-Derived Macroeconomics. Steps: Click QA content Click Available Books Select CC-Derived Macroeconomics Click on a section in the table of contents Expected Result: Questions are available """ self.ps.test_updates['name'] = 'cc1.03.007' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['cc1', 'cc1.03', 'cc1.03.007', '7966'] self.ps.test_updates['passed'] = False # Test steps and verification assertions self.content.login() self.content.open_user_menu() self.content.driver.find_element(By.PARTIAL_LINK_TEXT, "QA Content").click() self.content.page.wait_for_page_load() self.content.driver.find_element(By.ID, "available-books").click() element = self.content.driver.find_element( By.XPATH, "//span[contains(text(),'Macroeconomics with Concept Coach')]") self.content.sleep(0.5) self.content.driver.execute_script( 'return arguments[0].scrollIntoView();', element) self.content.driver.execute_script('window.scrollBy(0, -80);') element.click() self.content.sleep(0.5) self.content.driver.find_element( By.XPATH, "//span[@class='section-number' and text()='1.1']").click() self.content.wait.until( expect.visibility_of_element_located( (By.XPATH, "//div[contains(@class,'openstax-exercise-preview')]" ))).click() self.ps.test_updates['passed'] = True # Case C7967 - 008 - Content Analyst| Verify question availability for # CC-Derived Microeconomics @pytest.mark.skipif(str(7967) not in TESTS, reason='Excluded') def test_content_analyst_verify_question_availability_for_micro_7967(self): """Verify question availability for CC-Derived Microeconomics. Steps: Click QA content Click Available Books Select CC-Derived Microeconomics Click on a section in the table of contents Expected Result: Questions are available """ self.ps.test_updates['name'] = 'cc1.03.008' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['cc1', 'cc1.03', 'cc1.03.008', '7967'] self.ps.test_updates['passed'] = False # Test steps and verification assertions self.content.login() self.content.open_user_menu() self.content.driver.find_element(By.PARTIAL_LINK_TEXT, "QA Content").click() self.content.page.wait_for_page_load() self.content.driver.find_element(By.ID, "available-books").click() element = self.content.driver.find_element( By.XPATH, "//span[contains(text(),'Microeconomics with Concept Coach')]") self.content.sleep(0.5) self.content.driver.execute_script( 'return arguments[0].scrollIntoView();', element) self.content.driver.execute_script('window.scrollBy(0, -80);') element.click() self.content.sleep(0.5) self.content.driver.find_element( By.XPATH, "//span[@class='section-number' and text()='1.1']").click() self.content.wait.until( expect.visibility_of_element_located( (By.XPATH, "//div[contains(@class,'openstax-exercise-preview')]" ))).click() self.ps.test_updates['passed'] = True # Case C7968 - 009 - Content Analyst| Verify question availability for # CC-Derived Principles of Economics @pytest.mark.skipif(str(7968) not in TESTS, reason='Excluded') def test_content_analyst_verify_question_availability_for_princ_7968(self): """Verify question availability for CC-Derived Principles of Economics. Steps: Click QA content Click Available Books Select CC-Derived Principles of Economics Click on a section in the table of contents Expected Result: Questions are available """ self.ps.test_updates['name'] = 'cc1.03.009' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['cc1', 'cc1.03', 'cc1.03.009', '7968'] self.ps.test_updates['passed'] = False # Test steps and verification assertions self.content.login() self.content.open_user_menu() self.content.driver.find_element(By.PARTIAL_LINK_TEXT, "QA Content").click() self.content.page.wait_for_page_load() self.content.driver.find_element(By.ID, "available-books").click() element = self.content.driver.find_element( By.XPATH, "//span[contains(text()," + "'Principles of Economics with Concept Coach')]") self.content.sleep(0.5) self.content.driver.execute_script( 'return arguments[0].scrollIntoView();', element) self.content.driver.execute_script('window.scrollBy(0, -80);') element.click() self.content.sleep(0.5) self.content.driver.find_element( By.XPATH, "//span[@class='section-number' and text()='1.1']").click() self.content.wait.until( expect.visibility_of_element_located( (By.XPATH, "//div[contains(@class,'openstax-exercise-preview')]" ))).click() self.ps.test_updates['passed'] = True # Case C7969 - 010 - Content Analyst| Verify question availability for # CC-Derived Introduction to Sociology @pytest.mark.skipif(str(7969) not in TESTS, reason='Excluded') def test_content_analyst_verify_question_availability_for_soci_7969(self): """Verify question availability for CC-Der Introduction to Sociology. Steps: Click QA content Click Available Books Select CC-Derived Introcution to Sociology Click on a section in the table of contents Expected Result: Questions are available """ self.ps.test_updates['name'] = 'cc1.03.010' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['cc1', 'cc1.03', 'cc1.03.010', '7969'] self.ps.test_updates['passed'] = False # Test steps and verification assertions self.content.login() self.content.open_user_menu() self.content.driver.find_element(By.PARTIAL_LINK_TEXT, "QA Content").click() self.content.page.wait_for_page_load() self.content.driver.find_element(By.ID, "available-books").click() element = self.content.driver.find_element( By.XPATH, "//span[contains(text()," + "'Introduction to Sociology 2e with Concept Coach')]") self.content.sleep(0.5) self.content.driver.execute_script( 'return arguments[0].scrollIntoView();', element) self.content.driver.execute_script('window.scrollBy(0, -80);') element.click() self.content.sleep(0.5) self.content.driver.find_element( By.XPATH, "//span[@class='section-number' and text()='1.1']").click() self.content.wait.until( expect.visibility_of_element_located( (By.XPATH, "//div[contains(@class,'openstax-exercise-preview')]" ))).click() self.ps.test_updates['passed'] = True
def setUp(self): """Pretest settings.""" self.content = ContentQA(use_env_vars=True, driver_type=DRIVER) self.content.set_window_size(height=700, width=1200)
class TestContentPreparationAndImport(unittest.TestCase): """CC1.03 - Content Preparation and Import.""" def setUp(self): """Pretest settings.""" self.ps = PastaSauce() self.desired_capabilities['name'] = self.id() self.content = ContentQA( 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.content.driver.session_id), **self.ps.test_updates ) try: self.content.delete() except: pass # Case C7603 - 001 - Content Analyst | Import content into Tutor @pytest.mark.skipif(str(7603) not in TESTS, reason='Excluded') def test_content_analyst_import_content_into_tutor_7603(self): """Import content into Tutor. Steps: Go to tutor-qa login as content Select Content Analyst from the dropdown menu on the name Click on Ecosystems in the header Click "Download Manifest" for the desired course Scroll down and click Import a new Ecosystem button. Click "Choose File" Select the downloaded In comment section add today's date and your name. Eg: 2016-03-03 Kajal Click on the button Import Now wait for at most 5 mins. Expected Result: The message "Ecosystem import job queued" appears at the top """ self.ps.test_updates['name'] = 'cc1.03.001' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = [ 'cc1', 'cc1.03', 'cc1.03.001', '7603' ] self.ps.test_updates['passed'] = False # Test steps and verification assertions self.content.login() self.content.open_user_menu() self.content.driver.find_element( By.LINK_TEXT, "Content Analyst" ).click() self.content.page.wait_for_page_load() self.content.driver.find_element( By.LINK_TEXT, "Ecosystems" ).click() # download a manifest to test with self.content.wait.until( expect.visibility_of_element_located( (By.LINK_TEXT, "Download Manifest") ) ).click() # import a new ecosystem self.content.driver.execute_script( "window.scrollTo(0, document.body.scrollHeight);") self.content.driver.find_element( By.LINK_TEXT, "Import a new Ecosystem" ).click() # find a downloaded manifest home = os.getenv("HOME") files = os.listdir(home + '/Downloads') file = '' for i in range(len(files)): if (files[i][-4:] == '.yml'): file = files[i] break else: if i == len(files)-1: print('no .yml file found in downloads') raise Exception self.content.wait.until( expect.visibility_of_element_located( (By.ID, "ecosystem_manifest") ) ).send_keys(home + '/Downloads/' + file) self.content.wait.until( expect.visibility_of_element_located( (By.ID, "ecosystem_comments") ) ).send_keys(str(datetime.date.today()) + ' automated-contentqa') self.content.driver.find_element( By.XPATH, "//input[@type='submit']" ).click() self.content.wait.until( expect.visibility_of_element_located( (By.XPATH, '//div[contains(@class,"alert-info")]') ) ) self.ps.test_updates['passed'] = True # Case C7604 - 002 - Admin | Import content into Tutor @pytest.mark.skipif(str(7604) not in TESTS, reason='Excluded') def test_admin_import_content_into_tutor_7604(self): """Import content into Tutor. Steps: Select Customer Analyst from the dropdown menu on the name Click on Ecosystems in the header Click "Download Manifest" for the desired course Scroll down and click Import a new Ecosystem button. Click "Choose File" Select the downloaded file In comment section add today's date and your name. Eg: 2016-03-03 Kajal Click on the button Import Now wait for at most 5 mins. Expected Result: The message "Ecosystem import job queued" appears at the top """ self.ps.test_updates['name'] = 'cc1.03.002' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = [ 'cc1', 'cc1.03', 'cc1.03.002', '7604' ] self.ps.test_updates['passed'] = False # Test steps and verification assertions admin = Admin( existing_driver=self.content.driver, username=os.getenv('ADMIN_USER'), password=os.getenv('ADMIN_PASSWORD'), pasta_user=self.ps, capabilities=self.desired_capabilities, ) admin.login() admin.open_user_menu() admin.driver.find_element( By.LINK_TEXT, "Content Analyst" ).click() admin.page.wait_for_page_load() admin.driver.find_element( By.LINK_TEXT, "Ecosystems" ).click() # download a manifest to test with admin.wait.until( expect.visibility_of_element_located( (By.LINK_TEXT, "Download Manifest") ) ).click() # import a new ecosystem admin.driver.execute_script( "window.scrollTo(0, document.body.scrollHeight);") admin.driver.find_element( By.LINK_TEXT, "Import a new Ecosystem" ).click() # find a downloaded manifest home = os.getenv("HOME") files = os.listdir(home + '/Downloads') file = '' for i in range(len(files)): if (files[i][-4:] == '.yml'): file = files[i] break else: if i == len(files)-1: print('no .yml file found in downloads') raise Exception admin.wait.until( expect.visibility_of_element_located( (By.ID, "ecosystem_manifest") ) ).send_keys(home + '/Downloads/' + file) admin.wait.until( expect.visibility_of_element_located( (By.ID, "ecosystem_comments") ) ).send_keys(str(datetime.date.today()) + ' automated-admin') admin.driver.find_element( By.XPATH, "//input[@type='submit']" ).click() admin.wait.until( expect.visibility_of_element_located( (By.XPATH, '//div[contains(@class,"alert-info")]') ) ) admin.delete() self.ps.test_updates['passed'] = True # Case C7962 - 003 - Content Analyst| Verify question availability for # CC-Derived Biology @pytest.mark.skipif(str(7962) not in TESTS, reason='Excluded') def test_content_analyst_verify_question_availability_for_bio_7962(self): """Verify question availability for CC-Derived Biology. Steps: Click QA content Click Available Books Select CC-Derived Biology Click on a section in the table of contents Expected Result: Questions are available """ self.ps.test_updates['name'] = 'cc1.03.003' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = [ 'cc1', 'cc1.03', 'cc1.03.003', '7962' ] self.ps.test_updates['passed'] = False # Test steps and verification assertions self.content.login() self.content.open_user_menu() self.content.driver.find_element( By.PARTIAL_LINK_TEXT, "QA Content" ).click() self.content.page.wait_for_page_load() self.content.driver.find_element( By.ID, "available-books" ).click() element = self.content.driver.find_element( By.XPATH, "//span[contains(text(),'Biology with Concept Coach')]" ) self.content.sleep(0.5) self.content.driver.execute_script( 'return arguments[0].scrollIntoView();', element) self.content.driver.execute_script('window.scrollBy(0, -80);') element.click() self.content.sleep(0.5) self.content.driver.find_element( By.XPATH, "//span[@class='section-number' and text()='1.1']" ).click() self.content.wait.until( expect.visibility_of_element_located( (By.XPATH, "//div[contains(@class,'openstax-exercise-preview')]") ) ).click() self.ps.test_updates['passed'] = True # Case C7963 - 004 - Content Analyst| Verify question availability for # CC-Derived College Physics @pytest.mark.skipif(str(7963) not in TESTS, reason='Excluded') def test_content_analyst_verify_question_availability_for_phys_7963(self): """Verify question availability for CC-Derived College Physics. Steps: Click QA content Click Available Books Select CC-Derived College Physics Click on a section in the table of contents Expected Result: Questions are available """ self.ps.test_updates['name'] = 'cc1.03.004' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = [ 'cc1', 'cc1.03', 'cc1.03.004', '7963' ] self.ps.test_updates['passed'] = False # Test steps and verification assertions self.content.login() self.content.open_user_menu() self.content.driver.find_element( By.PARTIAL_LINK_TEXT, "QA Content" ).click() self.content.page.wait_for_page_load() self.content.driver.find_element( By.ID, "available-books" ).click() element = self.content.driver.find_element( By.XPATH, "//span[contains(text(),'Physics with Concept Coach')]" ) self.content.sleep(0.5) self.content.driver.execute_script( 'return arguments[0].scrollIntoView();', element) self.content.driver.execute_script('window.scrollBy(0, -80);') element.click() self.content.sleep(0.5) self.content.driver.find_element( By.XPATH, "//span[@class='section-number' and text()='1.1']" ).click() self.content.wait.until( expect.visibility_of_element_located( (By.XPATH, "//div[contains(@class,'openstax-exercise-preview')]") ) ).click() self.ps.test_updates['passed'] = True # Case C7964 - 005 - Content Analyst| Verify question availability for # CC-Derived Concepts of Biology @pytest.mark.skipif(str(7964) not in TESTS, reason='Excluded') def test_content_analyst_verify_question_avilability_for_concep_7964(self): """Verify question availability for CC-Derived Concepts of Biology. Steps: Click QA content Click Available Books Select CC-Derived Concepts of Biology Click on a section in the table of contents Expected Result: Questions are available """ self.ps.test_updates['name'] = 'cc1.03.005' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = [ 'cc1', 'cc1.03', 'cc1.03.005', '7964' ] self.ps.test_updates['passed'] = False # Test steps and verification assertions self.content.login() self.content.open_user_menu() self.content.driver.find_element( By.PARTIAL_LINK_TEXT, "QA Content" ).click() self.content.page.wait_for_page_load() self.content.driver.find_element( By.ID, "available-books" ).click() element = self.content.driver.find_element( By.XPATH, "//span[contains(text(),'Concepts of Biology with Concept Coach')]" ) self.content.sleep(0.5) self.content.driver.execute_script( 'return arguments[0].scrollIntoView();', element) self.content.driver.execute_script('window.scrollBy(0, -80);') element.click() self.content.sleep(0.5) self.content.driver.find_element( By.XPATH, "//span[@class='section-number' and text()='1.1']" ).click() self.content.wait.until( expect.visibility_of_element_located( (By.XPATH, "//div[contains(@class,'openstax-exercise-preview')]") ) ).click() self.ps.test_updates['passed'] = True # Case C7965 - 006 - Content Analyst| Verify question availability for # CC-Derived Anatomy & Physiology @pytest.mark.skipif(str(7965) not in TESTS, reason='Excluded') def test_content_analyst_verify_question_availability_for_ap_7965(self): """Verify question availability for CC-Derived Anatomy & Physiology. Steps: Click QA content Click Available Books Select CC-Derived Anatomy and Physiology Click on a section in the table of contents Expected Result: Questions are available """ self.ps.test_updates['name'] = 'cc1.03.006' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = [ 'cc1', 'cc1.03', 'cc1.03.006', '7965' ] self.ps.test_updates['passed'] = False # Test steps and verification assertions self.content.login() self.content.open_user_menu() self.content.driver.find_element( By.PARTIAL_LINK_TEXT, "QA Content" ).click() self.content.page.wait_for_page_load() self.content.driver.find_element( By.ID, "available-books" ).click() element = self.content.driver.find_element( By.XPATH, "//span[contains(text()," + "'Anatomy & Physiology with Concept Coach')]" ) self.content.sleep(0.5) self.content.driver.execute_script( 'return arguments[0].scrollIntoView();', element) self.content.driver.execute_script('window.scrollBy(0, -80);') element.click() self.content.sleep(0.5) self.content.driver.find_element( By.XPATH, "//span[@class='section-number' and text()='1.1']" ).click() self.content.wait.until( expect.visibility_of_element_located( (By.XPATH, "//div[contains(@class,'openstax-exercise-preview')]") ) ).click() self.ps.test_updates['passed'] = True # Case C7966 - 007 - Content Analyst| Verify question availability for # CC-Derived Macroeconomics @pytest.mark.skipif(str(7966) not in TESTS, reason='Excluded') def test_content_analyst_verify_question_availability_for_macro_7966(self): """Verify question availability for CC-Derived Macroeconomics. Steps: Click QA content Click Available Books Select CC-Derived Macroeconomics Click on a section in the table of contents Expected Result: Questions are available """ self.ps.test_updates['name'] = 'cc1.03.007' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = [ 'cc1', 'cc1.03', 'cc1.03.007', '7966' ] self.ps.test_updates['passed'] = False # Test steps and verification assertions self.content.login() self.content.open_user_menu() self.content.driver.find_element( By.PARTIAL_LINK_TEXT, "QA Content" ).click() self.content.page.wait_for_page_load() self.content.driver.find_element( By.ID, "available-books" ).click() element = self.content.driver.find_element( By.XPATH, "//span[contains(text(),'Macroeconomics with Concept Coach')]" ) self.content.sleep(0.5) self.content.driver.execute_script( 'return arguments[0].scrollIntoView();', element) self.content.driver.execute_script('window.scrollBy(0, -80);') element.click() self.content.sleep(0.5) self.content.driver.find_element( By.XPATH, "//span[@class='section-number' and text()='1.1']" ).click() self.content.wait.until( expect.visibility_of_element_located( (By.XPATH, "//div[contains(@class,'openstax-exercise-preview')]") ) ).click() self.ps.test_updates['passed'] = True # Case C7967 - 008 - Content Analyst| Verify question availability for # CC-Derived Microeconomics @pytest.mark.skipif(str(7967) not in TESTS, reason='Excluded') def test_content_analyst_verify_question_availability_for_micro_7967(self): """Verify question availability for CC-Derived Microeconomics. Steps: Click QA content Click Available Books Select CC-Derived Microeconomics Click on a section in the table of contents Expected Result: Questions are available """ self.ps.test_updates['name'] = 'cc1.03.008' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = [ 'cc1', 'cc1.03', 'cc1.03.008', '7967' ] self.ps.test_updates['passed'] = False # Test steps and verification assertions self.content.login() self.content.open_user_menu() self.content.driver.find_element( By.PARTIAL_LINK_TEXT, "QA Content" ).click() self.content.page.wait_for_page_load() self.content.driver.find_element( By.ID, "available-books" ).click() element = self.content.driver.find_element( By.XPATH, "//span[contains(text(),'Microeconomics with Concept Coach')]" ) self.content.sleep(0.5) self.content.driver.execute_script( 'return arguments[0].scrollIntoView();', element) self.content.driver.execute_script('window.scrollBy(0, -80);') element.click() self.content.sleep(0.5) self.content.driver.find_element( By.XPATH, "//span[@class='section-number' and text()='1.1']" ).click() self.content.wait.until( expect.visibility_of_element_located( (By.XPATH, "//div[contains(@class,'openstax-exercise-preview')]") ) ).click() self.ps.test_updates['passed'] = True # Case C7968 - 009 - Content Analyst| Verify question availability for # CC-Derived Principles of Economics @pytest.mark.skipif(str(7968) not in TESTS, reason='Excluded') def test_content_analyst_verify_question_availability_for_princ_7968(self): """Verify question availability for CC-Derived Principles of Economics. Steps: Click QA content Click Available Books Select CC-Derived Principles of Economics Click on a section in the table of contents Expected Result: Questions are available """ self.ps.test_updates['name'] = 'cc1.03.009' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = [ 'cc1', 'cc1.03', 'cc1.03.009', '7968' ] self.ps.test_updates['passed'] = False # Test steps and verification assertions self.content.login() self.content.open_user_menu() self.content.driver.find_element( By.PARTIAL_LINK_TEXT, "QA Content" ).click() self.content.page.wait_for_page_load() self.content.driver.find_element( By.ID, "available-books" ).click() element = self.content.driver.find_element( By.XPATH, "//span[contains(text()," + "'Principles of Economics with Concept Coach')]" ) self.content.sleep(0.5) self.content.driver.execute_script( 'return arguments[0].scrollIntoView();', element) self.content.driver.execute_script('window.scrollBy(0, -80);') element.click() self.content.sleep(0.5) self.content.driver.find_element( By.XPATH, "//span[@class='section-number' and text()='1.1']" ).click() self.content.wait.until( expect.visibility_of_element_located( (By.XPATH, "//div[contains(@class,'openstax-exercise-preview')]") ) ).click() self.ps.test_updates['passed'] = True # Case C7969 - 010 - Content Analyst| Verify question availability for # CC-Derived Introduction to Sociology @pytest.mark.skipif(str(7969) not in TESTS, reason='Excluded') def test_content_analyst_verify_question_availability_for_soci_7969(self): """Verify question availability for CC-Der Introduction to Sociology. Steps: Click QA content Click Available Books Select CC-Derived Introcution to Sociology Click on a section in the table of contents Expected Result: Questions are available """ self.ps.test_updates['name'] = 'cc1.03.010' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = [ 'cc1', 'cc1.03', 'cc1.03.010', '7969' ] self.ps.test_updates['passed'] = False # Test steps and verification assertions self.content.login() self.content.open_user_menu() self.content.driver.find_element( By.PARTIAL_LINK_TEXT, "QA Content" ).click() self.content.page.wait_for_page_load() self.content.driver.find_element( By.ID, "available-books" ).click() element = self.content.driver.find_element( By.XPATH, "//span[contains(text()," + "'Introduction to Sociology 2e with Concept Coach')]" ) self.content.sleep(0.5) self.content.driver.execute_script( 'return arguments[0].scrollIntoView();', element) self.content.driver.execute_script('window.scrollBy(0, -80);') element.click() self.content.sleep(0.5) self.content.driver.find_element( By.XPATH, "//span[@class='section-number' and text()='1.1']" ).click() self.content.wait.until( expect.visibility_of_element_located( (By.XPATH, "//div[contains(@class,'openstax-exercise-preview')]") ) ).click() self.ps.test_updates['passed'] = True
class TestExercisesTeacher(unittest.TestCase): """Tutor | Teacher""" def setUp(self): """Pretest settings.""" self.ps = PastaSauce() self.desired_capabilities['name'] = self.id() if not LOCAL_RUN: self.content = ContentQA(use_env_vars=True, pasta_user=self.ps, capabilities=self.desired_capabilities) else: self.content = ContentQA(use_env_vars=True) 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) try: self.content.delete() except: pass @pytest.mark.skipif(str(162262) not in TESTS, reason='Excluded') def test_creating_multiple_choice_questions_162262(self): """ Go to exercises qa Log in as a content analyst Click "Write a new exercise" Enter the video embed link into the Question Stem text box ***The video should appear in the box to the right*** Fill out the required fields Click on the box "Order Matters" ***User is able to preserve the order of choices*** Click "Tags" Click "Question Type", "DOK", "Blooms", and/or "Time" ***The user is able to pull out the dropdown tags*** Select a choice from the dropdown tags ***User is able to select a specific tag and the tag(s) appear in the box to the right*** Check the box that says "Requires Context" ***The user is able to specify whether context is required for a question and the tag "requires-context:true" appears in the box to the right*** Click "+" next to "CNX Module" Enter the CNX Module number Click "Save Draft" Click "Assets" Click "Add new image" Select an image ***The image and the options "Choose different image" and "Upload" should come up*** Click "Upload" ***There shoould be a URL and a "Delete" button)*** ***The user is presented with uploaded URL in the HTML snippet*** Click "Delete" ***The image is deleted*** Click "Save Draft", then click "Publish" ***Observe message: "Exercise [exercise ID] has published successfully")*** Click "Search" Enter the desired exercise ID Scroll down to "Detailed Solutions" Edit text in the "Detailed Solutions" text box Click "Publish" Expected Result: ***The user is able to edit detailed solutions and the changes are in the box to the right*** Corresponding test cases: T2.11 010-021 https://trello.com/c/6XGtFvPm/88-creating-multiple-choice-questions """ self.ps.test_updates['name'] = \ 'exercises_new_exercise_content_analyst_162262' + \ inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = \ ['exercises', 'new_exercise', 'content_analyst', '162262'] self.ps.test_updates['passed'] = False self.teacher.login(url=os.getenv('EXERCISES_QA'), username=os.getenv('CONTENT_USER'), password=os.getenv('CONTENT_PASSWORD')) # click create a new question self.teacher.find(By.CSS_SELECTOR, "a[href*='new']").click() textboxes = self.teacher.find_all(By.CSS_SELECTOR, ".question>div>textarea") # put embed link into Question Stem text box embedlink = '<iframe width="560" height="315" ' + \ 'src="https://www.youtube.com/embed/' embedlink += 'QnQe0xW_JY4" frameborder="0" allowfullscreen></iframe>"' textboxes[0].send_keys(embedlink) # verify that the video appears in the box to the right self.teacher.find(By.CSS_SELECTOR, "iframe") # fill out the required fields answers = self.teacher.find_all(By.CSS_SELECTOR, ".correct-answer>textarea") answers[0].send_keys('answer numero uno') answers[1].send_keys('answer numero dos') # textboxes[1].send_keys('answer numero tres') # click on Order Matters checkbox self.teacher.find(By.CSS_SELECTOR, "#input-om").click() # Click on Tabs tag self.teacher.find(By.CSS_SELECTOR, "#exercise-parts-tab-tags").click() # verify that all the dropdowns are clickable tagoptions = self.teacher.find_all(By.CSS_SELECTOR, ".form-control") for num in range(len(tagoptions)): expect.element_to_be_clickable(tagoptions[num]) # choose an option from a dropdown tagoptions[1].click() self.teacher.find_all(By.CSS_SELECTOR, "option")[1].click() # verify that the tag appears in the box to the right self.teacher.find( By.XPATH, "//*[@class='exercise-tag' and contains(text(),'type')]") self.teacher.find(By.CSS_SELECTOR, ".tag>input").click() self.teacher.find( By.XPATH, "//*[@class='exercise-tag' and contains(text(),'context:true')]") # click "+" next to CNX Module self.teacher.find_all(By.CSS_SELECTOR, ".fa.fa-plus-circle")[2].click() # put in a CNX module self.teacher.find( By.XPATH, ".//*[@class='form-control' and @placeholder]").send_keys( '12345678-1234-5788-9123-456798123456') # click save draft self.teacher.find(By.CSS_SELECTOR, ".async-button.draft.btn.btn-info").click() # click assets tab self.teacher.find(By.CSS_SELECTOR, "#exercise-parts-tab-assets").click() # Choose image. This is all local - prob have to edit for diff computer IMAGEPATH = "/Users/openstax10/desktop/bee_clip_art_18782.jpg" self.teacher.find(By.ID, "file").send_keys(IMAGEPATH) # check that Choose different image and Upload buttons are present self.teacher.find(By.XPATH, './/*[contains(text(),"Choose different image")]') self.teacher.find(By.XPATH, './/*[contains(text(),"Upload")]').click() self.teacher.page.wait_for_page_load() # check if uploaded url is present self.teacher.find(By.CSS_SELECTOR, ".copypaste") # check that delete button is present and click it self.teacher.find(By.XPATH, './/*[contains(text(),"Delete")]').click() self.teacher.sleep(1) # click publish self.teacher.find(By.CSS_SELECTOR, '.async-button.publish.btn.btn-primary').click() self.teacher.sleep(1) # confirm that you want to publish self.teacher.find( By.XPATH, './/*[@class="btn btn-primary" and contains(text(),"Publish")]' ).click() self.teacher.sleep(1) # close popup window tellign you ID # self.teacher.find( By.XPATH, './/*[@class="btn btn-primary" and contains(text(),"Close")]' ).click() # get id ID = self.teacher.current_url().split('/')[-1] # click search button self.teacher.find(By.CSS_SELECTOR, '.btn.btn-danger.back.btn.btn-default').click() # enter ID into field self.teacher.find(By.CSS_SELECTOR, '.form-control').send_keys(ID) self.teacher.find(By.CSS_SELECTOR, '.btn.btn-default.load').click() # edit detailed solution self.teacher.find(By.XPATH, "//div[4]/textarea") \ .send_keys('hello edited') detailedsol = self.teacher.find( By.CSS_SELECTOR, '.openstax-has-html.solution').get_attribute('innerHTML') # check that the text you inputted into detailed solution is in the # box to the right assert ('hello edited' == detailedsol) self.ps.test_updates['passed'] = True @pytest.mark.skipif(str(162263) not in TESTS, reason='Excluded') def test_creating_vocabulary_questions_162263(self): """ Go to exercises qa Log in as a content analyst Click "Write a new exercise" Click "New Vocabulary Term" from the header Fill out required fields Click "Save Draft" Click "Publish" ***The "Publish" button is whited out and the exercise ID appears in the box to the right*** Click "Search" Enter the desired exercise ID ***The vocabulary question loads and user is able to review it*** Enter next text into "Key Term", "Key Term Definition", and "Distractors" Click "Save Draft" Click "Publish" Expected result: ***The user is able to edit and save a vocabulary question*** Corresponding test cases: T2.11 032-034 https://trello.com/c/BAcghIsM/92-creating-vocabulary-questions """ self.ps.test_updates['name'] = \ 'exercises_new_exercise_content_analyst_162263' + \ inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = \ ['exercises', 'new_exercise', 'content_analyst', '162263'] self.ps.test_updates['passed'] = False # logging in with these credentials self.teacher.login(url=os.getenv('EXERCISES_QA'), username=os.getenv('CONTENT_USER'), password=os.getenv('CONTENT_PASSWORD')) # click create a new question self.teacher.find(By.CSS_SELECTOR, "a[href*='new']").click() # click New vocabulary question self.teacher.find(By.CSS_SELECTOR, ".btn.btn-success.vocabulary.blank").click() # enter testing as the key term self.teacher.find(By.CSS_SELECTOR, "#key-term").send_keys('testing') # enter 'ignore' as the definition self.teacher.find(By.CSS_SELECTOR, "#key-term-def").send_keys('ignore') # click save draft self.teacher.find(By.CSS_SELECTOR, ".async-button.draft.btn.btn-info").click() # click publish self.teacher.find(By.CSS_SELECTOR, ".async-button.publish.btn.btn-primary").click() self.teacher.sleep(1) # confirm publish self.teacher.find( By.XPATH, ".//*[@class='btn btn-primary' and contains(text(),'Publish')]" ).click() self.teacher.sleep(3) # get the exercise id exerciseid = self.teacher.find_all( By.CSS_SELECTOR, ".exercise-tag")[3].get_attribute('innerHTML')[4:] # go to search self.teacher.find(By.XPATH, ".//*[contains(text(),'Search')]").click() # search the exercise id self.teacher.find(By.CSS_SELECTOR, ".form-control") \ .send_keys(exerciseid) # click search self.teacher.find(By.CSS_SELECTOR, ".btn.btn-default.load").click() # confirm key term value is what was inputted originally keyterm = self.teacher.find(By.CSS_SELECTOR, "#key-term") \ .get_attribute('value') assert (keyterm == 'testing'), 'wrong term' # write something else for key term keyterm = self.teacher.find(By.CSS_SELECTOR, "#key-term") keyterm.send_keys(Keys.BACKSPACE * len('testing ')) self.teacher.sleep(.2) keyterm.send_keys('test edit') # confirm key term def value is what was inputted oirignally keytermdef = self.teacher.find(By.CSS_SELECTOR, '#key-term-def') \ .get_attribute('value') assert (keytermdef == 'ignore'), 'ignore it' # write something else for key term def keytermdef = self.teacher.find(By.CSS_SELECTOR, "#key-term-def") keytermdef.send_keys(Keys.BACKSPACE * len('ignore ')) self.teacher.sleep(0.2) keytermdef.send_keys('ignore edit') # fill in value for distractor self.teacher.find_all(By.CSS_SELECTOR, ".form-control")[2].send_keys('im a distractor') self.teacher.sleep(3) # save as draft self.teacher.find(By.CSS_SELECTOR, ".async-button.draft.btn.btn-info").click() self.teacher.sleep(1) # publish self.teacher.find(By.CSS_SELECTOR, ".async-button.publish.btn.btn-primary").click() # confirm publish self.teacher.find( By.XPATH, './/*[@class="btn btn-primary" and contains(text(),"Publish")]' ).click() self.teacher.sleep(2) # get new exercise id exerciseid = self.teacher.find_all( By.CSS_SELECTOR, ".exercise-tag")[3].get_attribute('innerHTML')[4:] # click search self.teacher.find(By.XPATH, ".//*[contains(text(),'Search')]").click() # search the exercise id self.teacher.find(By.CSS_SELECTOR, ".form-control") \ .send_keys(exerciseid) self.teacher.find(By.CSS_SELECTOR, ".btn.btn-default.load") \ .click() # verify that the value in key term is what was inputted previously keyterm = self.teacher.find(By.CSS_SELECTOR, "#key-term") \ .get_attribute('value') assert (keyterm == 'test edit'), 'test edited' self.ps.test_updates['passed'] = True @pytest.mark.skipif(str(162264) not in TESTS, reason='Excluded') def test_creating_multipart_question_162264(self): """ Go to exercises qa Log in as a content analyst Click "Write a new exercise" Check the box that says "Exercise contains multiple parts" Fill out the required fields Click "Publish" Expected result: ***The user gets a confirmation that says "Exercise [exercise ID] has published successfully"*** Corresponding test case: T2.11 044, 046 https://trello.com/c/L1RjXiSx/ 160-creating-multi-part-questions-without-detailed-solutions """ self.ps.test_updates['name'] = \ 'exercises_new_exercise_content_analyst_162264' + \ inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = \ ['exercises', 'new_exercise', 'content_analyst', '162264'] self.ps.test_updates['passed'] = False # logging in with these credentials self.teacher.login(url=os.getenv('EXERCISES_QA'), username=os.getenv('CONTENT_USER'), password=os.getenv('CONTENT_PASSWORD')) # click create a new question self.teacher.find(By.CSS_SELECTOR, "a[href*='new']") \ .click() # click "Exercise contains multiple parts" self.teacher.find(By.CSS_SELECTOR, '#mpq-toggle') \ .click() # write in something for question stem self.teacher.find(By.CSS_SELECTOR, '.question>div>textarea') \ .send_keys('test') # write in something for Distractor self.teacher.find(By.CSS_SELECTOR, '.correct-answer>textarea') \ .send_keys('ignore') # click tab "question 2" self.teacher.find(By.CSS_SELECTOR, '#exercise-parts-tab-question-1') \ .click() self.teacher.sleep(1) # write in something for question stem self.teacher.find_all(By.CSS_SELECTOR, '.question>div>textarea')[2].send_keys('test2') # write in something for Distractor self.teacher.find_all( By.CSS_SELECTOR, '.correct-answer>textarea')[2].send_keys('ignore2') # click save draft self.teacher.find(By.CSS_SELECTOR, '.async-button.draft.btn.btn-info').click() # click publish self.teacher.find(By.CSS_SELECTOR, '.async-button.publish.btn.btn-primary').click() self.teacher.sleep(1) # confirm publish self.teacher.find( By.XPATH, ".//*[@class='btn btn-primary' and contains(text(),'Publish')]" ).click() # confirm message appears self.teacher.find(By.CSS_SELECTOR, '.modal-body>b') self.ps.test_updates['passed'] = True
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 @pytest.mark.skipif(str(8239) not in TESTS, reason='Excluded') def test_admin_access_the_admin_console_8239(self): """Access the Admin console. Steps: Click on the 'Login' button Enter the admin account in the username and password text boxes Click on the 'Sign in' button Click on the user menu Click on the Admin option Expected Result: User is presented with the admin console """ self.ps.test_updates['name'] = 't1.36.002' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['t1', 't1.36', 't1.36.002', '8239'] self.ps.test_updates['passed'] = False # self.user = admin self.admin.login() self.admin.open_user_menu() self.admin.wait.until( expect.element_to_be_clickable( (By.LINK_TEXT, 'Admin') ) ).click() self.admin.page.wait_for_page_load() self.admin.find( By.XPATH, '//h1[contains(text(),"Admin Console")]') self.ps.test_updates['passed'] = True # Case C8240 - 003 - Admin | Log out @pytest.mark.skipif(str(8240) not in TESTS, reason='Excluded') def test_admin_log_out_8240(self): """Log out. Steps: Click on the 'Login' button Enter the admin account in the username and password text boxes Click on the 'Sign in' button Click on the user menu Click on the Log out option Expected Result: The User is signed out """ self.ps.test_updates['name'] = 't1.36.003' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['t1', 't1.36', 't1.36.003', '8240'] self.ps.test_updates['passed'] = False self.admin.login() self.admin.open_user_menu() self.admin.wait.until( expect.element_to_be_clickable( (By.XPATH, '//input[contains(@value,"Log Out")]') ) ).click() self.admin.page.wait_for_page_load() self.admin.find( By.XPATH, '//div[contains(@class,"tutor-home")]') self.ps.test_updates['passed'] = True # Case C8241 - 004 - Content Analyst | Log into Tutor @pytest.mark.skipif(str(8241) not in TESTS, reason='Excluded') def test_content_analyst_log_into_tutor_8241(self): """Log into Tutor. Steps: Click on the 'Login' button Enter the content analyst account in the username and password boxes Click on the 'Sign in' button Expected Result: The user is signed in """ self.ps.test_updates['name'] = 't1.36.004' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['t1', 't1.36', 't1.36.004', '8241'] self.ps.test_updates['passed'] = False self.content.get(self.content.url) self.content.page.wait_for_page_load() # check to see if the screen width is normal or condensed if self.content.driver.get_window_size()['width'] <= \ self.content.CONDENSED_WIDTH: # get small-window menu toggle is_collapsed = self.content.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.content.wait.until( expect.visibility_of_element_located( (By.LINK_TEXT, 'Login') ) ).click() self.content.page.wait_for_page_load() self.content.find( By.ID, 'auth_key' ).send_keys(self.content.username) self.content.find( By.ID, 'password' ).send_keys(self.content.password) # click on the sign in button self.content.find( By.XPATH, '//button[text()="Sign in"]' ).click() self.content.page.wait_for_page_load() assert('dashboard' in self.content.current_url()), \ 'Not taken to dashboard: %s' % self.content.current_url() self.ps.test_updates['passed'] = True # Case C8242 - 005 - Content Analyst | Access the QA Viewer @pytest.mark.skipif(str(8242) not in TESTS, reason='Excluded') def test_content_analyst_access_the_qa_viewer_8242(self): """Access the QA Viewer. Steps: Click on the 'Login' button Enter the content analyst account in the username and password boxes Click on the 'Sign in' button Click on the user menu Click on the QA Content option Expected Result: The user is presented with the QA viewer """ self.ps.test_updates['name'] = 't1.36.005' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['t1', 't1.36', 't1.36.005', '8242'] self.ps.test_updates['passed'] = False self.content.login() self.content.open_user_menu() self.content.wait.until( expect.element_to_be_clickable(( By.XPATH, '//a[contains(text(),"QA Content") and @role="menuitem"]' )) ).click() self.content.page.wait_for_page_load() assert('/qa' in self.content.current_url()), \ 'Not taken to the QA viewer: %s' % self.content.current_url() self.ps.test_updates['passed'] = True # Case C8243 - 006 - Content Analyst | Access the Content Analyst Console @pytest.mark.skipif(str(8243) not in TESTS, reason='Excluded') def test_content_analyst_access_the_content_analyst_console_8243(self): """Access the Content Annalyst Console. Steps: Click on the 'Login' button Enter the content analyst account in the username and password boxes Click on the 'Sign in' button Click on the user menu Click on the Content Analyst option Expected Result: The user is presented with the Content Analyst Console """ self.ps.test_updates['name'] = 't1.36.006' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['t1', 't1.36', 't1.36.006', '8243'] self.ps.test_updates['passed'] = False self.content.login() self.content.open_user_menu() self.content.wait.until( expect.element_to_be_clickable(( By.XPATH, '//a[contains(text(),"Content Analyst") and @role="menuitem"]' )) ).click() self.content.page.wait_for_page_load() self.content.find( By.XPATH, '//h1[contains(text(),"Content Analyst Console")]' ) self.ps.test_updates['passed'] = True # Case C8244 - 007 - Content Analyst | Log out @pytest.mark.skipif(str(8244) not in TESTS, reason='Excluded') def test_content_analyst_log_out_8244(self): """Log out. Steps: Click on the 'Login' button Enter the content analyst account in the username and password boxes Click on the 'Sign in' button Click on the user menu Click on the Log out option Expected Result: The user is logged out """ self.ps.test_updates['name'] = 't1.36.007' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['t1', 't1.36', 't1.36.007', '8244'] self.ps.test_updates['passed'] = False self.content.login() self.content.open_user_menu() self.content.wait.until( expect.element_to_be_clickable( (By.XPATH, '//input[contains(@value,"Log Out")]') ) ).click() self.content.page.wait_for_page_load() self.content.find( By.XPATH, '//div[contains(@class,"tutor-home")]' ) self.ps.test_updates['passed'] = True # Case C8245 - 008 - Student | Log into Tutor @pytest.mark.skipif(str(8245) not in TESTS, reason='Excluded') def test_student_log_into_tutor_8245(self): """Log into Tutor. Steps: Click on the 'Login' button Enter the student account in the username and password text boxes Click on the 'Sign in' button Expected Result: The user is logged in """ self.ps.test_updates['name'] = 't1.36.008' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['t1', 't1.36', 't1.36.008', '8245'] self.ps.test_updates['passed'] = False self.student.get(self.student.url) self.student.page.wait_for_page_load() # check to see if the screen width is normal or condensed if self.student.driver.get_window_size()['width'] <= \ self.student.CONDENSED_WIDTH: # get small-window menu toggle is_collapsed = self.student.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.student.wait.until( expect.visibility_of_element_located( (By.LINK_TEXT, 'Login') ) ).click() self.student.page.wait_for_page_load() self.student.find( By.ID, 'auth_key' ).send_keys(self.student.username) self.student.find( By.ID, 'password' ).send_keys(self.student.password) # click on the sign in button self.student.find( By.XPATH, '//button[text()="Sign in"]' ).click() self.student.page.wait_for_page_load() assert('dashboard' in self.student.current_url()), \ 'Not taken to dashboard: %s' % self.student.current_url() self.ps.test_updates['passed'] = True # Case C8246 - 009 - Teacher | Log into Tutor @pytest.mark.skipif(str(8246) not in TESTS, reason='Excluded') def test_teacher_log_into_tutor_8246(self): """Log into Tutor. Steps: Click on the 'Login' button Enter the teacher account in the username and password text boxes Click on the 'Sign in' button Expected Result: The user is logged in """ self.ps.test_updates['name'] = 't1.36.009' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['t1', 't1.36', 't1.36.009', '8246'] self.ps.test_updates['passed'] = False self.teacher.get(self.teacher.url) self.teacher.page.wait_for_page_load() # check to see if the screen width is normal or condensed if self.teacher.driver.get_window_size()['width'] <= \ self.teacher.CONDENSED_WIDTH: # get small-window menu toggle is_collapsed = self.teacher.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.teacher.wait.until( expect.visibility_of_element_located( (By.LINK_TEXT, 'Login') ) ).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) # click on the sign in button self.teacher.find( By.XPATH, '//button[text()="Sign in"]' ).click() self.teacher.page.wait_for_page_load() assert('dashboard' in self.teacher.current_url()),\ 'Not taken to dashboard: %s' % self.teacher.current_url() self.ps.test_updates['passed'] = True # Case C58271 - 010 - Student | Log out @pytest.mark.skipif(str(58271) not in TESTS, reason='Excluded') def test_content_analyst_log_out_58271(self): """Log out. Steps: Click on the 'Login' button Enter the student account in the username and password boxes Click on the 'Sign in' button Click on the user menu Click on the Log out option Expected Result: The user is logged out """ self.ps.test_updates['name'] = 't1.36.010' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['t1', 't1.36', 't1.36.010', '58271'] self.ps.test_updates['passed'] = False self.student.login() self.student.open_user_menu() self.student.wait.until( expect.element_to_be_clickable( (By.XPATH, '//input[contains(@value,"Log Out")]') ) ).click() self.student.page.wait_for_page_load() self.student.find( By.XPATH, '//div[contains(@class,"tutor-home")]' ) self.ps.test_updates['passed'] = True # Case C58272 - 011 - Teacher | Log out @pytest.mark.skipif(str(58272) not in TESTS, reason='Excluded') def test_teacher_log_out_58272(self): """Log out. Steps: Click on the 'Login' button Enter the teacher account in the username and password boxes Click on the 'Sign in' button Click on the user menu Click on the Log out option Expected Result: The user is logged out """ self.ps.test_updates['name'] = 't1.36.011' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['t1', 't1.36', 't1.36.011', '58272'] self.ps.test_updates['passed'] = False self.teacher.login() self.teacher.open_user_menu() self.teacher.wait.until( expect.element_to_be_clickable( (By.XPATH, '//input[contains(@value,"Log Out")]') ) ).click() self.teacher.page.wait_for_page_load() self.teacher.find( By.XPATH, '//div[contains(@class,"tutor-home")]' ) self.ps.test_updates['passed'] = True
class TestUserLogin(unittest.TestCase): """T1.36 - User login.""" 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) 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) else: self.admin = Admin(use_env_vars=True, ) self.content = ContentQA( existing_driver=self.admin.driver, use_env_vars=True, ) self.student = Student( existing_driver=self.admin.driver, use_env_vars=True, ) self.teacher = Teacher( existing_driver=self.admin.driver, use_env_vars=True, ) 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.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 'Log in' 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, 'Log in'))).click() self.admin.page.wait_for_page_load() self.admin.find(By.ID, 'login_username_or_email') \ .send_keys(self.admin.username) self.admin.find(By.XPATH, "//input[@value='Next']").click() self.admin.find(By.ID, 'login_password') \ .send_keys(self.admin.password) # click on the sign in button self.admin.find(By.XPATH, "//input[@value='Log in']").click() self.admin.page.wait_for_page_load() assert('dashboard' in self.admin.current_url()), \ 'Not taken to dashboard: %s' % self.admin.current_url() self.ps.test_updates['passed'] = True # Case C8239 - 002 - Admin | Access the Admin Console @pytest.mark.skipif(str(8239) not in TESTS, reason='Excluded') def test_admin_access_the_admin_console_8239(self): """Access the Admin console. Steps: Click on the 'Log in' button Enter the admin account in the username and password text boxes Click on the 'Sign in' button Click on the user menu Click on the Admin option Expected Result: User is presented with the admin console """ self.ps.test_updates['name'] = 't1.36.002' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['t1', 't1.36', 't1.36.002', '8239'] self.ps.test_updates['passed'] = False self.admin.login() self.admin.open_user_menu() self.admin.wait.until( expect.element_to_be_clickable((By.LINK_TEXT, 'Admin'))).click() self.admin.page.wait_for_page_load() self.admin.find(By.XPATH, '//h1[contains(text(),"Admin Console")]') self.ps.test_updates['passed'] = True # Case C8240 - 003 - Admin | Log out @pytest.mark.skipif(str(8240) not in TESTS, reason='Excluded') def test_admin_log_out_8240(self): """Log out. Steps: Click on the 'Log in' button Enter the admin account in the username and password text boxes Click on the 'Sign in' button Click on the user menu Click on the Log out option Expected Result: The User is signed out """ self.ps.test_updates['name'] = 't1.36.003' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['t1', 't1.36', 't1.36.003', '8240'] self.ps.test_updates['passed'] = False self.admin.login() self.admin.open_user_menu() self.admin.wait.until( expect.element_to_be_clickable( (By.XPATH, '//input[contains(@value,"Log out")]'))).click() self.admin.page.wait_for_page_load() self.admin.find(By.XPATH, '//div[contains(@class,"tutor-home")]') self.ps.test_updates['passed'] = True # Case C8241 - 004 - Content Analyst | Log into Tutor @pytest.mark.skipif(str(8241) not in TESTS, reason='Excluded') def test_content_analyst_log_into_tutor_8241(self): """Log into Tutor. Steps: Click on the 'Log in' button Enter the content analyst account in the username and password boxes Click on the 'Sign in' button Expected Result: The user is signed in """ self.ps.test_updates['name'] = 't1.36.004' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['t1', 't1.36', 't1.36.004', '8241'] self.ps.test_updates['passed'] = False self.content.get(self.content.url) self.content.page.wait_for_page_load() # check to see if the screen width is normal or condensed if self.content.driver.get_window_size()['width'] <= \ self.content.CONDENSED_WIDTH: # get small-window menu toggle is_collapsed = self.content.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.content.wait.until( expect.visibility_of_element_located( (By.LINK_TEXT, 'Log in'))).click() self.content.page.wait_for_page_load() self.content.find(By.ID, 'login_username_or_email') \ .send_keys(self.content.username) self.content.find(By.XPATH, "//input[@value='Next']").click() self.content.find(By.ID, 'login_password') \ .send_keys(self.content.password) # click on the sign in button self.content.find(By.XPATH, "//input[@value='Log in']").click() self.content.page.wait_for_page_load() assert('dashboard' in self.content.current_url()), \ 'Not taken to dashboard: %s' % self.content.current_url() self.ps.test_updates['passed'] = True # Case C8242 - 005 - Content Analyst | Access the QA Viewer @pytest.mark.skipif(str(8242) not in TESTS, reason='Excluded') def test_content_analyst_access_the_qa_viewer_8242(self): """Access the QA Viewer. Steps: Click on the 'Log in' button Enter the content analyst account in the username and password boxes Click on the 'Sign in' button Click on the user menu Click on the QA Content option Expected Result: The user is presented with the QA viewer """ self.ps.test_updates['name'] = 't1.36.005' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['t1', 't1.36', 't1.36.005', '8242'] self.ps.test_updates['passed'] = False self.content.login() self.content.open_user_menu() self.content.wait.until( expect.element_to_be_clickable( (By.XPATH, '//div[contains(text(),"QA Content")]'))).click() self.content.page.wait_for_page_load() assert('/qa' in self.content.current_url()), \ 'Not taken to the QA viewer: %s' % self.content.current_url() self.ps.test_updates['passed'] = True # Case C8243 - 006 - Content Analyst | Access the Content Analyst Console @pytest.mark.skipif(str(8243) not in TESTS, reason='Excluded') def test_content_analyst_access_the_content_analyst_console_8243(self): """Access the Content Annalyst Console. Steps: Click on the 'Log in' button Enter the content analyst account in the username and password boxes Click on the 'Sign in' button Click on the user menu Click on the Content Analyst option Expected Result: The user is presented with the Content Analyst Console """ self.ps.test_updates['name'] = 't1.36.006' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['t1', 't1.36', 't1.36.006', '8243'] self.ps.test_updates['passed'] = False self.content.login() self.content.open_user_menu() self.content.wait.until( expect.element_to_be_clickable( (By.XPATH, '//div[contains(text(),"Content Analyst")]'))).click() self.content.page.wait_for_page_load() self.content.find(By.XPATH, '//h1[contains(text(),"Content Analyst Console")]') self.ps.test_updates['passed'] = True # Case C8244 - 007 - Content Analyst | Log out @pytest.mark.skipif(str(8244) not in TESTS, reason='Excluded') def test_content_analyst_log_out_8244(self): """Log out. Steps: Click on the 'Log in' button Enter the content analyst account in the username and password boxes Click on the 'Sign in' button Click on the user menu Click on the Log out option Expected Result: The user is logged out """ self.ps.test_updates['name'] = 't1.36.007' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['t1', 't1.36', 't1.36.007', '8244'] self.ps.test_updates['passed'] = False self.content.login() self.content.open_user_menu() self.content.wait.until( expect.element_to_be_clickable( (By.XPATH, '//input[contains(@value,"Log out")]'))).click() self.content.page.wait_for_page_load() self.content.find(By.XPATH, '//div[contains(@class,"tutor-home")]') self.ps.test_updates['passed'] = True # Case C8245 - 008 - Student | Log into Tutor @pytest.mark.skipif(str(8245) not in TESTS, reason='Excluded') def test_student_log_into_tutor_8245(self): """Log into Tutor. Steps: Click on the 'Log in' button Enter the student account in the username and password text boxes Click on the 'Sign in' button Expected Result: The user is logged in """ self.ps.test_updates['name'] = 't1.36.008' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['t1', 't1.36', 't1.36.008', '8245'] self.ps.test_updates['passed'] = False self.student.get(self.student.url) self.student.page.wait_for_page_load() # check to see if the screen width is normal or condensed if self.student.driver.get_window_size()['width'] <= \ self.student.CONDENSED_WIDTH: # get small-window menu toggle is_collapsed = self.student.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.student.wait.until( expect.visibility_of_element_located( (By.LINK_TEXT, 'Log in'))).click() self.student.page.wait_for_page_load() self.student.find(By.ID, 'login_username_or_email') \ .send_keys(self.student.username) self.student.find(By.XPATH, "//input[@value='Next']") \ .click() self.student.find(By.ID, 'login_password') \ .send_keys(self.student.password) # click on the sign in button self.student.find(By.XPATH, "//input[@value='Log in']").click() self.student.page.wait_for_page_load() assert('dashboard' in self.student.current_url()), \ 'Not taken to dashboard: %s' % self.student.current_url() self.ps.test_updates['passed'] = True # Case C8246 - 009 - Teacher | Log into Tutor @pytest.mark.skipif(str(8246) not in TESTS, reason='Excluded') def test_teacher_log_into_tutor_8246(self): """Log into Tutor. Steps: Click on the 'Log in' button Enter the teacher account in the username and password text boxes Click on the 'Sign in' button Expected Result: The user is logged in """ self.ps.test_updates['name'] = 't1.36.009' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['t1', 't1.36', 't1.36.009', '8246'] self.ps.test_updates['passed'] = False self.teacher.get(self.teacher.url) self.teacher.page.wait_for_page_load() # check to see if the screen width is normal or condensed if self.teacher.driver.get_window_size()['width'] <= \ self.teacher.CONDENSED_WIDTH: # get small-window menu toggle is_collapsed = self.teacher.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.teacher.wait.until( expect.visibility_of_element_located( (By.LINK_TEXT, 'Log in'))).click() self.teacher.page.wait_for_page_load() self.teacher.find(By.ID, 'login_username_or_email') \ .send_keys(self.teacher.username) self.teacher.find(By.XPATH, "//input[@value='Next']").click() self.teacher.find(By.ID, 'login_password') \ .send_keys(self.teacher.password) # click on the sign in button self.teacher.find(By.XPATH, "//input[@value='Log in']").click() self.teacher.page.wait_for_page_load() assert('dashboard' in self.teacher.current_url()),\ 'Not taken to dashboard: %s' % self.teacher.current_url() self.ps.test_updates['passed'] = True # Case C58271 - 010 - Student | Log out @pytest.mark.skipif(str(58271) not in TESTS, reason='Excluded') def test_content_analyst_log_out_58271(self): """Log out. Steps: Click on the 'Log in' button Enter the student account in the username and password boxes Click on the 'Sign in' button Click on the user menu Click on the Log out option Expected Result: The user is logged out """ self.ps.test_updates['name'] = 't1.36.010' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['t1', 't1.36', 't1.36.010', '58271'] self.ps.test_updates['passed'] = False self.student.login() self.student.open_user_menu() self.student.wait.until( expect.element_to_be_clickable( (By.XPATH, '//input[contains(@value,"Log out")]'))).click() self.student.page.wait_for_page_load() self.student.find(By.XPATH, '//div[contains(@class,"tutor-home")]') self.ps.test_updates['passed'] = True # Case C58272 - 011 - Teacher | Log out @pytest.mark.skipif(str(58272) not in TESTS, reason='Excluded') def test_teacher_log_out_58272(self): """Log out. Steps: Click on the 'Log in' button Enter the teacher account in the username and password boxes Click on the 'Sign in' button Click on the user menu Click on the Log out option Expected Result: The user is logged out """ self.ps.test_updates['name'] = 't1.36.011' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['t1', 't1.36', 't1.36.011', '58272'] self.ps.test_updates['passed'] = False self.teacher.login() self.teacher.open_user_menu() self.teacher.wait.until( expect.element_to_be_clickable( (By.XPATH, '//input[contains(@value,"Log out")]'))).click() self.teacher.page.wait_for_page_load() self.teacher.find(By.XPATH, '//div[contains(@class,"tutor-home")]') self.ps.test_updates['passed'] = True # Case C96962 - 012 - Content Reviewer | Log into Exercises @pytest.mark.skipif(str(96962) not in TESTS, reason='Excluded') def test_content_reviewer_log_into_exercises_96962(self): """Log into Exercises. Steps: Go to https://exercises-qa.openstax.org/ Click "SIGN IN" Enter the Content username into "Email or username" text box Click "Next" Enter the Content password into "password" text box Click "Login" Expected Result: User is logged in """ self.ps.test_updates['name'] = 't1.36.012' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['t1', 't1.36', 't1.36.012', '96962'] self.ps.test_updates['passed'] = False # Test steps and verification assertions self.content.driver.get("https://exercises-qa.openstax.org/") self.content.sleep(3) self.content.find(By.LINK_TEXT, "SIGN IN").click() self.content.find(By.XPATH, "//input[@id='login_username_or_email']") \ .send_keys(os.getenv('CONTENT_USER')) self.content.find(By.XPATH, "//input[@id='login_username_or_email']") \ .send_keys(Keys.RETURN) self.content.sleep(2) self.content.find(By.XPATH, "//input[@id='login_password']") \ .send_keys(os.getenv('CONTENT_PASSWORD')) self.content.find(By.XPATH, "//input[@id='login_password']") \ .send_keys(Keys.RETURN) self.content.sleep(3) self.content.find(By.LINK_TEXT, "SIGN OUT") self.ps.test_updates['passed'] = True # Case C96963 - 013 - Content Reviewer | Access Reviewer Display @pytest.mark.skipif(str(96963) not in TESTS, reason='Excluded') def test_content_reviewer_access_reviewer_display_96963(self): """Access Reviewer Display. Steps: Expected Result: """ self.ps.test_updates['name'] = 't1.36.013' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['t1', 't1.36', 't1.36.013', '96963'] 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 C96964 - 014 - Content Reviewer | Log out @pytest.mark.skipif(str(96964) not in TESTS, reason='Excluded') def test_content_reviewer_log_out_96964(self): """Log out. Steps: go to https://exercises-qa.openstax.org/ Click "SIGN IN" Enter [content] into "Email or username" text box Click "Next" Enter [staxly16] into "password" text box Click "Login" Click "SIGN OUT" Expected Result: User is logged out. """ self.ps.test_updates['name'] = 't1.36.014' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['t1', 't1.36', 't1.36.014', '96964'] self.ps.test_updates['passed'] = False # Test steps and verification assertions self.content.driver.get("https://exercises-qa.openstax.org/") self.content.sleep(3) self.content.find(By.LINK_TEXT, "SIGN IN").click() self.content.find(By.XPATH, "//input[@id='login_username_or_email']") \ .send_keys(os.getenv('CONTENT_USER')) self.content.find(By.XPATH, "//input[@id='login_username_or_email']") \ .send_keys(Keys.RETURN) self.content.sleep(2) self.content.find(By.XPATH, "//input[@id='login_password']") \ .send_keys(os.getenv('CONTENT_PASSWORD')) self.content.find(By.XPATH, "//input[@id='login_password']") \ .send_keys(Keys.RETURN) self.content.sleep(3) self.content.find(By.LINK_TEXT, "SIGN OUT").click() self.content.sleep(2) self.content.find(By.LINK_TEXT, "SIGN IN") self.ps.test_updates['passed'] = True # Case C96965 - 015 - Content Editor | Log into Exercises @pytest.mark.skipif(str(96965) not in TESTS, reason='Excluded') def test_content_editor_log_into_exercises_96965(self): """Log into Exercises. Steps: Expected Result: """ self.ps.test_updates['name'] = 't1.36.015' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['t1', 't1.36', 't1.36.015', '96965'] 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 C96962 - 016 - Content Editor | Access the Exercise Editor @pytest.mark.skipif(str(96966) not in TESTS, reason='Excluded') def test_content_editor_access_the_exercise_editor_96966(self): """Access the Exercise Editor. Steps: Expected Result: """ self.ps.test_updates['name'] = 't1.36.016' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['t1', 't1.36', 't1.36.016', '96966'] 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 C96967 - 017 - Content Editor | Log out @pytest.mark.skipif(str(96967) not in TESTS, reason='Excluded') def test_content_editor_log_out_96967(self): """Log out. Steps: Expected Result: """ self.ps.test_updates['name'] = 't1.36.017' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['t1', 't1.36', 't1.36.017', '96967'] 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 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 @pytest.mark.skipif(str(8239) not in TESTS, reason='Excluded') def test_admin_access_the_admin_console_8239(self): """Access the Admin console. Steps: Click on the 'Login' button Enter the admin account in the username and password text boxes Click on the 'Sign in' button Click on the user menu Click on the Admin option Expected Result: User is presented with the admin console """ self.ps.test_updates['name'] = 't1.36.002' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['t1', 't1.36', 't1.36.002', '8239'] self.ps.test_updates['passed'] = False # self.user = admin self.admin.login() self.admin.open_user_menu() self.admin.wait.until( expect.element_to_be_clickable((By.LINK_TEXT, 'Admin'))).click() self.admin.page.wait_for_page_load() self.admin.find(By.XPATH, '//h1[contains(text(),"Admin Console")]') self.ps.test_updates['passed'] = True # Case C8240 - 003 - Admin | Log out @pytest.mark.skipif(str(8240) not in TESTS, reason='Excluded') def test_admin_log_out_8240(self): """Log out. Steps: Click on the 'Login' button Enter the admin account in the username and password text boxes Click on the 'Sign in' button Click on the user menu Click on the Log out option Expected Result: The User is signed out """ self.ps.test_updates['name'] = 't1.36.003' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['t1', 't1.36', 't1.36.003', '8240'] self.ps.test_updates['passed'] = False self.admin.login() self.admin.open_user_menu() self.admin.wait.until( expect.element_to_be_clickable( (By.XPATH, '//input[contains(@value,"Log Out")]'))).click() self.admin.page.wait_for_page_load() self.admin.find(By.XPATH, '//div[contains(@class,"tutor-home")]') self.ps.test_updates['passed'] = True # Case C8241 - 004 - Content Analyst | Log into Tutor @pytest.mark.skipif(str(8241) not in TESTS, reason='Excluded') def test_content_analyst_log_into_tutor_8241(self): """Log into Tutor. Steps: Click on the 'Login' button Enter the content analyst account in the username and password boxes Click on the 'Sign in' button Expected Result: The user is signed in """ self.ps.test_updates['name'] = 't1.36.004' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['t1', 't1.36', 't1.36.004', '8241'] self.ps.test_updates['passed'] = False self.content.get(self.content.url) self.content.page.wait_for_page_load() # check to see if the screen width is normal or condensed if self.content.driver.get_window_size()['width'] <= \ self.content.CONDENSED_WIDTH: # get small-window menu toggle is_collapsed = self.content.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.content.wait.until( expect.visibility_of_element_located( (By.LINK_TEXT, 'Login'))).click() self.content.page.wait_for_page_load() self.content.find(By.ID, 'auth_key').send_keys(self.content.username) self.content.find(By.ID, 'password').send_keys(self.content.password) # click on the sign in button self.content.find(By.XPATH, '//button[text()="Sign in"]').click() self.content.page.wait_for_page_load() assert('dashboard' in self.content.current_url()), \ 'Not taken to dashboard: %s' % self.content.current_url() self.ps.test_updates['passed'] = True # Case C8242 - 005 - Content Analyst | Access the QA Viewer @pytest.mark.skipif(str(8242) not in TESTS, reason='Excluded') def test_content_analyst_access_the_qa_viewer_8242(self): """Access the QA Viewer. Steps: Click on the 'Login' button Enter the content analyst account in the username and password boxes Click on the 'Sign in' button Click on the user menu Click on the QA Content option Expected Result: The user is presented with the QA viewer """ self.ps.test_updates['name'] = 't1.36.005' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['t1', 't1.36', 't1.36.005', '8242'] self.ps.test_updates['passed'] = False self.content.login() self.content.open_user_menu() self.content.wait.until( expect.element_to_be_clickable( (By.XPATH, '//a[contains(text(),"QA Content") and @role="menuitem"]' ))).click() self.content.page.wait_for_page_load() assert('/qa' in self.content.current_url()), \ 'Not taken to the QA viewer: %s' % self.content.current_url() self.ps.test_updates['passed'] = True # Case C8243 - 006 - Content Analyst | Access the Content Analyst Console @pytest.mark.skipif(str(8243) not in TESTS, reason='Excluded') def test_content_analyst_access_the_content_analyst_console_8243(self): """Access the Content Annalyst Console. Steps: Click on the 'Login' button Enter the content analyst account in the username and password boxes Click on the 'Sign in' button Click on the user menu Click on the Content Analyst option Expected Result: The user is presented with the Content Analyst Console """ self.ps.test_updates['name'] = 't1.36.006' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['t1', 't1.36', 't1.36.006', '8243'] self.ps.test_updates['passed'] = False self.content.login() self.content.open_user_menu() self.content.wait.until( expect.element_to_be_clickable( (By.XPATH, '//a[contains(text(),"Content Analyst") and @role="menuitem"]' ))).click() self.content.page.wait_for_page_load() self.content.find(By.XPATH, '//h1[contains(text(),"Content Analyst Console")]') self.ps.test_updates['passed'] = True # Case C8244 - 007 - Content Analyst | Log out @pytest.mark.skipif(str(8244) not in TESTS, reason='Excluded') def test_content_analyst_log_out_8244(self): """Log out. Steps: Click on the 'Login' button Enter the content analyst account in the username and password boxes Click on the 'Sign in' button Click on the user menu Click on the Log out option Expected Result: The user is logged out """ self.ps.test_updates['name'] = 't1.36.007' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['t1', 't1.36', 't1.36.007', '8244'] self.ps.test_updates['passed'] = False self.content.login() self.content.open_user_menu() self.content.wait.until( expect.element_to_be_clickable( (By.XPATH, '//input[contains(@value,"Log Out")]'))).click() self.content.page.wait_for_page_load() self.content.find(By.XPATH, '//div[contains(@class,"tutor-home")]') self.ps.test_updates['passed'] = True # Case C8245 - 008 - Student | Log into Tutor @pytest.mark.skipif(str(8245) not in TESTS, reason='Excluded') def test_student_log_into_tutor_8245(self): """Log into Tutor. Steps: Click on the 'Login' button Enter the student account in the username and password text boxes Click on the 'Sign in' button Expected Result: The user is logged in """ self.ps.test_updates['name'] = 't1.36.008' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['t1', 't1.36', 't1.36.008', '8245'] self.ps.test_updates['passed'] = False self.student.get(self.student.url) self.student.page.wait_for_page_load() # check to see if the screen width is normal or condensed if self.student.driver.get_window_size()['width'] <= \ self.student.CONDENSED_WIDTH: # get small-window menu toggle is_collapsed = self.student.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.student.wait.until( expect.visibility_of_element_located( (By.LINK_TEXT, 'Login'))).click() self.student.page.wait_for_page_load() self.student.find(By.ID, 'auth_key').send_keys(self.student.username) self.student.find(By.ID, 'password').send_keys(self.student.password) # click on the sign in button self.student.find(By.XPATH, '//button[text()="Sign in"]').click() self.student.page.wait_for_page_load() assert('dashboard' in self.student.current_url()), \ 'Not taken to dashboard: %s' % self.student.current_url() self.ps.test_updates['passed'] = True # Case C8246 - 009 - Teacher | Log into Tutor @pytest.mark.skipif(str(8246) not in TESTS, reason='Excluded') def test_teacher_log_into_tutor_8246(self): """Log into Tutor. Steps: Click on the 'Login' button Enter the teacher account in the username and password text boxes Click on the 'Sign in' button Expected Result: The user is logged in """ self.ps.test_updates['name'] = 't1.36.009' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['t1', 't1.36', 't1.36.009', '8246'] self.ps.test_updates['passed'] = False self.teacher.get(self.teacher.url) self.teacher.page.wait_for_page_load() # check to see if the screen width is normal or condensed if self.teacher.driver.get_window_size()['width'] <= \ self.teacher.CONDENSED_WIDTH: # get small-window menu toggle is_collapsed = self.teacher.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.teacher.wait.until( expect.visibility_of_element_located( (By.LINK_TEXT, 'Login'))).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) # click on the sign in button self.teacher.find(By.XPATH, '//button[text()="Sign in"]').click() self.teacher.page.wait_for_page_load() assert('dashboard' in self.teacher.current_url()),\ 'Not taken to dashboard: %s' % self.teacher.current_url() self.ps.test_updates['passed'] = True # Case C58271 - 010 - Student | Log out @pytest.mark.skipif(str(58271) not in TESTS, reason='Excluded') def test_content_analyst_log_out_58271(self): """Log out. Steps: Click on the 'Login' button Enter the student account in the username and password boxes Click on the 'Sign in' button Click on the user menu Click on the Log out option Expected Result: The user is logged out """ self.ps.test_updates['name'] = 't1.36.010' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['t1', 't1.36', 't1.36.010', '58271'] self.ps.test_updates['passed'] = False self.student.login() self.student.open_user_menu() self.student.wait.until( expect.element_to_be_clickable( (By.XPATH, '//input[contains(@value,"Log Out")]'))).click() self.student.page.wait_for_page_load() self.student.find(By.XPATH, '//div[contains(@class,"tutor-home")]') self.ps.test_updates['passed'] = True # Case C58272 - 011 - Teacher | Log out @pytest.mark.skipif(str(58272) not in TESTS, reason='Excluded') def test_teacher_log_out_58272(self): """Log out. Steps: Click on the 'Login' button Enter the teacher account in the username and password boxes Click on the 'Sign in' button Click on the user menu Click on the Log out option Expected Result: The user is logged out """ self.ps.test_updates['name'] = 't1.36.011' \ + inspect.currentframe().f_code.co_name[4:] self.ps.test_updates['tags'] = ['t1', 't1.36', 't1.36.011', '58272'] self.ps.test_updates['passed'] = False self.teacher.login() self.teacher.open_user_menu() self.teacher.wait.until( expect.element_to_be_clickable( (By.XPATH, '//input[contains(@value,"Log Out")]'))).click() self.teacher.page.wait_for_page_load() self.teacher.find(By.XPATH, '//div[contains(@class,"tutor-home")]') self.ps.test_updates['passed'] = True