-
-
Notifications
You must be signed in to change notification settings - Fork 129
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1326 bug draganddrop action fails due to not locating the element cor…
…rectly after the action takes place (#1389) * reproducing swipeElement issue for android Note: drag and drop works well for web. Signed-off-by: Mohab Mohie <Mohab.MohieElDeen@outlook.com> * upgrading default browserstack sel ver - upgraded from 4.12.1 to 4.15.0 Signed-off-by: Mohab Mohie <Mohab.MohieElDeen@outlook.com> * upgrading app url - issue is already fixed by implementing the drag and drop flag (defaults to false) in an earlier release. Signed-off-by: Mohab Mohie <Mohab.MohieElDeen@outlook.com> --------- Signed-off-by: Mohab Mohie <Mohab.MohieElDeen@outlook.com>
- Loading branch information
1 parent
bd1b243
commit b22dd43
Showing
3 changed files
with
77 additions
and
1 deletion.
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
76 changes: 76 additions & 0 deletions
76
src/test/java/testPackage/appium/AndroidDragAndDropTest.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,76 @@ | ||
package testPackage.appium; | ||
|
||
import com.shaft.driver.SHAFT; | ||
import io.appium.java_client.AppiumBy; | ||
import io.appium.java_client.remote.AutomationName; | ||
import org.openqa.selenium.By; | ||
import org.openqa.selenium.Platform; | ||
import org.testng.annotations.AfterMethod; | ||
import org.testng.annotations.BeforeMethod; | ||
import org.testng.annotations.Test; | ||
|
||
public class AndroidDragAndDropTest { | ||
private SHAFT.GUI.WebDriver driver; | ||
|
||
@Test | ||
public void wizard_scrollInExpandableLists_verticalScrolling_insideScreen() { | ||
By dragButton = By.xpath("//android.widget.Button[@content-desc='Drag']"); | ||
By draggableRobotEyes = By.xpath("//android.view.ViewGroup[@content-desc='drag-c1']/android.widget.ImageView"); | ||
By dropRobotEyes = By.xpath("//android.view.ViewGroup[@content-desc='drop-c1']/android.view.ViewGroup"); | ||
|
||
By dragAndDropScreen = AppiumBy.accessibilityId("Drag-drop-screen"); | ||
|
||
// WebDriver code -> really fails to drag | ||
// driver.element().click(dragButton) | ||
// .dragAndDrop(draggableRobotEyes, dropRobotEyes) | ||
// .and().assertThat(dragAndDropScreen).matchesReferenceImage().perform(); | ||
|
||
// Appium code -> drag and drop happens but shows up as failed | ||
driver.touch().tap(dragButton) | ||
.swipeToElement(draggableRobotEyes, dropRobotEyes) | ||
.and().assertThat(dragAndDropScreen).matchesReferenceImage().perform(); | ||
} | ||
|
||
@SuppressWarnings("CommentedOutCode") | ||
@BeforeMethod | ||
public void setup() { | ||
System.setProperty("mobile_autoGrantPermissions", "true"); | ||
// common attributes | ||
SHAFT.Properties.platform.set().targetPlatform(Platform.ANDROID.name()); | ||
SHAFT.Properties.mobile.set().automationName(AutomationName.ANDROID_UIAUTOMATOR2); | ||
|
||
// self-managed execution | ||
// SHAFT.Properties.mobile.set().selfManaged(true); | ||
// SHAFT.Properties.mobile.set().selfManagedAndroidSDKVersion(31); | ||
|
||
// local appium server (for local and GitHub actions execution) | ||
// SHAFT.Properties.platform.set().executionAddress("localhost:4723"); | ||
// SHAFT.Properties.mobile.set().app("src/test/resources/testDataFiles/apps/Android-NativeDemoApp-0.4.0.apk"); | ||
|
||
// local appium server (android-emulator docker-compose) | ||
// SHAFT.Properties.platform.set().executionAddress("localhost:4725"); | ||
// SHAFT.Properties.mobile.set().app("src/test/resources/testDataFiles/apps/Android-NativeDemoApp-0.4.0.apk"); | ||
|
||
// remote browserstack server (new app version) | ||
// SHAFT.Properties.platform.set().executionAddress("browserstack"); | ||
// SHAFT.Properties.browserStack.set().platformVersion("13.0"); | ||
// SHAFT.Properties.browserStack.set().deviceName("Google Pixel 7"); | ||
// SHAFT.Properties.browserStack.set().appName("Android-NativeDemoApp-0.4.0.apk"); | ||
// SHAFT.Properties.browserStack.set().appRelativeFilePath("src/test/resources/testDataFiles/apps/Android-NativeDemoApp-0.4.0.apk"); | ||
// SHAFT.Properties.browserStack.set().appUrl(""); | ||
|
||
// remote browserstack server (existing app version) | ||
SHAFT.Properties.platform.set().executionAddress("browserstack"); | ||
SHAFT.Properties.browserStack.set().platformVersion("13.0"); | ||
SHAFT.Properties.browserStack.set().deviceName("Google Pixel 7"); | ||
SHAFT.Properties.browserStack.set().appName("Android-NativeDemoApp-0.4.0.apk"); | ||
SHAFT.Properties.browserStack.set().appRelativeFilePath(""); | ||
SHAFT.Properties.browserStack.set().appUrl("bs://832ef13a11caa84ad714e0d4f8d9553cd3c5a3ca"); | ||
driver = new SHAFT.GUI.WebDriver(); | ||
} | ||
|
||
@AfterMethod(alwaysRun = true) | ||
public void teardown() { | ||
driver.quit(); | ||
} | ||
} |
Binary file added
BIN
+29.4 MB
src/test/resources/testDataFiles/apps/Android-NativeDemoApp-0.4.0.apk
Binary file not shown.