Commit d0134f3a authored by Hussein's avatar Hussein

Merge remote-tracking branch 'origin-service/master' into develop

parents 73caa233 b8c748d0
......@@ -60,7 +60,8 @@ buildscript {
'mockitoKotlin' : '1.5.0',
'truth' : '0.35',
'espresso' : '3.1.1',
'uiAutomator' : '2.2.0'
'uiAutomator' : '2.2.0',
'cucumber' : '4.4.0'
]
abiCodes = [
......
......@@ -130,14 +130,21 @@ dependencies {
testImplementation "org.robolectric:shadows-multidex:${versions.robolectric}"
// Cucumber
androidTestImplementation('info.cukes:cucumber-android:1.2.4') {
/* androidTestImplementation('info.cukes:cucumber-android:1.2.4') {
exclude module: 'cucumber-jvm-deps'
}
androidTestImplementation('info.cukes:cucumber-picocontainer:1.2.4') {
exclude module: 'cucumber-jvm-deps'
}
androidTestImplementation 'info.cukes:cucumber-jvm-deps:1.0.5'
androidTestImplementation 'info.cukes:cucumber-jvm-deps:1.0.5'*/
/*androidTestImplementation group: 'io.cucumber', name: 'cucumber-java', version: '4.2.3'
androidTestImplementation group: 'io.cucumber', name: 'cucumber-junit', version: '4.2.3'*/
androidTestImplementation "io.cucumber:cucumber-android:${versions.cucumber}"
androidTestImplementation "io.cucumber:cucumber-picocontainer:${versions.cucumber}"
// Screenshots
androidTestImplementation 'com.squareup.spoon:spoon-client:1.7.1'
androidTestImplementation('com.schibsted.spain:barista:2.8.0') {
......@@ -160,9 +167,8 @@ android {
setProperty("archivesBaseName", "$buildConfig.versionName-$versionCode")
generatedDensities = ["mdpi", "hdpi", "xhdpi"]
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
testApplicationId "com.fsck.k9.pEp.ui.activities.test"
// testInstrumentationRunner "com.fsck.k9.pEp.ui.activities.runner.CucumberTestRunner"
testInstrumentationRunner "com.fsck.k9.pEp.ui.activities.test.CucumberTestCase"
multiDexEnabled true
vectorDrawables.useSupportLibrary = true
......
Feature: Test
Background:
Given I created an account
@TM-01
Scenario Outline: Cucumber Click on Search button
@QA-sync
Scenario Outline: Cucumber KeySync
When I select account <account>
Then I remove account 0
And I keysync devices A and B
And I keysync device C
And I setup second account for devices A and B
Then I remove from keysync device C
Examples:
|account|
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
| 0 |
......@@ -68,7 +68,7 @@ public class AssertColorContactInSentItemsWhenDisableProtectionTest {
// TODO FIX TEST
@Test (timeout = TIMEOUT_TEST)
public void sendMessageToYourselfWithDisabledProtectionAndCheckReceivedMessageIsUnsecure() {
testUtils.createAccount();
//testUtils.createAccount();
composeMessage();
checkPEpStatus(Rating.pEpRatingTrusted);
selectFromMenu(R.string.pep_force_unprotected);
......@@ -81,7 +81,7 @@ public class AssertColorContactInSentItemsWhenDisableProtectionTest {
goToSentFolder();
testUtils.clickFirstMessage();
// testUtils.clickView(R.id.tvPep);
testUtils.assertMessageStatus(Rating.pEpRatingTrusted.value);
testUtils.assertMessageStatus(Rating.pEpRatingTrusted);
testUtils.goBackAndRemoveAccount();
}
......
......@@ -57,7 +57,7 @@ public class AttachFilesToEmailTest {
private void attachFilesToAccount(boolean isGmail) {
testUtils.increaseTimeoutWait();
testUtils.createAccount();
//testUtils.createAccount();
testUtils.composeMessageButton();
messageTo = getTextFromView(onView(withId(R.id.identity)));
testUtils.fillMessage(new TestUtils.BasicMessage("", "Subject", "Message", messageTo), true);
......
......@@ -61,7 +61,7 @@ public class BackButtonDeviceAfterHandshakeButtonPressedTest {
@Test (timeout = TIMEOUT_TEST)
public void backButtonDeviceAfterHandshakeButtonPressed() {
testUtils.createAccount();
//testUtils.createAccount();
sendMessages(3);
device.waitForIdle();
testUtils.waitForMessageAndClickIt();
......
......@@ -49,7 +49,7 @@ public class ConfigureSeveralAccountsRemoveThemAndSetUpNewOne {
public void ConfigureAccountRemoveThemSetUpNewAccount() {
int total = 14;
for (int account = 0; account < total; account++) {
testUtils.createAccount();
//testUtils.createAccount();
testUtils.goBackAndRemoveAccount();
device.waitForIdle();
}
......
......@@ -61,7 +61,7 @@ public class GreenStatusEmailTest {
private void greenStatusMessageTest() {
testUtils.increaseTimeoutWait();
testUtils.createAccount();
//testUtils.createAccount();
testUtils.composeMessageButton();
testUtils.testStatusEmpty();
device.waitForIdle();
......
package com.fsck.k9.pEp.ui.activities;
import androidx.test.espresso.IdlingRegistry;
import androidx.test.espresso.intent.rule.IntentsTestRule;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.LargeTest;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;
import androidx.test.uiautomator.UiDevice;
import com.fsck.k9.R;
......@@ -17,7 +18,6 @@ import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import foundation.pEp.jniadapter.Rating;
import static androidx.test.espresso.Espresso.onView;
......@@ -56,7 +56,7 @@ public class GreyStatusMessageTest {
private void greyStatusEmailTest(boolean isGmail) {
testUtils.increaseTimeoutWait();
testUtils.createAccount();
//testUtils.createAccount();
testUtils.composeMessageButton();
testUtils.testStatusEmpty();
testUtils.testStatusMail(new TestUtils.BasicMessage("", "Subject", "Message", EMAIL),
......
......@@ -52,7 +52,7 @@ public class GreyStatusMessageTestUIAutomator {
public void greyStatusMessageTest(boolean isGmail) {
testUtils.increaseTimeoutWait();
testUtils.createAccount();
//testUtils.createAccount();
testUtils.composeMessageButton();
testUtils.testStatusEmpty();
testUtils.testStatusMail(new TestUtils.BasicMessage("", "Subject", "Message", EMAIL),
......
......@@ -48,7 +48,7 @@ public class ImportSettingsCancelFromAccountTest {
public void importSettingsCancelTest(boolean isGmail) {
testUtils.increaseTimeoutWait();
testUtils.createAccount();
//testUtils.createAccount();
device.waitForIdle();
testUtils.pressBack();
device.waitForIdle();
......
......@@ -55,7 +55,7 @@ public class ImportSettingsCancelTest {
private void importSettingsTest(boolean isGmail) {
testUtils.increaseTimeoutWait();
testUtils.externalAppRespondWithFile(R.raw.settingsthemedark);
testUtils.createAccount();
//testUtils.createAccount();
testUtils.pressBack();
device.waitForIdle();
testUtils.pressBack();
......
......@@ -51,7 +51,7 @@ public class ImportSettingsDarkThemeTest {
@Test (timeout = TIMEOUT_TEST)
public void importSettingDarkTheme() {
testUtils.createAccount();
//testUtils.createAccount();
testUtils.pressBack();
testUtils.openOptionsMenu();
device.waitForIdle();
......
......@@ -65,7 +65,7 @@ public class InboxActionBarChangingColorTest {
@Test (timeout = TIMEOUT_TEST)
public void assertActionBarColorIsNotChanging() {
testUtils.increaseTimeoutWait();
testUtils.createAccount();
//testUtils.createAccount();
assertSelfMessageColor();
assertBotMessageColor();
testUtils.goBackAndRemoveAccount();
......@@ -83,7 +83,7 @@ public class InboxActionBarChangingColorTest {
testUtils.waitForNewMessage();
//testUtils.clickLastMessageReceived();
// testUtils.clickView(R.id.tvPep);
testUtils.assertMessageStatus(Rating.pEpRatingTrusted.value);
testUtils.assertMessageStatus(Rating.pEpRatingTrusted);
device.waitForIdle();
testUtils.pressBack();
checkToolbarColor(R.color.pep_green);
......
......@@ -59,7 +59,7 @@ public class MessageUnsecureWhenDisableProtectionTest {
@Test (timeout = TIMEOUT_TEST)
public void sendMessageToYourselfWithDisabledProtectionAndCheckReceivedMessageIsUnsecure() {
testUtils.createAccount();
//testUtils.createAccount();
composeMessage();
//testUtils.checkStatus(Rating.pEpRatingTrusted);
testUtils.pressBack();
......
......@@ -64,7 +64,7 @@ public class RemoveContactsFromMessageAndKeepOriginalToolbarColor {
@Test (timeout = TIMEOUT_TEST)
public void assertRemoveTwoDifferentColorContactsAndKeepOriginalToolbarColor() {
testUtils.increaseTimeoutWait();
testUtils.createAccount();
//testUtils.createAccount();
messageFrom = testUtils.getTextFromTextViewThatContainsText("@");
assertToolBarHasNoColorWhenUnkownReceiver(messageFrom);
assertToolBarHasNoColorWhenUnkownReceiver("random@test.pep-security.net");
......
......@@ -56,7 +56,7 @@ public class SendMessageIsBlockedAfterChekingpEpStatus {
@Test (timeout = TIMEOUT_TEST)
public void sendMessageToYourselfWithDisabledProtectionAndCheckReceivedMessageIsUnsecure() {
testUtils.createAccount();
//testUtils.createAccount();
composeSelfMessage();
testUtils.checkStatus(Rating.pEpRatingTrusted);
testUtils.pressBack();
......
......@@ -68,7 +68,7 @@ public class StatusIncomingMessageTest {
// TODO FIX TEST
private void assertPartnerStatusIsTrusted() {
testUtils.createAccount();
//testUtils.createAccount();
testUtils.composeMessageButton();
device.waitForIdle();
testUtils.fillMessage(new TestUtils.BasicMessage("", MESSAGE_SUBJECT, MESSAGE_BODY, messageTo), false);
......@@ -79,7 +79,7 @@ public class StatusIncomingMessageTest {
testUtils.clickMessageStatus();
testUtils.clickView(R.id.confirmTrustWords);
// testUtils.clickView(R.id.tvPep);
testUtils.assertMessageStatus(Rating.pEpRatingTrusted.value);
//testUtils.assertMessageStatus(Rating.pEpRatingTrusted.value);
device.waitForIdle();
goBackToMessageList();
}
......
......@@ -66,7 +66,7 @@ public class StoreDraftEncryptedOnTrustedServersWhenNeverUnprotected {
@Test
public void StoreDraftEncryptedOnTrustedServersWhenNeverUnprotected() {
testUtils.createAccount();
//testUtils.createAccount();
storeMessagesSecurely();
testUtils.goBackToMessageListAndPressComposeMessageButton();
device.waitForIdle();
......
......@@ -157,6 +157,23 @@ public class UtilsPackage {
};
}
public static Matcher<View> withTextColor(final int expectedId) {
return new BoundedMatcher<View, TextView>(TextView.class) {
@Override
protected boolean matchesSafely(TextView textView) {
int colorId = ContextCompat.getColor(textView.getContext(), expectedId);
return textView.getCurrentTextColor() == colorId;
}
@Override
public void describeTo(Description description) {
description.appendText("with text color: ");
description.appendValue(expectedId);
}
};
}
public static int getViewColorHSV(ViewInteraction interaction) {
final int[] color = new int[1];
interaction.perform(new ViewAction() {
......
......@@ -79,7 +79,7 @@ public class YellowStatusEmailFromBotTest {
}
// TODO FIX TEST
public void sendMessageAndAssertYellowStatusMessage() {
testUtils.createAccount();
//testUtils.createAccount();
testUtils.composeMessageButton();
device.waitForIdle();
testUtils.fillMessage(new TestUtils.BasicMessage("", MESSAGE_SUBJECT, MESSAGE_BODY, messageTo), false);
......
/*
package com.fsck.k9.pEp.ui.activities.runner;
import android.os.Bundle;
......@@ -6,19 +7,23 @@ import android.os.Bundle;
import cucumber.api.CucumberOptions;
import cucumber.api.android.CucumberInstrumentationCore;
*/
/**
* Used in build.gradle/testInstrumentationRunner to run Cucumber tests
* 'testInstrumentationRunner' variable in build.gradle has to point to this package
* This class must be in a different package than the glue code
* (this class is in '...cucumber.runner' and glue is in '...cucumber.steps')
*/
*//*
public class CucumberTestRunner extends androidx.test.runner.AndroidJUnitRunner {
public static final String TAG = com.fsck.k9.pEp.ui.activities.runner.CucumberTestRunner.class.getSimpleName();
/**
*/
/**
* This is the item Cucumber uses to identify the tags parameter, see method
* cucumber-android-1.2.2.jar\cucumber\runtime\android\Arguments.class @ getCucumberOptionsString()
*/
*//*
private static final String CUCUMBER_TAGS_KEY = "tags";
private final CucumberInstrumentationCore instrumentationCore = new CucumberInstrumentationCore(this);
......@@ -26,12 +31,14 @@ public class CucumberTestRunner extends androidx.test.runner.AndroidJUnitRunner
public void onCreate(final Bundle bundle) {
super.onCreate(bundle);
// Read tags passed as parameters and overwrite @CucumberOptions tags inside CucumberTestCase.java
/*final String tags = BuildConfig.TEST_TAGS;
*/
/*final String tags = BuildConfig.TEST_TAGS;
if (!tags.isEmpty()) {
// Reformat tags list to separate items with '--' as expected by Cucumber library, see method
// cucumber-android-1.2.2.jar\cucumber\runtime\android\Arguments.class @ appendOption()
bundle.putString(CUCUMBER_TAGS_KEY, tags.replaceAll(",", "--").replaceAll("\\s",""));
}*/
}*//*
instrumentationCore.create(bundle);
}
......@@ -40,4 +47,4 @@ public class CucumberTestRunner extends androidx.test.runner.AndroidJUnitRunner
waitForIdleSync();
instrumentationCore.start();
}
}
\ No newline at end of file
}*/
package com.fsck.k9.pEp.ui.activities.test;
import org.junit.runner.RunWith;
import cucumber.api.CucumberOptions;
import cucumber.api.android.CucumberAndroidJUnitRunner;
import cucumber.api.junit.Cucumber;
@RunWith(Cucumber.class)
/**
* This class configures the Cucumber test framework and Java glue code
*
......@@ -12,7 +17,7 @@ import cucumber.api.CucumberOptions;
* 3- Tag your scenarios in the feature files with new specific tags for each flavor and include them in the flavor's version of this file
* i.e. Add tag @flavor-one to a test scenario and modify the flavor's CucumberTestCase.java with tags={"~@manual", "@flavor-one"}
*/
@CucumberOptions(features = "features/AATest.feature", // Test scenarios
@CucumberOptions(features = {"features/AATest.feature"}, // Test scenarios
glue = {"com.fsck.k9.pEp.ui.activities.cucumber.steps"} // Steps definitions
/*, format = {"pretty", // Cucumber report formats and location to store them in phone/emulator
"html:/data/data/security.pEp/files/cucumber-html-report",
......@@ -22,12 +27,15 @@ import cucumber.api.CucumberOptions;
// the following path here and in the build.gradle: /data/data/com.neoranga55.cleanguitestarchitecture/cucumber-reports/
}*/
//,plugin = {"json:target/cucumber.json"}
,plugin = {"pretty", "json:/data/data/security.pEp.debug/cucumber-reports/cucumber.json"} //IMPORTANT!!!!!!!!!!!!!!!!!!!!!!!!!!!: Change the cucumber.json name file to create save_report.apk file
//,plugin = {"pretty", "json:/mnt/sdcard/files/cucumber.json"}
,monochrome = true
,plugin = {"pretty", "json:/data/data/security.pEp.debug/cucumber-reports/cucumber.json"
//, "html:/data/data/security.pEp.debug/cucumber-reports/"
//, "de.monochromata.cucumber.report.PrettyReports:/data/data/security.pEp.debug/cucumber-reports/pretty-cucumber" //IMPORTANT!!!!!!!!!!!!!!!!!!!!!!!!!!!: Change the cucumber.json name file to create save_report.apk file
//,plugin = {"pretty", "json:/mnt/sdcard/files/cucumber.json"
}
//,monochrome = true
,tags={"~@ignore"}
)
// This class must be in a different package than the glue code
// (this class is in '...cucumber.test' and glue is in '...cucumber.steps')
public class CucumberTestCase {
public class CucumberTestCase extends CucumberAndroidJUnitRunner {
}
\ No newline at end of file
package com.fsck.k9.pEp.ui.fragments;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.LargeTest;
import androidx.test.rule.ActivityTestRule;
......@@ -17,7 +16,7 @@ import static androidx.test.espresso.matcher.ViewMatchers.isDisplayed;
import static androidx.test.espresso.matcher.ViewMatchers.withId;
@RunWith(AndroidJUnit4.class)
//@RunWith(AndroidJUnit4.class)
@LargeTest
public class AccountSetupBasicsFragmentTest {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment