Skip to content

Commit 88b1d11

Browse files
Merge pull request appium#448 from YOU-i-Labs/master
Updated YouiEngineDriver to use CommandExecutor
2 parents a549bee + e5b690c commit 88b1d11

File tree

4 files changed

+116
-0
lines changed

4 files changed

+116
-0
lines changed
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package io.appium.java_client.remote;
2+
3+
import org.openqa.selenium.remote.CapabilityType;
4+
5+
/**
6+
* The list of youiengine-specific capabilities.
7+
*/
8+
public interface YouiEngineCapabilityType extends CapabilityType {
9+
/**
10+
* IP address of the app to execute commands against.
11+
*/
12+
String APP_ADDRESS = "youiEngineAppAddress";
13+
}
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*
2+
* Licensed under the Apache License, Version 2.0 (the "License");
3+
* you may not use this file except in compliance with the License.
4+
* See the NOTICE file distributed with this work for additional
5+
* information regarding copyright ownership.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package io.appium.java_client.youiengine;
18+
19+
import io.appium.java_client.AppiumDriver;
20+
import io.appium.java_client.TouchAction;
21+
import io.appium.java_client.youiengine.internal.JsonToYouiEngineElementConverter;
22+
import org.openqa.selenium.Capabilities;
23+
import org.openqa.selenium.WebElement;
24+
25+
import java.net.URL;
26+
27+
public class YouiEngineDriver<T extends WebElement> extends AppiumDriver<T> {
28+
29+
/** Constructor takes in the Appium Server URL and the capabilities you want to use for this
30+
* test execution. **/
31+
public YouiEngineDriver(URL remoteAddress, Capabilities desiredCapabilities) {
32+
super(remoteAddress, desiredCapabilities, JsonToYouiEngineElementConverter.class);
33+
}
34+
35+
@Override
36+
public void swipe(int startx, int starty, int endx, int endy, int duration) {
37+
// YouiEngine does not use duration
38+
TouchAction swipeAction = new TouchAction(this).press(startx, starty).moveTo(endx, endy)
39+
.release();
40+
swipeAction.perform();
41+
}
42+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/*
2+
* Licensed under the Apache License, Version 2.0 (the "License");
3+
* you may not use this file except in compliance with the License.
4+
* See the NOTICE file distributed with this work for additional
5+
* information regarding copyright ownership.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package io.appium.java_client.youiengine;
18+
19+
import io.appium.java_client.MobileElement;
20+
21+
public class YouiEngineElement extends MobileElement {
22+
23+
}
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* Licensed under the Apache License, Version 2.0 (the "License");
3+
* you may not use this file except in compliance with the License.
4+
* See the NOTICE file distributed with this work for additional
5+
* information regarding copyright ownership.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package io.appium.java_client.youiengine.internal;
18+
19+
import io.appium.java_client.MobileElement;
20+
import io.appium.java_client.internal.JsonToMobileElementConverter;
21+
import io.appium.java_client.youiengine.YouiEngineElement;
22+
23+
import org.openqa.selenium.remote.RemoteWebDriver;
24+
25+
26+
public class JsonToYouiEngineElementConverter extends JsonToMobileElementConverter {
27+
public JsonToYouiEngineElementConverter(RemoteWebDriver driver) {
28+
super(driver);
29+
}
30+
31+
@Override
32+
protected MobileElement newMobileElement() {
33+
YouiEngineElement toReturn = new YouiEngineElement();
34+
toReturn.setParent(driver);
35+
return toReturn;
36+
}
37+
}
38+

0 commit comments

Comments
 (0)