From 6e3e80a2639fd32803b7f45f900f905dea3c70fa Mon Sep 17 00:00:00 2001 From: Dominik Bek Date: Fri, 28 Jun 2024 16:17:19 +0200 Subject: [PATCH 1/4] CATROID-1598 Add perform Click on OK button after the Error Message is displayed --- .../catroid/uiespresso/stage/StageResourceFailedTest.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/catroid/src/androidTest/java/org/catrobat/catroid/uiespresso/stage/StageResourceFailedTest.java b/catroid/src/androidTest/java/org/catrobat/catroid/uiespresso/stage/StageResourceFailedTest.java index ea564bc9e82..19b7fb2dca5 100644 --- a/catroid/src/androidTest/java/org/catrobat/catroid/uiespresso/stage/StageResourceFailedTest.java +++ b/catroid/src/androidTest/java/org/catrobat/catroid/uiespresso/stage/StageResourceFailedTest.java @@ -43,9 +43,12 @@ import androidx.test.core.app.ApplicationProvider; import androidx.test.ext.junit.runners.AndroidJUnit4; +import androidx.test.filters.FlakyTest; import static androidx.test.espresso.Espresso.onView; +import static androidx.test.espresso.action.ViewActions.click; import static androidx.test.espresso.assertion.ViewAssertions.matches; +import static androidx.test.espresso.matcher.ViewMatchers.isClickable; import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed; import static androidx.test.espresso.matcher.ViewMatchers.isRoot; import static androidx.test.espresso.matcher.ViewMatchers.withText; @@ -65,11 +68,12 @@ public void setUp() throws Exception { } @Category({Cat.AppUi.class, Level.Smoke.class}) + @FlakyTest @Test public void testResourceFailedDialog() { baseActivityTestRule.launchActivity(null); - onView(isRoot()).perform(CustomActions.wait(5000)); + onView(isRoot()).perform(CustomActions.wait(1000)); onView(withText(R.string.prestage_resource_not_available_title)) .check(matches(isDisplayed())); @@ -80,6 +84,8 @@ public void testResourceFailedDialog() { onView(withText(failedResourceMessage)) .check(matches(isDisplayed())); + + onView(withText("OK")).perform(click()); } public void createProject(String projectName) { From 3bb5ab1ad5ad25140cc2454e28c9996e500cfaec Mon Sep 17 00:00:00 2001 From: Dominik Bek Date: Wed, 31 Jul 2024 12:16:02 +0200 Subject: [PATCH 2/4] CATROID-1598 comments out the wait and add click OK --- .../catroid/uiespresso/stage/StageResourceFailedTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/catroid/src/androidTest/java/org/catrobat/catroid/uiespresso/stage/StageResourceFailedTest.java b/catroid/src/androidTest/java/org/catrobat/catroid/uiespresso/stage/StageResourceFailedTest.java index 19b7fb2dca5..8022544355b 100644 --- a/catroid/src/androidTest/java/org/catrobat/catroid/uiespresso/stage/StageResourceFailedTest.java +++ b/catroid/src/androidTest/java/org/catrobat/catroid/uiespresso/stage/StageResourceFailedTest.java @@ -73,7 +73,7 @@ public void setUp() throws Exception { public void testResourceFailedDialog() { baseActivityTestRule.launchActivity(null); - onView(isRoot()).perform(CustomActions.wait(1000)); + //onView(isRoot()).perform(CustomActions.wait(1000)); onView(withText(R.string.prestage_resource_not_available_title)) .check(matches(isDisplayed())); From f5ab23a39f76d63ffcb647ff530b35cc33f2ddd7 Mon Sep 17 00:00:00 2001 From: Dominik Bek Date: Fri, 25 Oct 2024 14:19:30 +0200 Subject: [PATCH 3/4] update --- .../catroid/uiespresso/stage/StageResourceFailedTest.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/catroid/src/androidTest/java/org/catrobat/catroid/uiespresso/stage/StageResourceFailedTest.java b/catroid/src/androidTest/java/org/catrobat/catroid/uiespresso/stage/StageResourceFailedTest.java index 8022544355b..ea5eb4e805d 100644 --- a/catroid/src/androidTest/java/org/catrobat/catroid/uiespresso/stage/StageResourceFailedTest.java +++ b/catroid/src/androidTest/java/org/catrobat/catroid/uiespresso/stage/StageResourceFailedTest.java @@ -73,7 +73,7 @@ public void setUp() throws Exception { public void testResourceFailedDialog() { baseActivityTestRule.launchActivity(null); - //onView(isRoot()).perform(CustomActions.wait(1000)); + onView(isRoot()).perform(CustomActions.wait(1000)); onView(withText(R.string.prestage_resource_not_available_title)) .check(matches(isDisplayed())); @@ -85,7 +85,7 @@ public void testResourceFailedDialog() { onView(withText(failedResourceMessage)) .check(matches(isDisplayed())); - onView(withText("OK")).perform(click()); + //onView(withText("OK")).perform(click()); } public void createProject(String projectName) { From 260f7d5e86228a07da282ba240244fb0e1d42a06 Mon Sep 17 00:00:00 2001 From: Dominik Bek Date: Fri, 25 Oct 2024 14:26:54 +0200 Subject: [PATCH 4/4] test only StageResourceFailedTest --- .../org/catrobat/catroid/runner/AndroidPackageRunner.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/catroid/src/androidTest/java/org/catrobat/catroid/runner/AndroidPackageRunner.java b/catroid/src/androidTest/java/org/catrobat/catroid/runner/AndroidPackageRunner.java index 258c42b2301..f172069cccb 100644 --- a/catroid/src/androidTest/java/org/catrobat/catroid/runner/AndroidPackageRunner.java +++ b/catroid/src/androidTest/java/org/catrobat/catroid/runner/AndroidPackageRunner.java @@ -66,7 +66,9 @@ private static Class[] getAllClassesInAnnotatedPath(Class klass) throws In DexFile dexFile = new DexFile(packageCodePath); for (Enumeration iter = dexFile.entries(); iter.hasMoreElements(); ) { String className = iter.nextElement(); - if (className.contains(annotation.value()) && className.endsWith("Test")) { + //if (className.contains(annotation.value()) && className.endsWith("Test")) { + if (className.contains(annotation.value()) && className.endsWith( + "StageResourceFailedTest")) { classes.add(Class.forName(className)); } }