@ -5,6 +5,7 @@
package org.mozilla.fenix.ui.robots
import android.util.Log
import androidx.test.espresso.Espresso.closeSoftKeyboard
import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.matcher.RootMatchers
@ -36,11 +37,10 @@ import org.mozilla.fenix.helpers.click
class SettingsSubMenuAutofillRobot {
fun verifyAutofillToolbarTitle ( ) {
assertUIObjectExists ( autofillToolbarTitle )
Log . i ( TAG , " verifyAutofillToolbarTitle: Verified \" Autofill \" toolbar title exists " )
assertUIObjectExists ( autofillToolbarTitle ( ) )
}
fun verifyManageAddressesToolbarTitle ( ) {
Log . i ( TAG , " verifyManageAddressesToolbarTitle: Trying to verify th e \" Manage addresses \" toolbar title is displayed " )
Log . i ( TAG , " verifyManageAddressesToolbarTitle: Trying to verify th at th e \" Manage addresses \" toolbar title is displayed " )
onView (
allOf (
withId ( R . id . navigationToolbar ) ,
@ -49,21 +49,21 @@ class SettingsSubMenuAutofillRobot {
) ,
) ,
) . check ( matches ( isDisplayed ( ) ) )
Log . i ( TAG , " verifyManageAddressesToolbarTitle: Verified th e \" Manage addresses \" toolbar title is displayed " )
Log . i ( TAG , " verifyManageAddressesToolbarTitle: Verified th at th e \" Manage addresses \" toolbar title is displayed " )
}
fun verifyAddressAutofillSection ( isAddressAutofillEnabled : Boolean , userHasSavedAddress : Boolean ) {
assertUIObjectExists (
autofillToolbarTitle ,
addressesSectionTitle ,
saveAndAutofillAddressesOption ,
saveAndAutofillAddressesSummary ,
autofillToolbarTitle () ,
addressesSectionTitle () ,
saveAndAutofillAddressesOption () ,
saveAndAutofillAddressesSummary () ,
)
if ( userHasSavedAddress ) {
assertUIObjectExists ( manageAddressesButton )
assertUIObjectExists ( manageAddressesButton () )
} else {
assertUIObjectExists ( addAddressButton )
assertUIObjectExists ( addAddressButton () )
}
verifyAddressesAutofillToggle ( isAddressAutofillEnabled )
@ -71,18 +71,18 @@ class SettingsSubMenuAutofillRobot {
fun verifyCreditCardsAutofillSection ( isAddressAutofillEnabled : Boolean , userHasSavedCreditCard : Boolean ) {
assertUIObjectExists (
autofillToolbarTitle ,
creditCardsSectionTitle ,
saveAndAutofillCreditCardsOption ,
saveAndAutofillCreditCardsSummary ,
syncCreditCardsAcrossDevicesButton ,
autofillToolbarTitle () ,
creditCardsSectionTitle () ,
saveAndAutofillCreditCardsOption () ,
saveAndAutofillCreditCardsSummary () ,
syncCreditCardsAcrossDevicesButton () ,
)
if ( userHasSavedCreditCard ) {
assertUIObjectExists ( manageSavedCreditCardsButton )
assertUIObjectExists ( manageSavedCreditCardsButton () )
} else {
assertUIObjectExists ( addCreditCardButton )
assertUIObjectExists ( addCreditCardButton () )
}
verifySaveAndAutofillCreditCardsToggle ( isAddressAutofillEnabled )
@ -90,28 +90,28 @@ class SettingsSubMenuAutofillRobot {
fun verifyManageAddressesSection ( vararg savedAddressDetails : String ) {
assertUIObjectExists (
navigateBackButton ,
manageAddressesToolbarTitle ,
addAddressButton ,
navigateBackButton () ,
manageAddressesToolbarTitle () ,
addAddressButton () ,
)
for ( savedAddressDetail in savedAddressDetails ) {
assertUIObjectExists ( itemContainingText ( savedAddressDetail ) )
Log . i ( TAG , " verifyManageAddressesSection: Verified saved address detail: $savedAddressDetail exists " )
}
}
fun verifySavedCreditCardsSection ( creditCardLastDigits : String , creditCardExpiryDate : String ) {
assertUIObjectExists (
navigateBackButton ,
savedCreditCardsToolbarTitle ,
addCreditCardButton ,
navigateBackButton () ,
savedCreditCardsToolbarTitle () ,
addCreditCardButton () ,
itemContainingText ( creditCardLastDigits ) ,
itemContainingText ( creditCardExpiryDate ) ,
)
}
fun verifyAddressesAutofillToggle ( enabled : Boolean ) {
onView ( withText ( R . string . preferences _addresses _save _and _autofill _addresses ) )
Log . i ( TAG , " verifyAddressesAutofillToggle: Trying to verify that the \" Save and autofill addresses \" toggle is checked: $enabled " )
onView ( withText ( R . string . preferences _addresses _save _and _autofill _addresses _2 ) )
. check (
matches (
hasCousin (
@ -126,11 +126,12 @@ class SettingsSubMenuAutofillRobot {
) ,
) ,
)
Log . i ( TAG , " verifyAddressesAutofillToggle: Verified if address autofill toggle is enabl ed: $enabled " )
Log . i ( TAG , " verifyAddressesAutofillToggle: Verified that the \" Save and autofill addresses \" toggle is check ed: $enabled " )
}
fun verifySaveAndAutofillCreditCardsToggle ( enabled : Boolean ) =
onView ( withText ( R . string . preferences _credit _cards _save _and _autofill _cards ) )
fun verifySaveAndAutofillCreditCardsToggle ( enabled : Boolean ) {
Log . i ( TAG , " verifySaveAndAutofillCreditCardsToggle: Trying to verify that the \" Save and autofill cards \" toggle is checked: $enabled " )
onView ( withText ( R . string . preferences _credit _cards _save _and _autofill _cards _2 ) )
. check (
matches (
hasCousin (
@ -145,46 +146,41 @@ class SettingsSubMenuAutofillRobot {
) ,
) ,
)
Log . i ( TAG , " verifySaveAndAutofillCreditCardsToggle: Verified that the \" Save and autofill cards \" toggle is checked: $enabled " )
}
fun verifyAddAddressView ( ) {
Log . i ( TAG , " verifyAddAddressView: Trying to perform \" Close soft keyboard \" action " )
// Closing the keyboard to ensure full visibility of the "Add address" view
closeSoftKeyboard ( )
Log . i ( TAG , " verifyAddAddressView: Performed \" Close soft keyboard \" action " )
assertUIObjectExists (
addAddressToolbarTitle ,
navigateBackButton ,
toolbarCheckmarkButton ,
firstNameTextInput ,
middleNameTextInput ,
)
scrollToElementByText ( getStringResource ( R . string . addresses _street _address ) )
Log . i ( TAG , " verifyAddAddressView: Scrolled to \" Street Address \" text input " )
assertUIObjectExists (
lastNameTextInput ,
streetAddressTextInput ,
addAddressToolbarTitle ( ) ,
navigateBackButton ( ) ,
toolbarCheckmarkButton ( ) ,
nameTextInput ( ) ,
streetAddressTextInput ( ) ,
cityTextInput ( ) ,
subRegionDropDown ( ) ,
)
scrollToElementByText ( getStringResource ( R . string . addresses _country ) )
Log . i ( TAG , " verifyAddAddressView: Scrolled to \" Country or region \" dropdown " )
assertUIObjectExists (
cityTextInput ,
subRegionDropDown ,
zipCodeTextInput ,
zipCodeTextInput ( ) ,
countryDropDown ( ) ,
phoneTextInput ( ) ,
emailTextInput ( ) ,
)
scrollToElementByText ( getStringResource ( R . string . addresses _save _button ) )
Log . i ( TAG , " verifyAddAddressView: Scrolled to \" Save \" button " )
assertUIObjectExists (
countryDropDown ,
phoneTextInput ,
emailTextInput ,
)
assertUIObjectExists (
saveButton ,
cancelButton ,
saveButton ( ) ,
cancelButton ( ) ,
)
}
fun verifyCountryOption ( country : String ) {
scrollToElementByText ( getStringResource ( R . string . addresses _country ) )
Log . i ( TAG , " verifyCountryOption: Scrolled to \" Country or region \" dropdown " )
mDevice. pressBack ( )
Log . i ( TAG , " fillAndSaveAddress: Dismissed \" Country or region \" dropdown using device back butt on" )
Log . i ( TAG , " verifyCountryOption: Trying to perform \" Close soft keyboard \" action " )
// Closing the keyboard to ensure full visibility of the "Add address" view
closeSoftKeyboard ( )
Log . i ( TAG , " verifyCountryOption: Performed \" Close soft keyboard \" acti on" )
assertUIObjectExists ( itemContainingText ( country ) )
}
@ -193,116 +189,115 @@ class SettingsSubMenuAutofillRobot {
}
fun verifyCountryOptions ( vararg countries : String ) {
countryDropDown . click ( )
Log . i ( TAG , " verifyCountryOptions: Clicked \" Country or region \" dropdown " )
Log . i ( TAG , " verifyCountryOptions: Trying to click the \" Country or region \" dropdown " )
countryDropDown ( ) . click ( )
Log . i ( TAG , " verifyCountryOptions: Clicked the \" Country or region \" dropdown " )
for ( country in countries ) {
assertUIObjectExists ( itemContainingText ( country ) )
}
}
fun selectCountry ( country : String ) {
countryDropDown . click ( )
Log . i ( TAG , " selectCountry: Clicked \" Country or region \" dropdown " )
Log . i ( TAG , " selectCountry: Trying to click the \" Country or region \" dropdown " )
countryDropDown ( ) . click ( )
Log . i ( TAG , " selectCountry: Clicked the \" Country or region \" dropdown " )
Log . i ( TAG , " selectCountry: Trying to select $country dropdown option " )
countryOption ( country ) . click ( )
Log . i ( TAG , " selectCountry: Selected $country dropdown option " )
}
fun verifyEditAddressView ( ) {
assertUIObjectExists (
editAddressToolbarTitle ,
navigateBackButton ,
toolbarDeleteAddressButton ,
toolbarCheckmarkButton ,
firstNameTextInput ,
middleNameTextInput ,
)
scrollToElementByText ( getStringResource ( R . string . addresses _street _address ) )
Log . i ( TAG , " verifyEditAddressView: Scrolled to \" Street Address \" text input " )
assertUIObjectExists (
lastNameTextInput ,
streetAddressTextInput ,
editAddressToolbarTitle ( ) ,
navigateBackButton ( ) ,
toolbarDeleteAddressButton ( ) ,
toolbarCheckmarkButton ( ) ,
nameTextInput ( ) ,
streetAddressTextInput ( ) ,
cityTextInput ( ) ,
subRegionDropDown ( ) ,
)
scrollToElementByText ( getStringResource ( R . string . addresses _country ) )
Log . i ( TAG , " verifyEditAddressView: Scrolled to \" Country or region \" dropdown " )
assertUIObjectExists (
cityTextInput ,
subRegionDropDown ,
zipCodeTextInput ,
zipCodeTextInput ( ) ,
countryDropDown ( ) ,
phoneTextInput ( ) ,
emailTextInput ( ) ,
)
scrollToElementByText ( getStringResource ( R . string . addresses _save _button ) )
Log . i ( TAG , " verifyEditAddressView: Scrolled to \" Save \" button " )
assertUIObjectExists (
countryDropDown ,
phoneTextInput ,
emailTextInput ,
saveButton ( ) ,
cancelButton ( ) ,
)
assertUIObjectExists (
saveButton ,
cancelButton ,
)
assertUIObjectExists ( deleteAddressButton )
assertUIObjectExists ( deleteAddressButton ( ) )
}
fun clickSaveAndAutofillAddressesOption ( ) {
saveAndAutofillAddressesOption . click ( )
Log . i ( TAG , " clickSaveAndAutofillAddressesOption: Clicked \" Save and autofill addresses \" button " )
Log . i ( TAG , " clickSaveAndAutofillAddressesOption: Trying to click the \" Save and fill addresses \" button " )
saveAndAutofillAddressesOption ( ) . click ( )
Log . i ( TAG , " clickSaveAndAutofillAddressesOption: Clicked the \" Save and fill addresses \" button " )
}
fun clickAddAddressButton ( ) {
addAddressButton . click ( )
Log . i ( TAG , " clickAddAddressButton: Clicked \" Add address \" button " )
Log . i ( TAG , " clickAddAddressButton: Trying to click the \" Add address \" button " )
addAddressButton ( ) . click ( )
Log . i ( TAG , " clickAddAddressButton: Clicked the \" Add address \" button " )
}
fun clickManageAddressesButton ( ) {
manageAddressesButton . click ( )
Log . i ( TAG , " clickManageAddressesButton: Clicked \" Manage addresses \" button " )
Log . i ( TAG , " clickManageAddressesButton: Trying to click the \" Manage addresses \" button " )
manageAddressesButton ( ) . click ( )
Log . i ( TAG , " clickManageAddressesButton: Clicked the \" Manage addresses \" button " )
}
fun clickSavedAddress ( firstName : String ) {
savedAddress ( firstName ) . clickAndWaitForNewWindow ( waitingTime )
Log . i ( TAG , " clickSavedAddress: Clicked $firstName saved address and waiting for a new window for $waitingTime " )
fun clickSavedAddress ( name : String ) {
Log . i ( TAG , " clickSavedAddress: Trying to click the $name saved address and and wait for $waitingTime ms for a new window " )
savedAddress ( name ) . clickAndWaitForNewWindow ( waitingTime )
Log . i ( TAG , " clickSavedAddress: Clicked the $name saved address and and waited for $waitingTime ms for a new window " )
}
fun clickDeleteAddressButton ( ) {
Log . i ( TAG , " clickDeleteAddressButton: Looking for delete address toolbar button " )
toolbarDeleteAddressButton . waitForExists ( waitingTime )
toolbarDeleteAddressButton . click ( )
Log . i ( TAG , " clickDeleteAddressButton: Clicked delete address toolbar button " )
Log . i ( TAG , " clickDeleteAddressButton: Waiting for $waitingTime ms for the delete address toolbar button to exist " )
toolbarDeleteAddressButton ( ) . waitForExists ( waitingTime )
Log . i ( TAG , " clickDeleteAddressButton: Waited for $waitingTime ms for the delete address toolbar button to exist " )
Log . i ( TAG , " clickDeleteAddressButton: Trying to click the delete address toolbar button " )
toolbarDeleteAddressButton ( ) . click ( )
Log . i ( TAG , " clickDeleteAddressButton: Clicked the delete address toolbar button " )
}
fun clickCancelDeleteAddressButton ( ) {
cancelDeleteAddressButton . click ( )
Log . i ( TAG , " clickCancelDeleteAddressButton: Clicked \" CANCEL \" button from delete address dialog " )
Log . i ( TAG , " clickCancelDeleteAddressButton: Trying to click the \" CANCEL \" button from the delete address dialog " )
cancelDeleteAddressButton ( ) . click ( )
Log . i ( TAG , " clickCancelDeleteAddressButton: Clicked the \" CANCEL \" button from the delete address dialog " )
}
fun clickConfirmDeleteAddressButton ( ) {
confirmDeleteAddressButton . click ( )
Log . i ( TAG , " clickConfirmDeleteAddressButton: Clicked \" DELETE \" button from delete address dialog " )
Log . i ( TAG , " clickConfirmDeleteAddressButton: Trying to click the \" DELETE \" button from the delete address dialog " )
confirmDeleteAddressButton ( ) . click ( )
Log . i ( TAG , " clickConfirmDeleteAddressButton: Clicked \" DELETE \" button from the delete address dialog " )
}
fun clickSubRegionOption ( subRegion : String ) {
scrollToElementByText ( subRegion )
Log . i ( TAG , " clickSubRegionOption: Scrolled to \" State \" drop down " )
subRegionOption ( subRegion ) . also {
Log . i ( TAG , " clickSubRegionOption: Looking for \" State \" $subRegion dropdown option " )
Log . i ( TAG , " clickSubRegionOption: Waiting for $waitingTime ms for the \" State \" $subRegion dropdown option to exist " )
it . waitForExists ( waitingTime )
Log . i ( TAG , " clickSubRegionOption: Waited for $waitingTime ms for the \" State \" $subRegion dropdown option to exist " )
Log . i ( TAG , " clickSubRegionOption: Trying to click the \" State \" $subRegion dropdown option " )
it . click ( )
Log . i ( TAG , " clickSubRegionOption: Clicked \" State \" $subRegion dropdown option " )
Log . i ( TAG , " clickSubRegionOption: Clicked the \" State \" $subRegion dropdown option " )
}
}
fun clickCountryOption ( country : String ) {
Log . i ( TAG , " clickCountryOption: Looking for \" Country or region \" $country dropdown option " )
Log . i ( TAG , " clickCountryOption: Waiting for $waitingTime ms for the \" Country or region \" $country dropdown option to exist " )
countryOption ( country ) . waitForExists ( waitingTime )
Log . i ( TAG , " clickCountryOption: Waited for $waitingTime ms for the \" Country or region \" $country dropdown option to exist " )
Log . i ( TAG , " clickCountryOption: Trying to click \" Country or region \" $country dropdown option " )
countryOption ( country ) . click ( )
Log . i ( TAG , " clickCountryOption: Clicked \" Country or region \" $country dropdown option " )
}
fun verifyAddAddressButton ( ) {
assertUIObjectExists ( addAddressButton )
Log . i ( TAG , " verifyAddAddressButton: Verified \" Add address \" button exists " )
}
fun verifyAddAddressButton ( ) = assertUIObjectExists ( addAddressButton ( ) )
fun fillAndSaveAddress (
navigateToAutofillSettings : Boolean ,
isAddressAutofillEnabled : Boolean = true ,
userHasSavedAddress : Boolean = false ,
firstName : String ,
middleName : String ,
lastName : String ,
name : String ,
streetAddress : String ,
city : String ,
state : String ,
@ -320,98 +315,180 @@ class SettingsSubMenuAutofillRobot {
clickAddAddressButton ( )
}
}
Log . i ( TAG , " fillAndSaveAddress: Looking for \" First Name \" text input " )
firstNameTextInput . waitForExists ( waitingTime )
Log . i ( TAG , " fillAndSaveAddress: Waiting for $waitingTime ms for \" Name \" text field to exist " )
nameTextInput ( ) . waitForExists ( waitingTime )
Log . i ( TAG , " fillAndSaveAddress: Waited for $waitingTime ms for \" Name \" text field to exist " )
Log . i ( TAG , " fillAndSaveAddress: Trying to click device back button to dismiss keyboard using device back button " )
mDevice . pressBack ( )
Log . i ( TAG , " fillAndSaveAddress: Dismissed keyboard using device back button " )
firstNameTextInput . setText ( firstName )
Log . i ( TAG , " fillAndSaveAddress: \" First Name \" set to $firstName " )
middleNameTextInput . setText ( middleName )
Log . i ( TAG , " fillAndSaveAddress: \" Middle Name \" set to $middleName " )
lastNameTextInput. setText ( lastName )
Log . i ( TAG , " fillAndSaveAddress: \" Last Name\" set to $lastName " )
streetAddressTextInput . setText ( streetAddress )
Log . i ( TAG , " fillAndSaveAddress: \" Street Address \" set to $streetAddress " )
cityTextInput . setText ( city )
Log . i ( TAG , " fillAndSaveAddress: \" City \" set to $city " )
subRegionDropDown .click ( )
Log . i ( TAG , " fillAndSaveAddress: Clicked device back button to dismiss keyboard using device back button" )
Log . i ( TAG , " fillAndSaveAddress: Trying to set \" Name \" to $name " )
nameTextInput ( ) . setText ( name )
Log . i ( TAG , " fillAndSaveAddress: \" Name \" was set to $name " )
Log . i ( TAG , " fillAndSaveAddress: Trying to set \" Street Address \" to $streetAddress " )
streetAddressTextInput( ) . setText ( streetAddress )
Log . i ( TAG , " fillAndSaveAddress: \" Street Address\" was set to $streetAddress " )
Log . i ( TAG , " fillAndSaveAddress: Trying to set \" City \" to $city " )
cityTextInput ( ) . setText ( city )
Log . i ( TAG , " fillAndSaveAddress: \" City \" was set to $city " )
Log . i ( TAG , " fillAndSaveAddress: Trying to click \" State \" dropdown button " )
subRegionDropDown () .click ( )
Log . i ( TAG , " fillAndSaveAddress: Clicked \" State \" dropdown button " )
Log . i ( TAG , " fillAndSaveAddress: Trying to click the $state dropdown option " )
clickSubRegionOption ( state )
Log . i ( TAG , " fillAndSaveAddress: Selected $state as \" State \" " )
zipCodeTextInput . setText ( zipCode )
Log . i ( TAG , " fillAndSaveAddress: \" Zip \" set to $zipCode " )
countryDropDown . click ( )
Log . i ( TAG , " fillAndSaveAddress: Clicked $state dropdown option " )
Log . i ( TAG , " fillAndSaveAddress: Trying to set \" Zip \" to $zipCode " )
zipCodeTextInput ( ) . setText ( zipCode )
Log . i ( TAG , " fillAndSaveAddress: \" Zip \" was set to $zipCode " )
Log . i ( TAG , " fillAndSaveAddress: Trying to click \" Country or region \" dropdown button " )
countryDropDown ( ) . click ( )
Log . i ( TAG , " fillAndSaveAddress: Clicked \" Country or region \" dropdown button " )
Log . i ( TAG , " fillAndSaveAddress: Trying to click $country dropdown option " )
clickCountryOption ( country )
Log . i ( TAG , " fillAndSaveAddress: Selected $country as \" Country or region \" " )
Log . i ( TAG , " fillAndSaveAddress: Clicked $country dropdown option " )
scrollToElementByText ( getStringResource ( R . string . addresses _save _button ) )
Log . i ( TAG , " fillAndSaveAddress: Scrolled to \" Save \" button " )
phoneTextInput . setText ( phoneNumber )
Log . i ( TAG , " fillAndSaveAddress: \" Phone \" set to $phoneNumber " )
emailTextInput . setText ( emailAddress )
Log . i ( TAG , " fillAndSaveAddress: \" Email \" set to $emailAddress " )
saveButton . click ( )
Log . i ( TAG , " fillAndSaveAddress: Clicked \" Save \" button " )
Log . i ( TAG , " fillAndSaveAddress: Looking for \" Manage addressese \" button " )
manageAddressesButton . waitForExists ( waitingTime )
}
fun clickAddCreditCardButton ( ) = addCreditCardButton . click ( )
fun clickManageSavedCreditCardsButton ( ) = manageSavedCreditCardsButton . click ( )
fun clickSecuredCreditCardsLaterButton ( ) = securedCreditCardsLaterButton . click ( )
fun clickSavedCreditCard ( ) = savedCreditCardNumber . clickAndWaitForNewWindow ( waitingTime )
Log . i ( TAG , " fillAndSaveAddress: Trying to set \" Phone \" to $phoneNumber " )
phoneTextInput ( ) . setText ( phoneNumber )
Log . i ( TAG , " fillAndSaveAddress: \" Phone \" was set to $phoneNumber " )
Log . i ( TAG , " fillAndSaveAddress: Trying to set \" Email \" to $emailAddress " )
emailTextInput ( ) . setText ( emailAddress )
Log . i ( TAG , " fillAndSaveAddress: \" Email \" was set to $emailAddress " )
Log . i ( TAG , " fillAndSaveAddress: Trying to click the \" Save \" button " )
saveButton ( ) . click ( )
Log . i ( TAG , " fillAndSaveAddress: Clicked the \" Save \" button " )
Log . i ( TAG , " fillAndSaveAddress: Waiting for $waitingTime ms for for \" Manage addresses \" button to exist " )
manageAddressesButton ( ) . waitForExists ( waitingTime )
Log . i ( TAG , " fillAndSaveAddress: Waited for $waitingTime ms for for \" Manage addresses \" button to exist " )
}
fun clickAddCreditCardButton ( ) {
Log . i ( TAG , " clickAddCreditCardButton: Trying to click the \" Add credit card \" button " )
addCreditCardButton ( ) . click ( )
Log . i ( TAG , " clickAddCreditCardButton: Clicked the \" Add credit card \" button " )
}
fun clickManageSavedCreditCardsButton ( ) {
Log . i ( TAG , " clickManageSavedCreditCardsButton: Trying to click the \" Manage saved cards \" button " )
manageSavedCreditCardsButton ( ) . click ( )
Log . i ( TAG , " clickManageSavedCreditCardsButton: Clicked the \" Manage saved cards \" button " )
}
fun clickSecuredCreditCardsLaterButton ( ) {
Log . i ( TAG , " clickSecuredCreditCardsLaterButton: Trying to click the \" Later \" button " )
securedCreditCardsLaterButton ( ) . click ( )
Log . i ( TAG , " clickSecuredCreditCardsLaterButton: Clicked the \" Later \" button " )
}
fun clickSavedCreditCard ( ) {
Log . i ( TAG , " clickSavedCreditCard: Trying to click the saved credit card and and wait for $waitingTime ms for a new window " )
savedCreditCardNumber ( ) . clickAndWaitForNewWindow ( waitingTime )
Log . i ( TAG , " clickSavedCreditCard: Clicked the saved credit card and and waited for $waitingTime ms for a new window " )
}
fun clickDeleteCreditCardToolbarButton ( ) {
deleteCreditCardToolbarButton . waitForExists ( waitingTime )
deleteCreditCardToolbarButton . click ( )
Log . i ( TAG , " clickDeleteCreditCardToolbarButton: Waiting for $waitingTime ms for the delete credit card toolbar button to exist " )
deleteCreditCardToolbarButton ( ) . waitForExists ( waitingTime )
Log . i ( TAG , " clickDeleteCreditCardToolbarButton: Waited for $waitingTime ms for the delete credit card toolbar button to exist " )
Log . i ( TAG , " clickDeleteCreditCardToolbarButton: Trying to click the delete credit card toolbar button " )
deleteCreditCardToolbarButton ( ) . click ( )
Log . i ( TAG , " clickDeleteCreditCardToolbarButton: Clicked the delete credit card toolbar button " )
}
fun clickDeleteCreditCardMenuButton ( ) {
deleteCreditCardMenuButton . waitForExists ( waitingTime )
deleteCreditCardMenuButton . click ( )
Log . i ( TAG , " clickDeleteCreditCardMenuButton: Waiting for $waitingTime ms for the delete credit card menu button to exist " )
deleteCreditCardMenuButton ( ) . waitForExists ( waitingTime )
Log . i ( TAG , " clickDeleteCreditCardMenuButton: Waited for $waitingTime ms for the delete credit card menu button to exist " )
Log . i ( TAG , " clickDeleteCreditCardMenuButton: Trying to click the delete credit card menu button " )
deleteCreditCardMenuButton ( ) . click ( )
Log . i ( TAG , " clickDeleteCreditCardMenuButton: Clicked the delete credit card menu button " )
}
fun clickSaveAndAutofillCreditCardsOption ( ) {
Log . i ( TAG , " clickSaveAndAutofillCreditCardsOption: Trying to click the \" Save and autofill cards \" option " )
saveAndAutofillCreditCardsOption ( ) . click ( )
Log . i ( TAG , " clickSaveAndAutofillCreditCardsOption: Clicked the \" Save and autofill cards \" option " )
}
fun clickSaveAndAutofillCreditCardsOption ( ) = saveAndAutofillCreditCardsOption . click ( )
fun clickConfirmDeleteCreditCardButton ( ) = confirmDeleteCreditCardButton . click ( )
fun clickConfirmDeleteCreditCardButton ( ) {
Log . i ( TAG , " clickConfirmDeleteCreditCardButton: Trying to click the \" Delete \" credit card dialog button " )
confirmDeleteCreditCardButton ( ) . click ( )
Log . i ( TAG , " clickConfirmDeleteCreditCardButton: Clicked the \" Delete \" credit card dialog button " )
}
fun clickCancelDeleteCreditCardButton ( ) = cancelDeleteCreditCardButton . click ( )
fun clickCancelDeleteCreditCardButton ( ) {
Log . i ( TAG , " clickCancelDeleteCreditCardButton: Trying to click the \" Cancel \" credit card dialog button " )
cancelDeleteCreditCardButton ( ) . click ( )
Log . i ( TAG , " clickCancelDeleteCreditCardButton: Clicked the \" Cancel \" credit card dialog button " )
}
fun clickExpiryMonthOption ( expiryMonth : String ) {
Log . i ( TAG , " clickExpiryMonthOption: Waiting for $waitingTime ms for the $expiryMonth expiry month option to exist " )
expiryMonthOption ( expiryMonth ) . waitForExists ( waitingTime )
Log . i ( TAG , " clickExpiryMonthOption: Waited for $waitingTime ms for the $expiryMonth expiry month option to exist " )
Log . i ( TAG , " clickExpiryMonthOption: Trying to click $expiryMonth expiry month option " )
expiryMonthOption ( expiryMonth ) . click ( )
Log . i ( TAG , " clickExpiryMonthOption: Clicked $expiryMonth expiry month option " )
}
fun clickExpiryYearOption ( expiryYear : String ) {
Log . i ( TAG , " clickExpiryYearOption: Waiting for $waitingTime ms for the $expiryYear expiry year option to exist " )
expiryYearOption ( expiryYear ) . waitForExists ( waitingTime )
Log . i ( TAG , " clickExpiryYearOption: Waited for $waitingTime ms for the $expiryYear expiry year option to exist " )
Log . i ( TAG , " clickExpiryYearOption: Trying to click $expiryYear expiry year option " )
expiryYearOption ( expiryYear ) . click ( )
Log . i ( TAG , " clickExpiryYearOption: Clicked $expiryYear expiry year option " )
}
fun verifyAddCreditCardsButton ( ) = assertUIObjectExists ( addCreditCardButton )
fun verifyAddCreditCardsButton ( ) = assertUIObjectExists ( addCreditCardButton () )
fun fillAndSaveCreditCard ( cardNumber : String , cardName : String , expiryMonth : String , expiryYear : String ) {
creditCardNumberTextInput . waitForExists ( waitingTime )
creditCardNumberTextInput . setText ( cardNumber )
nameOnCreditCardTextInput . setText ( cardName )
expiryMonthDropDown . click ( )
Log . i ( TAG , " fillAndSaveCreditCard: Waiting for $waitingTime ms for the credit card number text field to exist " )
creditCardNumberTextInput ( ) . waitForExists ( waitingTime )
Log . i ( TAG , " fillAndSaveCreditCard: Waited for $waitingTime ms for the credit card number text field to exist " )
Log . i ( TAG , " fillAndSaveCreditCard: Trying to set the credit card number to: $cardNumber " )
creditCardNumberTextInput ( ) . setText ( cardNumber )
Log . i ( TAG , " fillAndSaveCreditCard: The credit card number was set to: $cardNumber " )
Log . i ( TAG , " fillAndSaveCreditCard: Trying to set the name on card to: $cardName " )
nameOnCreditCardTextInput ( ) . setText ( cardName )
Log . i ( TAG , " fillAndSaveCreditCard: The credit card name was set to: $cardName " )
Log . i ( TAG , " fillAndSaveCreditCard: Trying to click the expiry month dropdown " )
expiryMonthDropDown ( ) . click ( )
Log . i ( TAG , " fillAndSaveCreditCard: Clicked the expiry month dropdown " )
Log . i ( TAG , " fillAndSaveCreditCard: Trying to click $expiryMonth expiry month option " )
clickExpiryMonthOption ( expiryMonth )
expiryYearDropDown . click ( )
Log . i ( TAG , " fillAndSaveCreditCard: Clicked $expiryMonth expiry month option " )
Log . i ( TAG , " fillAndSaveCreditCard: Trying to click the expiry year dropdown " )
expiryYearDropDown ( ) . click ( )
Log . i ( TAG , " fillAndSaveCreditCard: Clicked the expiry year dropdown " )
Log . i ( TAG , " fillAndSaveCreditCard: Trying to click $expiryYear expiry year option " )
clickExpiryYearOption ( expiryYear )
saveButton . click ( )
manageSavedCreditCardsButton . waitForExists ( waitingTime )
Log . i ( TAG , " fillAndSaveCreditCard: Clicked $expiryYear expiry year option " )
Log . i ( TAG , " fillAndSaveCreditCard: Trying to click the \" Save \" button " )
saveButton ( ) . click ( )
Log . i ( TAG , " fillAndSaveCreditCard: Clicked the \" Save \" button " )
Log . i ( TAG , " fillAndSaveCreditCard: Waiting for $waitingTime ms for the \" Manage saved cards \" button to exist " )
manageSavedCreditCardsButton ( ) . waitForExists ( waitingTime )
Log . i ( TAG , " fillAndSaveCreditCard: Waited for $waitingTime ms for the \" Manage saved cards \" button to exist " )
}
fun clearCreditCardNumber ( ) =
creditCardNumberTextInput . also {
creditCardNumberTextInput ( ) . also {
Log . i ( TAG , " clearCreditCardNumber: Waiting for $waitingTime ms for the credit card number text field to exist " )
it . waitForExists ( waitingTime )
Log . i ( TAG , " clearCreditCardNumber: Waited for $waitingTime ms for the credit card number text field to exist " )
Log . i ( TAG , " clearCreditCardNumber: Trying to clear the credit card number text field " )
it . clearTextField ( )
Log . i ( TAG , " clearCreditCardNumber: Cleared the credit card number text field " )
}
fun clearNameOnCreditCard ( ) =
nameOnCreditCardTextInput . also {
nameOnCreditCardTextInput ( ) . also {
Log . i ( TAG , " clearNameOnCreditCard: Waiting for $waitingTime ms for name on card text field to exist " )
it . waitForExists ( waitingTime )
Log . i ( TAG , " clearNameOnCreditCard: Waited for $waitingTime ms for name on card text field to exist " )
Log . i ( TAG , " clearNameOnCreditCard: Trying to clear the name on card text field " )
it . clearTextField ( )
Log . i ( TAG , " clearNameOnCreditCard: Cleared the name on card text field " )
}
fun clickSaveCreditCardToolbarButton ( ) = saveCreditCardToolbarButton . click ( )
fun clickSaveCreditCardToolbarButton ( ) {
Log . i ( TAG , " clickSaveCreditCardToolbarButton: Trying to click the save credit card toolbar button " )
saveCreditCardToolbarButton ( ) . click ( )
Log . i ( TAG , " clickSaveCreditCardToolbarButton: Clicked the save credit card toolbar button " )
}
fun verifyEditCreditCardView (
cardNumber : String ,
@ -420,19 +497,22 @@ class SettingsSubMenuAutofillRobot {
expiryYear : String ,
) {
assertUIObjectExists (
editCreditCardToolbarTitle ,
navigateBackButton ,
deleteCreditCardToolbarButton ,
saveCreditCardToolbarButton ,
editCreditCardToolbarTitle () ,
navigateBackButton () ,
deleteCreditCardToolbarButton () ,
saveCreditCardToolbarButton () ,
)
assertEquals ( cardNumber , creditCardNumberTextInput . text )
assertEquals ( cardName , nameOnCreditCardTextInput . text )
Log . i ( TAG , " verifyEditCreditCardView: Trying to verify that the card number text field is set to: $cardNumber " )
assertEquals ( cardNumber , creditCardNumberTextInput ( ) . text )
Log . i ( TAG , " verifyEditCreditCardView: Verified that the card number text field was set to: $cardNumber " )
Log . i ( TAG , " verifyEditCreditCardView: Trying to verify that the card name text field is set to: $cardName " )
assertEquals ( cardName , nameOnCreditCardTextInput ( ) . text )
Log . i ( TAG , " verifyEditCreditCardView: Verified that the card card name text field was set to: $cardName " )
// Can't get the text from the drop-down items, need to verify them individually
assertUIObjectExists (
expiryYearDropDown ,
expiryMonthDropDown ,
expiryYearDropDown () ,
expiryMonthDropDown () ,
)
assertUIObjectExists (
@ -441,47 +521,53 @@ class SettingsSubMenuAutofillRobot {
)
assertUIObjectExists (
saveButton ,
cancelButton ,
saveButton () ,
cancelButton () ,
)
assertUIObjectExists ( deleteCreditCardMenuButton )
assertUIObjectExists ( deleteCreditCardMenuButton () )
}
fun verifyEditCreditCardToolbarTitle ( ) = assertUIObjectExists ( editCreditCardToolbarTitle )
fun verifyEditCreditCardToolbarTitle ( ) = assertUIObjectExists ( editCreditCardToolbarTitle () )
fun verifyCreditCardNumberErrorMessage ( ) =
assertUIObjectExists ( itemContainingText ( getStringResource ( R . string . credit _cards _number _validation _error _message ) ) )
assertUIObjectExists ( itemContainingText ( getStringResource ( R . string . credit _cards _number _validation _error _message _2 ) ) )
fun verifyNameOnCreditCardErrorMessage ( ) =
assertUIObjectExists ( itemContainingText ( getStringResource ( R . string . credit _cards _name _on _card _validation _error _message ) ) )
assertUIObjectExists ( itemContainingText ( getStringResource ( R . string . credit _cards _name _on _card _validation _error _message _2 ) ) )
class Transition {
fun goBack ( interact : SettingsRobot . ( ) -> Unit ) : SettingsRobot . Transition {
Log . i ( TAG , " goBack: Trying to click the device back button " )
mDevice . pressBack ( )
Log . i ( TAG , " goBack: Clicked the device back button " )
SettingsRobot ( ) . interact ( )
return SettingsRobot . Transition ( )
}
fun goBackToAutofillSettings ( interact : SettingsSubMenuAutofillRobot . ( ) -> Unit ) : SettingsSubMenuAutofillRobot . Transition {
navigateBackButton . click ( )
Log . i ( TAG , " goBackToAutofillSettings: Clicked \" Navigate back \" toolbar button " )
Log . i ( TAG , " goBackToAutofillSettings: Trying to click the navigate up toolbar button " )
navigateBackButton ( ) . click ( )
Log . i ( TAG , " goBackToAutofillSettings: Clicked the navigate up toolbar button " )
SettingsSubMenuAutofillRobot ( ) . interact ( )
return SettingsSubMenuAutofillRobot . Transition ( )
}
fun goBackToSavedCreditCards ( interact : SettingsSubMenuAutofillRobot . ( ) -> Unit ) : SettingsSubMenuAutofillRobot . Transition {
navigateBackButton . click ( )
Log . i ( TAG , " goBackToSavedCreditCards: Trying to click the navigate up toolbar button " )
navigateBackButton ( ) . click ( )
Log . i ( TAG , " goBackToSavedCreditCards: Clicked the navigate up toolbar button " )
SettingsSubMenuAutofillRobot ( ) . interact ( )
return SettingsSubMenuAutofillRobot . Transition ( )
}
fun goBackToBrowser ( interact : BrowserRobot . ( ) -> Unit ) : BrowserRobot . Transition {
Log . i ( TAG , " goBackToBrowser: Trying to click the device back button " )
mDevice . pressBack ( )
Log . i ( TAG , " goBackToBrowser: Go back to browser view using device back button" )
Log . i ( TAG , " goBackToBrowser: Clicked the device back button" )
BrowserRobot ( ) . interact ( )
return BrowserRobot . Transition ( )
@ -494,66 +580,65 @@ fun autofillScreen(interact: SettingsSubMenuAutofillRobot.() -> Unit): SettingsS
return SettingsSubMenuAutofillRobot . Transition ( )
}
private val autofillToolbarTitle = itemContainingText ( getStringResource ( R . string . preferences _autofill ) )
private val addressesSectionTitle = itemContainingText ( getStringResource ( R . string . preferences _addresses ) )
private val manageAddressesToolbarTitle =
private fun autofillToolbarTitle ( ) = itemContainingText ( getStringResource ( R . string . preferences _autofill ) )
private fun addressesSectionTitle ( ) = itemContainingText ( getStringResource ( R . string . preferences _addresses ) )
private fun manageAddressesToolbarTitle ( ) =
mDevice . findObject (
UiSelector ( )
. resourceId ( " $packageName :id/navigationToolbar " )
. childSelector ( UiSelector ( ) . text ( getStringResource ( R . string . addresses _manage _addresses ) ) ) ,
)
private val saveAndAutofillAddressesOption = itemContainingText ( getStringResource ( R . string . preferences _addresses _save _and _autofill _addresses ) )
private val saveAndAutofillAddressesSummary = itemContainingText ( getStringResource ( R . string . preferences _addresses _save _and _autofill _addresses _summary ) )
private val addAddressButton = itemContainingText ( getStringResource ( R . string . preferences _addresses _add _address ) )
private val manageAddressesButton =
private fun saveAndAutofillAddressesOption ( ) = itemContainingText ( getStringResource ( R . string . preferences _addresses _save _and _autofill _addresses _2 ) )
private fun saveAndAutofillAddressesSummary ( ) = itemContainingText ( getStringResource ( R . string . preferences _addresses _save _and _autofill _addresses _summary _2 ) )
private fun addAddressButton ( ) = itemContainingText ( getStringResource ( R . string . preferences _addresses _add _address ) )
private fun manageAddressesButton ( ) =
mDevice . findObject (
UiSelector ( )
. resourceId ( " android:id/title " )
. text ( getStringResource ( R . string . preferences _addresses _manage _addresses ) ) ,
)
private val addAddressToolbarTitle = itemContainingText ( getStringResource ( R . string . addresses _add _address ) )
private val editAddressToolbarTitle = itemContainingText ( getStringResource ( R . string . addresses _edit _address ) )
private val toolbarCheckmarkButton = itemWithResId ( " $packageName :id/save_address_button " )
private val navigateBackButton = itemWithDescription ( getStringResource ( R . string . action _bar _up _description ) )
private val firstNameTextInput = itemWithResId ( " $packageName :id/first_name_input " )
private val middleNameTextInput = itemWithResId ( " $packageName :id/middle_name_input " )
private val lastNameTextInput = itemWithResId ( " $packageName :id/last_name_input " )
private val streetAddressTextInput = itemWithResId ( " $packageName :id/street_address_input " )
private val cityTextInput = itemWithResId ( " $packageName :id/city_input " )
private val subRegionDropDown = itemWithResId ( " $packageName :id/subregion_drop_down " )
private val zipCodeTextInput = itemWithResId ( " $packageName :id/zip_input " )
private val countryDropDown = itemWithResId ( " $packageName :id/country_drop_down " )
private val phoneTextInput = itemWithResId ( " $packageName :id/phone_input " )
private val emailTextInput = itemWithResId ( " $packageName :id/email_input " )
private val saveButton = itemWithResId ( " $packageName :id/save_button " )
private val cancelButton = itemWithResId ( " $packageName :id/cancel_button " )
private val deleteAddressButton = itemContainingText ( getStringResource ( R . string . addressess _delete _address _button ) )
private val toolbarDeleteAddressButton = itemWithResId ( " $packageName :id/delete_address_button " )
private val cancelDeleteAddressButton = onView ( withId ( android . R . id . button2 ) ) . inRoot ( RootMatchers . isDialog ( ) )
private val confirmDeleteAddressButton = onView ( withId ( android . R . id . button1 ) ) . inRoot ( RootMatchers . isDialog ( ) )
private val creditCardsSectionTitle = itemContainingText ( getStringResource ( R . string . preferences _credit _cards ) )
private val saveAndAutofillCreditCardsOption = itemContainingText ( getStringResource ( R . string . preferences _credit _cards _save _and _autofill _cards ) )
private val saveAndAutofillCreditCardsSummary = itemContainingText ( getStringResource ( R . string . preferences _credit _cards _save _and _autofill _cards _summary ) )
private val syncCreditCardsAcrossDevicesButton = itemContainingText ( getStringResource ( R . string . preferences _credit _cards _sync _cards _across _devices ) )
private val addCreditCardButton = mDevice . findObject ( UiSelector ( ) . textContains ( getStringResource ( R . string . preferences _credit _cards _add _credit _card ) ) )
private val savedCreditCardsToolbarTitle = itemContainingText ( getStringResource ( R . string . credit _cards _saved _cards ) )
private val editCreditCardToolbarTitle = itemContainingText ( getStringResource ( R . string . credit _cards _edit _card ) )
private val manageSavedCreditCardsButton = mDevice . findObject ( UiSelector ( ) . textContains ( getStringResource ( R . string . preferences _credit _cards _manage _saved _cards ) ) )
private val creditCardNumberTextInput = mDevice . findObject ( UiSelector ( ) . resourceId ( " $packageName :id/card_number_input " ) )
private val nameOnCreditCardTextInput = mDevice . findObject ( UiSelector ( ) . resourceId ( " $packageName :id/name_on_card_input " ) )
private val expiryMonthDropDown = mDevice . findObject ( UiSelector ( ) . resourceId ( " $packageName :id/expiry_month_drop_down " ) )
private val expiryYearDropDown = mDevice . findObject ( UiSelector ( ) . resourceId ( " $packageName :id/expiry_year_drop_down " ) )
private val savedCreditCardNumber = mDevice . findObject ( UiSelector ( ) . resourceId ( " $packageName :id/credit_card_logo " ) )
private val deleteCreditCardToolbarButton = mDevice . findObject ( UiSelector ( ) . resourceId ( " $packageName :id/delete_credit_card_button " ) )
private val saveCreditCardToolbarButton = itemWithResId ( " $packageName :id/save_credit_card_button " )
private val deleteCreditCardMenuButton = itemContainingText ( getStringResource ( R . string . credit _cards _delete _card _button ) )
private val confirmDeleteCreditCardButton = onView ( withId ( android . R . id . button1 ) ) . inRoot ( RootMatchers . isDialog ( ) )
private val cancelDeleteCreditCardButton = onView ( withId ( android . R . id . button2 ) ) . inRoot ( RootMatchers . isDialog ( ) )
private val securedCreditCardsLaterButton = onView ( withId ( android . R . id . button2 ) ) . inRoot ( RootMatchers . isDialog ( ) )
private fun savedAddress ( firstName : String ) = mDevice . findObject ( UiSelector ( ) . textContains ( firstName ) )
private fun addAddressToolbarTitle ( ) = itemContainingText ( getStringResource ( R . string . addresses _add _address ) )
private fun editAddressToolbarTitle ( ) = itemContainingText ( getStringResource ( R . string . addresses _edit _address ) )
private fun toolbarCheckmarkButton ( ) = itemWithResId ( " $packageName :id/save_address_button " )
private fun navigateBackButton ( ) = itemWithDescription ( getStringResource ( R . string . action _bar _up _description ) )
private fun nameTextInput ( ) = itemWithResId ( " $packageName :id/name_input " )
private fun streetAddressTextInput ( ) = itemWithResId ( " $packageName :id/street_address_input " )
private fun cityTextInput ( ) = itemWithResId ( " $packageName :id/city_input " )
private fun subRegionDropDown ( ) = itemWithResId ( " $packageName :id/subregion_drop_down " )
private fun zipCodeTextInput ( ) = itemWithResId ( " $packageName :id/zip_input " )
private fun countryDropDown ( ) = itemWithResId ( " $packageName :id/country_drop_down " )
private fun phoneTextInput ( ) = itemWithResId ( " $packageName :id/phone_input " )
private fun emailTextInput ( ) = itemWithResId ( " $packageName :id/email_input " )
private fun saveButton ( ) = itemWithResId ( " $packageName :id/save_button " )
private fun cancelButton ( ) = itemWithResId ( " $packageName :id/cancel_button " )
private fun deleteAddressButton ( ) = itemContainingText ( getStringResource ( R . string . addressess _delete _address _button ) )
private fun toolbarDeleteAddressButton ( ) = itemWithResId ( " $packageName :id/delete_address_button " )
private fun cancelDeleteAddressButton ( ) = onView ( withId ( android . R . id . button2 ) ) . inRoot ( RootMatchers . isDialog ( ) )
private fun confirmDeleteAddressButton ( ) = onView ( withId ( android . R . id . button1 ) ) . inRoot ( RootMatchers . isDialog ( ) )
private fun creditCardsSectionTitle ( ) = itemContainingText ( getStringResource ( R . string . preferences _credit _cards _2 ) )
private fun saveAndAutofillCreditCardsOption ( ) = itemContainingText ( getStringResource ( R . string . preferences _credit _cards _save _and _autofill _cards _2 ) )
private fun saveAndAutofillCreditCardsSummary ( ) = itemContainingText ( getStringResource ( R . string . preferences _credit _cards _save _and _autofill _cards _summary _2 ) )
private fun syncCreditCardsAcrossDevicesButton ( ) = itemContainingText ( getStringResource ( R . string . preferences _credit _cards _sync _cards _across _devices ) )
private fun addCreditCardButton ( ) = mDevice . findObject ( UiSelector ( ) . textContains ( getStringResource ( R . string . preferences _credit _cards _add _credit _card _2 ) ) )
private fun savedCreditCardsToolbarTitle ( ) = itemContainingText ( getStringResource ( R . string . credit _cards _saved _cards ) )
private fun editCreditCardToolbarTitle ( ) = itemContainingText ( getStringResource ( R . string . credit _cards _edit _card ) )
private fun manageSavedCreditCardsButton ( ) = mDevice . findObject ( UiSelector ( ) . textContains ( getStringResource ( R . string . preferences _credit _cards _manage _saved _cards _2 ) ) )
private fun creditCardNumberTextInput ( ) = mDevice . findObject ( UiSelector ( ) . resourceId ( " $packageName :id/card_number_input " ) )
private fun nameOnCreditCardTextInput ( ) = mDevice . findObject ( UiSelector ( ) . resourceId ( " $packageName :id/name_on_card_input " ) )
private fun expiryMonthDropDown ( ) = mDevice . findObject ( UiSelector ( ) . resourceId ( " $packageName :id/expiry_month_drop_down " ) )
private fun expiryYearDropDown ( ) = mDevice . findObject ( UiSelector ( ) . resourceId ( " $packageName :id/expiry_year_drop_down " ) )
private fun savedCreditCardNumber ( ) = mDevice . findObject ( UiSelector ( ) . resourceId ( " $packageName :id/credit_card_logo " ) )
private fun deleteCreditCardToolbarButton ( ) = mDevice . findObject ( UiSelector ( ) . resourceId ( " $packageName :id/delete_credit_card_button " ) )
private fun saveCreditCardToolbarButton ( ) = itemWithResId ( " $packageName :id/save_credit_card_button " )
private fun deleteCreditCardMenuButton ( ) = itemContainingText ( getStringResource ( R . string . credit _cards _delete _card _button ) )
private fun confirmDeleteCreditCardButton ( ) = onView ( withId ( android . R . id . button1 ) ) . inRoot ( RootMatchers . isDialog ( ) )
private fun cancelDeleteCreditCardButton ( ) = onView ( withId ( android . R . id . button2 ) ) . inRoot ( RootMatchers . isDialog ( ) )
private fun securedCreditCardsLaterButton ( ) = onView ( withId ( android . R . id . button2 ) ) . inRoot ( RootMatchers . isDialog ( ) )
private fun savedAddress ( name : String ) = mDevice . findObject ( UiSelector ( ) . textContains ( name ) )
private fun subRegionOption ( subRegion : String ) = mDevice . findObject ( UiSelector ( ) . textContains ( subRegion ) )
private fun countryOption ( country : String ) = mDevice . findObject ( UiSelector ( ) . textContains ( country ) )