Skip to content

Upgrade Selenium/Appium Versions and add a conversion script #55

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<org.testng.version>7.11.0</org.testng.version>
<cucumber-java.version>7.23.0</cucumber-java.version>
<io.appium.version>9.2.2</io.appium.version>
<io.appium.version>9.5.0</io.appium.version>
<!-- MUST update with Appium above to make sure the versions are compatible-->
<org.seleniumhq.selenium.version>4.19.0</org.seleniumhq.selenium.version>
<org.seleniumhq.selenium.version>4.34.0</org.seleniumhq.selenium.version>
<log4j.version>2.24.3</log4j.version>
<commons.io.version>2.19.0</commons.io.version>
<org.apache.commons.version>3.17.0</org.apache.commons.version>
Expand Down
230 changes: 230 additions & 0 deletions scripts/appium-conversion.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,230 @@
#!/usr/bin/env python3
import sys
import os

# Conversion script for migrating appium capabilities to use the appium prefix. This is required for the new version of appium
# that is imported by the Java SDK 6.1.0 and later.
def update_appium_capabilities(filepath):
with open(filepath, 'r') as infile:
contents = infile.read()
capabilities = [
"adbExecTimeout",
"adbPort",
"absoluteWebLocations",
"additionalWebviewBundleIds",
"allowDelayAdb",
"allowProvisioningDeviceRegistration",
"allowTestPackages",
"androidInstallTimeout",
"app",
"appActivity",
"appInstallStrategy",
"appPackage",
"appPushTimeout",
"appWaitActivity",
"appWaitDuration",
"appWaitForLaunch",
"appWaitPackage",
"autoAcceptAlerts",
"autoFillPasswords",
"autoGrantPermissions",
"autoLaunch",
"autoWebview",
"autoWebviewName",
"autoWebviewTimeout",
"automationName",
"avd",
"avdArgs",
"avdEnv",
"avdLaunchTimeout",
"avdReadyTimeout",
"buildToolsVersion",
"bundleId",
"calendarAccessAuthorized",
"calendarFormat",
"chromeLoggingPrefs",
"chromeOptions",
"chromedriverArgs",
"chromedriverChromeMappingFile",
"chromedriverDisableBuildCheck",
"chromedriverExecutable",
"chromedriverExecutableDir",
"chromedriverPort",
"chromedriverPorts",
"chromedriverUseSystemExecutable",
"clearDeviceLogsOnStart",
"clearSystemFiles",
"commandTimeouts",
"connectHardwareKeyboard",
"customSSLCert",
"derivedDataPath",
"deviceName",
"disableAutomaticScreenshots",
"disableSuppressAccessibilityService",
"disableWindowAnimation",
"dontStopAppOnReset",
"enableAsyncExecuteFromHttps",
"enablePerformanceLogging",
"enableWebviewDetailsCollection",
"enforceAppInstall",
"enforceFreshSimulatorCreation",
"ensureWebviewsHavePages",
"extractChromeAndroidPackageFromContextName",
"forceAppLaunch",
"forceSimulatorSoftwareKeyboardPresence",
"fullContextList",
"fullReset",
"gpsEnabled",
"hideKeyboard",
"ignoreHiddenApiPolicyError",
"includeDeviceCapsToSessionInfo",
"includeSafariInWebviews",
"injectedImageProperties",
"intentAction",
"intentCategory",
"intentFlags",
"iosInstallPause",
"iosSimulatorLogsPredicate",
"isHeadless",
"keepKeyChains",
"keyAlias",
"keyPassword",
"keychainPassword",
"keychainPath",
"keychainsExcludePatterns",
"keystorePassword",
"keystorePath",
"language",
"launchWithIDB",
"locale",
"localeScript",
"localizableStringsDir",
"logcatFilterSpecs",
"logcatFormat",
"maxTypingFrequency",
"mjpegScreenshotUrl",
"mjpegServerPort",
"mockLocationApp",
"nativeWebScreenshot",
"nativeWebTap",
"nativeWebTapStrict",
"networkSpeed",
"newCommandTimeout",
"noReset",
"noSign",
"optionalIntentArguments",
"orientation",
"otherApps",
"permissions",
"platformVersion",
"prebuiltWDAPath",
"printPageSourceOnFindFailure",
"processArguments",
"recreateChromeDriverSessions",
"reduceMotion",
"reduceTransparency",
"remoteAdbHost",
"remoteAppsCacheLimit",
"resetLocationService",
"resetOnSessionStartOnly",
"resultBundlePath",
"resultBundleVersion",
"safariAllowPopups",
"safariGarbageCollect",
"safariGlobalPreferences",
"safariIgnoreFraudWarning",
"safariIgnoreWebHostnames",
"safariInitialUrl",
"safariLogAllCommunication",
"safariLogAllCommunicationHexDump",
"safariOpenLinksInBackground",
"safariSocketChunkSize",
"safariWebInspectorMaxFrameLength",
"scaleFactor",
"screenshotQuality",
"shouldTerminateApp",
"shouldUseSingletonTestManager",
"showChromedriverLog",
"showIOSLog",
"showXcodeLog",
"shutdownOtherSimulators",
"simpleIsVisibleCheck",
"simulatorDevicesSetPath",
"simulatorPasteboardAutomaticSync",
"simulatorStartupTimeout",
"simulatorTracePointer",
"simulatorWindowCenter",
"skipDeviceInitialization",
"skipLogCapture",
"skipLogcatCapture",
"skipServerInstallation",
"skipUnlock",
"suppressKillServer",
"systemPort",
"timeZone",
"udid",
"uiautomator2ServerInstallTimeout",
"uiautomator2ServerLaunchTimeout",
"uiautomator2ServerReadTimeout",
"uninstallOtherPackages",
"unlockKey",
"unlockStrategy",
"unlockSuccessTimeout",
"unlockType",
"updatedWDABundleId",
"useJSONSource",
"useKeystore",
"useNativeCachingStrategy",
"useNewWDA",
"usePrebuiltWDA",
"usePreinstalledWDA",
"useSimpleBuildTest",
"useXctestrunFile",
"userProfile",
"waitForIdleTimeout",
"waitForQuiescence",
"wdaBaseUrl",
"wdaConnectionTimeout",
"wdaEventloopIdleDelay",
"wdaLaunchTimeout",
"wdaLocalPort",
"wdaStartupRetries",
"wdaStartupRetryInterval",
"webDriverAgentUrl",
"webkitResponseTimeout",
"webviewConnectRetries",
"webviewConnectTimeout",
"webviewDevtoolsPort",
"xcodeConfigFile",
"xcodeOrgId",
"xcodeSigningId"
]

for capability in capabilities:
if f"\"{capability}\"" in contents:
print(f"Updating capability: {capability} in {filepath}")
# Replace the capability with its Appium v6.0.0 equivalent
contents =contents.replace(f"\"{capability}\"", f"\"appium:{capability}\"")
with open(filepath, 'w') as outfile:
outfile.write(contents)


# main execution starts here
args_processed = 0
for filepath in sys.argv[1:]:
args_processed = args_processed + 1
if os.path.isfile(filepath) and filepath[-5:] == '.json':
update_appium_capabilities(filepath)
elif os.path.isdir(filepath):
for root, dirs, files in os.walk(filepath):
for path in files:
if path[-5:] == '.json':
print("Processing file: " + os.path.join(root, path))
update_appium_capabilities(os.path.join(root, path))
else:
print(filepath + ' is not a valid json file or directory.')

if (args_processed == 0):
print("Usage: %s <path-to-directory>]+")
print("Converts files from ")
print(" <path-to-driver> : relative or absolute path to a directory with .json or pom.xml files to convert")
File renamed without changes.