Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ android {
}
}


// Force same version as in the app
configurations.all {
resolutionStrategy {
Expand Down Expand Up @@ -76,4 +77,6 @@ dependencies {
// or "androidTestCompile", depending on the app's implementation
// androidTestCompile for now, might change later
androidTestCompile 'com.android.support.test.espresso:espresso-idling-resource:3.0.0'

}

22 changes: 11 additions & 11 deletions app/src/androidTest/assets/user.properties
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
name=Boris
last_name=Gurtovoy
address1=my street 666
city=Los Angeles
state=CA
zip=90007
email_login=borisqa@bayqa.com
password_login=bayqa12345
bank_name=Chase
account_number=21367823612765372
password_bank=password12345
name = Joy
email = bayQaTraining@email.com
passwordForLogin = password2017
bankName = Wells Fargo
accountNumber = 00002345234
passwordForBankAccount = passwordBank
lastName= Taylor
city=San Francisco
street1 = my street
state = CA
zip = 94134
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package io.mattcarroll.androidtesting.signup;

import android.content.res.AssetManager;
import android.content.res.Resources;
import android.support.test.InstrumentationRegistry;

import org.junit.Before;

import java.io.IOException;
import java.util.Properties;

/**
* Created by abzalbek on 9/10/17.
*/

public class BaseTest {

private Properties properties;

public Properties getProperties() {
return properties;
}

public void setProperties(Properties properties) {
this.properties = properties;
}

// triggering method before tests
@Before
public void baseSetUp() throws IOException {
properties = new Properties();
AssetManager testAssetManager = InstrumentationRegistry.getContext().getAssets();
AssetManager.AssetInputStream assetStream = (AssetManager.AssetInputStream) testAssetManager.open("user.properties");
properties.load(assetStream);

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
package io.mattcarroll.androidtesting.signup.PageObjects;

import android.support.annotation.NonNull;

import io.mattcarroll.androidtesting.R;

import static android.support.test.espresso.Espresso.closeSoftKeyboard;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.Espresso.pressBack;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.action.ViewActions.typeText;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
import static android.support.test.espresso.matcher.ViewMatchers.withId;

/**
* Created by abzalbek on 9/18/17.
*/

public class BankAccountPage {
public BankAccountPage() {
onView(withId(R.id.edittext_bank_name))
.check(matches(isDisplayed()));
}

public BankAccountPage fillBankName(@NonNull String bankName){
onView(withId(R.id.edittext_bank_name))
.perform(typeText(bankName));
return this;
}

public BankAccountPage fillAccountNumber(@NonNull String accountNumber){
onView(withId(R.id.edittext_account_number))
.perform(typeText(accountNumber));
return this;
}
public BankAccountPage fillPassword(@NonNull String password){
onView(withId(R.id.edittext_password))
.perform(typeText(password));
return this;
}

public void goBack(){
closeSoftKeyboard();
pressBack();
}
public void pressLinkAccountButton(){
onView(withId(R.id.button_link_account))
.perform(click());
}

// decided to skip assertation of error!!!!
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
package io.mattcarroll.androidtesting.signup.PageObjects;

import android.support.annotation.NonNull;

import io.mattcarroll.androidtesting.R;

import static android.support.test.espresso.Espresso.closeSoftKeyboard;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.Espresso.pressBack;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.action.ViewActions.typeText;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.matcher.ViewMatchers.hasErrorText;
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
import static android.support.test.espresso.matcher.ViewMatchers.withId;

/**
* Created by abzalbek on 9/18/17.
*/

public class CredentialsPage {

public CredentialsPage() {
onView(withId(R.id.autocompletetextview_email)).check(matches(isDisplayed()));
}

public CredentialsPage typeTextToEmailField(String email){
onView(withId(R.id.autocompletetextview_email)).perform(typeText(email));
return this;
}

public CredentialsPage typeTextToPasswordField(String passwrod){
onView(withId(R.id.edittext_password)).perform(typeText(passwrod));
return this;
}

public CredentialsPage assertHasEmailError(@NonNull String error){
onView(withId(R.id.autocompletetextview_email))
.check(matches(hasErrorText(error)));
return this;
}

public CredentialsPage assertHasPasswordError(@NonNull String error){
onView(withId(R.id.edittext_password))
.check(matches(hasErrorText(error)));
return this;
}

public void goBack(){
closeSoftKeyboard();
pressBack();
}
//button_next
public void clickOnSignUPButton(){
onView(withId(R.id.button_next))
.perform(click());
}

public SignUPSuccesFullPage submitAndSuccess(){
clickOnSignUPButton();
return new SignUPSuccesFullPage();
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
package io.mattcarroll.androidtesting.signup.PageObjects;

import io.mattcarroll.androidtesting.R;

import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
import static android.support.test.espresso.matcher.ViewMatchers.withId;

/**
* Created by abzalbek on 9/14/17.
*/

public class HomeActivityPage {

public HomeActivityPage() {

onView(withId(R.id.textview_no_accounts)).check(matches(isDisplayed()));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
package io.mattcarroll.androidtesting.signup.PageObjects;


import android.support.annotation.NonNull;

import io.mattcarroll.androidtesting.R;

import static android.support.test.espresso.Espresso.onData;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.Espresso.pressBack;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.action.ViewActions.scrollTo;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
import static android.support.test.espresso.matcher.ViewMatchers.withId;
import static android.support.test.espresso.matcher.ViewMatchers.withText;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.Matchers.allOf;
import static org.hamcrest.Matchers.hasToString;
import static org.hamcrest.Matchers.is;

/**
* Created by abzalbek on 9/14/17.
*/

public class InterestsPage {
public InterestsPage() {

onView(withId(R.id.listview_interests)).check(matches(isDisplayed()));
}
// very important!!!
public InterestsPage clickOnView(@NonNull String ...interests) {
for (String interest:interests){
onData(is(interest)).perform(click());
}
return this;
}
// that one for checking
public static void scrollingListView(String itemName) {
onData(allOf(is(instanceOf(String.class)), is(itemName))).perform(
scrollTo()
);
}

public void back() {
pressBack();
}

public void pressNext(){
onView(withId(R.id.button_next)).perform(
click());
}

public CredentialsPage submitAndExpectCredendialPage(){
pressNext();
return new CredentialsPage();
}

public void checkingPopUP(){
onView(withId(R.id.title_template)).check(matches(isDisplayed()));
}


}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package io.mattcarroll.androidtesting.signup.PageObjects;

import io.mattcarroll.androidtesting.R;

import static android.support.test.espresso.Espresso.closeSoftKeyboard;
import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.Espresso.pressBack;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
import static android.support.test.espresso.matcher.ViewMatchers.withId;

/**
* Created by abzalbek on 9/18/17.
*/

public class LinkAccountPage {
public LinkAccountPage() {
onView(withId(R.id.fab_manage_accounts))
.check(matches(isDisplayed()));
}

public void goBack() {
closeSoftKeyboard();
pressBack();
}

public ListLinkAccountPage addButton(){
onView(withId(R.id.fab_manage_accounts))
.perform(click());
return new ListLinkAccountPage();
}

}





Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package io.mattcarroll.androidtesting.signup.PageObjects;

import io.mattcarroll.androidtesting.R;

import static android.support.test.espresso.Espresso.onView;
import static android.support.test.espresso.action.ViewActions.click;
import static android.support.test.espresso.assertion.ViewAssertions.matches;
import static android.support.test.espresso.matcher.ViewMatchers.isDisplayed;
import static android.support.test.espresso.matcher.ViewMatchers.withId;

/**
* Created by abzalbek on 9/18/17.
*/

public class ListLinkAccountPage {
public ListLinkAccountPage() {
onView(withId(R.id.button_link_account)).check(matches(isDisplayed()));
}

public BankAccountPage linkAccountButton(){
onView(withId(R.id.button_link_account))
.perform(click());
return new BankAccountPage();
}

}
Loading