diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6969baab..f17aa908 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,7 +1,7 @@ repos: - repo: https://github.com/astral-sh/ruff-pre-commit # Ruff version. - rev: v0.7.2 + rev: v0.8.1 hooks: # Run the linter. - id: ruff diff --git a/Pipfile b/Pipfile index ae991286..487935b4 100644 --- a/Pipfile +++ b/Pipfile @@ -10,10 +10,10 @@ pre-commit = "~=3.5" pytest = "~=8.3" pytest-cov = "~=5.0" python-dateutil = "~=2.9" -ruff = "~=0.7.4" +ruff = "~=0.8.1" tox = "~=4.23" types-python-dateutil = "~=2.9" [packages] -selenium = "==4.27.0" +selenium = "==4.27.1" typing-extensions = "~=4.12.2" diff --git a/appium/webdriver/common/appiumby.py b/appium/webdriver/common/appiumby.py index b269bb0f..14526899 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,20 @@ 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', +] diff --git a/appium/webdriver/extensions/flutter_integration/flutter_finder.py b/appium/webdriver/extensions/flutter_integration/flutter_finder.py index 473976ba..2e5db4ec 100644 --- a/appium/webdriver/extensions/flutter_integration/flutter_finder.py +++ b/appium/webdriver/extensions/flutter_integration/flutter_finder.py @@ -15,13 +15,16 @@ # specific language governing permissions and limitations # under the License. -from typing import Tuple +from typing import Tuple, Union + +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: str, value: str) -> None: + def __init__(self, using: Union[SeleniumByType, AppiumByType], value: str) -> None: self.using = using self.value = value