Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/npm_and_yarn/semantic-release-2…
Browse files Browse the repository at this point in the history
…3.0.0
  • Loading branch information
KazuCocoa authored Jan 19, 2024
2 parents ac867cc + b10f7ed commit e357648
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,17 @@

import org.json.JSONArray;
import org.json.JSONException;
import org.junit.Ignore;
import org.junit.Test;

import io.appium.uiautomator2.model.By;
import io.appium.uiautomator2.model.Point;
import io.appium.uiautomator2.unittest.test.internal.BaseTest;
import io.appium.uiautomator2.unittest.test.internal.Response;

import static io.appium.uiautomator2.unittest.test.internal.TestUtils.waitForElement;
import static io.appium.uiautomator2.unittest.test.internal.commands.DeviceCommands.findElement;
import static io.appium.uiautomator2.unittest.test.internal.commands.DeviceCommands.performActions;
import static io.appium.uiautomator2.unittest.test.internal.commands.DeviceCommands.scrollToText;
import static io.appium.uiautomator2.unittest.test.internal.commands.ElementCommands.click;
import static io.appium.uiautomator2.unittest.test.internal.commands.ElementCommands.drag;
import static io.appium.uiautomator2.unittest.test.internal.commands.ElementCommands.fling;
Expand Down Expand Up @@ -72,22 +73,23 @@ private void verifyDragResult() {
}

private void setupDragDropView() throws JSONException {
scrollToText("Views"); // Due to 'Views' option not visible on small screen
Response response = findElement(By.accessibilityId("Views"));
clickAndWaitForStaleness(response.getElementId());
response = findElement(By.accessibilityId("Drag and Drop"));
clickAndWaitForStaleness(response.getElementId());
startActivity(".view.DragAndDropDemo");
waitForElement(By.id("io.appium.android.apis:id/drag_explanation"));
}

private void setupEditView() throws JSONException {
Response response = findElement(By.accessibilityId("App"));
clickAndWaitForStaleness(response.getElementId());
response = findElement(By.accessibilityId("Alert Dialogs"));
clickAndWaitForStaleness(response.getElementId());
response = findElement(By.accessibilityId("Text Entry dialog"));
startActivity(".app.AlertDialogSamples");
Response response = waitForElement(By.accessibilityId("Text Entry dialog"));
clickAndWaitForStaleness(response.getElementId());
}

@Override
public void launchAUT() {
// Skip some setup to avoid redundant setup.
dismissSystemAlert();
}

@Ignore("This test is not stable on CI as probably slow response. Please enable again once we move the CI instance to faster emulator one such as M1 macOS instance. Local run works.")
@Test
public void verifyDragAndDropOnAnotherElement() throws JSONException {
setupDragDropView();
Expand All @@ -110,6 +112,7 @@ public void verifyDragAndDropOnAnotherElement() throws JSONException {
verifyDragResult();
}

@Ignore("This test is not stable on CI as probably slow response. Please enable again once we move the CI instance to faster emulator one such as M1 macOS instance. Local run works.")
@Test
public void verifyTypingText() throws JSONException {
setupEditView();
Expand All @@ -131,6 +134,7 @@ public void verifyTypingText() throws JSONException {
assertThat((String) response.getValue(), equalTo("hi"));
}

@Ignore("This test is not stable on CI as probably slow response. Please enable again once we move the CI instance to faster emulator one such as M1 macOS instance. Local run works.")
@Test
public void verifyLongClickGesture() throws JSONException {
setupDragDropView();
Expand All @@ -149,6 +153,7 @@ public void verifyLongClickGesture() throws JSONException {
assertFalse(longClickResponse.isSuccessful());
}

@Ignore("This test is not stable on CI as probably slow response. Please enable again once we move the CI instance to faster emulator one such as M1 macOS instance. Local run works.")
@Test
public void verifyDragGesture() throws JSONException {
setupDragDropView();
Expand Down Expand Up @@ -194,6 +199,7 @@ public void verifyFlingGesture() throws JSONException {
assertFalse(flingResponse.isSuccessful());
}

@Ignore("This test is not stable on CI as probably slow response. Please enable again once we move the CI instance to faster emulator one such as M1 macOS instance. Local run works.")
@Test
public void verifyPinchCloseGesture() throws JSONException {
setupDragDropView();
Expand All @@ -219,6 +225,7 @@ public void verifyPinchCloseGesture() throws JSONException {
assertFalse(pinchCloseResponse.isSuccessful());
}

@Ignore("This test is not stable on CI as probably slow response. Please enable again once we move the CI instance to faster emulator one such as M1 macOS instance. Local run works.")
@Test
public void verifyPinchOpenGesture() throws JSONException {
setupDragDropView();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import io.appium.uiautomator2.unittest.test.internal.Response;
import io.netty.handler.codec.http.HttpResponseStatus;

import static io.appium.uiautomator2.unittest.test.internal.TestUtils.waitForElement;
import static io.appium.uiautomator2.unittest.test.internal.commands.DeviceCommands.acceptAlert;
import static io.appium.uiautomator2.unittest.test.internal.commands.DeviceCommands.dismissAlert;
import static io.appium.uiautomator2.unittest.test.internal.commands.DeviceCommands.findElement;
Expand All @@ -38,10 +39,8 @@
public class AlertCommandsTest extends BaseTest {

private void setupView() throws JSONException {
Response response = findElement(By.accessibilityId("App"));
clickAndWaitForStaleness(response.getElementId());
response = findElement(By.accessibilityId("Alert Dialogs"));
clickAndWaitForStaleness(response.getElementId());
startActivity(".app.AlertDialogSamples");
waitForElement(By.accessibilityId("List dialog"));
}

@Test
Expand All @@ -66,7 +65,11 @@ public void verifyDismissingAnAlertWithButton() throws JSONException {
Response response = findElement(By.accessibilityId("OK Cancel dialog with a long message"));
clickAndWaitForStaleness(response.getElementId());

response = dismissAlert("CANCEL");
if (Build.VERSION.SDK_INT > 28) {
response = dismissAlert("Cancel");
} else {
response = dismissAlert("CANCEL");
}
assertTrue(response.isSuccessful());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

public class Config {
public static final Long NETTY_STATUS_TIMEOUT = 32_000L;
public static final Long EXPLICIT_TIMEOUT = 16_000L;
public static final Long EXPLICIT_TIMEOUT = 24_000L;
public static final Long IMPLICIT_TIMEOUT = 8_000L;
public static final Long APP_LAUNCH_TIMEOUT = 32_000L;
public static final int DEFAULT_POLLING_INTERVAL = 300;
Expand Down

0 comments on commit e357648

Please sign in to comment.