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

Commit

Permalink
chore: automate profile options and edit profile for app nav design (#…
Browse files Browse the repository at this point in the history
…181)

- chore: update profile options for app nav design
- chore: update profile screen for app nav design
- chore: update edit profile test cases for app nav design

Fixes: LEARNER-9543
  • Loading branch information
bilalawan321 authored Oct 10, 2023
1 parent 170f62f commit 2869648
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 28 deletions.
5 changes: 4 additions & 1 deletion tests/android/pages/android_elements.py
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@
course_dashboard_content_header = 'org.edx.mobile:id/row_header'
course_dashboard_download_icon = 'org.edx.mobile:id/bulk_download'
course_dashboard_course_organization = 'org.edx.mobile:id/course_organization'
course_dashboard_toolbar_dismiss_button = 'org.edx.mobile:id/expanded_toolbar_dismiss'
course_dashboard_toolbar_dismiss_button = 'org.edx.mobile:id/collapsed_toolbar_dismiss'
course_dashboard_course_title = 'org.edx.mobile:id/course_title'
course_dashboard_course_expiry_date = 'org.edx.mobile:id/course_expiry_date'
course_dashboard_upgrade_button = 'org.edx.mobile:id/btn_upgrade'
Expand Down Expand Up @@ -260,6 +260,9 @@
profile_options_privacy_policy = 'org.edx.mobile:id/tv_privacy_policy'
profile_options_cookie_policy = 'org.edx.mobile:id/tv_cookie_policy'
profile_options_data_consent_policy = 'org.edx.mobile:id/tv_data_consent_policy'
profile_options_submit_feedback = 'org.edx.mobile:id/lbl_submit_feedback'
profile_options_get_support = 'org.edx.mobile:id/lbl_get_support'
profile_options_delete_description = 'org.edx.mobile:id/lbl_delete_account_description'

# VIDEO DOWNLOAD QUALITY
video_quality_popup_title = 'org.edx.mobile:id/tv_header_video_quality'
Expand Down
18 changes: 13 additions & 5 deletions tests/android/tests/test_android_edit_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from tests.android.pages.android_login_smoke import AndroidLoginSmoke
from tests.android.pages.android_main_dashboard import AndroidMainDashboard
from tests.android.pages.android_profile import AndroidProfile
from tests.android.pages.android_profile_options import AndroidProfileOptions
from tests.common import strings
from tests.common.globals import Globals

Expand Down Expand Up @@ -37,14 +38,22 @@ def test_ui_elements_smoke(self, set_capabilities, setup_logging):

global_contents = Globals(setup_logging)
android_main_dashboard_page = AndroidMainDashboard(set_capabilities, setup_logging)
android_profile_screen = AndroidProfile(set_capabilities, setup_logging)
edit_profile_screen = AndroidEditProfile(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'
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'
user_image.click()

assert android_main_dashboard_page.load_account_screen() == global_contents.ACCOUNT_ACTIVITY_NAME
android_profile_screen.get_edit_profile_screen().click()
assert edit_profile_screen.get_by_class_from_elements(
android_elements.all_textviews,
global_contents.first_existence).text == strings.EDIT_PROFILE_SCREEN_TITLE
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'
assert strings.EDIT_PROFILE_USER_NAME in edit_profile_screen.get_element_by_id(
Expand Down Expand Up @@ -136,6 +145,5 @@ def test_sign_out_smoke(self, set_capabilities, setup_logging):
android_profile_screen = AndroidProfile(set_capabilities, setup_logging)
android_main_dashboard_page = AndroidMainDashboard(set_capabilities, setup_logging)
android_profile_screen.get_navigation_icon().click()
android_profile_screen.get_navigation_icon().click()

assert android_main_dashboard_page.log_out() == global_contents.DISCOVERY_LAUNCH_ACTIVITY_NAME
23 changes: 14 additions & 9 deletions tests/android/tests/test_android_profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@
User Profile Test Module
"""

from tests.android.pages import android_elements
from tests.android.pages.android_login_smoke import AndroidLoginSmoke
from tests.android.pages.android_main_dashboard import AndroidMainDashboard
from tests.android.pages.android_profile import AndroidProfile
from tests.android.pages.android_profile_options import AndroidProfileOptions
from tests.common import strings
from tests.common.globals import Globals


Expand Down Expand Up @@ -35,16 +38,18 @@ def test_ui_elements_smoke(self, set_capabilities, setup_logging):
global_contents = Globals(setup_logging)
android_main_dashboard_page = AndroidMainDashboard(set_capabilities, setup_logging)
android_profile_screen = AndroidProfile(set_capabilities, setup_logging)

assert android_main_dashboard_page.load_account_screen() == global_contents.ACCOUNT_ACTIVITY_NAME
android_profile_screen.get_edit_profile_screen().click()

android_profile_screen.get_navigation_icon().click()
android_profile_screen.get_edit_profile_screen().click()
android_profile_screen.get_navigation_icon().click()
profile_options_page = AndroidProfileOptions(set_capabilities, setup_logging)

profile_tab = android_main_dashboard_page.get_all_tabs()[2]
assert profile_tab.text == 'Profile'
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'
user_image.click()
assert android_profile_screen.get_user_profile_image().get_attribute('displayed') == 'true'
assert android_profile_screen.get_user_profile_name().get_attribute('displayed') == 'true'

if android_profile_screen.get_user_profile_language():
assert android_profile_screen.get_user_profile_language().get_attribute('displayed') == 'true'

Expand Down
22 changes: 10 additions & 12 deletions tests/android/tests/test_android_profile_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,10 @@ def test_validate_video_settings_cell_elements(self, set_capabilities, setup_log
profile_options_page = AndroidProfileOptions(set_capabilities, setup_logging)
global_contents = Globals(setup_logging)

menu_icon = android_main_dashboard_page.get_menu_icon()
assert menu_icon.get_attribute('content-desc') == strings.PROFILE_SCREEN_TITLE
android_main_dashboard_page.get_menu_icon().click()

navigation_icon = profile_options_page.get_all_image_buttons()[0]
assert navigation_icon.get_attribute('content-desc') == strings.PROFILE_OPTIONS_SCREEN_NAVIGATION_ICON
navigation_icon.click()
android_main_dashboard_page.get_menu_icon().click()
profile_tab = android_main_dashboard_page.get_all_tabs()[2]
assert profile_tab.text == 'Profile'
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

Expand Down Expand Up @@ -235,12 +231,12 @@ def test_validate_help_cell_elements(self, set_capabilities, setup_logging):
"""

global_contents = Globals(setup_logging)
profile_options_page = AndroidProfileOptions(set_capabilities, setup_logging)

help_cell = global_contents.get_element_by_id(set_capabilities, android_elements.profile_options_help_cell)
assert help_cell.text == strings.PROFILE_OPTIONS_HELP_CELL_TITLE

submit_feedback_label = profile_options_page.get_all_textviews()[17]
submit_feedback_label = global_contents.get_element_by_id(
set_capabilities, android_elements.profile_options_submit_feedback)
assert submit_feedback_label.text == strings.PROFILE_OPTIONS_FEEDBACK_LABEL

support_subtitle = global_contents.get_element_by_id(
Expand All @@ -255,7 +251,8 @@ def test_validate_help_cell_elements(self, set_capabilities, setup_logging):
set_capabilities, android_elements.profile_options_privacy_policy)
global_contents.scroll_from_element(set_capabilities, privacy_policy)

get_support_label = profile_options_page.get_all_textviews()[8]
get_support_label = global_contents.get_element_by_id(
set_capabilities, android_elements.profile_options_get_support)
assert get_support_label.text == strings.PROFILE_OPTIONS_SUPPORT_LABEL

get_support_description = global_contents.get_element_by_id(
Expand Down Expand Up @@ -294,7 +291,8 @@ def test_validate_signout_and_delete_cell_elements(self, set_capabilities, setup
set_capabilities, android_elements.profile_options_delete_account_button)
assert delete_account_button.text == strings.PROFILE_OPTIONS_DELETE_ACCOUNT_BUTTON

delete_account_instructions = profile_options_page.get_all_textviews()[11]
delete_account_instructions = global_contents.get_element_by_id(
set_capabilities, android_elements.profile_options_delete_description)
assert delete_account_instructions.text == strings.PROFILE_OPTIONS_DELETE_INFO_LABEL

delete_account_button.click()
Expand Down
2 changes: 1 addition & 1 deletion tests/common/strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,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 = 'App Version 4.0.0 PROD TEST'
PROFILE_OPTIONS_SIGNOUT_VERSION_ANDROID = 'Version 5.0.2 '
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.')
Expand Down

0 comments on commit 2869648

Please sign in to comment.