diff --git a/tests/android/pages/android_course_dashboard.py b/tests/android/pages/android_course_dashboard.py index 863c6115..0ea9082c 100644 --- a/tests/android/pages/android_course_dashboard.py +++ b/tests/android/pages/android_course_dashboard.py @@ -299,3 +299,70 @@ def course_dashboard_get_all_tabs(self): self.driver, android_elements.course_layout ) + + def get_course_section_row_title(self): + """ + Get course section row title + + Returns: + webdriver element: Course section row title Element + """ + + self.global_contents.wait_for_element_visibility( + self.driver, + android_elements.course_section_row_title + ) + + return self.global_contents.wait_and_get_element( + self.driver, + android_elements.course_section_row_title + ) + + def get_course_sub_section_row_title(self): + """ + Get course sub section row title + + Returns: + webdriver element: Course sub section title Element + """ + + self.global_contents.wait_for_element_visibility( + self.driver, + android_elements.course_sub_section_row_title + ) + + return self.global_contents.wait_and_get_element( + self.driver, + android_elements.course_sub_section_row_title + ) + + def get_course_sub_section_screen_title(self): + """ + Get course sub section screen title + + Returns: + webdriver element: Course sub section screen title Element + """ + + self.global_contents.wait_for_element_visibility( + self.driver, + android_elements.course_sub_section_screen_title + ) + + return self.global_contents.wait_and_get_element( + self.driver, + android_elements.course_sub_section_screen_title + ) + + def navigate_to_main_dashboard(self, set_capabilities): + """ + Get navigation icon and navigate to main dashboard screen to logout + + Arguments: + set_capabilities (webdriver element): it will return driver object and we use + back menthod of driver to navigate to previous screen + """ + + set_capabilities.back() + set_capabilities.back() + set_capabilities.back() diff --git a/tests/android/pages/android_elements.py b/tests/android/pages/android_elements.py index 8b89bb96..353fe330 100644 --- a/tests/android/pages/android_elements.py +++ b/tests/android/pages/android_elements.py @@ -166,6 +166,9 @@ course_dashboard_course_expiry_date = 'org.edx.mobile:id/course_expiry_date' course_dashboard_upgrade_button = 'org.edx.mobile:id/btn_upgrade' course_dashboard_tabs = 'org.edx.mobile:id/tabs' +course_section_row_title = 'org.edx.mobile:id/tv_section_title' +course_sub_section_row_title = 'org.edx.mobile:id/tv_sub_section_title' +course_sub_section_screen_title = 'org.edx.mobile:id/course_sub_section_title' # COURSE SUBSECTION SCREEN course_dashboard_row_header = 'org.edx.mobile:id/row_header' diff --git a/tests/android/pages/android_main_dashboard.py b/tests/android/pages/android_main_dashboard.py index 054e6dcb..95336486 100644 --- a/tests/android/pages/android_main_dashboard.py +++ b/tests/android/pages/android_main_dashboard.py @@ -303,3 +303,15 @@ def get_all_tabs(self): self.driver, android_elements.main_dashboard_courses_tab ) + + def get_profile_tab(self): + """ + Get Learn Tab + + Returns: + webdriver element: Learn Tab Element + """ + + profile_tab = self.get_all_tabs()[2] + + return profile_tab diff --git a/tests/android/tests/test_android_course_all_posts.py b/tests/android/tests/test_android_course_all_posts.py index 83f46641..dce3b685 100644 --- a/tests/android/tests/test_android_course_all_posts.py +++ b/tests/android/tests/test_android_course_all_posts.py @@ -30,33 +30,32 @@ def test_navigate_to_all_posts_smoke(self, set_capabilities, setup_logging): Verify that on clicking navigation icon user move to dashboard screen """ - global_contents = Globals(setup_logging) android_course_dashboard_page = AndroidCourseDashboard(set_capabilities, setup_logging) android_my_courses_list_page = AndroidMyCoursesList(set_capabilities, setup_logging) - android_main_dashboard_page = AndroidMainDashboard(set_capabilities, setup_logging) - discussions_dashboard_page = AndroidDiscussionsDashboard(set_capabilities, setup_logging) - assert android_main_dashboard_page.load_courses_tab() if android_my_courses_list_page.get_my_courses_list_row(): + course_name = android_my_courses_list_page.get_first_course().text android_my_courses_list_page.get_first_course().click() else: setup_logging.info('No course enrolled by this user.') - navigation_icon = android_course_dashboard_page.get_navigation_icon() - assert navigation_icon.get_attribute('content-desc') == strings.COURSE_DASHBOARD_NAVIGATION_ICON + if course_name: + # Verifing the title of the screen + assert course_name in android_course_dashboard_page.course_dashboard_course_title().text - discussion_tab_element = android_course_dashboard_page.get_discussion_tab() - discussion_tab_element.click() - assert discussion_tab_element.get_attribute('selected') == 'true' + assert android_course_dashboard_page.course_dashboard_course_organization().text \ + == strings.LOGIN_EDX_LOGO + assert android_course_dashboard_page.course_dashboard_course_expiry_date().text - all_posts_element = global_contents.get_by_id_from_elements( - set_capabilities, - android_elements.discussion_all_posts_button, - global_contents.first_existence) - assert all_posts_element.text == strings.DISCUSSION_ALL_POSTS - all_posts_element.click() - assert discussions_dashboard_page.get_screen_title().text == strings.DISCUSSION_ALL_POSTS - discussions_dashboard_page.get_navigation_icon().click() + home_tab = android_course_dashboard_page.course_dashboard_get_all_tabs()[3] + discussions_tab = android_course_dashboard_page.course_dashboard_get_all_tabs()[5] + + assert home_tab.get_attribute('content-desc') == strings.COURSE_DASHBOARD_HOME_TAB + assert home_tab.get_attribute('selected') == strings.TRUE + + assert discussions_tab.get_attribute('content-desc') == strings.COURSE_DASHBOARD_DISCUSSION_TAB + assert discussions_tab.get_attribute('selected') == strings.FALSE + discussions_tab.click() def test_ui_elements_smoke(self, set_capabilities, setup_logging): """ @@ -193,11 +192,13 @@ def test_sign_out_smoke(self, set_capabilities, setup_logging): Verify that user can logout from course discussions screen """ - discussions_dashboard_page = AndroidDiscussionsDashboard(set_capabilities, setup_logging) android_main_dashboard_page = AndroidMainDashboard(set_capabilities, setup_logging) - discussions_dashboard_page.get_navigation_icon().click() - discussions_dashboard_page.get_navigation_icon().click() - assert android_main_dashboard_page.get_logout_account_option().text == strings.PROFILE_OPTIONS_SIGNOUT_BUTTON + set_capabilities.back() + set_capabilities.back() + set_capabilities.back() + assert android_main_dashboard_page.get_profile_tab().text == strings.PROFILE_SCREEN_TITLE + android_main_dashboard_page.get_profile_tab().click() + assert android_main_dashboard_page.log_out() == Globals.DISCOVERY_LAUNCH_ACTIVITY_NAME setup_logging.info('Ending Test Case') diff --git a/tests/android/tests/test_android_course_dashboard.py b/tests/android/tests/test_android_course_dashboard.py index 50e71b06..50922859 100644 --- a/tests/android/tests/test_android_course_dashboard.py +++ b/tests/android/tests/test_android_course_dashboard.py @@ -55,26 +55,26 @@ def test_ui_elements_smoke(self, set_capabilities, setup_logging): == strings.LOGIN_EDX_LOGO assert android_course_dashboard_page.course_dashboard_course_expiry_date().text - home_tab = android_course_dashboard_page.course_dashboard_get_all_tabs()[4] - videos_tab = android_course_dashboard_page.course_dashboard_get_all_tabs()[5] - discussions_tab = android_course_dashboard_page.course_dashboard_get_all_tabs()[6] - dates_tab = android_course_dashboard_page.course_dashboard_get_all_tabs()[7] - handouts_tab = android_course_dashboard_page.course_dashboard_get_all_tabs()[8] + home_tab = android_course_dashboard_page.course_dashboard_get_all_tabs()[3] + videos_tab = android_course_dashboard_page.course_dashboard_get_all_tabs()[4] + discussions_tab = android_course_dashboard_page.course_dashboard_get_all_tabs()[5] + dates_tab = android_course_dashboard_page.course_dashboard_get_all_tabs()[6] + handouts_tab = android_course_dashboard_page.course_dashboard_get_all_tabs()[7] - assert home_tab.get_attribute('content-desc') == 'Home' - assert home_tab.get_attribute('selected') == 'true' + assert home_tab.get_attribute('content-desc') == strings.COURSE_DASHBOARD_HOME_TAB + assert home_tab.get_attribute('selected') == strings.TRUE - assert videos_tab.get_attribute('content-desc') == 'Videos' - assert videos_tab.get_attribute('selected') == 'false' + assert videos_tab.get_attribute('content-desc') == strings.COURSE_DASHBOARD_VIDEOS_TAB + assert videos_tab.get_attribute('selected') == strings.FALSE - assert discussions_tab.get_attribute('content-desc') == 'Discussion' - assert discussions_tab.get_attribute('selected') == 'false' + assert discussions_tab.get_attribute('content-desc') == strings.COURSE_DASHBOARD_DISCUSSION_TAB + assert discussions_tab.get_attribute('selected') == strings.FALSE - assert dates_tab.get_attribute('content-desc') == 'Dates' - assert dates_tab.get_attribute('selected') == 'false' + assert dates_tab.get_attribute('content-desc') == strings.COURSE_DASHBOARD_DATES_TAB + assert dates_tab.get_attribute('selected') == strings.FALSE - assert handouts_tab.get_attribute('content-desc') == 'Handouts' - assert handouts_tab.get_attribute('selected') == 'false' + assert handouts_tab.get_attribute('content-desc') == strings.COURSE_DASHBOARD_HANDOUTS_TITLE + assert handouts_tab.get_attribute('selected') == strings.FALSE def test_load_contents_smoke(self, set_capabilities, setup_logging): """ @@ -89,40 +89,40 @@ def test_load_contents_smoke(self, set_capabilities, setup_logging): """ android_course_dashboard_page = AndroidCourseDashboard(set_capabilities, setup_logging) - home_tab = android_course_dashboard_page.course_dashboard_get_all_tabs()[4] - videos_tab = android_course_dashboard_page.course_dashboard_get_all_tabs()[5] - discussions_tab = android_course_dashboard_page.course_dashboard_get_all_tabs()[6] - dates_tab = android_course_dashboard_page.course_dashboard_get_all_tabs()[7] - handouts_tab = android_course_dashboard_page.course_dashboard_get_all_tabs()[8] + home_tab = android_course_dashboard_page.course_dashboard_get_all_tabs()[3] + videos_tab = android_course_dashboard_page.course_dashboard_get_all_tabs()[4] + discussions_tab = android_course_dashboard_page.course_dashboard_get_all_tabs()[5] + dates_tab = android_course_dashboard_page.course_dashboard_get_all_tabs()[6] + handouts_tab = android_course_dashboard_page.course_dashboard_get_all_tabs()[7] videos_tab.click() - assert videos_tab.get_attribute('selected') == 'true' - assert videos_tab.get_attribute('content-desc') == 'Videos' + assert videos_tab.get_attribute('selected') == strings.TRUE + assert videos_tab.get_attribute('content-desc') == strings.COURSE_DASHBOARD_VIDEOS_TAB discussions_tab.click() - assert discussions_tab.get_attribute('selected') == 'true' - assert discussions_tab.get_attribute('content-desc') == 'Discussion' + assert discussions_tab.get_attribute('selected') == strings.TRUE + assert discussions_tab.get_attribute('content-desc') == strings.COURSE_DASHBOARD_DISCUSSION_TAB dates_tab.click() - assert dates_tab.get_attribute('selected') == 'true' - assert dates_tab.get_attribute('content-desc') == 'Dates' + assert dates_tab.get_attribute('selected') == strings.TRUE + assert dates_tab.get_attribute('content-desc') == strings.COURSE_DASHBOARD_DATES_TAB handouts_tab.click() - assert handouts_tab.get_attribute('selected') == 'true' - assert handouts_tab.get_attribute('content-desc') == 'Handouts' + assert handouts_tab.get_attribute('selected') == strings.TRUE + assert handouts_tab.get_attribute('content-desc') == strings.COURSE_DASHBOARD_HANDOUTS_TITLE - announcements_tabs = android_course_dashboard_page.course_dashboard_get_all_tabs()[8] + announcements_tabs = android_course_dashboard_page.course_dashboard_get_all_tabs()[7] announcements_tabs.click() - assert announcements_tabs.get_attribute('selected') == 'true' - assert announcements_tabs.get_attribute('content-desc') == 'Announcements' + assert announcements_tabs.get_attribute('selected') == strings.TRUE + assert announcements_tabs.get_attribute('content-desc') == strings.COURSE_DASHBOARD_ANNOUNCEMENT_TITLE discussions_tab.click() - assert discussions_tab.get_attribute('selected') == 'true' - assert discussions_tab.get_attribute('content-desc') == 'Discussion' + assert discussions_tab.get_attribute('selected') == strings.TRUE + assert discussions_tab.get_attribute('content-desc') == strings.COURSE_DASHBOARD_DISCUSSION_TAB home_tab.click() - assert home_tab.get_attribute('content-desc') == 'Home' - assert home_tab.get_attribute('selected') == 'true' + assert home_tab.get_attribute('content-desc') == strings.COURSE_DASHBOARD_HOME_TAB + assert home_tab.get_attribute('selected') == strings.TRUE def test_sign_out_smoke(self, set_capabilities, setup_logging): """ @@ -132,9 +132,8 @@ def test_sign_out_smoke(self, set_capabilities, setup_logging): android_main_dashboard_page = AndroidMainDashboard(set_capabilities, setup_logging) set_capabilities.back() - profile_tab = android_main_dashboard_page.get_all_tabs()[2] - assert profile_tab.text == 'Profile' - profile_tab.click() + assert android_main_dashboard_page.get_profile_tab().text == strings.PROFILE_SCREEN_TITLE + android_main_dashboard_page.get_profile_tab().click() assert android_main_dashboard_page.log_out() == Globals.DISCOVERY_LAUNCH_ACTIVITY_NAME setup_logging.info('Ending Test Case') diff --git a/tests/android/tests/test_android_course_dates.py b/tests/android/tests/test_android_course_dates.py index bcd274f5..fbcd4330 100644 --- a/tests/android/tests/test_android_course_dates.py +++ b/tests/android/tests/test_android_course_dates.py @@ -4,8 +4,6 @@ from tests.android.pages import android_elements from tests.android.pages.android_course_dashboard import AndroidCourseDashboard -from tests.android.pages.android_discussions_dashboard import \ - AndroidDiscussionsDashboard from tests.android.pages.android_login_smoke import AndroidLoginSmoke from tests.android.pages.android_main_dashboard import AndroidMainDashboard from tests.android.pages.android_my_courses_list import AndroidMyCoursesList @@ -41,39 +39,30 @@ def test_ui_elements_smoke(self, set_capabilities, setup_logging): global_contents = Globals(setup_logging) android_course_dashboard_page = AndroidCourseDashboard(set_capabilities, setup_logging) android_my_courses_list_page = AndroidMyCoursesList(set_capabilities, setup_logging) - android_main_dashboard_page = AndroidMainDashboard(set_capabilities, setup_logging) - assert android_main_dashboard_page.load_courses_tab() if android_my_courses_list_page.get_my_courses_list_row(): + course_name = android_my_courses_list_page.get_first_course().text android_my_courses_list_page.get_first_course().click() else: setup_logging.info('No course enrolled by this user.') - dates_tab_element = android_course_dashboard_page.get_dates_tab() - dates_tab_element.click() - assert dates_tab_element.get_attribute('selected') == 'true' - - navigation_icon = android_course_dashboard_page.get_navigation_icon() - assert navigation_icon.get_attribute('content-desc') == strings.COURSE_DASHBOARD_NAVIGATION_ICON - - assert android_course_dashboard_page.get_all_text_views()[0].text == strings.DATES_HEADER_TITLE - assert android_course_dashboard_page.get_course_share_icon().get_attribute('content-desc') \ - == strings.COURSE_DASHBOARD_SHARE_COURSE_ANDROID + if course_name: + # Verifing the title of the screen + assert course_name in android_course_dashboard_page.course_dashboard_course_title().text - dates_banner_title = global_contents.get_element_by_id( - set_capabilities, - android_elements.dates_banner_title) - assert dates_banner_title.text == strings.DATES_COURSE_BANNER_TITLE + dates_tab = android_course_dashboard_page.course_dashboard_get_all_tabs()[6] + dates_tab.click() + assert dates_tab.get_attribute('content-desc') == strings.COURSE_DASHBOARD_DATES_TAB dates_banner_info = global_contents.get_element_by_id( set_capabilities, android_elements.dates_banner_info) assert dates_banner_info.text == strings.DATES_COURSE_BANNER_INFO - dates_sync_title = android_course_dashboard_page.get_all_text_views()[3] + dates_sync_title = android_course_dashboard_page.get_all_text_views()[10] assert dates_sync_title.text == strings.DATES_CALENDAR_SYNC_TITLE - dates_sync_info = android_course_dashboard_page.get_all_text_views()[4] + dates_sync_info = android_course_dashboard_page.get_all_text_views()[11] assert dates_sync_info.text == strings.DATES_CALENDAR_SYNC_INFO dates_course_date_id = global_contents.get_element_by_id( @@ -112,16 +101,6 @@ def test_scroll_dates_smoke(self, set_capabilities, setup_logging): ) assert course_end_description.text == strings.DATES_COURSE_ENDS_DESCRIPTION - all_info_containers = global_contents.get_all_elements_by_id( - set_capabilities, - android_elements.dates_info_container - ) - - dates_banner_title = global_contents.get_element_by_id( - set_capabilities, - android_elements.dates_banner_title) - assert dates_banner_title.text == strings.DATES_COURSE_BANNER_TITLE - def test_calendar_sync_toggle_smoke(self, set_capabilities, setup_logging): """ Scenarios: @@ -320,10 +299,11 @@ def test_sign_out_smoke(self, set_capabilities, setup_logging): Verify that user can logout from course Dates screen """ - discussions_dashboard_page = AndroidDiscussionsDashboard(set_capabilities, setup_logging) android_main_dashboard_page = AndroidMainDashboard(set_capabilities, setup_logging) + set_capabilities.back() + set_capabilities.back() + assert android_main_dashboard_page.get_profile_tab().text == strings.PROFILE_SCREEN_TITLE + android_main_dashboard_page.get_profile_tab().click() - discussions_dashboard_page.get_navigation_icon().click() - assert android_main_dashboard_page.get_logout_account_option().text == strings.PROFILE_OPTIONS_SIGNOUT_BUTTON assert android_main_dashboard_page.log_out() == Globals.DISCOVERY_LAUNCH_ACTIVITY_NAME setup_logging.info('Ending Test Case') diff --git a/tests/android/tests/test_android_course_html_component.py b/tests/android/tests/test_android_course_html_component.py index cdd4abfe..59a68999 100644 --- a/tests/android/tests/test_android_course_html_component.py +++ b/tests/android/tests/test_android_course_html_component.py @@ -5,8 +5,6 @@ from tests.android.pages.android_course_dashboard import AndroidCourseDashboard from tests.android.pages.android_course_html_component import \ AndroidCourseHTMLComponent -from tests.android.pages.android_course_subsection import \ - AndroidCourseSubsection from tests.android.pages.android_login_smoke import AndroidLoginSmoke from tests.android.pages.android_main_dashboard import AndroidMainDashboard from tests.android.pages.android_my_courses_list import AndroidMyCoursesList @@ -34,40 +32,33 @@ def test_ui_elements_smoke(self, set_capabilities, setup_logging): Verify that on Clicking any topic Specific resource screen should be loaded successfully """ - global_contents = Globals(setup_logging) android_course_dashboard_page = AndroidCourseDashboard(set_capabilities, setup_logging) android_my_courses_list_page = AndroidMyCoursesList(set_capabilities, setup_logging) - android_main_dashboard_page = AndroidMainDashboard(set_capabilities, setup_logging) - android_course_section_page = AndroidCourseSubsection(set_capabilities, setup_logging) course_html_component = AndroidCourseHTMLComponent(set_capabilities, setup_logging) - assert android_main_dashboard_page.load_courses_tab() if android_my_courses_list_page.get_my_courses_list_row(): - android_my_courses_list_page.load_course_details_screen() + course_name = android_my_courses_list_page.get_second_course().text + android_my_courses_list_page.get_second_course().click() else: setup_logging.info('No course enrolled by this user.') - topic_name = android_course_section_page.get_course_row_title().text - android_course_section_page.get_course_row_title().click() - - if topic_name: - assert android_course_dashboard_page.get_all_text_views()[0].text in topic_name + if course_name: + # Verifing the title of the screen + assert course_name in android_course_dashboard_page.course_dashboard_course_title().text - course_topic_content = android_course_section_page.get_course_topic_row().text + assert android_course_dashboard_page.get_course_section_row_title().text + assert android_course_dashboard_page.get_course_sub_section_row_title().text + subsection_name = android_course_dashboard_page.get_course_sub_section_row_title().text + assert subsection_name == strings.COURSE_SUBSECTION_TITLE - android_course_section_page.get_course_topic_row().click() - assert android_course_dashboard_page.get_all_text_views()[0].text in course_topic_content + android_course_dashboard_page.get_course_sub_section_row_title().click() + assert android_course_dashboard_page.get_course_sub_section_screen_title().text in subsection_name assert course_html_component.get_next_button().text == strings.COURSE_HTML_COMPONENT_NEXT_BUTTON assert course_html_component.get_prev_button().text == strings.COURSE_HTML_COMPONENT_PREV_BUTTON - if course_topic_content != strings.COURSE_SUBSECTION_CONTENT_ROW_TEXT_IOS: - assert course_html_component.get_next_unit_title() course_html_component.get_next_button().click() - assert course_html_component.get_screen_activity_name() == global_contents.COURSE_UNIT_NAVIGATION_ACTIVITY_NAME - if course_topic_content != strings.COURSE_SUBSECTION_CONTENT_ROW_TEXT_IOS: - assert course_html_component.get_prev_unit_title() course_html_component.get_prev_button().click() - assert android_course_dashboard_page.get_all_text_views()[0].text in course_topic_content + assert android_course_dashboard_page.get_course_sub_section_screen_title().text in subsection_name def test_sign_out_smoke(self, set_capabilities, setup_logging): """ @@ -76,8 +67,10 @@ def test_sign_out_smoke(self, set_capabilities, setup_logging): """ android_main_dashboard_page = AndroidMainDashboard(set_capabilities, setup_logging) - android_course_section_page = AndroidCourseSubsection(set_capabilities, setup_logging) - android_course_section_page.navigate_to_main_dashboard(set_capabilities) - assert android_main_dashboard_page.get_logout_account_option().text == strings.PROFILE_OPTIONS_SIGNOUT_BUTTON + set_capabilities.back() + set_capabilities.back() + assert android_main_dashboard_page.get_profile_tab().text == strings.PROFILE_SCREEN_TITLE + android_main_dashboard_page.get_profile_tab().click() + assert android_main_dashboard_page.log_out() == Globals.DISCOVERY_LAUNCH_ACTIVITY_NAME setup_logging.info('Ending Test Case') diff --git a/tests/android/tests/test_android_course_resources.py b/tests/android/tests/test_android_course_resources.py index 9bff358b..805d5256 100644 --- a/tests/android/tests/test_android_course_resources.py +++ b/tests/android/tests/test_android_course_resources.py @@ -104,9 +104,9 @@ def test_sign_out_smoke(self, set_capabilities, setup_logging): android_main_dashboard_page = AndroidMainDashboard(set_capabilities, setup_logging) set_capabilities.back() - profile_tab = android_main_dashboard_page.get_all_tabs()[2] - assert profile_tab.text == 'Profile' - profile_tab.click() + set_capabilities.back() + assert android_main_dashboard_page.get_profile_tab().text == strings.PROFILE_SCREEN_TITLE + android_main_dashboard_page.get_profile_tab().click() assert android_main_dashboard_page.log_out() == Globals.DISCOVERY_LAUNCH_ACTIVITY_NAME setup_logging.info('Ending Test Case') diff --git a/tests/android/tests/test_android_create_new_post.py b/tests/android/tests/test_android_create_new_post.py index 372ed72e..03fbd7dd 100644 --- a/tests/android/tests/test_android_create_new_post.py +++ b/tests/android/tests/test_android_create_new_post.py @@ -33,21 +33,20 @@ def test_navigate_to_all_posts_smoke(self, set_capabilities, setup_logging): global_contents = Globals(setup_logging) android_course_dashboard_page = AndroidCourseDashboard(set_capabilities, setup_logging) android_my_courses_list_page = AndroidMyCoursesList(set_capabilities, setup_logging) - android_main_dashboard_page = AndroidMainDashboard(set_capabilities, setup_logging) discussions_dashboard_page = AndroidDiscussionsDashboard(set_capabilities, setup_logging) - assert android_main_dashboard_page.load_courses_tab() if android_my_courses_list_page.get_my_courses_list_row(): android_my_courses_list_page.get_first_course().click() else: setup_logging.info('No course enrolled by this user.') - navigation_icon = android_course_dashboard_page.get_navigation_icon() - assert navigation_icon.get_attribute('content-desc') == strings.COURSE_DASHBOARD_NAVIGATION_ICON + assert android_course_dashboard_page.course_dashboard_toolbar_dismiss_button().get_attribute( + 'clickable') == strings.TRUE - discussion_tab_element = android_course_dashboard_page.get_discussion_tab() - discussion_tab_element.click() - assert discussion_tab_element.get_attribute('selected') == 'true' + discussions_tab = android_course_dashboard_page.course_dashboard_get_all_tabs()[5] + assert discussions_tab.get_attribute('content-desc') == strings.COURSE_DASHBOARD_DISCUSSION_TAB + assert discussions_tab.get_attribute('selected') == strings.FALSE + discussions_tab.click() all_posts_element = global_contents.get_by_id_from_elements( set_capabilities, @@ -106,7 +105,7 @@ def test_create_discussion_post(self, set_capabilities, setup_logging): set_capabilities, android_elements.create_post_discussion_button) assert discussion_button.text == strings.CREATE_POST_DISCUSSION_BUTTON - assert discussion_button.get_attribute('checked') == 'true' + assert discussion_button.get_attribute('checked') == strings.TRUE topic_spinner = global_contents.get_element_by_id( set_capabilities, @@ -158,9 +157,9 @@ def test_create_question_post(self, set_capabilities, setup_logging): set_capabilities, android_elements.create_post_question_button) assert question_button.text == strings.CREATE_POST_QUESTION_BUTTON - assert question_button.get_attribute('checked') == 'false' + assert question_button.get_attribute('checked') == strings.FALSE question_button.click() - assert question_button.get_attribute('checked') == 'true' + assert question_button.get_attribute('checked') == strings.TRUE title = global_contents.get_element_by_id( set_capabilities, @@ -189,11 +188,12 @@ def test_sign_out_smoke(self, set_capabilities, setup_logging): Verify that user can logout from course discussions screen """ - discussions_dashboard_page = AndroidDiscussionsDashboard(set_capabilities, setup_logging) android_main_dashboard_page = AndroidMainDashboard(set_capabilities, setup_logging) + android_course_dashboard_page = AndroidCourseDashboard(set_capabilities, setup_logging) + + android_course_dashboard_page.navigate_to_main_dashboard(set_capabilities) + assert android_main_dashboard_page.get_profile_tab().text == strings.PROFILE_SCREEN_TITLE + android_main_dashboard_page.get_profile_tab().click() - discussions_dashboard_page.get_navigation_icon().click() - discussions_dashboard_page.get_navigation_icon().click() - assert android_main_dashboard_page.get_logout_account_option().text == strings.PROFILE_OPTIONS_SIGNOUT_BUTTON assert android_main_dashboard_page.log_out() == Globals.DISCOVERY_LAUNCH_ACTIVITY_NAME setup_logging.info('Ending Test Case') diff --git a/tests/android/tests/test_android_discussion_details.py b/tests/android/tests/test_android_discussion_details.py index 41fc5826..31597252 100644 --- a/tests/android/tests/test_android_discussion_details.py +++ b/tests/android/tests/test_android_discussion_details.py @@ -30,20 +30,19 @@ def test_navigate_to_discussion_screen(self, set_capabilities, setup_logging): global_contents = Globals(setup_logging) android_course_dashboard_page = AndroidCourseDashboard(set_capabilities, setup_logging) android_my_courses_list_page = AndroidMyCoursesList(set_capabilities, setup_logging) - android_main_dashboard_page = AndroidMainDashboard(set_capabilities, setup_logging) - assert android_main_dashboard_page.load_courses_tab() if android_my_courses_list_page.get_my_courses_list_row(): android_my_courses_list_page.get_first_course().click() else: setup_logging.info('No course enrolled by this user.') - navigation_icon = android_course_dashboard_page.get_navigation_icon() - assert navigation_icon.get_attribute('content-desc') == strings.COURSE_DASHBOARD_NAVIGATION_ICON + assert android_course_dashboard_page.course_dashboard_toolbar_dismiss_button().get_attribute( + 'clickable') == strings.TRUE - discussion_tab_element = android_course_dashboard_page.get_discussion_tab() - discussion_tab_element.click() - assert discussion_tab_element.get_attribute('selected') == strings.TRUE + discussions_tab = android_course_dashboard_page.course_dashboard_get_all_tabs()[5] + assert discussions_tab.get_attribute('content-desc') == strings.COURSE_DASHBOARD_DISCUSSION_TAB + assert discussions_tab.get_attribute('selected') == strings.FALSE + discussions_tab.click() all_posts_element = global_contents.get_by_id_from_elements( set_capabilities, @@ -249,12 +248,13 @@ def test_sign_out_smoke(self, set_capabilities, setup_logging): Verify that user can logout from course discussions details screen """ - discussions_dashboard_page = AndroidDiscussionsDashboard(set_capabilities, setup_logging) android_main_dashboard_page = AndroidMainDashboard(set_capabilities, setup_logging) + android_course_dashboard_page = AndroidCourseDashboard(set_capabilities, setup_logging) + + android_course_dashboard_page.navigate_to_main_dashboard(set_capabilities) + set_capabilities.back() + assert android_main_dashboard_page.get_profile_tab().text == strings.PROFILE_SCREEN_TITLE + android_main_dashboard_page.get_profile_tab().click() - discussions_dashboard_page.get_navigation_icon().click() - discussions_dashboard_page.get_navigation_icon().click() - discussions_dashboard_page.get_navigation_icon().click() - assert android_main_dashboard_page.get_logout_account_option().text == strings.PROFILE_OPTIONS_SIGNOUT_BUTTON assert android_main_dashboard_page.log_out() == Globals.DISCOVERY_LAUNCH_ACTIVITY_NAME setup_logging.info('Ending Test Case') diff --git a/tests/android/tests/test_android_discussions_dashboard.py b/tests/android/tests/test_android_discussions_dashboard.py index be345668..6f586d03 100644 --- a/tests/android/tests/test_android_discussions_dashboard.py +++ b/tests/android/tests/test_android_discussions_dashboard.py @@ -38,28 +38,14 @@ def test_ui_elements_smoke(self, set_capabilities, setup_logging): global_contents = Globals(setup_logging) android_course_dashboard_page = AndroidCourseDashboard(set_capabilities, setup_logging) android_my_courses_list_page = AndroidMyCoursesList(set_capabilities, setup_logging) - android_main_dashboard_page = AndroidMainDashboard(set_capabilities, setup_logging) - - global_contents = Globals(setup_logging) - android_course_dashboard_page = AndroidCourseDashboard(set_capabilities, setup_logging) - android_my_courses_list_page = AndroidMyCoursesList(set_capabilities, setup_logging) - android_main_dashboard_page = AndroidMainDashboard(set_capabilities, setup_logging) if android_my_courses_list_page.get_my_courses_list_row(): - course_name = android_my_courses_list_page.get_second_course().text - android_my_courses_list_page.get_second_course().click() + android_my_courses_list_page.get_first_course().click() else: setup_logging.info('No course enrolled by this user.') assert android_course_dashboard_page.course_dashboard_toolbar_dismiss_button().get_attribute( 'clickable') == strings.TRUE - android_course_dashboard_page.course_dashboard_toolbar_dismiss_button().click() - assert android_main_dashboard_page.on_screen() == global_contents.MAIN_DASHBOARD_ACTIVITY_NAME - android_my_courses_list_page.get_second_course().click() - - if course_name: - # Verifing the title of the screen - assert course_name in android_course_dashboard_page.course_dashboard_course_title().text assert android_course_dashboard_page.course_dashboard_course_organization().text \ == strings.LOGIN_EDX_LOGO @@ -89,12 +75,6 @@ def test_ui_elements_smoke(self, set_capabilities, setup_logging): global_contents.second_existence) assert my_following_posts_element.text == strings.DISCUSSION_MY_FOLLOWING_POSTS - general_posts_element = global_contents.get_by_id_from_elements( - set_capabilities, - android_elements.discussion_all_posts_button, - global_contents.third_existence) - assert general_posts_element.text == strings.DISCUSSION_GENERAL_POSTS - def test_load_contents_smoke(self, set_capabilities, setup_logging): """ Scenarios: @@ -123,14 +103,6 @@ def test_load_contents_smoke(self, set_capabilities, setup_logging): assert discussions_dashboard_page.get_screen_title().text == strings.DISCUSSION_MY_FOLLOWING_POSTS discussions_dashboard_page.get_navigation_icon().click() - general_posts_element = global_contents.get_by_id_from_elements( - set_capabilities, - android_elements.discussion_all_posts_button, - global_contents.third_existence) - general_posts_element.click() - assert discussions_dashboard_page.get_screen_title().text == strings.DISCUSSION_GENERAL_POSTS - discussions_dashboard_page.get_navigation_icon().click() - discussions_dashboard_page.search_post(set_capabilities) assert discussions_dashboard_page.get_screen_title().text == strings.DISCUSSION_SEARCH_RESULTS @@ -145,9 +117,9 @@ def test_sign_out_smoke(self, set_capabilities, setup_logging): discussions_dashboard_page.get_navigation_icon().click() set_capabilities.back() - profile_tab = android_main_dashboard_page.get_all_tabs()[2] - assert profile_tab.text == 'Profile' - profile_tab.click() + set_capabilities.back() + assert android_main_dashboard_page.get_profile_tab().text == strings.PROFILE_SCREEN_TITLE + android_main_dashboard_page.get_profile_tab().click() assert android_main_dashboard_page.log_out() == Globals.DISCOVERY_LAUNCH_ACTIVITY_NAME setup_logging.info('Ending Test Case') diff --git a/tests/android/tests/test_android_edit_profile.py b/tests/android/tests/test_android_edit_profile.py index b4871c21..6a4d8066 100644 --- a/tests/android/tests/test_android_edit_profile.py +++ b/tests/android/tests/test_android_edit_profile.py @@ -42,20 +42,20 @@ def test_ui_elements_smoke(self, set_capabilities, setup_logging): profile_options_page = AndroidProfileOptions(set_capabilities, setup_logging) profile_tab = android_main_dashboard_page.get_all_tabs()[2] - assert profile_tab.text == 'Profile' + assert profile_tab.text == strings.PROFILE_SCREEN_TITLE profile_tab.click() profile_tab = android_main_dashboard_page.get_all_tabs()[2].click() screen_title = profile_options_page.get_all_textviews()[0] assert screen_title.text == strings.PROFILE_OPTIONS_SCREEN_TITLE user_image = global_contents.get_element_by_id(set_capabilities, android_elements.profile_screen_user_image) - assert user_image.get_attribute('displayed') == 'true' + assert user_image.get_attribute('displayed') == strings.TRUE user_image.click() assert edit_profile_screen.get_by_class_from_elements( android_elements.all_textviews, global_contents.first_existence).text == strings.PROFILE_OPTIONS_PERSONAL_INFORMATION_LABEL_LOWER assert edit_profile_screen.get_element_by_id(android_elements.edit_profile_screen_image)\ - .get_attribute('displayed') == 'true' + .get_attribute('displayed') == strings.TRUE assert strings.EDIT_PROFILE_USER_NAME in edit_profile_screen.get_element_by_id( android_elements.edit_profile_user_name).get_attribute('content-desc') @@ -74,7 +74,7 @@ def test_update_profile_location(self, set_capabilities, setup_logging): if global_contents.enable_workflows is False: profile_view = edit_profile_screen.get_by_class_from_elements( android_elements.all_textviews, global_contents.seventh_existence).get_attribute('enabled') - if profile_view.get_attribute('enabled') == 'false': + if profile_view.get_attribute('enabled') == strings.FALSE: edit_profile_screen.get_element_by_id(android_elements.edit_profile_full_view).click() edit_profile_screen.get_by_class_from_elements( diff --git a/tests/android/tests/test_android_login.py b/tests/android/tests/test_android_login.py index 59337681..ab27b1a5 100644 --- a/tests/android/tests/test_android_login.py +++ b/tests/android/tests/test_android_login.py @@ -56,7 +56,6 @@ def test_ui_elements(self, set_capabilities, setup_logging): assert android_login_page.get_facebook_textview().text == strings.FACEBOOK_OPTION assert android_login_page.get_google_textview().text == strings.GOOGLE_OPTION assert android_login_page.get_agreement_textview().text == strings.LOGIN_ANDROID_AGREEMENT - assert android_login_page.get_app_version().text == strings.PROFILE_OPTIONS_SIGNOUT_VERSION_ANDROID @pytest.mark.skip(reason="No id could be assigned to part of string, will figure it out later") def test_back_and_forth_smoke(self, set_capabilities, setup_logging): @@ -154,19 +153,18 @@ def test_login_smoke(self, set_capabilities, setup_logging): assert android_main_dashboard_page.on_screen() == Globals.MAIN_DASHBOARD_ACTIVITY_NAME setup_logging.info(f'{global_contents.login_user_name} is successfully logged in') - profile_tab = android_main_dashboard_page.get_all_tabs()[2] - assert profile_tab.text == 'Profile' - profile_tab.click() + assert android_main_dashboard_page.get_profile_tab().text == strings.PROFILE_SCREEN_TITLE + android_main_dashboard_page.get_profile_tab().click() assert android_main_dashboard_page.log_out() == global_contents.NEW_LOGISTRATION_ACTIVITY_NAME setup_logging.info(f'Ending {TestAndroidLogin.__name__} Test Case') setup_logging.info('Ending {} Test Case'.format(TestAndroidLogin.__name__)) - def test_upgrade_app(self, set_capabilities, setup_logging): - """ - Verifies that user can upgrade app - """ + # def test_upgrade_app(self, set_capabilities, setup_logging): + # """ + # Verifies that user can upgrade app + # """ - global_contents = Globals(setup_logging) - if global_contents.enable_workflows is False: - assert global_contents.upgrade_target_app(set_capabilities) + # global_contents = Globals(setup_logging) + # if global_contents.enable_workflows is False: + # assert global_contents.upgrade_target_app(set_capabilities) diff --git a/tests/android/tests/test_android_main_dashboard.py b/tests/android/tests/test_android_main_dashboard.py index 497c05a9..225ad7d7 100644 --- a/tests/android/tests/test_android_main_dashboard.py +++ b/tests/android/tests/test_android_main_dashboard.py @@ -27,15 +27,15 @@ def test_validate_ui_elements(self, set_capabilities, setup_logging): assert android_main_dashboard_page.get_my_courses_dropdown().text == strings.MAIN_DASHBOARD_MY_COURSES_DROPDOWN learn_tab = android_main_dashboard_page.get_all_tabs()[1] assert learn_tab.text == 'Learn' - assert learn_tab.get_attribute('selected') == 'true' + assert learn_tab.get_attribute('selected') == strings.TRUE discover_tab = android_main_dashboard_page.get_all_tabs()[0] assert discover_tab.text == 'Discover' - assert discover_tab.get_attribute('selected') == 'false' + assert discover_tab.get_attribute('selected') == strings.FALSE profile_tab = android_main_dashboard_page.get_all_tabs()[2] assert profile_tab.text == 'Profile' - assert profile_tab.get_attribute('selected') == 'false' + assert profile_tab.get_attribute('selected') == strings.FALSE def test_load_contents_smoke(self, set_capabilities, setup_logging): """ @@ -47,15 +47,11 @@ def test_load_contents_smoke(self, set_capabilities, setup_logging): android_main_dashboard_page = AndroidMainDashboard(set_capabilities, setup_logging) discover_tab = android_main_dashboard_page.get_all_tabs()[0] discover_tab.click() - assert discover_tab.get_attribute('selected') == 'true' - assert android_main_dashboard_page.get_screen_heading().get_attribute('content-desc') \ - == strings.MAIN_DASHBOARD_DISCOVER_SCREEN_HEADING + assert discover_tab.get_attribute('selected') == strings.TRUE profile_tab = android_main_dashboard_page.get_all_tabs()[2] profile_tab.click() - assert profile_tab.get_attribute('selected') == 'true' - assert android_main_dashboard_page.get_screen_heading().get_attribute('content-desc') \ - == strings.MAIN_DASHBOARD_PROFILE + assert profile_tab.get_attribute('selected') == strings.TRUE def test_logout_smoke(self, set_capabilities, setup_logging): """ @@ -101,23 +97,19 @@ def test_landscape_smoke(self, set_capabilities, setup_logging): assert android_main_dashboard_page.get_all_text_views()[0].text == strings.MAIN_DASHBOARD_MY_COURSES_DROPDOWN learn_tab = android_main_dashboard_page.get_all_tabs()[1] assert learn_tab.text == 'Learn' - assert learn_tab.get_attribute('selected') == 'true' + assert learn_tab.get_attribute('selected') == strings.TRUE discover_tab = android_main_dashboard_page.get_all_tabs()[0] assert discover_tab.text == 'Discover' - assert discover_tab.get_attribute('selected') == 'false' + assert discover_tab.get_attribute('selected') == strings.FALSE discover_tab.click() - assert discover_tab.get_attribute('selected') == 'true' - assert android_main_dashboard_page.get_screen_heading().get_attribute('content-desc') \ - == strings.MAIN_DASHBOARD_DISCOVER_SCREEN_HEADING + assert discover_tab.get_attribute('selected') == strings.TRUE profile_tab = android_main_dashboard_page.get_all_tabs()[2] assert profile_tab.text == 'Profile' - assert profile_tab.get_attribute('selected') == 'false' + assert profile_tab.get_attribute('selected') == strings.FALSE profile_tab.click() - assert profile_tab.get_attribute('selected') == 'true' - assert android_main_dashboard_page.get_screen_heading().get_attribute('content-desc') \ - == strings.MAIN_DASHBOARD_PROFILE + assert profile_tab.get_attribute('selected') == strings.TRUE def test_sign_out_smoke(self, set_capabilities, setup_logging): """ diff --git a/tests/android/tests/test_android_my_courses_list.py b/tests/android/tests/test_android_my_courses_list.py index cb6613ef..ba55c10a 100644 --- a/tests/android/tests/test_android_my_courses_list.py +++ b/tests/android/tests/test_android_my_courses_list.py @@ -1,11 +1,11 @@ """ My Courses List Test Module """ -import pytest from tests.android.pages.android_login_smoke import AndroidLoginSmoke from tests.android.pages.android_main_dashboard import AndroidMainDashboard from tests.android.pages.android_my_courses_list import AndroidMyCoursesList +from tests.android.pages.android_course_dashboard import AndroidCourseDashboard from tests.common import strings from tests.common.globals import Globals @@ -36,55 +36,49 @@ def test_validate_ui_elements_smoke(self, set_capabilities, setup_logging): """ + global_contents = Globals(setup_logging) android_main_dashboard_page = AndroidMainDashboard(set_capabilities, setup_logging) android_my_courses_list_page = AndroidMyCoursesList(set_capabilities, setup_logging) + android_course_dashboard_page = AndroidCourseDashboard(set_capabilities, setup_logging) + android_main_dashboard_page = AndroidMainDashboard(set_capabilities, setup_logging) + + assert android_main_dashboard_page.get_my_courses_dropdown().text == strings.MAIN_DASHBOARD_MY_COURSES_DROPDOWN + learn_tab = android_main_dashboard_page.get_all_tabs()[1] + assert learn_tab.text == 'Learn' + assert learn_tab.get_attribute('selected') == strings.TRUE + + discover_tab = android_main_dashboard_page.get_all_tabs()[0] + assert discover_tab.text == 'Discover' + assert discover_tab.get_attribute('selected') == strings.FALSE - assert android_main_dashboard_page.load_courses_tab() - # assert android_main_dashboard_page.get_profile_icon().text == strings.BLANK_FIELD - assert android_main_dashboard_page.get_all_text_views()[0].text == strings.MAIN_DASHBOARD_SCREEN_TITLE - assert android_main_dashboard_page.get_menu_icon().text == strings.BLANK_FIELD - assert android_main_dashboard_page.get_courses_tab().text == strings.MAIN_DASHBOARD_COURSES_TAB - assert android_main_dashboard_page.get_discovery_tab().text == strings.MAIN_DASHBOARD_DISCOVERY_TAB + profile_tab = android_main_dashboard_page.get_all_tabs()[2] + assert profile_tab.text == 'Profile' + assert profile_tab.get_attribute('selected') == strings.FALSE if android_my_courses_list_page.get_my_courses_list_row(): - assert android_my_courses_list_page.get_my_courses_list_row() - android_my_courses_list_page.get_contents_from_list() - android_my_courses_list_page.scroll_course_list_and_click_find_course_button() + course_name = android_my_courses_list_page.get_second_course().text + android_my_courses_list_page.get_second_course().click() else: setup_logging.info('No course enrolled by this user.') - find_courses_message = android_my_courses_list_page.get_find_courses_message().text - assert find_courses_message == strings.MY_COURSES_LIST_FIND_COURSES_MESSAGE - find_courses_button = android_my_courses_list_page.get_find_course_button().text - assert find_courses_button == strings.MY_COURSES_LIST_FIND_COURSES_BUTTON_ANDROID - - def test_load_course_details_smoke(self, set_capabilities, setup_logging): - """ - Scenarios: - Verify that tapping any course should load specific Course Dashboard screen - Verity that from Course Dashboard tapping back should load My Courses List screen - Verify that user should be able to scroll courses - Verify on tapping "Find a Course" button will load Discovery screen - Verity that from Course Dashboard tapping back should load My Courses List screen - - """ - - android_main_dashboard_page = AndroidMainDashboard(set_capabilities, setup_logging) - android_my_courses_list_page = AndroidMyCoursesList(set_capabilities, setup_logging) - global_contents = Globals(setup_logging) + assert course_name in android_course_dashboard_page.course_dashboard_course_title().text + assert android_course_dashboard_page.course_dashboard_toolbar_dismiss_button().get_attribute( + 'clickable') == strings.TRUE + android_course_dashboard_page.course_dashboard_toolbar_dismiss_button().click() + assert android_main_dashboard_page.on_screen() == global_contents.MAIN_DASHBOARD_ACTIVITY_NAME - if android_my_courses_list_page.get_my_courses_list_row(): - course_dashboard_screen = android_my_courses_list_page.load_course_details_screen() - assert course_dashboard_screen == global_contents.COURSE_DASHBOARD_ACTIVITY_NAME - set_capabilities.back() - assert android_main_dashboard_page.on_screen() == global_contents.MAIN_DASHBOARD_ACTIVITY_NAME - global_contents.swipe_screen(set_capabilities) + discover_tab = android_main_dashboard_page.get_all_tabs()[0] + assert discover_tab.text == 'Discover' + assert discover_tab.get_attribute('selected') == strings.FALSE + discover_tab.click() + assert discover_tab.get_attribute('selected') == strings.TRUE - course_discovery_screen = android_my_courses_list_page.load_discovery_screen() - assert course_discovery_screen == global_contents.MAIN_DASHBOARD_ACTIVITY_NAME - # set_capabilities.back() + learn_tab = android_main_dashboard_page.get_all_tabs()[1] + assert learn_tab.text == strings.MAIN_DASHBOARD_LEARN_TAB + learn_tab.click() + assert learn_tab.get_attribute('selected') == strings.TRUE - @pytest.mark.skip(reason="Not getting any element to scroll in landscape mode, will figure it out later") + # @pytest.mark.skip(reason="Not getting any element to scroll in landscape mode, will figure it out later") def test_landscape_smoke(self, set_capabilities, setup_logging): """ Scenarios: @@ -115,43 +109,45 @@ def test_landscape_smoke(self, set_capabilities, setup_logging): android_main_dashboard_page = AndroidMainDashboard(set_capabilities, setup_logging) android_my_courses_list_page = AndroidMyCoursesList(set_capabilities, setup_logging) + android_course_dashboard_page = AndroidCourseDashboard(set_capabilities, setup_logging) global_contents = Globals(setup_logging) global_contents.turn_orientation(set_capabilities, global_contents.LANDSCAPE_ORIENTATION) - android_main_dashboard_page.load_courses_tab() + assert android_main_dashboard_page.get_my_courses_dropdown().text == strings.MAIN_DASHBOARD_MY_COURSES_DROPDOWN + learn_tab = android_main_dashboard_page.get_all_tabs()[1] + assert learn_tab.text == strings.MAIN_DASHBOARD_LEARN_TAB + assert learn_tab.get_attribute('selected') == strings.TRUE - assert android_main_dashboard_page.get_profile_icon().text == strings.BLANK_FIELD - assert android_main_dashboard_page.get_title_textview().text == strings.COURSES_DISCOVERY_COURSES_TAB - assert android_main_dashboard_page.get_menu_icon().text == strings.BLANK_FIELD - assert android_main_dashboard_page.get_courses_tab().text == strings.MAIN_DASHBOARD_COURSES_TAB - assert android_main_dashboard_page.get_discovery_tab().text == strings.MAIN_DASHBOARD_DISCOVERY_TAB + discover_tab = android_main_dashboard_page.get_all_tabs()[0] + assert discover_tab.text == strings.DISCOVER_COURSES_SCREEN_TITLE + assert discover_tab.get_attribute('selected') == strings.FALSE - if android_my_courses_list_page.get_my_courses_list_row(): - assert android_my_courses_list_page.get_my_courses_list_row() - android_my_courses_list_page.get_contents_from_list() - course_dashboard_screen = android_my_courses_list_page.load_course_details_screen() - assert course_dashboard_screen == global_contents.COURSE_DASHBOARD_ACTIVITY_NAME - set_capabilities.back() - assert android_main_dashboard_page.on_screen() == global_contents.MAIN_DASHBOARD_ACTIVITY_NAME - # global_contents.swipe_screen(set_capabilities) - android_my_courses_list_page.scroll_course_list_and_click_find_course_button() + profile_tab = android_main_dashboard_page.get_all_tabs()[2] + assert profile_tab.text == strings.PROFILE_SCREEN_TITLE + assert profile_tab.get_attribute('selected') == strings.FALSE + if android_my_courses_list_page.get_my_courses_list_row(): + course_name = android_my_courses_list_page.get_first_course().text + android_my_courses_list_page.get_first_course().click() else: setup_logging.info('No course enrolled by this user.') - find_courses_message = android_my_courses_list_page.get_find_courses_message().text - assert find_courses_message == strings.MY_COURSES_LIST_FIND_COURSES_MESSAGE - find_courses_button = android_my_courses_list_page.get_find_course_button().text - assert find_courses_button == strings.MY_COURSES_LIST_FIND_COURSES_BUTTON_ANDROID - - course_discovery_screen = android_my_courses_list_page.load_discovery_screen() - assert course_discovery_screen == global_contents.MAIN_DASHBOARD_ACTIVITY_NAME - # set_capabilities.back() + assert course_name in android_course_dashboard_page.course_dashboard_course_title().text + assert android_course_dashboard_page.course_dashboard_toolbar_dismiss_button().get_attribute( + 'clickable') == strings.TRUE + android_course_dashboard_page.course_dashboard_toolbar_dismiss_button().click() assert android_main_dashboard_page.on_screen() == global_contents.MAIN_DASHBOARD_ACTIVITY_NAME - global_contents.turn_orientation(set_capabilities, global_contents.PORTRAIT_ORIENTATION) + discover_tab = android_main_dashboard_page.get_all_tabs()[0] + assert discover_tab.text == strings.DISCOVER_COURSES_SCREEN_TITLE + assert discover_tab.get_attribute('selected') == strings.FALSE + discover_tab.click() + assert discover_tab.get_attribute('selected') == strings.TRUE - setup_logging.info(f'Ending {TestAndroidMyCoursesList.__name__} Test Case') + learn_tab = android_main_dashboard_page.get_all_tabs()[1] + assert learn_tab.text == strings.MAIN_DASHBOARD_LEARN_TAB + learn_tab.click() + assert learn_tab.get_attribute('selected') == strings.TRUE def test_sign_out_smoke(self, set_capabilities, setup_logging): """ @@ -161,6 +157,10 @@ def test_sign_out_smoke(self, set_capabilities, setup_logging): android_main_dashboard_page = AndroidMainDashboard(set_capabilities, setup_logging) global_contents = Globals(setup_logging) - assert android_main_dashboard_page.on_screen() == global_contents.MAIN_DASHBOARD_ACTIVITY_NAME - assert android_main_dashboard_page.get_logout_account_option().text == strings.PROFILE_OPTIONS_SIGNOUT_BUTTON - assert android_main_dashboard_page.log_out() == Globals.DISCOVERY_LAUNCH_ACTIVITY_NAME + + global_contents.turn_orientation(set_capabilities, global_contents.PORTRAIT_ORIENTATION) + assert android_main_dashboard_page.get_profile_tab().text == strings.PROFILE_SCREEN_TITLE + android_main_dashboard_page.get_profile_tab().click() + + assert android_main_dashboard_page.log_out() == global_contents.DISCOVERY_LAUNCH_ACTIVITY_NAME + setup_logging.info(f'{global_contents.login_user_name} is successfully logged out') diff --git a/tests/android/tests/test_android_profile.py b/tests/android/tests/test_android_profile.py index 55ab1b51..fdfb02ab 100644 --- a/tests/android/tests/test_android_profile.py +++ b/tests/android/tests/test_android_profile.py @@ -41,17 +41,17 @@ def test_ui_elements_smoke(self, set_capabilities, setup_logging): profile_options_page = AndroidProfileOptions(set_capabilities, setup_logging) profile_tab = android_main_dashboard_page.get_all_tabs()[2] - assert profile_tab.text == 'Profile' + assert profile_tab.text == strings.PROFILE_SCREEN_TITLE profile_tab.click() profile_tab = android_main_dashboard_page.get_all_tabs()[2].click() screen_title = profile_options_page.get_all_textviews()[0] assert screen_title.text == strings.PROFILE_OPTIONS_SCREEN_TITLE user_image = global_contents.get_element_by_id(set_capabilities, android_elements.profile_screen_user_image) - assert user_image.get_attribute('displayed') == 'true' + assert user_image.get_attribute('displayed') == strings.TRUE user_image.click() - assert android_profile_screen.get_user_profile_image().get_attribute('displayed') == 'true' + assert android_profile_screen.get_user_profile_image().get_attribute('displayed') == strings.TRUE if android_profile_screen.get_user_profile_language(): - assert android_profile_screen.get_user_profile_language().get_attribute('displayed') == 'true' + assert android_profile_screen.get_user_profile_language().get_attribute('displayed') == strings.TRUE set_capabilities.back() assert android_main_dashboard_page.log_out() == Globals.DISCOVERY_LAUNCH_ACTIVITY_NAME diff --git a/tests/android/tests/test_android_profile_options.py b/tests/android/tests/test_android_profile_options.py index 18cc8f13..74a62765 100644 --- a/tests/android/tests/test_android_profile_options.py +++ b/tests/android/tests/test_android_profile_options.py @@ -78,7 +78,7 @@ def test_allow_cellular_download_smoke(self, set_capabilities, setup_logging): assert global_contents.wait_for_element_visibility( set_capabilities, android_elements.settings_screen_allow_cellular_download_dialog - ).get_attribute('displayed') == 'true' + ).get_attribute('displayed') == strings.TRUE title = global_contents.get_element_by_id( set_capabilities, android_elements.settings_screen_dialog_title) @@ -175,19 +175,19 @@ def test_validate_personal_information_cell_elements(self, set_capabilities, set personal_information_email_label = global_contents.get_element_by_id( set_capabilities, android_elements.profile_options_personal_information_email_label) - assert personal_information_email_label.get_attribute('displayed') == 'true' + assert personal_information_email_label.get_attribute('displayed') == strings.TRUE personal_information_username_label = global_contents.get_element_by_id( set_capabilities, android_elements.profile_options_personal_information_username_label) - assert personal_information_username_label.get_attribute('displayed') == 'true' + assert personal_information_username_label.get_attribute('displayed') == strings.TRUE personal_information_profile_view = global_contents.get_element_by_id( set_capabilities, android_elements.profile_options_personal_information_profile_view) - assert personal_information_profile_view.get_attribute('displayed') == 'true' + assert personal_information_profile_view.get_attribute('displayed') == strings.TRUE personal_information_profile_view = global_contents.get_element_by_id( set_capabilities, android_elements.profile_options_personal_information_image_view) - assert personal_information_profile_view.get_attribute('displayed') == 'true' + assert personal_information_profile_view.get_attribute('displayed') == strings.TRUE def test_validate_privacy_cell_elements(self, set_capabilities, setup_logging): """ diff --git a/tests/android/tests/test_android_register.py b/tests/android/tests/test_android_register.py index 6e2239db..884de460 100644 --- a/tests/android/tests/test_android_register.py +++ b/tests/android/tests/test_android_register.py @@ -68,9 +68,9 @@ def test_ui_elements_smoke(self, set_capabilities, setup_logging): android_register_page.page_scroll_down() assert android_register_page.get_create_my_account_textview().get_attribute( 'content-desc') == strings.REGISTER_CREATE_MY_ACCOUNT - assert android_register_page.get_google_textview().text == strings.GOOGLE_OPTION - assert android_register_page.get_facebook_textview().text == strings.FACEBOOK_OPTION - assert android_register_page.get_microsoft_login_textview().text == strings.MICROSOFT_LOGIN_BUTTON + assert android_register_page.get_google_textview().text == strings.REGISTER_WITH_GOOGLE + assert android_register_page.get_facebook_textview().text == strings.REGISTER_WITH_FACEBOOK + assert android_register_page.get_microsoft_login_textview().text == strings.REGISTER_WITH_MICROSOFT def test_required_and_optional_fields_smoke(self, set_capabilities, setup_logging): """ diff --git a/tests/android/tests/test_android_videos_dashboard.py b/tests/android/tests/test_android_videos_dashboard.py index c20671bf..b31640f1 100644 --- a/tests/android/tests/test_android_videos_dashboard.py +++ b/tests/android/tests/test_android_videos_dashboard.py @@ -217,9 +217,9 @@ def test_sign_out_smoke(self, set_capabilities, setup_logging): android_main_dashboard_page = AndroidMainDashboard(set_capabilities, setup_logging) set_capabilities.back() - profile_tab = android_main_dashboard_page.get_all_tabs()[2] - assert profile_tab.text == 'Profile' - profile_tab.click() + set_capabilities.back() + assert android_main_dashboard_page.get_profile_tab().text == strings.PROFILE_SCREEN_TITLE + android_main_dashboard_page.get_profile_tab().click() assert android_main_dashboard_page.log_out() == Globals.DISCOVERY_LAUNCH_ACTIVITY_NAME setup_logging.info('Ending Test Case') diff --git a/tests/common/globals.py b/tests/common/globals.py index 732a07f5..ab4118a7 100644 --- a/tests/common/globals.py +++ b/tests/common/globals.py @@ -28,7 +28,7 @@ class Globals: LAUNCH_ACTIVITY_NAME1 = '.view.LaunchActivity' SPLASH_ACTIVITY_NAME = '.view.SplashActivity' NEW_LOGISTRATION_ACTIVITY_NAME = '.view.DiscoveryLaunchActivity' - LOGIN_ACTIVITY_NAME = '.view.LoginActivity' + LOGIN_ACTIVITY_NAME = '.view.login.LoginActivity' TERMS_AND_CONDITIONS_ACTIVITY_NAME = '.view.dialog.WebViewActivity' WHATS_NEW_ACTIVITY_NAME = '.whatsnew.WhatsNewActivity' VIEW_MY_COURSES_ACTIVITY_NAME = '.view.MyCoursesListActivity' @@ -73,7 +73,7 @@ def __init__(self, project_log): self.fifteenth_existence = 14 self.sixteenth_existence = 15 self.enable_workflows = True - self.whats_new_enable = False + self.whats_new_enable = True # Read user_preferences.yml and set globals accordingly self.setup_global_environment() diff --git a/tests/common/strings.py b/tests/common/strings.py index ab477ab8..a218dafc 100644 --- a/tests/common/strings.py +++ b/tests/common/strings.py @@ -12,8 +12,11 @@ ERROR_UTF_ELEMENT = 'Unable to find specific element - ' ERROR_LABEL_NOT_MATCHING = 'Problem, label on specific element is not matching - ' ERROR_SCREEN_NOT_LOADED = 'Problem, screen is not loaded.' -FACEBOOK_OPTION = 'Continue with Facebook' -GOOGLE_OPTION = 'Continue with Google' +FACEBOOK_OPTION = 'Login with Facebook' +GOOGLE_OPTION = 'Sign in with Google' +REGISTER_WITH_GOOGLE = 'Continue with Google' +REGISTER_WITH_FACEBOOK = 'Continue with Facebook' +REGISTER_WITH_MICROSOFT = 'Continue with Microsoft' EULA = 'edX End User License Agreement' TERMS = 'edX Terms of Service and Honor Code' PRIVACY = 'Privacy Policy' @@ -106,6 +109,7 @@ MAIN_DASHBOARD_NAVIGATION_ACCOUNT_OPTION = 'ACCOUNT' MAIN_DASHBOARD_MY_COURSES_DROPDOWN = 'My courses' MAIN_DASHBOARD_DISCOVER_SCREEN_HEADING = 'Discover' +MAIN_DASHBOARD_LEARN_TAB = 'Learn' # ACCOUNT SCREEN ACCOUNT_SCREEN_TITLE = 'Account' @@ -210,6 +214,7 @@ COURSE_DASHBOARD_ANNOUNCEMENT_ROW = 'Keep up with the latest news' COURSE_DASHBOARD_NAVIGATION_ICON = 'Navigate up' COURSE_DASHBOARD_RESUME_ROW = 'Resume' +COURSE_DASHBOARD_HOME_TAB = 'Home' # COURSE SUBSECTION SCREEN # These constants used to verify the view, against the course "Was Alexander Great?" @@ -222,8 +227,9 @@ # COURSE HTML COMPONENT SCREEN COURSE_HTML_COMPONENT_NAVIGATION_ICON = 'Navigate up' -COURSE_HTML_COMPONENT_NEXT_BUTTON = 'Next' -COURSE_HTML_COMPONENT_PREV_BUTTON = 'Previous' +COURSE_HTML_COMPONENT_NEXT_BUTTON = 'NEXT' +COURSE_HTML_COMPONENT_PREV_BUTTON = 'PREVIOUS' +COURSE_SUBSECTION_TITLE = 'Welcome to an edX Course!' # SETTINGS SCREEN SETTINGS_SCREEN_NAVIGATION_ICON = 'Navigate up' @@ -318,7 +324,7 @@ PROFILE_OPTIONS_FAQ_BUTTON_ANDROID = 'View FAQ' PROFILE_OPTIONS_SIGNOUT_BUTTON = 'Sign out' PROFILE_OPTIONS_SIGNOUT_VERSION = 'Version 3.2.3 ' -PROFILE_OPTIONS_SIGNOUT_VERSION_ANDROID = 'Version 5.0.2 ' +PROFILE_OPTIONS_SIGNOUT_VERSION_ANDROID = 'Version 5.0.3 ' PROFILE_OPTIONS_DELETE_ACCOUNT_BUTTON = 'Delete account' PROFILE_OPTIONS_DELETE_INFO_LABEL = ('Follow the instructions on the next screen to delete your account and ' 'all related data.')