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

Update Tables test #200

Open
wants to merge 8 commits into
base: development
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
Next Next commit
- Update CsvTest
  • Loading branch information
Lamouresparus committed Mar 4, 2022
commit c4c05085fd7aeb4bf1c1d2283e0b0a4f81f4e46f
Original file line number Diff line number Diff line change
@@ -67,7 +67,7 @@ public class CsvTest {
private ActivityScenario<MainActivity> scenario;

// don't annotate used in chain rule
private ActivityScenarioRule<MainActivity> mIntentsRule = new ActivityScenarioRule<MainActivity>(MainActivity.class);
private ActivityScenarioRule<MainActivity> mIntentsRule = new ActivityScenarioRule<>(MainActivity.class);


private void beforeActivityLaunched(){
Original file line number Diff line number Diff line change
@@ -25,14 +25,11 @@
import androidx.recyclerview.widget.RecyclerView;
import androidx.test.espresso.ViewInteraction;
import androidx.test.espresso.contrib.RecyclerViewActions;
import androidx.test.espresso.intent.rule.IntentsTestRule;
import androidx.test.espresso.web.sugar.Web;
import androidx.test.espresso.web.webdriver.Locator;
import androidx.test.ext.junit.rules.ActivityScenarioRule;
import androidx.test.platform.app.InstrumentationRegistry;

import com.todddavies.components.progressbar.Main;

import org.hamcrest.Matcher;
import org.opendatakit.tables.R;
import org.opendatakit.tables.activities.MainActivity;
@@ -130,10 +127,12 @@ public static int getColor(Matcher<View> matcher, final int x, final int y) {
return color[0];
}

public static ViewInteraction toastMsgMatcher(ActivityScenarioRule rule, Matcher<String> matcher) {
return onView(withText(matcher))
.inRoot(withDecorView(not(is(getActivity(rule).getWindow().getDecorView()))))
.check(matches(isDisplayed()));
public static void toastMsgMatcher(ActivityScenarioRule<MainActivity> rule, Matcher<String> matcher) {
rule.getScenario().onActivity(activity -> {
onView(withText(matcher))
.inRoot(withDecorView(not(is(activity.getWindow().getDecorView()))))
.check(matches(isDisplayed()));
});
}

public static void openTableManagerFromCustomHome() {
@@ -161,10 +160,4 @@ public static ViewInteraction onRecyclerViewText(@StringRes int textId) {

return onView(withText(textId));
}

private static MainActivity getActivity(ActivityScenarioRule<MainActivity> activityScenarioRule) {
AtomicReference<MainActivity> activityRef = new AtomicReference<>();
activityScenarioRule.getScenario().onActivity(activityRef::set);
return activityRef.get();
}
}