Skip to content

Commit

Permalink
refactor: 💡rename the file, function and test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
ralap-na committed Jun 8, 2024
1 parent 66fd236 commit 32eb891
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
options.app = 'D:/STV/HushKeyboard/app/build/outputs/apk/debug/app-debug.apk'
appium_server_url = 'http://127.0.0.1:4723/wd/hub'

class TestAppium(unittest.TestCase):
class TestWideNotationInputWithLowercase(unittest.TestCase):
def setUp(self):
self.driver = webdriver.Remote(appium_server_url, options=options)
self.driver.implicitly_wait(15)
Expand All @@ -27,7 +27,7 @@ def test_switch_default_keyboard_to_hush_keyboard(self):

self.switch_hush_keyboard_to_input_keyboard()

self.using_w_rw()
self.toggle_wide_notation_setting()

self.enter_r_u_f_l_d_b_in_sequence()

Expand All @@ -45,23 +45,23 @@ def enable_hush_keyboard(self):
enable = self.driver.find_element(by=AppiumBy.XPATH, value='//*[@content-desc="Hush Keyboard"]')
self.assertEqual(enable.get_attribute('checked'), 'true')
self.driver.find_element(by=AppiumBy.XPATH, value='//*[@content-desc="Navigate up"]').click()

def switch_hush_keyboard_to_input_keyboard(self):
self.driver.find_element(by=AppiumBy.XPATH, value='//*[@text="Select input method"]').click()
self.driver.find_element(by=AppiumBy.XPATH, value='//*[@resource-id="android:id/text1" and @text="Hush '
'Keyboard"]/parent::*').click()
def using_w_rw(self):

def toggle_wide_notation_setting(self):
self.driver.find_element(by=AppiumBy.XPATH, value='//*[@content-desc="Settings"]').click()
time.sleep(2)
self.driver.tap([(950, 470)])
time.sleep(1)
self.driver.tap([(840, 700)])
# check if wide notation is using lowercase
wideNotation = self.driver.find_element(by=AppiumBy.XPATH,
wide_notation = self.driver.find_element(by=AppiumBy.XPATH,
value='//*[@text="Wide notation"]/preceding-sibling::*['
'@text="Use lowercase (r)"]')
self.assertEqual(wideNotation.get_attribute('text'), 'Use lowercase (r)')
self.assertEqual(wide_notation .get_attribute('text'), 'Use lowercase (r)')
self.driver.back()

def enter_r_u_f_l_d_b_in_sequence(self):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
options.app = 'D:/STV/HushKeyboard/app/build/outputs/apk/debug/app-debug.apk'
appium_server_url = 'http://127.0.0.1:4723/wd/hub'

class TestAppium(unittest.TestCase):
class TestWideNotationInputWithWideNotation(unittest.TestCase):
def setUp(self):
self.driver = webdriver.Remote(appium_server_url, options=options)
self.driver.implicitly_wait(15)
Expand All @@ -27,7 +27,7 @@ def test_switch_default_keyboard_to_hush_keyboard(self):

self.switch_hush_keyboard_to_input_keyboard()

self.using_w_rw()
self.toggle_wide_notation_setting()

self.enter_R_U_F_L_D_B_in_sequence()

Expand All @@ -45,19 +45,19 @@ def enable_hush_keyboard(self):
enable = self.driver.find_element(by=AppiumBy.XPATH, value='//*[@content-desc="Hush Keyboard"]')
self.assertEqual(enable.get_attribute('checked'), 'true')
self.driver.find_element(by=AppiumBy.XPATH, value='//*[@content-desc="Navigate up"]').click()

def switch_hush_keyboard_to_input_keyboard(self):
self.driver.find_element(by=AppiumBy.XPATH, value='//*[@text="Select input method"]').click()
self.driver.find_element(by=AppiumBy.XPATH, value='//*[@resource-id="android:id/text1" and @text="Hush '
'Keyboard"]/parent::*').click()
def using_w_rw(self):

def toggle_wide_notation_setting(self):
self.driver.find_element(by=AppiumBy.XPATH, value='//*[@content-desc="Settings"]').click()
# check if wide notation is using Rw
wideNotation = self.driver.find_element(by=AppiumBy.XPATH,
wide_notation = self.driver.find_element(by=AppiumBy.XPATH,
value='//*[@text="Wide notation"]/preceding-sibling::*['
'@text="Use w (Rw)"]')
self.assertEqual(wideNotation.get_attribute('text'), 'Use w (Rw)')
self.assertEqual(wide_notation .get_attribute('text'), 'Use w (Rw)')
self.driver.back()

def enter_R_U_F_L_D_B_in_sequence(self):
Expand Down

0 comments on commit 32eb891

Please sign in to comment.