Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Original file line number Diff line number Diff line change
Expand Up @@ -176,6 +176,14 @@ private static By buildMobileBy(LocatorGroupStrategy locatorGroupStrategy, Annot
}
}

if (isIOSXcuit()) {
iOSXcuitFindBy[] xCuitFindByArray = annotatedElement.getAnnotationsByType(iOSXcuitFindBy.class);
if (xCuitFindByArray != null && xCuitFindByArray.length > 0) {
return buildMobileBy(howToUseLocators != null ? howToUseLocators.windowsAutomation() : null,
xCuitFindByArray);
}
}

if (isIOS()) {
iOSFindBy[] iOSFindByArray = annotatedElement.getAnnotationsByType(iOSFindBy.class);
//should be kept for some time
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

package io.appium.java_client.pagefactory.bys.builder;

import static io.appium.java_client.remote.AutomationName.IOS_XCUI_TEST;
import static io.appium.java_client.remote.AutomationName.SELENDROID;
import static io.appium.java_client.remote.MobilePlatform.ANDROID;
import static io.appium.java_client.remote.MobilePlatform.IOS;
Expand Down Expand Up @@ -180,6 +181,10 @@ protected boolean isIOS() {
return IOS.equalsIgnoreCase(platform);
}

protected boolean isIOSXcuit() {
return isIOS() && IOS_XCUI_TEST.equalsIgnoreCase(automation);
}

protected boolean isWindows() {
return WINDOWS.equalsIgnoreCase(platform);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,12 @@ enum Strategies {
return MobileBy
.windowsAutomation(getValue(annotation, this));
}
},
BY_NS_PREDICATE("iOSNsPredicate") {
@Override By getBy(Annotation annotation) {
return MobileBy
.iOSNsPredicateString(getValue(annotation, this));
}
};

private final String valueName;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
* 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.pagefactory;

import java.lang.annotation.ElementType;
import java.lang.annotation.Repeatable;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Retention(RetentionPolicy.RUNTIME) @Target({ElementType.FIELD, ElementType.TYPE})
@Repeatable(iOSXcuitFindBySet.class)
public @interface iOSXcuitFindBy {
Copy link
Member

Choose a reason for hiding this comment

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

Can this be iOSXCUITFindBy please?


/**
* The NSPredicate class is used to define logical conditions used to constrain
* a search either for a fetch or for in-memory filtering.
*/
String iOSNsPredicate() default "";

/**
* It an UI automation accessibility Id which is a convenient to iOS.
* About iOS accessibility
* {@link "https://developer.apple.com/library/ios/documentation/UIKit/Reference/
* UIAccessibilityIdentification_Protocol/index.html"}
*/
String accessibility() default "";

/**
* It is an id of the target element.
*/
String id() default "";

/**
* It is a name of a type/class of the target element.
*/
String className() default "";

/**
* It is a desired element tag.
*/
String tagName() default "";

/**
* It is a xpath to the target element.
*/
String xpath() default "";
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
/*
* 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.pagefactory;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

@Retention(RetentionPolicy.RUNTIME) @Target({ElementType.FIELD, ElementType.TYPE})
public @interface iOSXcuitFindBySet {
Copy link
Member

Choose a reason for hiding this comment

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

Here too iOSXCUITFindBySet ?

/**
* @return an array of {@link io.appium.java_client.pagefactory.iOSXcuitFindBy} which builds a sequence of
* the chained searching for elements or a set of possible locators
*/
iOSXcuitFindBy[] value();
Copy link
Member

Choose a reason for hiding this comment

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

Here too.

}