From 19feaaa7a4e6441d0ade879918123e72d07f93cc Mon Sep 17 00:00:00 2001 From: Brijesh Date: Fri, 29 Nov 2024 00:34:51 +0530 Subject: [PATCH 1/4] feat: Added typing for AppiumBy types --- appium/webdriver/common/appiumby.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/appium/webdriver/common/appiumby.py b/appium/webdriver/common/appiumby.py index b269bb0f..146f27a9 100644 --- a/appium/webdriver/common/appiumby.py +++ b/appium/webdriver/common/appiumby.py @@ -12,6 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +from typing import Literal + from selenium.webdriver.common.by import By @@ -32,3 +34,19 @@ class AppiumBy(By): FLUTTER_INTEGRATION_KEY = '-flutter key' FLUTTER_INTEGRATION_TEXT = '-flutter text' FLUTTER_INTEGRATION_TEXT_CONTAINING = '-flutter text containing' + +ByType = Literal[ + "-ios predicate string", + "-ios class chain", + "-android uiautomator", + "-android viewtag", + "-android datamatcher", + "-android viewmatcher", + "accessibility id", + "-image", + "-custom", + "-flutter semantics label", + "-flutter type", + "-flutter key", + "-flutter text containing", +] From 2cababd0d4cdcf7af2c82bda9583c771f9a8e301 Mon Sep 17 00:00:00 2001 From: Brijesh Date: Fri, 29 Nov 2024 01:03:07 +0530 Subject: [PATCH 2/4] fix: using single quotes --- appium/webdriver/common/appiumby.py | 27 ++++++++++--------- .../flutter_integration/flutter_finder.py | 5 ++-- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/appium/webdriver/common/appiumby.py b/appium/webdriver/common/appiumby.py index 146f27a9..14526899 100644 --- a/appium/webdriver/common/appiumby.py +++ b/appium/webdriver/common/appiumby.py @@ -35,18 +35,19 @@ class AppiumBy(By): FLUTTER_INTEGRATION_TEXT = '-flutter text' FLUTTER_INTEGRATION_TEXT_CONTAINING = '-flutter text containing' + ByType = Literal[ - "-ios predicate string", - "-ios class chain", - "-android uiautomator", - "-android viewtag", - "-android datamatcher", - "-android viewmatcher", - "accessibility id", - "-image", - "-custom", - "-flutter semantics label", - "-flutter type", - "-flutter key", - "-flutter text containing", + '-ios predicate string', + '-ios class chain', + '-android uiautomator', + '-android viewtag', + '-android datamatcher', + '-android viewmatcher', + 'accessibility id', + '-image', + '-custom', + '-flutter semantics label', + '-flutter type', + '-flutter key', + '-flutter text containing', ] diff --git a/appium/webdriver/extensions/flutter_integration/flutter_finder.py b/appium/webdriver/extensions/flutter_integration/flutter_finder.py index 473976ba..14e86c3c 100644 --- a/appium/webdriver/extensions/flutter_integration/flutter_finder.py +++ b/appium/webdriver/extensions/flutter_integration/flutter_finder.py @@ -17,11 +17,12 @@ from typing import Tuple -from appium.webdriver.common.appiumby import AppiumBy +from appium.webdriver.common.appiumby.AppiumBy import By as AppiumBy +from appium.webdriver.common.appiumby.AppiumBy import ByType class FlutterFinder: - def __init__(self, using: str, value: str) -> None: + def __init__(self, using: ByType, value: str) -> None: self.using = using self.value = value From 710cd5c7cdf0600aea56d74f7e4e7833863c2c62 Mon Sep 17 00:00:00 2001 From: Brijesh Date: Fri, 29 Nov 2024 10:38:13 +0530 Subject: [PATCH 3/4] fix: adding selenium typing --- .../extensions/flutter_integration/flutter_finder.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/appium/webdriver/extensions/flutter_integration/flutter_finder.py b/appium/webdriver/extensions/flutter_integration/flutter_finder.py index 14e86c3c..ec271abd 100644 --- a/appium/webdriver/extensions/flutter_integration/flutter_finder.py +++ b/appium/webdriver/extensions/flutter_integration/flutter_finder.py @@ -15,14 +15,15 @@ # specific language governing permissions and limitations # under the License. -from typing import Tuple +from typing import Tuple, Union from appium.webdriver.common.appiumby.AppiumBy import By as AppiumBy -from appium.webdriver.common.appiumby.AppiumBy import ByType +from appium.webdriver.common.appiumby.AppiumBy import ByType as AppiumByType +from selenium.webdriver.common.by import ByType as SeleniumByType class FlutterFinder: - def __init__(self, using: ByType, value: str) -> None: + def __init__(self, using: Union[SeleniumByType, AppiumByType], value: str) -> None: self.using = using self.value = value From f84541bdd30798fb1b2a2a81c7f439e8c7a04e81 Mon Sep 17 00:00:00 2001 From: Brijesh Date: Sat, 30 Nov 2024 00:20:32 +0530 Subject: [PATCH 4/4] fix: pipeline --- .../extensions/flutter_integration/flutter_finder.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/appium/webdriver/extensions/flutter_integration/flutter_finder.py b/appium/webdriver/extensions/flutter_integration/flutter_finder.py index ec271abd..2e5db4ec 100644 --- a/appium/webdriver/extensions/flutter_integration/flutter_finder.py +++ b/appium/webdriver/extensions/flutter_integration/flutter_finder.py @@ -17,10 +17,11 @@ from typing import Tuple, Union -from appium.webdriver.common.appiumby.AppiumBy import By as AppiumBy -from appium.webdriver.common.appiumby.AppiumBy import ByType as AppiumByType from selenium.webdriver.common.by import ByType as SeleniumByType +from appium.webdriver.common.appiumby import AppiumBy +from appium.webdriver.common.appiumby import ByType as AppiumByType + class FlutterFinder: def __init__(self, using: Union[SeleniumByType, AppiumByType], value: str) -> None: