Sha256: 2d2033ade9345f3c2bd94dec0b9af1171c757051936a06433855609f2c793ca0

Contents?: true

Size: 1.09 KB

Versions: 121

Compression:

Stored size: 1.09 KB

Contents

package sh.calaba.instrumentationbackend.actions.wait;


import sh.calaba.instrumentationbackend.InstrumentationBackend;
import sh.calaba.instrumentationbackend.Result;
import sh.calaba.instrumentationbackend.actions.Action;


public class WaitForText implements Action {

    @Override
    public Result execute(String... args) {
        
        int timeout = 90 * 1000;
        if (args.length > 1) { // a second argument is a timeout
            try {
                // the argument is in seconds but robotium takes milliseconds
                timeout = 1000 * Integer.parseInt(args[1]);
            } catch (NumberFormatException e) {
                return new Result(false, "Invalid timeout supplied. Should be an integer."); 
            }
        }
 
        boolean timedOut = !InstrumentationBackend.solo.waitForText(args[0], 1, timeout);
        if(timedOut) {
            return new Result(false, "Time out while waiting for text:" + args[0]);
        } else {
            return Result.successResult();
        }

    }

    @Override
    public String key() {
        return "wait_for_text";
    }
}

Version data entries

121 entries across 121 versions & 2 rubygems

Version Path
calabash-android-0.4.10.pre4 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/wait/WaitForText.java
calabash-android-0.4.10.pre3 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/wait/WaitForText.java
calabash-android-0.4.10.pre2 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/wait/WaitForText.java
calabash-android-0.4.10.pre1 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/wait/WaitForText.java
calabash-android-0.4.9 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/wait/WaitForText.java
testautoa-0.4.5 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/wait/WaitForText.java
calabash-android-0.4.9.pre4 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/wait/WaitForText.java
calabash-android-0.4.9.pre3 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/wait/WaitForText.java
calabash-android-0.4.9.pre2 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/wait/WaitForText.java
calabash-android-0.4.9.pre1 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/wait/WaitForText.java
calabash-android-0.4.8 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/wait/WaitForText.java
calabash-android-0.4.7.pre10 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/wait/WaitForText.java
calabash-android-0.4.7.pre9 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/wait/WaitForText.java
calabash-android-0.4.7.pre8 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/wait/WaitForText.java
calabash-android-0.4.7.pre7 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/wait/WaitForText.java
calabash-android-0.4.7.pre6 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/wait/WaitForText.java
calabash-android-0.4.7.pre4 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/wait/WaitForText.java
calabash-android-0.4.7.pre3 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/wait/WaitForText.java
calabash-android-0.4.7.pre2 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/wait/WaitForText.java
calabash-android-0.4.7.pre1 test-server/instrumentation-backend/src/sh/calaba/instrumentationbackend/actions/wait/WaitForText.java