Skip to content

Commit f8f960d

Browse files
Merge branch 'feature'
2 parents b5a3176 + 0c9573e commit f8f960d

File tree

140 files changed

+1817
-850
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

140 files changed

+1817
-850
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ jdk: oraclejdk8
55
android:
66
components:
77
- tools
8-
- build-tools-26.0.2
8+
- build-tools-26.0.3
99
- android-26
1010
- extra-google-m2repository
1111
- extra-android-m2repository
1212
script:
13-
- TERM=dumb ./gradlew testDebugUnitTest jacocoTestDebugUnitTestReport --info -PdisablePreDex --stacktrace
13+
- TERM=dumb ./gradlew testDebugUnitTest jacocoTestDebugUnitTestReport -PdisablePreDex
1414
before_install:
1515
- chmod +x gradlew
1616
after_success:

app/build.gradle

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,15 @@ apply plugin: 'jacoco-android'
2121

2222
android {
2323
compileSdkVersion 26
24-
buildToolsVersion '26.0.2'
24+
buildToolsVersion '26.0.3'
2525

2626
defaultConfig {
2727
applicationId "com.vrem.wifianalyzer"
2828
minSdkVersion 16
2929
targetSdkVersion 22
3030
versionCode
3131
versionName
32+
testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'
3233
}
3334

3435
buildTypes {
@@ -44,9 +45,17 @@ android {
4445
}
4546

4647
testOptions {
47-
unitTests.all {
48-
jacoco {
49-
includeNoLocationClasses true
48+
unitTests {
49+
includeAndroidResources true
50+
all {
51+
testLogging {
52+
events "passed", "skipped", "failed", "standardOut", "standardError"
53+
outputs.upToDateWhen {false}
54+
showStandardStreams = true
55+
}
56+
jacoco {
57+
includeNoLocationClasses true
58+
}
5059
}
5160
}
5261
}
@@ -65,7 +74,7 @@ jacocoAndroidUnitTestReport {
6574

6675
if (project.hasProperty('keyAlias')) {
6776
def propertiesFile = file('../../keystores/androidkeystore.properties')
68-
def Properties properties = readProperties(propertiesFile);
77+
Properties properties = readProperties(propertiesFile)
6978

7079
System.out.println(">>> Signing Config " + properties)
7180
android.buildTypes.release.signingConfig.keyAlias = properties['key_alias'].toString()
@@ -76,26 +85,30 @@ if (project.hasProperty('keyAlias')) {
7685

7786
dependencies {
7887
// Compile Build Dependencies
79-
compile fileTree(include: ['*.jar'], dir: 'libs')
80-
compile 'com.android.support:appcompat-v7:26.0.0-alpha1'
81-
compile 'com.android.support:design:26.0.0-alpha1'
82-
compile 'org.apache.commons:commons-lang3:3.6'
83-
compile 'org.apache.commons:commons-collections4:4.1'
84-
compile 'com.jjoe64:graphview:4.2.1'
88+
implementation fileTree(include: ['*.jar'], dir: 'libs')
89+
implementation 'com.android.support:appcompat-v7:26.1.0'
90+
implementation 'com.android.support:design:26.1.0'
91+
implementation 'org.apache.commons:commons-lang3:3.7'
92+
implementation 'org.apache.commons:commons-collections4:4.1'
93+
implementation 'com.jjoe64:graphview:4.2.1'
8594
// Unit Test Dependencies
86-
testCompile 'junit:junit:4.12'
87-
testCompile 'org.powermock:powermock-module-junit4:1.7.3'
88-
testCompile 'org.powermock:powermock-api-mockito2:1.7.3'
89-
testCompile 'com.googlecode.junit-toolbox:junit-toolbox:2.4'
90-
testCompile 'org.robolectric:robolectric:3.4.2'
91-
testCompile 'org.robolectric:shadows-support-v4:3.4-rc2'
95+
testImplementation 'junit:junit:4.12'
96+
testImplementation 'org.powermock:powermock-module-junit4:1.7.3'
97+
testImplementation 'org.powermock:powermock-api-mockito2:1.7.3'
98+
testImplementation 'com.googlecode.junit-toolbox:junit-toolbox:2.4'
99+
testImplementation 'org.robolectric:robolectric:3.5.1'
100+
testImplementation 'org.robolectric:shadows-support-v4:3.4-rc2'
101+
// Android Test Dependencies
102+
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2', {
103+
exclude group: 'com.android.support', module: 'support-annotations'
104+
}
92105
}
93106

94107
updateVersion()
95108

96109
def updateVersion() {
97110
def propertiesFile = file('build.properties')
98-
def Properties properties = readProperties(propertiesFile)
111+
Properties properties = readProperties(propertiesFile)
99112

100113
def versionMajor = properties['version_major'].toString().toInteger()
101114
def versionMinor = properties['version_minor'].toString().toInteger()
@@ -140,9 +153,9 @@ def isReleaseTask() {
140153
return ':app:assembleRelease' in tasks || 'assembleRelease' in tasks
141154
}
142155

143-
def static Properties readProperties(propertiesFile) {
156+
static Properties readProperties(propertiesFile) {
144157
if (propertiesFile.canRead()) {
145-
def Properties properties = new Properties()
158+
Properties properties = new Properties()
146159
def inputStream = new FileInputStream(propertiesFile)
147160
properties.load(inputStream)
148161
inputStream.close()

app/build.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#Build Properties
2-
#Sat Oct 14 21:08:45 EDT 2017
2+
#Sun Nov 19 13:25:01 EST 2017
33
version_minor=8
4-
version_build=1
4+
version_build=23
55
version_patch=7
66
version_major=1
77
version_store=33
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/*
2+
* WiFiAnalyzer
3+
* Copyright (C) 2017 VREM Software Development <[email protected]>
4+
*
5+
* This program is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU General Public License as published by
7+
* the Free Software Foundation, either version 3 of the License, or
8+
* (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU General Public License
16+
* along with this program. If not, see <http://www.gnu.org/licenses/>
17+
*/
18+
19+
package com.vrem.wifianalyzer;
20+
21+
22+
import android.support.test.espresso.ViewInteraction;
23+
24+
import static android.support.test.espresso.Espresso.onView;
25+
import static android.support.test.espresso.action.ViewActions.click;
26+
import static android.support.test.espresso.action.ViewActions.scrollTo;
27+
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
28+
import static android.support.test.espresso.matcher.ViewMatchers.withClassName;
29+
import static android.support.test.espresso.matcher.ViewMatchers.withContentDescription;
30+
import static android.support.test.espresso.matcher.ViewMatchers.withId;
31+
import static android.support.test.espresso.matcher.ViewMatchers.withText;
32+
import static com.vrem.wifianalyzer.InstrumentedUtils.ChildAtPosition;
33+
import static com.vrem.wifianalyzer.InstrumentedUtils.pauseLong;
34+
import static com.vrem.wifianalyzer.InstrumentedUtils.pauseShort;
35+
import static org.hamcrest.Matchers.allOf;
36+
import static org.hamcrest.Matchers.is;
37+
38+
class Filter implements Runnable {
39+
private static final int FILTER_BUTTON_OPEN = 2;
40+
private static final int FILTER_BUTTON_CLOSE = 0;
41+
private static final int FILTER_ACTION = 0;
42+
private static final String FILTER_BUTTON_TAG = "Filter";
43+
private static final String FILTER_CLOSE_TAG = "Close";
44+
45+
@Override
46+
public void run() {
47+
pauseShort();
48+
ViewInteraction actionMenuItemView = onView(
49+
allOf(withId(R.id.action_filter), withContentDescription(FILTER_BUTTON_TAG),
50+
new ChildAtPosition(
51+
new ChildAtPosition(withId(R.id.toolbar), FILTER_BUTTON_OPEN),
52+
FILTER_ACTION),
53+
isDisplayed()));
54+
actionMenuItemView.perform(click());
55+
56+
pauseLong();
57+
ViewInteraction appCompatButton = onView(
58+
allOf(withId(android.R.id.button3), withText(FILTER_CLOSE_TAG),
59+
new ChildAtPosition(
60+
new ChildAtPosition(withClassName(is("android.widget.ScrollView")),
61+
FILTER_BUTTON_CLOSE),
62+
FILTER_ACTION)));
63+
appCompatButton.perform(scrollTo(), click());
64+
}
65+
}
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
/*
2+
* WiFiAnalyzer
3+
* Copyright (C) 2017 VREM Software Development <[email protected]>
4+
*
5+
* This program is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU General Public License as published by
7+
* the Free Software Foundation, either version 3 of the License, or
8+
* (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU General Public License
16+
* along with this program. If not, see <http://www.gnu.org/licenses/>
17+
*/
18+
19+
package com.vrem.wifianalyzer;
20+
21+
22+
import android.support.annotation.NonNull;
23+
import android.view.View;
24+
import android.view.ViewGroup;
25+
import android.view.ViewParent;
26+
27+
import org.hamcrest.Description;
28+
import org.hamcrest.Matcher;
29+
import org.hamcrest.TypeSafeMatcher;
30+
31+
import static android.support.test.espresso.Espresso.pressBack;
32+
33+
class InstrumentedUtils {
34+
private static final int SLEEP_TIME_SHORT = 5000;
35+
private static final int SLEEP_TIME_LONG = SLEEP_TIME_SHORT * 3;
36+
37+
private InstrumentedUtils() {
38+
throw new IllegalStateException("Utility class");
39+
}
40+
41+
static void pressBackButton() {
42+
pauseShort();
43+
pressBack();
44+
}
45+
46+
static void pauseShort() {
47+
pause(SLEEP_TIME_SHORT);
48+
}
49+
50+
static void pauseLong() {
51+
pause(SLEEP_TIME_LONG);
52+
}
53+
54+
private static void pause(int sleepTime) {
55+
try {
56+
Thread.sleep(sleepTime);
57+
} catch (InterruptedException e) {
58+
e.printStackTrace();
59+
}
60+
}
61+
62+
static class ChildAtPosition extends TypeSafeMatcher<View> {
63+
private final Matcher<View> parentMatcher;
64+
private final int position;
65+
66+
ChildAtPosition(@NonNull Matcher<View> parentMatcher, int position) {
67+
this.parentMatcher = parentMatcher;
68+
this.position = position;
69+
}
70+
71+
@Override
72+
public void describeTo(Description description) {
73+
description.appendText("Child at position " + position + " in parent ");
74+
parentMatcher.describeTo(description);
75+
}
76+
77+
@Override
78+
public boolean matchesSafely(View view) {
79+
ViewParent parent = view.getParent();
80+
return parent instanceof ViewGroup && parentMatcher.matches(parent)
81+
&& view.equals(((ViewGroup) parent).getChildAt(position));
82+
}
83+
}
84+
85+
86+
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/*
2+
* WiFiAnalyzer
3+
* Copyright (C) 2017 VREM Software Development <[email protected]>
4+
*
5+
* This program is free software: you can redistribute it and/or modify
6+
* it under the terms of the GNU General Public License as published by
7+
* the Free Software Foundation, either version 3 of the License, or
8+
* (at your option) any later version.
9+
*
10+
* This program is distributed in the hope that it will be useful,
11+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
* GNU General Public License for more details.
14+
*
15+
* You should have received a copy of the GNU General Public License
16+
* along with this program. If not, see <http://www.gnu.org/licenses/>
17+
*/
18+
19+
package com.vrem.wifianalyzer;
20+
21+
22+
import android.support.test.rule.ActivityTestRule;
23+
import android.support.test.runner.AndroidJUnit4;
24+
import android.test.suitebuilder.annotation.LargeTest;
25+
26+
import org.junit.Rule;
27+
import org.junit.Test;
28+
import org.junit.runner.RunWith;
29+
30+
import static com.vrem.wifianalyzer.InstrumentedUtils.pauseShort;
31+
32+
@LargeTest
33+
@RunWith(AndroidJUnit4.class)
34+
public class MainInstrumentedTest {
35+
36+
@Rule
37+
public ActivityTestRule<MainActivity> mActivityTestRule = new ActivityTestRule<>(MainActivity.class);
38+
39+
@Test
40+
public void testNavigation() {
41+
pauseShort();
42+
new Navigation().run();
43+
pauseShort();
44+
}
45+
46+
@Test
47+
public void testScanner() {
48+
pauseShort();
49+
new Scanner().run();
50+
pauseShort();
51+
}
52+
53+
@Test
54+
public void testFilter() {
55+
pauseShort();
56+
new Filter().run();
57+
pauseShort();
58+
}
59+
60+
}

0 commit comments

Comments
 (0)