-
Notifications
You must be signed in to change notification settings - Fork 564
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into tests-cleanup
- Loading branch information
Showing
26 changed files
with
1,467 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
from .base import FlutterOptions |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
# Licensed to the Software Freedom Conservancy (SFC) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The SFC licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
from typing import Dict | ||
|
||
from appium.options.common.automation_name_option import AUTOMATION_NAME | ||
from appium.options.common.base import AppiumOptions | ||
from appium.options.flutter_integration.flutter_element_wait_timeout_option import FlutterElementWaitTimeOutOption | ||
from appium.options.flutter_integration.flutter_enable_mock_camera_option import FlutterEnableMockCameraOption | ||
from appium.options.flutter_integration.flutter_server_launch_timeout_option import FlutterServerLaunchTimeOutOption | ||
from appium.options.flutter_integration.flutter_system_port_option import FlutterSystemPortOption | ||
|
||
|
||
class FlutterOptions( | ||
AppiumOptions, | ||
FlutterElementWaitTimeOutOption, | ||
FlutterEnableMockCameraOption, | ||
FlutterServerLaunchTimeOutOption, | ||
FlutterSystemPortOption, | ||
): | ||
|
||
@property | ||
def default_capabilities(self) -> Dict: | ||
return { | ||
AUTOMATION_NAME: 'FlutterIntegration', | ||
} |
51 changes: 51 additions & 0 deletions
51
appium/options/flutter_integration/flutter_element_wait_timeout_option.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
# Licensed to the Software Freedom Conservancy (SFC) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The SFC licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
from datetime import timedelta | ||
from typing import Optional, Union | ||
|
||
from appium.options.common.supports_capabilities import SupportsCapabilities | ||
|
||
FLUTTER_ELEMENT_WAIT_TIMEOUT = 'flutterElementWaitTimeout' | ||
|
||
|
||
class FlutterElementWaitTimeOutOption(SupportsCapabilities): | ||
|
||
@property | ||
def flutter_element_wait_timeout(self) -> Optional[timedelta]: | ||
""" | ||
Maximum timeout to wait for element for Flutter integration test | ||
Returns: | ||
Optional[timedelta]: The timeout value as a `timedelta` object if set, or `None` if the timeout is not defined. | ||
""" | ||
return self.get_capability(FLUTTER_ELEMENT_WAIT_TIMEOUT) | ||
|
||
@flutter_element_wait_timeout.setter | ||
def flutter_element_wait_timeout(self, value: Union[timedelta, int]) -> None: | ||
""" | ||
Sets the maximum timeout to wait for a Flutter element in an integration test. | ||
Default timeout is 5000ms | ||
Args: | ||
value (Union[timedelta, int]): The timeout value, either as a `timedelta` object or an integer in milliseconds. | ||
If provided as a `timedelta`, it will be converted to milliseconds. | ||
""" | ||
self.set_capability( | ||
FLUTTER_ELEMENT_WAIT_TIMEOUT, | ||
(int(value.total_seconds() * 1000) if isinstance(value, timedelta) else value), | ||
) |
46 changes: 46 additions & 0 deletions
46
appium/options/flutter_integration/flutter_enable_mock_camera_option.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Licensed to the Software Freedom Conservancy (SFC) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The SFC licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
from typing import Optional | ||
|
||
from appium.options.common.supports_capabilities import SupportsCapabilities | ||
|
||
FLUTTER_ENABLE_MOCK_CAMERA = 'flutterEnableMockCamera' | ||
|
||
|
||
class FlutterEnableMockCameraOption(SupportsCapabilities): | ||
|
||
@property | ||
def flutter_enable_mock_camera(self) -> bool: | ||
""" | ||
Get state of the mock camera for Flutter integration test | ||
Returns: | ||
bool: A boolean indicating whether the mock camera is enabled (True) or disabled (False). | ||
""" | ||
return self.get_capability(FLUTTER_ENABLE_MOCK_CAMERA) | ||
|
||
@flutter_enable_mock_camera.setter | ||
def flutter_enable_mock_camera(self, value: bool) -> None: | ||
""" | ||
Setter method enable or disable the mock camera for Flutter integration test | ||
Default state is `False` | ||
Args: | ||
value (bool): A boolean value indicating whether to enable (True) or disable (False) the mock camera. | ||
""" | ||
self.set_capability(FLUTTER_ENABLE_MOCK_CAMERA, value) |
52 changes: 52 additions & 0 deletions
52
appium/options/flutter_integration/flutter_server_launch_timeout_option.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
# Licensed to the Software Freedom Conservancy (SFC) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The SFC licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
from datetime import timedelta | ||
from typing import Optional, Union | ||
|
||
from appium.options.common.supports_capabilities import SupportsCapabilities | ||
|
||
FLUTTER_SERVER_LAUNCH_TIMEOUT = 'flutterServerLaunchTimeout' | ||
|
||
|
||
class FlutterServerLaunchTimeOutOption(SupportsCapabilities): | ||
|
||
@property | ||
def flutter_server_launch_timeout(self) -> Optional[timedelta]: | ||
""" | ||
Gets the current timeout for launching the Flutter server in a Flutter application. | ||
Returns: | ||
Optional[timedelta]: The timeout value as a `timedelta` object if set, or `None` if the timeout is not defined. | ||
""" | ||
return self.get_capability(FLUTTER_SERVER_LAUNCH_TIMEOUT) | ||
|
||
@flutter_server_launch_timeout.setter | ||
def flutter_server_launch_timeout(self, value: Union[timedelta, int]) -> None: | ||
""" | ||
Sets the timeout for launching the Flutter server in Flutter application. | ||
Default timeout is 5000ms | ||
Args: | ||
value (Union[timedelta, int]): The timeout value, either as a `timedelta` object or an integer in milliseconds. | ||
If provided as a `timedelta`, it will be converted to milliseconds. | ||
""" | ||
self.set_capability( | ||
FLUTTER_SERVER_LAUNCH_TIMEOUT, | ||
(int(value.total_seconds() * 1000) if isinstance(value, timedelta) else value), | ||
) |
46 changes: 46 additions & 0 deletions
46
appium/options/flutter_integration/flutter_system_port_option.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# Licensed to the Software Freedom Conservancy (SFC) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The SFC licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
|
||
from typing import Optional | ||
|
||
from appium.options.common.supports_capabilities import SupportsCapabilities | ||
|
||
FLUTTER_SYSTEM_PORT = 'flutterSystemPort' | ||
|
||
|
||
class FlutterSystemPortOption(SupportsCapabilities): | ||
|
||
@property | ||
def flutter_system_port(self) -> Optional[int]: | ||
""" | ||
Get flutter system port for Flutter integration tests. | ||
Returns: | ||
int: returns the port number | ||
""" | ||
return self.get_capability(FLUTTER_SYSTEM_PORT) | ||
|
||
@flutter_system_port.setter | ||
def flutter_system_port(self, value: int) -> None: | ||
""" | ||
Sets the system port for Flutter integration tests. | ||
By default the first free port from 10000..11000 range is selected | ||
Args: | ||
value (int): The port number to be used for the Flutter server. | ||
""" | ||
self.set_capability(FLUTTER_SYSTEM_PORT, value) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.