-
-
Notifications
You must be signed in to change notification settings - Fork 764
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Splitting of TouchActions * Codacy Fixes * #456 FIX #454 FIX: API redesign. - new interfaces were added - deprecated API * #456 FIX #454 FIX: MultiTouchAction refactoring - new methods were added to MultiTouchAction - AppiumDriver methods which perform multiple touch actions were marked as Deprecated - Constructors of TouchAction and MultiTouchAction were changed. Now it accepts any instance that can perform touch action and multiple touch actions. * #456 FIX #454 FIX: New CreatesSwipeAction API - the new interface CreatesSwipeAction was added. - the reversion of last changes of TouchableElement. - the `swipe` is deprecated method. * #456 FIX #454 FIX: Forgot to commit this change * #456 FIX #454 FIX: CreatesSwipeAction API was implemented - CreatesSwipeAction API was implemented - SwipeElementDirection was redesigned - constructors of TouchAction and MultiTouchAction were improved. * #456 FIX #454 FIX: AndroidTouchActions were covered with tests. - also code issues were got fixed * #456 FIX #454 FIX: Refactoring of MobileElement * #456 FIX #454 FIX: IOSGesturesTest was redesigned. - IOSSwipeGestureTest was added * #456 FIX #454 FIX: Checkstyle issues were got fixed * #456 FIX #454 FIX: The additional test on Android. - the swiping combined with the tapping. * Issues that found by codecy were got fixed * The addition #513 Fixed Codacy errors Fixed Codacy errors * Fixed tests Fixed tests Fixed tests Fixed tests
- Loading branch information
1 parent
28d10c8
commit 7042073
Showing
35 changed files
with
972 additions
and
373 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
101 changes: 101 additions & 0 deletions
101
src/main/java/io/appium/java_client/CreatesSwipeAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
/* | ||
* 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; | ||
|
||
import org.openqa.selenium.WebElement; | ||
|
||
public interface CreatesSwipeAction { | ||
|
||
/** | ||
* Creates combined touch action for the swiping by start/end coordinates. | ||
* | ||
* @param startX x-coordinate to swipe from | ||
* @param startY y-coordinate to swipe from | ||
* @param endX x-coordinate to swipe to | ||
* @param endY y-coordinate to swipe to | ||
* @param duration in milliseconds | ||
* @return an instance of combined {@link TouchAction} | ||
*/ | ||
TouchAction swipe(int startX, int startY, int endX, int endY, int duration); | ||
|
||
/** | ||
* Creates combined touch action for the swiping from given coordinates to the given element. | ||
* | ||
* @param startX x-coordinate to swipe from | ||
* @param startY y-coordinate to swipe from | ||
* @param element an element to swipe to | ||
* @param duration in milliseconds | ||
* @return an instance of combined {@link TouchAction} | ||
*/ | ||
TouchAction swipe(int startX, int startY, WebElement element, int duration); | ||
|
||
/** | ||
* Creates combined touch action for the swiping from one element to another. | ||
* | ||
* @param element1 an element to swipe to | ||
* @param element2 an element to swipe to | ||
* @param duration in milliseconds | ||
* @return an instance of combined {@link TouchAction} | ||
*/ | ||
TouchAction swipe(WebElement element1, WebElement element2, int duration); | ||
|
||
|
||
/** | ||
* Creates combined touch action for the swiping inside an element. | ||
* | ||
* @param element an element where the swiping is performed | ||
* @param direction is the direction to perform the swiping inside the element | ||
* @param duration in milliseconds | ||
* @return an instance of combined {@link TouchAction} | ||
*/ | ||
default TouchAction swipe(MobileElement element, SwipeElementDirection direction, int duration) { | ||
return direction.swipe(this, element, 0, 0, duration); | ||
} | ||
|
||
/** | ||
* Creates combined touch action for the swiping inside an element using some offset from its | ||
* borders. | ||
* | ||
* @param element an element where the swiping is performed | ||
* @param direction is the direction to perform the swiping inside the element | ||
* @param offsetFromStartBorder is the offset from the border of the element where the | ||
* swiping should be started. If direction is UP then | ||
* this is offset from the bottom of the element. | ||
* If direction is DOWN then this is offset from the top of | ||
* the element. If direction is RIGHT then this is offset from | ||
* the left border of the element. If direction is LEFT then | ||
* this is offset from the right border of the element. | ||
* @param offsetFromEndBorder is the offset from the border of the element where | ||
* the swiping should be finished. If direction is UP then | ||
* this is offset from the top of the element. | ||
* If direction is DOWN then this is offset from the bottom | ||
* of the element. If direction is RIGHT then | ||
* this is offset from the right border of the element. | ||
* If direction is LEFT then this is offset from the | ||
* left border of the element. | ||
* @param duration in milliseconds | ||
* @return an instance of combined {@link TouchAction} | ||
* @throws IllegalCoordinatesException when resulted coordinates are out of the | ||
* element borders or disagree with the given direction. | ||
*/ | ||
default TouchAction swipe(MobileElement element, SwipeElementDirection direction, int offsetFromStartBorder, | ||
int offsetFromEndBorder, | ||
int duration) throws IllegalCoordinatesException { | ||
return direction.swipe(this, element, offsetFromStartBorder, offsetFromEndBorder, | ||
duration); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
|
||
import static io.appium.java_client.MobileCommand.GET_DEVICE_TIME; | ||
|
||
import org.openqa.selenium.remote.Response; | ||
|
||
public interface HasDeviceTime extends ExecutesMethod { | ||
/* | ||
Gets device date and time for both iOS(Supports only real device) and Android devices | ||
*/ | ||
default String getDeviceTime() { | ||
Response response = execute(GET_DEVICE_TIME); | ||
return response.getValue().toString(); | ||
} | ||
} |
Oops, something went wrong.