Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix logout for connected tests and re-enable Slack notifications #11850

Merged
merged 3 commits into from
May 7, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
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
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ workflows:
branches:
ignore: /pull\/[0-9]+/
- Connected Tests:
post-to-slack: false
post-to-slack: true
# Always run connected tests on develop and release branches
filters:
branches:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import androidx.test.espresso.action.GeneralLocation;
import androidx.test.espresso.action.Press;
import androidx.test.espresso.action.Tap;
import androidx.test.espresso.matcher.ViewMatchers.Visibility;
import androidx.test.runner.lifecycle.ActivityLifecycleMonitorRegistry;
import androidx.test.uiautomator.UiDevice;
import androidx.test.uiautomator.UiObjectNotFoundException;
Expand Down Expand Up @@ -46,6 +47,7 @@
import static androidx.test.espresso.matcher.ViewMatchers.isDescendantOfA;
import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed;
import static androidx.test.espresso.matcher.ViewMatchers.withClassName;
import static androidx.test.espresso.matcher.ViewMatchers.withEffectiveVisibility;
import static androidx.test.espresso.matcher.ViewMatchers.withId;
import static androidx.test.espresso.matcher.ViewMatchers.withText;
import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
Expand All @@ -58,8 +60,12 @@
public class WPSupportUtils {
// HIGH-LEVEL METHODS

public static ViewInteraction visibleElementWithId(Integer elementID) {
return onView(allOf(withId(elementID), withEffectiveVisibility(Visibility.VISIBLE)));
}

public static boolean isElementDisplayed(Integer elementID) {
return isElementDisplayed(onView(withId(elementID)));
return isElementDisplayed(visibleElementWithId(elementID));
}

public static boolean isElementDisplayed(ViewInteraction element) {
Expand All @@ -82,7 +88,7 @@ public static boolean isElementCompletelyDisplayed(ViewInteraction element) {

public static void scrollToThenClickOn(Integer elementID) {
waitForElementToBeDisplayed(elementID);
onView(withId(elementID))
visibleElementWithId(elementID)
.perform(scrollTo());
clickOn(elementID);
}
Expand All @@ -95,7 +101,7 @@ public static void scrollToThenClickOn(ViewInteraction element) {

public static void clickOn(Integer elementID) {
waitForElementToBeDisplayed(elementID);
clickOn(onView(withId(elementID)));
clickOn(visibleElementWithId(elementID));
idleFor(500); // allow for transitions
}

Expand Down Expand Up @@ -154,7 +160,7 @@ public static void clickOn(String locator) {

public static void longClickOn(Integer elementID) {
waitForElementToBeDisplayed(elementID);
onView(withId(elementID)).perform(longClick());
visibleElementWithId(elementID).perform(longClick());
}

public static void longClickOn(ViewInteraction element) {
Expand Down Expand Up @@ -186,7 +192,7 @@ public static void clickOnSpinnerItemAtIndex(int index) {

public static void populateTextField(Integer elementID, String text) {
waitForElementToBeDisplayed(elementID);
onView(withId(elementID))
visibleElementWithId(elementID)
.perform(replaceText(text))
.perform(closeSoftKeyboard());
}
Expand Down Expand Up @@ -311,11 +317,11 @@ public static void selectItemWithTitleInTabLayout(String string, Integer element
Integer maxTries = 10;

for (Integer i = 0; i < 10; i++) {
onView(withId(elementID)).perform(swipeRight());
visibleElementWithId(elementID).perform(swipeRight());
}

while (!tabLayoutHasTextDisplayed(elementID, string) && tries < maxTries) {
onView(withId(elementID)).perform(swipeLeft());
visibleElementWithId(elementID).perform(swipeLeft());
tries++;
}

Expand Down