Skip to content

Commit

Permalink
CATROID-1494 Check checkbox when clicking on a fragment
Browse files Browse the repository at this point in the history
  • Loading branch information
l-ilma committed Nov 23, 2022
1 parent 560a973 commit b59e9a1
Show file tree
Hide file tree
Showing 48 changed files with 310 additions and 144 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ private void deleteSound(int position) {
onView(withText(R.string.delete))
.perform(click());
onRecyclerView().atPosition(position)
.performCheckItem();
.performCheckItemClick();
onView(withId(R.id.confirm))
.perform(click());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ private void deleteSound(int position) {
onView(withText(R.string.delete))
.perform(click());
onRecyclerView().atPosition(position)
.performCheckItem();
.performCheckItemClick();
onView(withId(R.id.confirm))
.perform(click());
onView(allOf(withId(android.R.id.button1), withText(R.string.delete)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public void deleteVariableFromMenuTest() {
onView(withText(R.string.delete))
.perform(click());
onDataList().onVariableAtPosition(0)
.performCheckItem();
.performCheckItemClick();
onActionMode()
.performConfirm();
onView(withId(android.R.id.button1))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ class DeleteSpriteCloneTest {
Espresso.onView(withText(R.string.delete))
.perform(click())
RecyclerViewInteractionWrapper.onRecyclerView().atPosition(2)
.performCheckItem()
.performCheckItemClick()
Espresso.onView(withId(R.id.confirm))
.perform(click())
Espresso.onView(allOf(withId(android.R.id.button1), withText(R.string.delete)))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public void actionBarDataFragmentTitleTest() {
onView(withText(R.string.delete))
.perform(click());
onDataList().onVariableAtPosition(0)
.performCheckItem();
.performCheckItemClick();
onActionMode()
.performGoBack();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,13 +75,13 @@ public void actionModeDataFragmentTitleTest() {
.perform(click());

onDataList().onVariableAtPosition(0)
.performCheckItem();
.performCheckItemClick();
onDataList().onVariableAtPosition(1)
.performCheckItem();
.performCheckItemClick();
onDataList().onListAtPosition(2)
.performCheckItem();
.performCheckItemClick();
onDataList().onListAtPosition(2)
.performCheckItem();
.performCheckItemClick();

onActionMode().checkTitleMatches(UiTestUtils.getResourcesString(R.string.delete) + " 2");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,13 @@ public void onlyTwoProjectsCheckedTest() {
onView(withText(R.string.merge)).perform(click());

onRecyclerView().atPosition(0)
.performCheckItem();
.performCheckItemClick();

onRecyclerView().atPosition(1)
.performCheckItem();
.performCheckItemClick();

onRecyclerView().atPosition(2)
.performCheckItem();
.performCheckItemClick();

onRecyclerView().atPosition(0).onChildView(R.id.checkbox).check(matches(isChecked()));
onRecyclerView().atPosition(1).onChildView(R.id.checkbox).check(matches(isChecked()));
Expand All @@ -115,19 +115,19 @@ public void actionModeMergeTitleTest() {
.perform(click());

onRecyclerView().atPosition(0)
.performCheckItem();
.performCheckItemClick();
onActionMode().checkTitleMatches(UiTestUtils.getResourcesString(R.string.merge) + " 1");

onRecyclerView().atPosition(1)
.performCheckItem();
.performCheckItemClick();
onActionMode().checkTitleMatches(UiTestUtils.getResourcesString(R.string.merge) + " 2");

onRecyclerView().atPosition(0)
.performCheckItem();
.performCheckItemClick();
onActionMode().checkTitleMatches(UiTestUtils.getResourcesString(R.string.merge) + " 1");

onRecyclerView().atPosition(1)
.performCheckItem();
.performCheckItemClick();

onActionMode().checkTitleMatches(UiTestUtils.getResourcesString(R.string.merge) + " 0");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
import static org.catrobat.catroid.uiespresso.ui.fragment.rvutils.RecyclerViewInteractionWrapper.onRecyclerView;
import static org.hamcrest.Matchers.allOf;

import static androidx.test.InstrumentationRegistry.getInstrumentation;
import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.Espresso.openActionBarOverflowOrOptionsMenu;
import static androidx.test.espresso.action.ViewActions.click;
Expand Down Expand Up @@ -85,11 +84,11 @@ public void setUp() throws Exception {
@Category({Cat.AppUi.class, Level.Smoke.class})
@Test
public void deleteLookDialogTest() {
openActionBarOverflowOrOptionsMenu(getInstrumentation().getTargetContext());
openActionBarOverflowOrOptionsMenu(InstrumentationRegistry.getInstrumentation().getTargetContext());
onView(withText(R.string.delete)).perform(click());

onRecyclerView().atPosition(1)
.performCheckItem();
.performCheckItemClick();

onView(withId(R.id.confirm)).perform(click());

Expand All @@ -115,11 +114,11 @@ public void deleteLookDialogTest() {
@Category({Cat.AppUi.class, Level.Smoke.class})
@Test
public void cancelDeleteLookDialogTest() {
openActionBarOverflowOrOptionsMenu(getInstrumentation().getTargetContext());
openActionBarOverflowOrOptionsMenu(InstrumentationRegistry.getInstrumentation().getTargetContext());
onView(withText(R.string.delete)).perform(click());

onRecyclerView().atPosition(1)
.performCheckItem();
.performCheckItemClick();

onView(withId(R.id.confirm)).perform(click());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,6 @@
import static org.catrobat.catroid.uiespresso.ui.fragment.rvutils.RecyclerViewInteractionWrapper.onRecyclerView;
import static org.hamcrest.Matchers.allOf;

import static androidx.test.InstrumentationRegistry.getInstrumentation;
import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.Espresso.openActionBarOverflowOrOptionsMenu;
import static androidx.test.espresso.action.ViewActions.click;
Expand Down Expand Up @@ -84,11 +83,11 @@ public void setUp() throws Exception {
@Category({Cat.AppUi.class, Level.Smoke.class})
@Test
public void deleteSoundDialogTest() {
openActionBarOverflowOrOptionsMenu(getInstrumentation().getTargetContext());
openActionBarOverflowOrOptionsMenu(InstrumentationRegistry.getInstrumentation().getTargetContext());
onView(withText(R.string.delete)).perform(click());

onRecyclerView().atPosition(1)
.performCheckItem();
.performCheckItemClick();

onView(withId(R.id.confirm)).perform(click());

Expand All @@ -114,11 +113,11 @@ public void deleteSoundDialogTest() {
@Category({Cat.AppUi.class, Level.Smoke.class})
@Test
public void cancelDeleteSoundDialogTest() {
openActionBarOverflowOrOptionsMenu(getInstrumentation().getTargetContext());
openActionBarOverflowOrOptionsMenu(InstrumentationRegistry.getInstrumentation().getTargetContext());
onView(withText(R.string.delete)).perform(click());

onRecyclerView().atPosition(1)
.performCheckItem();
.performCheckItemClick();

onView(withId(R.id.confirm)).perform(click());

Expand All @@ -143,6 +142,16 @@ public void cancelDeleteSoundDialogTest() {
onActionMode().checkTitleMatches(UiTestUtils.getResourcesString(R.string.delete) + " 1");
}

@Category({Cat.AppUi.class, Level.Smoke.class})
@Test
public void selectFragmentToDeleteTest() {
openActionBarOverflowOrOptionsMenu(InstrumentationRegistry.getInstrumentation().getTargetContext());
onView(withText(R.string.delete)).perform(click());

onRecyclerView().atPosition(0).perform(click());
onRecyclerView().atPosition(0).performCheckItemCheck();
}

private void createProject(String projectName) throws IOException {
Project project = new Project(ApplicationProvider.getApplicationContext(), projectName);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,12 @@

import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.platform.app.InstrumentationRegistry;

import static org.catrobat.catroid.uiespresso.ui.actionbar.utils.ActionModeWrapper.onActionMode;
import static org.catrobat.catroid.uiespresso.ui.fragment.rvutils.RecyclerViewInteractionWrapper.onRecyclerView;
import static org.hamcrest.Matchers.allOf;

import static androidx.test.InstrumentationRegistry.getInstrumentation;
import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.Espresso.openActionBarOverflowOrOptionsMenu;
import static androidx.test.espresso.action.ViewActions.click;
Expand Down Expand Up @@ -75,11 +75,11 @@ public void setUp() throws Exception {
@Category({Cat.AppUi.class, Level.Smoke.class})
@Test
public void deleteSpriteDialogTest() {
openActionBarOverflowOrOptionsMenu(getInstrumentation().getTargetContext());
openActionBarOverflowOrOptionsMenu(InstrumentationRegistry.getInstrumentation().getTargetContext());
onView(withText(R.string.delete)).perform(click());

onRecyclerView().atPosition(2)
.performCheckItem();
.performCheckItemClick();

onView(withId(R.id.confirm)).perform(click());

Expand All @@ -105,11 +105,11 @@ public void deleteSpriteDialogTest() {
@Category({Cat.AppUi.class, Level.Smoke.class})
@Test
public void cancelDeleteSpriteDialogTest() {
openActionBarOverflowOrOptionsMenu(getInstrumentation().getTargetContext());
openActionBarOverflowOrOptionsMenu(InstrumentationRegistry.getInstrumentation().getTargetContext());
onView(withText(R.string.delete)).perform(click());

onRecyclerView().atPosition(2)
.performCheckItem();
.performCheckItemClick();

onView(withId(R.id.confirm)).perform(click());

Expand All @@ -134,6 +134,16 @@ public void cancelDeleteSpriteDialogTest() {
onActionMode().checkTitleMatches(UiTestUtils.getResourcesString(R.string.delete) + " 1");
}

@Category({Cat.AppUi.class, Level.Smoke.class})
@Test
public void selectFragmentToDeleteTest() {
openActionBarOverflowOrOptionsMenu(InstrumentationRegistry.getInstrumentation().getTargetContext());
onView(withText(R.string.delete)).perform(click());

onRecyclerView().atPosition(1).perform(click());
onRecyclerView().atPosition(1).performCheckItemCheck();
}

private void createProject(String projectName) {
Project project = new Project(ApplicationProvider.getApplicationContext(), projectName);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
import static org.catrobat.catroid.common.Constants.IMAGE_DIRECTORY_NAME;
import static org.catrobat.catroid.uiespresso.ui.fragment.rvutils.RecyclerViewInteractionWrapper.onRecyclerView;

import static androidx.test.InstrumentationRegistry.getInstrumentation;
import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.Espresso.openActionBarOverflowOrOptionsMenu;
import static androidx.test.espresso.action.ViewActions.click;
Expand Down Expand Up @@ -79,11 +78,11 @@ public void setUp() throws Exception {
@Category({Cat.AppUi.class, Level.Smoke.class})
@Test
public void copyLookTest() {
openActionBarOverflowOrOptionsMenu(getInstrumentation().getTargetContext());
openActionBarOverflowOrOptionsMenu(InstrumentationRegistry.getInstrumentation().getTargetContext());
onView(withText(R.string.copy)).perform(click());

onRecyclerView().atPosition(0)
.performCheckItem();
.performCheckItemClick();

onView(withId(R.id.confirm)).perform(click());

Expand All @@ -94,6 +93,16 @@ public void copyLookTest() {
.check(matches(isDisplayed()));
}

@Category({Cat.AppUi.class, Level.Smoke.class})
@Test
public void selectFragmentToCopyTest() {
openActionBarOverflowOrOptionsMenu(InstrumentationRegistry.getInstrumentation().getTargetContext());
onView(withText(R.string.copy)).perform(click());

onRecyclerView().atPosition(0).perform(click());
onRecyclerView().atPosition(0).performCheckItemCheck();
}

private void createProject() throws IOException {
String projectName = "copyLookFragmentTest";
Project project = new Project(ApplicationProvider.getApplicationContext(), projectName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
import static org.catrobat.catroid.common.Constants.SOUND_DIRECTORY_NAME;
import static org.catrobat.catroid.uiespresso.ui.fragment.rvutils.RecyclerViewInteractionWrapper.onRecyclerView;

import static androidx.test.InstrumentationRegistry.getInstrumentation;
import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.Espresso.openActionBarOverflowOrOptionsMenu;
import static androidx.test.espresso.action.ViewActions.click;
Expand Down Expand Up @@ -95,12 +94,12 @@ public void tearDown() throws Exception {
@Category({Cat.AppUi.class, Level.Smoke.class})
@Test
public void copySceneTest() {
openActionBarOverflowOrOptionsMenu(getInstrumentation().getTargetContext());
openActionBarOverflowOrOptionsMenu(InstrumentationRegistry.getInstrumentation().getTargetContext());
onView(withText(R.string.copy))
.perform(click());

onRecyclerView().atPosition(0)
.performCheckItem();
.performCheckItemClick();

onView(withId(R.id.confirm))
.perform(click());
Expand All @@ -122,6 +121,16 @@ public void copySceneTest() {
assertEquals(1, copiedSceneSoundFilesCount);
}

@Category({Cat.AppUi.class, Level.Smoke.class})
@Test
public void selectFragmentToCopyTest() {
openActionBarOverflowOrOptionsMenu(InstrumentationRegistry.getInstrumentation().getTargetContext());
onView(withText(R.string.copy)).perform(click());

onRecyclerView().atPosition(0).perform(click());
onRecyclerView().atPosition(0).performCheckItemCheck();
}

private void createProject(Context context, String projectName) throws Exception {

Project project = new Project(context, projectName);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
import static org.catrobat.catroid.common.Constants.SOUND_DIRECTORY_NAME;
import static org.catrobat.catroid.uiespresso.ui.fragment.rvutils.RecyclerViewInteractionWrapper.onRecyclerView;

import static androidx.test.InstrumentationRegistry.getInstrumentation;
import static androidx.test.espresso.Espresso.onView;
import static androidx.test.espresso.Espresso.openActionBarOverflowOrOptionsMenu;
import static androidx.test.espresso.action.ViewActions.click;
Expand Down Expand Up @@ -79,11 +78,11 @@ public void setUp() throws Exception {
@Category({Cat.AppUi.class, Level.Smoke.class})
@Test
public void copySoundTest() {
openActionBarOverflowOrOptionsMenu(getInstrumentation().getTargetContext());
openActionBarOverflowOrOptionsMenu(InstrumentationRegistry.getInstrumentation().getTargetContext());
onView(withText(R.string.copy)).perform(click());

onRecyclerView().atPosition(0)
.performCheckItem();
.performCheckItemClick();

onView(withId(R.id.confirm)).perform(click());

Expand All @@ -94,6 +93,16 @@ public void copySoundTest() {
.check(matches(isDisplayed()));
}

@Category({Cat.AppUi.class, Level.Smoke.class})
@Test
public void selectFragmentToCopyTest() {
openActionBarOverflowOrOptionsMenu(InstrumentationRegistry.getInstrumentation().getTargetContext());
onView(withText(R.string.copy)).perform(click());

onRecyclerView().atPosition(0).perform(click());
onRecyclerView().atPosition(0).performCheckItemCheck();
}

private void createProject() throws IOException {
String projectName = "copySoundFragmentTest";
Project project = new Project(ApplicationProvider.getApplicationContext(), projectName);
Expand Down
Loading

0 comments on commit b59e9a1

Please sign in to comment.