Sitelet https://github.com/appium/python-client/pull/735/files
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions appium/options/gecko/android_storage_option.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# 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

ANDROID_STORAGE = 'androidStorage'


class AndroidStorageOption(SupportsCapabilities):
@property
def android_storage(self) -> Optional[str]:
"""
The currently set storage type.
"""
return self.get_capability(ANDROID_STORAGE)

@android_storage.setter
def android_storage(self, value: str) -> None:
"""
See https://firefox-source-docs.mozilla.org/testing/geckodriver
/Flags.html#code-android-storage-var-android-storage-var-code
"""
self.set_capability(ANDROID_STORAGE, value)
20 changes: 20 additions & 0 deletions appium/options/gecko/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,31 @@

from appium.options.common.automation_name_option import AUTOMATION_NAME
from appium.options.common.base import AppiumOptions
from appium.options.common.system_port_option import SystemPortOption

from .android_storage_option import AndroidStorageOption
from .firefox_options_option import FirefoxOptionsOption
from .marionette_port_option import MarionettePortOption
from .verbosity_option import VerbosityOption


class GeckoOptions(
AppiumOptions,
AndroidStorageOption,
FirefoxOptionsOption,
MarionettePortOption,
SystemPortOption,
VerbosityOption,
):
@SystemPortOption.system_port.setter # type: ignore
def system_port(self, value: int) -> None:
"""
The number of the port for the driver to listen on. Must be unique
for each session. If not provided then the driver will try to detect
it automatically.
"""
SystemPortOption.system_port.fset(self, value) # type: ignore

@property
def default_capabilities(self) -> Dict:
return {
Expand Down
38 changes: 38 additions & 0 deletions appium/options/gecko/firefox_options_option.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# 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 Any, Dict, Optional

from appium.options.common.supports_capabilities import SupportsCapabilities

FIREFOX_OPTIONS = 'moz:firefoxOptions'


class FirefoxOptionsOption(SupportsCapabilities):
@property
def firefox_options(self) -> Optional[Dict[str, Any]]:
"""
Firefox options mapping.
"""
return self.get_capability(FIREFOX_OPTIONS)

@firefox_options.setter
def firefox_options(self, value: Dict[str, Any]) -> None:
"""
See https://developer.mozilla.org/en-US/docs/Web/WebDriver/Capabilities/firefoxOptions
"""
self.set_capability(FIREFOX_OPTIONS, value)
43 changes: 43 additions & 0 deletions appium/options/gecko/marionette_port_option.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# 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

MARIONETTE_PORT = 'marionettePort'


class MarionettePortOption(SupportsCapabilities):
@property
def marionette_port(self) -> Optional[int]:
"""
The number of the port for the Marionette server to listen on.
"""
return self.get_capability(MARIONETTE_PORT)

@marionette_port.setter
def marionette_port(self, value: int) -> None:
"""
Selects the port for Geckodriver’s connection to the Marionette
remote protocol. The existing Firefox instance must have Marionette
enabled. To enable the remote protocol in Firefox, you can pass the
-marionette flag. Unless the marionette.port preference has been
user-set, Marionette will listen on port 2828, which is the default
value for this capability.
"""
self.set_capability(MARIONETTE_PORT, value)
40 changes: 40 additions & 0 deletions appium/options/gecko/verbosity_option.py
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 Optional

from appium.options.common.supports_capabilities import SupportsCapabilities

VERBOSITY = 'verbosity'


class VerbosityOption(SupportsCapabilities):
@property
def verbosity(self) -> Optional[str]:
"""
The verbosity level of driver logging.
"""
return self.get_capability(VERBOSITY)

@verbosity.setter
def verbosity(self, value: str) -> None:
"""
The verbosity level of driver logging.
By default, minimum verbosity is applied.
Either 'debug' or 'trace'.
"""
self.set_capability(VERBOSITY, value)