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

chore: update test cases with app nav design #182

Merged
merged 3 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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()
143 changes: 0 additions & 143 deletions tests/android/pages/android_course_subsection.py

This file was deleted.

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
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please confirm what this assertion is doing?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

course_dashboard_course_expiry_date method returns the element that has the Course Ending date in it on the header of course dashboard page, and the assertion is expecting that element has valid text in it.

For reference, you can see the attached screenshot which has the text Ended on August 31

Screenshot 2023-10-30 at 8 01 42 PM


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')
Loading
Loading