Android Open Source - android-cd-travis-example Cities Activity Functional Tests






From Project

Back to project page android-cd-travis-example.

License

The source code is released under:

MIT License

If you think the Android project android-cd-travis-example listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.ruenzuo.weatherapp.test;
//from   ww w.ja va  2s.  c o  m
import android.app.Instrumentation;
import android.test.ActivityInstrumentationTestCase2;
import android.test.ViewAsserts;

import com.ruenzuo.weatherapp.BuildConfig;
import com.ruenzuo.weatherapp.activities.CitiesActivity;
import com.ruenzuo.weatherapp.activities.CityActivity;

public class CitiesActivityFunctionalTests extends ActivityInstrumentationTestCase2 <CitiesActivity> {

    private CitiesActivity activity;

    public CitiesActivityFunctionalTests() {
        super(CitiesActivity.class);
    }

    @Override
    protected void setUp() throws Exception {
        super.setUp();
        setActivityInitialTouchMode(false);
        activity = getActivity();
    }

    public void testActivity() throws Throwable {
        Instrumentation.ActivityMonitor monitor = getInstrumentation().addMonitor(CityActivity.class.getName(), null, false);
        if (BuildConfig.IS_FREE) {
            Thread.sleep(5000);
            ViewAsserts.assertOnScreen(activity.getWindow().getDecorView(), activity.getAdView());
            assertEquals(false, activity.getSearchItem().isVisible());
        }
        else {
            ViewAsserts.assertOnScreen(activity.getWindow().getDecorView(), activity.getSearchItem().getActionView());
            assertNull(activity.getAdView());
        }
    }

}




Java Source Code List

com.ruenzuo.weatherapp.activities.CitiesActivity.java
com.ruenzuo.weatherapp.activities.CitiesActivity.java
com.ruenzuo.weatherapp.activities.CityActivity.java
com.ruenzuo.weatherapp.activities.CityActivity.java
com.ruenzuo.weatherapp.adapters.CitiesAdapter.java
com.ruenzuo.weatherapp.adapters.CityAdapter.java
com.ruenzuo.weatherapp.base.CitiesBaseActivity.java
com.ruenzuo.weatherapp.base.CityBaseActivity.java
com.ruenzuo.weatherapp.fragments.CitiesListFragment.java
com.ruenzuo.weatherapp.fragments.CityFragment.java
com.ruenzuo.weatherapp.pojos.City.java
com.ruenzuo.weatherapp.pojos.Coordinate.java
com.ruenzuo.weatherapp.pojos.Forecast.java
com.ruenzuo.weatherapp.pojos.ListCities.java
com.ruenzuo.weatherapp.requests.CityJsonRequest.java
com.ruenzuo.weatherapp.test.CitiesActivityFunctionalTests.java
com.ruenzuo.weatherapp.test.CityActivityFunctionalTests.java