Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
14 changes: 13 additions & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ variables:

jobs:
- job: Android_E2E_Tests
# timeoutInMinutes: '90'
steps:
- template: .azure-templates/bootstrap_steps.yml
- script: |
Expand Down Expand Up @@ -61,3 +60,16 @@ jobs:
publishJUnitResults: true
tasks: 'build'
options: 'xcuiTest -x checkstyleTest -x test -x signMavenJavaPublication'
- job: Misc_Tests
steps:
- task: Gradle@2
inputs:
gradleWrapperFile: 'gradlew'
gradleOptions: '-Xmx3072m'
javaHomeOption: 'JDKVersion'
jdkVersionOption: "$(JDK_VERSION)"
jdkArchitectureOption: 'x64'
publishJUnitResults: true
tasks: 'build'
options: 'miscTest -x checkstyleTest -x test -x signMavenJavaPublication'
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
options: 'miscTest -x checkstyleTest -x test -x signMavenJavaPublication'
options: 'miscTest -x checkstyleTest -x test'

it seems exclusion of signMavenJavaPublication is not needed anymore

Copy link
Contributor Author

Choose a reason for hiding this comment

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

was not sure about this one. How do you see it's not needed?

Copy link
Collaborator

@valfirst valfirst Oct 29, 2021

Choose a reason for hiding this comment

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

I'm running it locally without exclusion and it doesn't fail

Copy link
Collaborator

Choose a reason for hiding this comment

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

but CI could differ, so it's just my assumption

Copy link
Collaborator

Choose a reason for hiding this comment

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

Created PR to check the assumption: #1568, all builds are passed.


23 changes: 18 additions & 5 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -189,15 +189,11 @@ task xcuiTest( type: Test ) {
testLogging.showStandardStreams = true
testLogging.exceptionFormat = 'full'
filter {
includeTestsMatching '*.appium.element.generation.ios.*'
includeTestsMatching '*.appium.AppiumFluentWaitTest'
includeTestsMatching 'io.appium.java_client.ios.*'
includeTestsMatching '*.pagefactory_tests.XCUITModeTest'
includeTestsMatching '*.pagefactory_tests.widget.tests.combined.*'
includeTestsMatching '*.pagefactory_tests.widget.tests.ios.*'
includeTestsMatching '*.StartingAppLocallyTest.startingIOSAppWithCapabilitiesAndServiceTest'
includeTestsMatching '*.StartingAppLocallyTest.startingIOSAppWithCapabilitiesAndFlagsOnServerSideTest'
exclude '**/UIAutomationTest.class'
includeTestsMatching 'io.appium.java_client.service.local.StartingAppLocallyIosTest'
exclude '**/IOSScreenRecordTest.class'
exclude '**/ImagesComparisonTest.class'
}
Expand All @@ -211,5 +207,22 @@ task uiAutomationTest( type: Test ) {
includeTestsMatching 'io.appium.java_client.android.SettingTest'
includeTestsMatching 'io.appium.java_client.android.ClipboardTest'
includeTestsMatching '*.AndroidAppStringsTest'
includeTestsMatching '*.pagefactory_tests.widget.tests.android.*'
includeTestsMatching '*.pagefactory_tests.widget.tests.AndroidPageObjectTest'
includeTestsMatching 'io.appium.java_client.service.local.StartingAppLocallyAndroidTest'
includeTestsMatching 'io.appium.java_client.service.local.ServerBuilderTest'
includeTestsMatching 'io.appium.java_client.service.local.ThreadSafetyTest'
}
}

task miscTest( type: Test ) {
useJUnit()
testLogging.showStandardStreams = true
testLogging.exceptionFormat = 'full'
filter {
includeTestsMatching 'io.appium.java_client.touch.*'
includeTestsMatching 'io.appium.java_client.events.*'
includeTestsMatching 'io.appium.java_client.remote.*'
includeTestsMatching 'io.appium.java_client.drivers.options.*'
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
import io.appium.java_client.android.options.mjpeg.SupportsMjpegScreenshotUrlOption;
import io.appium.java_client.android.options.mjpeg.SupportsMjpegServerPortOption;
import io.appium.java_client.android.options.other.SupportsDisableSuppressAccessibilityServiceOption;
import io.appium.java_client.android.options.server.SupportsEspressoBuildConfigOption;
import io.appium.java_client.android.options.server.SupportsEspressoServerLaunchTimeoutOption;
import io.appium.java_client.android.options.server.SupportsForceEspressoRebuildOption;
import io.appium.java_client.android.options.server.SupportsShowGradleLogOption;
Expand Down Expand Up @@ -113,6 +114,7 @@ public class EspressoOptions extends BaseOptions<EspressoOptions> implements
SupportsForceEspressoRebuildOption<EspressoOptions>,
SupportsShowGradleLogOption<EspressoOptions>,
SupportsOrientationOption<EspressoOptions>,
SupportsEspressoBuildConfigOption<EspressoOptions>,
// App options: https://github.com/appium/appium-uiautomator2-driver#app
SupportsAppOption<EspressoOptions>,
SupportsAppPackageOption<EspressoOptions>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public interface SupportsKeystoreOptions<T extends BaseOptions<T>> extends
* @param keystoreConfig The keystore config to use.
* @return self instance for chaining.
*/
default T useKeystore(KeystoreConfig keystoreConfig) {
default T setKeystoreConfig(KeystoreConfig keystoreConfig) {
return amend(USE_KEYSTORE_OPTION, true)
.amend(KEYSTORE_PATH_OPTION, keystoreConfig.getPath())
.amend(KEYSTORE_PASSWORD_OPTION, keystoreConfig.getPassword())
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
* 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.
*/

package io.appium.java_client.ios.options.other;

import io.appium.java_client.internal.CapabilityHelpers;
import io.appium.java_client.remote.options.BaseMapOptionData;

import java.time.Duration;
import java.util.Map;
import java.util.Optional;

public class CommandTimeouts extends BaseMapOptionData<CommandTimeouts> {
public static final String DEFAULT_COMMAND = "default";

public CommandTimeouts() {
}

public CommandTimeouts(Map<String, Object> timeouts) {
super(timeouts);
}

public CommandTimeouts(String json) {
super(json);
}

/**
* Sets the timeout for the particular Appium command that
* is proxied to WDA.
* Command names you can find in logs, look for
* "Executing command 'command_name'" records.
* Timeout value is expected to contain max milliseconds to wait for
* the given WDA command to be executed before terminating the session forcefully.
*
* @param commandName The command name.
* @param timeout Command timeout.
* @return self instance for chaining.
*/
public CommandTimeouts withCommandTimeout(String commandName, Duration timeout) {
return assignOptionValue(commandName, timeout.toMillis());
}

/**
* Sets the default timeout for all Appium commands that
* are proxied to WDA.
*
* @param timeout Commands timeout.
* @return self instance for chaining.
*/
public CommandTimeouts withDefaultCommandTimeout(Duration timeout) {
return withCommandTimeout(DEFAULT_COMMAND, timeout);
}

/**
* Get the command timeout.
*
* @param commandName The command name
* @return Timeout value.
*/
public Optional<Duration> getCommandTimeout(String commandName) {
Optional<Object> result = getOptionValue(commandName);
return result.map(CapabilityHelpers::toDuration);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,48 +16,36 @@

package io.appium.java_client.ios.options.other;

import com.google.gson.JsonObject;
import io.appium.java_client.remote.options.BaseOptions;
import io.appium.java_client.remote.options.CanSetCapability;
import org.openqa.selenium.Capabilities;
import org.openqa.selenium.internal.Either;

import java.time.Duration;
import java.util.Optional;

import static io.appium.java_client.internal.CapabilityHelpers.toDuration;

public interface SupportsCommandTimeoutsOption<T extends BaseOptions<T>> extends
Capabilities, CanSetCapability<T> {
String COMMAND_TIMEOUTS_OPTION = "commandTimeouts";

/**
* Custom timeout(s) in milliseconds for WDA backend commands execution.
* This might be useful if WDA backend freezes unexpectedly or requires too
* much time to fail and blocks automated test execution. The value is expected
* to be of type string and can either contain max milliseconds to wait for
* each WDA command to be executed before terminating the session forcefully
* or a valid JSON string, where keys are internal Appium command names (you
* can find these in logs, look for "Executing command 'command_name'" records)
* and values are timeouts in milliseconds. You can also set the 'default' key
* to assign the timeout for all other commands not explicitly enumerated as
* JSON keys.
* much time to fail and blocks automated test execution.
*
* @param timeouts E.g. '{"findElement": 40000, "findElements": 40000}'.
* @param timeouts Command timeouts.
* @return self instance for chaining.
*/
default T setCommandTimeouts(JsonObject timeouts) {
default T setCommandTimeouts(CommandTimeouts timeouts) {
return amend(COMMAND_TIMEOUTS_OPTION, timeouts.toString());
}

/**
* Custom timeout(s) in milliseconds for WDA backend commands execution.
* Custom timeout for all WDA backend commands execution.
* This might be useful if WDA backend freezes unexpectedly or requires too
* much time to fail and blocks automated test execution. The value is expected
* to be of type string and can either contain max milliseconds to wait for
* each WDA command to be executed before terminating the session forcefully
* or a valid JSON string, where keys are internal Appium command names (you
* can find these in logs, look for "Executing command 'command_name'" records)
* and values are timeouts in milliseconds. You can also set the 'default' key
* to assign the timeout for all other commands not explicitly enumerated as
* JSON keys.
* much time to fail and blocks automated test execution.
*
* @param timeout The timeout value for all commands.
* @return self instance for chaining.
Expand All @@ -69,11 +57,14 @@ default T setCommandTimeouts(Duration timeout) {
/**
* Get custom timeout(s) in milliseconds for WDA backend commands execution.
*
* @return Command timeouts.
* @return Either a global timeout duration or detailed command timeouts.
*/
default Optional<String> getCommandTimeouts() {
return Optional.ofNullable(
(String) getCapability(COMMAND_TIMEOUTS_OPTION)
);
default Optional<Either<CommandTimeouts, Duration>> getCommandTimeouts() {
return Optional.ofNullable(getCapability(COMMAND_TIMEOUTS_OPTION))
.map(String::valueOf)
.map((v) -> v.trim().startsWith("{")
? Either.left(new CommandTimeouts(v))
: Either.right(toDuration(v))
);
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
* 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.
*/

package io.appium.java_client.ios.options.simulator;

public enum PasteboardSyncState {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* See the NOTICE file distributed with this work for additional
* information regarding copyright ownership.
* 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.
*/

package io.appium.java_client.ios.options.simulator;

import io.appium.java_client.remote.options.BaseMapOptionData;

import java.util.Map;
import java.util.Optional;

public class Permissions extends BaseMapOptionData<Permissions> {
public Permissions() {
}

public Permissions(Map<String, Object> permissions) {
super(permissions);
}

public Permissions(String json) {
super(json);
}

/**
* Since Xcode SDK 11.4 Apple provides native APIs to interact with
* application settings. Check the output of `xcrun simctl privacy booted`
* command to get the list of available permission names. Use yes, no
* and unset as values in order to grant, revoke or reset the corresponding
* permission. Below Xcode SDK 11.4 it is required that applesimutils package
* is installed and available in PATH. The list of available service names
* and statuses can be found at https://github.com/wix/AppleSimulatorUtils.
* For example: {"com.apple.mobilecal": {"calendar": "YES"}}
*
* @param bundleId The app identifier to change permissions for.
* @param mapping Permissions mapping, where keys are perm names and vales are YES/NO.
* @return self instance for chaining.
*/
public Permissions withAppPermissions(String bundleId, Map<String, String> mapping) {
return assignOptionValue(bundleId, mapping);
}

/**
* Get permissions mapping for the given app bundle identifier.
*
* @param bundleId App bundle identifier.
* @return Permissions mapping.
*/
public Optional<Map<String, String>> getAppPermissions(String bundleId) {
return getOptionValue(bundleId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@

package io.appium.java_client.ios.options.simulator;

import com.google.gson.JsonObject;
import io.appium.java_client.remote.options.BaseOptions;
import io.appium.java_client.remote.options.CanSetCapability;
import org.openqa.selenium.Capabilities;
Expand All @@ -28,49 +27,23 @@ public interface SupportsPermissionsOption<T extends BaseOptions<T>> extends
String PERMISSIONS_OPTION = "permissions";

/**
* Allows to set permissions for the specified application bundle on
* Simulator only. The capability value is expected to be a valid JSON
* with {"bundleId1": {"serviceName1": "serviceStatus1", ...}, ...}
* format. Since Xcode SDK 11.4 Apple provides native APIs to interact with
* application settings. Check the output of xcrun simctl privacy booted
* command to get the list of available permission names. Use yes, no
* and unset as values in order to grant, revoke or reset the corresponding
* permission. Below Xcode SDK 11.4 it is required that applesimutils package
* is installed and available in PATH. The list of available service names
* and statuses can be found at https://github.com/wix/AppleSimulatorUtils.
* Allows setting of permissions for the specified application bundle on
* Simulator only.
*
* @param json For example {"com.apple.mobilecal": {"calendar": "YES"}}
* @param permissions Permissions mapping.
* @return self instance for chaining.
*/
default T setPermissions(JsonObject json) {
return amend(PERMISSIONS_OPTION, json.toString());
default T setPermissions(Permissions permissions) {
return amend(PERMISSIONS_OPTION, permissions.toString());
}

/**
* Allows to set permissions for the specified application bundle on
* Simulator only. The capability value is expected to be a valid JSON
* string with {"bundleId1": {"serviceName1": "serviceStatus1", ...}, ...}
* format. Since Xcode SDK 11.4 Apple provides native APIs to interact with
* application settings. Check the output of xcrun simctl privacy booted
* command to get the list of available permission names. Use yes, no
* and unset as values in order to grant, revoke or reset the corresponding
* permission. Below Xcode SDK 11.4 it is required that applesimutils package
* is installed and available in PATH. The list of available service names
* and statuses can be found at https://github.com/wix/AppleSimulatorUtils.
* Get Simulator permissions.
*
* @param json For example {"com.apple.mobilecal": {"calendar": "YES"}}
* @return self instance for chaining.
*/
default T setPermissions(String json) {
return amend(PERMISSIONS_OPTION, json);
}

/**
* Get Simulator permissions..
*
* @return Permissions json.
* @return Permissions object.
*/
default Optional<String> getPermissions() {
return Optional.ofNullable((String) getCapability(PERMISSIONS_OPTION));
default Optional<Permissions> getPermissions() {
return Optional.ofNullable(getCapability(PERMISSIONS_OPTION))
.map((v) -> new Permissions(String.valueOf(v)));
}
}
Loading