Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: address options in the migration guide #929

Merged
merged 3 commits into from
Oct 18, 2023
Merged
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
26 changes: 15 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,15 +60,19 @@ For example, some changes in the Selenium binding could break the Appium client.


### Quick migration guide from v2 to v3
- `options` keyword argument in the `webdriver.Remote` constructor such as `XCUITestOptions` instead of `desired_capabilities`
- Available options are https://github.com/appium/python-client/tree/master/appium/options
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we may also link the example code below where options are used

- Please check the [Usage](#usage) below as an exampple.
- Not a "new" change, but the `desired_capabilities` argument has been removed since v3.
- Replacement
- `start_activity` method: Please use [`mobile: startActivity`](https://github.com/appium/appium-uiautomator2-driver?tab=readme-ov-file#mobile-startactivity)
- `launch_app`, `close_app` and `reset` methods: Please refer to https://github.com/appium/appium/issues/15807
- `available_ime_engines`, `is_ime_active`, `activate_ime_engine`, `deactivate_ime_engine` and `active_ime_engine` methods: Please use [`mobile: shell`](https://github.com/appium/appium-uiautomator2-driver?tab=readme-ov-file#mobile-shell)
- `set_value` and `set_text` methods: Please use `element.send_keys` or `send_keys` by W3C Actions
- Removal
- `end_test_coverage` method is no longer available
- `session` properly is no longer available
- `all_sessions` properly is no longer available
- `session` property is no longer available
- `all_sessions` property is no longer available

### Quick migration guide from v1 to v2
- Enhancement
Expand Down Expand Up @@ -148,7 +152,7 @@ APPIUM_HOST = '127.0.0.1'
def appium_service():
service = AppiumService()
service.start(
# Check the output of `appium server --help` for the complete list of
# Check the output of `appium server --help` for the complete list of
# server command line arguments
args=['--address', APPIUM_HOST, '-p', str(APPIUM_PORT)],
timeout_ms=20000,
Expand All @@ -157,17 +161,17 @@ def appium_service():
service.stop()


def create_ios_driver(custom_opts = None):
def create_ios_driver(custom_opts = None):
options = XCUITestOptions()
options.platformVersion = '13.4'
options.udid = '123456789ABC'
if custom_opts is not None:
options.load_capabilities(custom_opts)
# Appium1 points to http://127.0.0.1:4723/wd/hub by default
return webdriver.Remote(f'http://{APPIUM_HOST}:{APPIUM_PORT}', options=options)


def create_android_driver(custom_opts = None):

def create_android_driver(custom_opts = None):
options = UiAutomator2Options()
options.platformVersion = '10'
options.udid = '123456789ABC'
Expand All @@ -180,29 +184,29 @@ def create_android_driver(custom_opts = None):
@pytest.fixture
def ios_driver_factory():
return create_ios_driver


@pytest.fixture
def ios_driver():
# prefer this fixture if there is no need to customize driver options in tests
# prefer this fixture if there is no need to customize driver options in tests
driver = create_ios_driver()
yield driver
driver.quit()


@pytest.fixture
def android_driver_factory():
return create_android_driver


@pytest.fixture
def android_driver():
# prefer this fixture if there is no need to customize driver options in tests
# prefer this fixture if there is no need to customize driver options in tests
driver = create_android_driver()
yield driver
driver.quit()


def test_ios_click(appium_service, ios_driver_factory):
# Usage of the context manager ensures the driver session is closed properly
# after the test completes. Otherwise, make sure to call `driver.quit()` on teardown.
Expand Down
Loading