Sha256: 7980c204e4b06f95545e3aa54f47ca9ce5298230bf4523987da2867676b524bf

Contents?: true

Size: 1.38 KB

Versions: 159

Compression:

Stored size: 1.38 KB

Contents

package sh.calaba.instrumentationbackend.actions.spinner;


import sh.calaba.instrumentationbackend.InstrumentationBackend;
import sh.calaba.instrumentationbackend.Result;
import sh.calaba.instrumentationbackend.TestHelpers;
import sh.calaba.instrumentationbackend.actions.Action;
import android.view.View;
import android.widget.Spinner;

/**
 * Action for selecting a item from a Spinner
 * First arg is the content description of the Spinner
 * Second arg is the text of the item to be selected
 *
 */
public class SelectSpinnerItemByContentDescription implements Action {

    @Override
    public Result execute(String... args) {
        String contentDescription = args[0];
        String item = args[1];
        View view = TestHelpers.getViewByDescription(contentDescription);
        if(view == null) {
        	
            return new Result(false, "No view found with content description: '" + contentDescription + "'");
        } else if (!(view instanceof Spinner)) {
            return new Result(false, "Expected Spinner found: '" + view.getClass() + "'");
        } else {
        	//Open spinner
            InstrumentationBackend.solo.clickOnView(view);
            //Select item
            InstrumentationBackend.solo.clickOnText(item);
            return Result.successResult();
        }
    }

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

}

Version data entries

159 entries across 159 versions & 2 rubygems

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