Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

Commit

Permalink
chore: update all screens test cases for app nav design
Browse files Browse the repository at this point in the history
Fix failed test cases after releae 5.0.3

Update strings and android elements files for app nav designs
  • Loading branch information
bilalawan321 committed Oct 28, 2023
1 parent bb1a9e5 commit 520ec81
Show file tree
Hide file tree
Showing 21 changed files with 322 additions and 299 deletions.
67 changes: 67 additions & 0 deletions tests/android/pages/android_course_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
3 changes: 3 additions & 0 deletions tests/android/pages/android_elements.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
12 changes: 12 additions & 0 deletions tests/android/pages/android_main_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
43 changes: 22 additions & 21 deletions tests/android/tests/test_android_course_all_posts.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand Down Expand Up @@ -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')
75 changes: 37 additions & 38 deletions tests/android/tests/test_android_course_dashboard.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
"""
Expand All @@ -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):
"""
Expand All @@ -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')
46 changes: 13 additions & 33 deletions tests/android/tests/test_android_course_dates.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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')
Loading

0 comments on commit 520ec81

Please sign in to comment.