Skip to content

Commit

Permalink
Remove failed test screenshots
Browse files Browse the repository at this point in the history
  • Loading branch information
lkorth committed Nov 11, 2015
1 parent a072c7c commit e3dcede
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 86 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,3 @@ Gemfile.lock
.bundle
*.iml
build
failed_test_screenshots
Original file line number Diff line number Diff line change
Expand Up @@ -29,26 +29,18 @@
import static android.support.test.espresso.Espresso.setFailureHandler;

@RunWith(AndroidJUnit4.class)
public class BraintreePaymentActivityTestRunner implements FailureHandler {

@Rule
public TestName mTestName = new TestName();
public class BraintreePaymentActivityTestRunner {

@Rule
public ActivityTestRule<BraintreePaymentTestActivity> mActivityTestRule =
new ActivityTestRule<>(BraintreePaymentTestActivity.class, true, false);

private FailureHandler mDelegate;

@SuppressWarnings("deprecation")
@Before
public void setUp() {
BraintreeHttpClient.DEBUG = true;
PayPalTestSignatureVerification.disableAppSwitchSignatureVerification();

mDelegate = new DefaultFailureHandler(getTargetContext());
setFailureHandler(this);

((KeyguardManager) getTargetContext().getSystemService(Context.KEYGUARD_SERVICE))
.newKeyguardLock("BraintreePaymentActivity")
.disableKeyguard();
Expand Down Expand Up @@ -76,17 +68,6 @@ public BraintreePaymentActivity getActivity(Intent intent) {
return mActivityTestRule.launchActivity(intent);
}

@Override
public void handle(Throwable throwable, Matcher<View> matcher) {
if (!ViewHelper.sWaitingForView) {
Log.d("request_screenshot", mTestName.getMethodName() + "-" + System.currentTimeMillis());
SystemClock.sleep(500);
} else {
SystemClock.sleep(20);
}
mDelegate.handle(throwable, matcher);
}

@Test(timeout = 100)
public void test(){}
}
2 changes: 0 additions & 2 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,9 @@ task :tests => :lint do
if output.match(/device$/)
begin
sh "ruby script/httpsd.rb /tmp/httpsd.pid"
log_listener_pid = fork { exec 'ruby', 'script/log_listener.rb' }
sh "./gradlew --continue runAllTests connectedAndroidTest"
ensure
`kill -9 \`cat /tmp/httpsd.pid\``
`kill -9 #{log_listener_pid}`
end
else
puts "Please connect a device or start an emulator and try again"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,28 +27,19 @@ public class ViewHelper {
public static final int TEN_SECONDS = 10000;
public static final int FIFTEEN_SECONDS = 15000;

public static boolean sWaitingForView;

public static ViewInteraction waitForView(final Matcher<View> viewFinder, Matcher<View> viewCondition, final long millis) {
checkNotNull(viewFinder);

final long endTime = System.currentTimeMillis() + millis;
ViewHelper.sWaitingForView = true;

do {
try {
ViewInteraction interaction = onView(viewFinder);
interaction.check(matches(viewCondition));

ViewHelper.sWaitingForView = false;
return interaction;
} catch (Exception ignored) {
} catch (Error ignored) {
}
} catch (Exception | Error ignored) {}
} while (System.currentTimeMillis() < endTime);

ViewHelper.sWaitingForView = false;

ViewInteraction interaction = onView(viewFinder);
interaction.check(matches(viewCondition));

Expand Down
3 changes: 0 additions & 3 deletions ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ cleanup_android() {
$android_adb emu kill
$android_adb kill-server
kill -9 `cat /tmp/httpsd.pid`
kill -9 $log_listener_pid
}

start_adb() {
Expand Down Expand Up @@ -117,8 +116,6 @@ cd_android
wait_for_emulator
ruby script/httpsd.rb /tmp/httpsd.pid
ruby script/log_listener.rb &
log_listener_pid=$!
$android_path/gradlew --info --continue --no-color runAllTests connectedAndroidTest
test_return_code=$?
Expand Down
50 changes: 0 additions & 50 deletions script/log_listener.rb

This file was deleted.

0 comments on commit e3dcede

Please sign in to comment.