Bug 1880640 - Add pairs of logs to SettingsSubMenuAutofillRobot

fenix/125.0
AndiAJ 3 months ago committed by mergify[bot]
parent 518d89d449
commit e711687c54

@ -37,10 +37,9 @@ class SettingsSubMenuAutofillRobot {
fun verifyAutofillToolbarTitle() {
assertUIObjectExists(autofillToolbarTitle())
Log.i(TAG, "verifyAutofillToolbarTitle: Verified \"Autofill\" toolbar title exists")
}
fun verifyManageAddressesToolbarTitle() {
Log.i(TAG, "verifyManageAddressesToolbarTitle: Trying to verify the \"Manage addresses\" toolbar title is displayed")
Log.i(TAG, "verifyManageAddressesToolbarTitle: Trying to verify that the \"Manage addresses\" toolbar title is displayed")
onView(
allOf(
withId(R.id.navigationToolbar),
@ -49,7 +48,7 @@ class SettingsSubMenuAutofillRobot {
),
),
).check(matches(isDisplayed()))
Log.i(TAG, "verifyManageAddressesToolbarTitle: Verified the \"Manage addresses\" toolbar title is displayed")
Log.i(TAG, "verifyManageAddressesToolbarTitle: Verified that the \"Manage addresses\" toolbar title is displayed")
}
fun verifyAddressAutofillSection(isAddressAutofillEnabled: Boolean, userHasSavedAddress: Boolean) {
@ -96,7 +95,6 @@ class SettingsSubMenuAutofillRobot {
)
for (savedAddressDetail in savedAddressDetails) {
assertUIObjectExists(itemContainingText(savedAddressDetail))
Log.i(TAG, "verifyManageAddressesSection: Verified saved address detail: $savedAddressDetail exists")
}
}
@ -111,6 +109,7 @@ class SettingsSubMenuAutofillRobot {
}
fun verifyAddressesAutofillToggle(enabled: Boolean) {
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))
.check(
matches(
@ -126,10 +125,11 @@ class SettingsSubMenuAutofillRobot {
),
),
)
Log.i(TAG, "verifyAddressesAutofillToggle: Verified if address autofill toggle is enabled: $enabled")
Log.i(TAG, "verifyAddressesAutofillToggle: Verified that the \"Save and autofill addresses\" toggle is checked: $enabled")
}
fun verifySaveAndAutofillCreditCardsToggle(enabled: Boolean) =
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))
.check(
matches(
@ -145,6 +145,8 @@ class SettingsSubMenuAutofillRobot {
),
),
)
Log.i(TAG, "verifySaveAndAutofillCreditCardsToggle: Verified that the \"Save and autofill cards\" toggle is checked: $enabled")
}
fun verifyAddAddressView() {
assertUIObjectExists(
@ -155,20 +157,17 @@ class SettingsSubMenuAutofillRobot {
middleNameTextInput(),
)
scrollToElementByText(getStringResource(R.string.addresses_street_address))
Log.i(TAG, "verifyAddAddressView: Scrolled to \"Street Address\" text input")
assertUIObjectExists(
lastNameTextInput(),
streetAddressTextInput(),
)
scrollToElementByText(getStringResource(R.string.addresses_country))
Log.i(TAG, "verifyAddAddressView: Scrolled to \"Country or region\" dropdown")
assertUIObjectExists(
cityTextInput(),
subRegionDropDown(),
zipCodeTextInput(),
)
scrollToElementByText(getStringResource(R.string.addresses_save_button))
Log.i(TAG, "verifyAddAddressView: Scrolled to \"Save\" button")
assertUIObjectExists(
countryDropDown(),
phoneTextInput(),
@ -182,9 +181,9 @@ class SettingsSubMenuAutofillRobot {
fun verifyCountryOption(country: String) {
scrollToElementByText(getStringResource(R.string.addresses_country))
Log.i(TAG, "verifyCountryOption: Scrolled to \"Country or region\" dropdown")
Log.i(TAG, "verifyCountryOption: Trying to click device back button")
mDevice.pressBack()
Log.i(TAG, "fillAndSaveAddress: Dismissed \"Country or region\" dropdown using device back button")
Log.i(TAG, "verifyCountryOption: Clicked device back button")
assertUIObjectExists(itemContainingText(country))
}
@ -193,16 +192,19 @@ class SettingsSubMenuAutofillRobot {
}
fun verifyCountryOptions(vararg countries: String) {
Log.i(TAG, "verifyCountryOptions: Trying to click the \"Country or region\" dropdown")
countryDropDown().click()
Log.i(TAG, "verifyCountryOptions: Clicked \"Country or region\" dropdown")
Log.i(TAG, "verifyCountryOptions: Clicked the \"Country or region\" dropdown")
for (country in countries) {
assertUIObjectExists(itemContainingText(country))
}
}
fun selectCountry(country: String) {
Log.i(TAG, "selectCountry: Trying to click the \"Country or region\" dropdown")
countryDropDown().click()
Log.i(TAG, "selectCountry: Clicked \"Country or region\" dropdown")
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")
}
@ -217,20 +219,17 @@ class SettingsSubMenuAutofillRobot {
middleNameTextInput(),
)
scrollToElementByText(getStringResource(R.string.addresses_street_address))
Log.i(TAG, "verifyEditAddressView: Scrolled to \"Street Address\" text input")
assertUIObjectExists(
lastNameTextInput(),
streetAddressTextInput(),
)
scrollToElementByText(getStringResource(R.string.addresses_country))
Log.i(TAG, "verifyEditAddressView: Scrolled to \"Country or region\" dropdown")
assertUIObjectExists(
cityTextInput(),
subRegionDropDown(),
zipCodeTextInput(),
)
scrollToElementByText(getStringResource(R.string.addresses_save_button))
Log.i(TAG, "verifyEditAddressView: Scrolled to \"Save\" button")
assertUIObjectExists(
countryDropDown(),
phoneTextInput(),
@ -244,57 +243,65 @@ class SettingsSubMenuAutofillRobot {
}
fun clickSaveAndAutofillAddressesOption() {
Log.i(TAG, "clickSaveAndAutofillAddressesOption: Trying to click the \"Save and autofill addresses\" button")
saveAndAutofillAddressesOption().click()
Log.i(TAG, "clickSaveAndAutofillAddressesOption: Clicked \"Save and autofill addresses\" button")
Log.i(TAG, "clickSaveAndAutofillAddressesOption: Clicked the \"Save and autofill addresses\" button")
}
fun clickAddAddressButton() {
Log.i(TAG, "clickAddAddressButton: Trying to click the \"Add address\" button")
addAddressButton().click()
Log.i(TAG, "clickAddAddressButton: Clicked \"Add address\" button")
Log.i(TAG, "clickAddAddressButton: Clicked the \"Add address\" button")
}
fun clickManageAddressesButton() {
Log.i(TAG, "clickManageAddressesButton: Trying to click the \"Manage addresses\" button")
manageAddressesButton().click()
Log.i(TAG, "clickManageAddressesButton: Clicked \"Manage addresses\" button")
Log.i(TAG, "clickManageAddressesButton: Clicked the \"Manage addresses\" button")
}
fun clickSavedAddress(firstName: String) {
Log.i(TAG, "clickSavedAddress: Trying to click the $firstName saved address and and wait for $waitingTime ms for a new window")
savedAddress(firstName).clickAndWaitForNewWindow(waitingTime)
Log.i(TAG, "clickSavedAddress: Clicked $firstName saved address and waiting for a new window for $waitingTime")
Log.i(TAG, "clickSavedAddress: Clicked the $firstName saved address and and waited for $waitingTime ms for a new window")
}
fun clickDeleteAddressButton() {
Log.i(TAG, "clickDeleteAddressButton: Looking for 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 delete address toolbar button")
Log.i(TAG, "clickDeleteAddressButton: Clicked the delete address toolbar button")
}
fun clickCancelDeleteAddressButton() {
Log.i(TAG, "clickCancelDeleteAddressButton: Trying to click the \"CANCEL\" button from the delete address dialog")
cancelDeleteAddressButton().click()
Log.i(TAG, "clickCancelDeleteAddressButton: Clicked \"CANCEL\" button from delete address dialog")
Log.i(TAG, "clickCancelDeleteAddressButton: Clicked the \"CANCEL\" button from the delete address dialog")
}
fun clickConfirmDeleteAddressButton() {
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 delete address dialog")
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,
@ -320,98 +327,186 @@ class SettingsSubMenuAutofillRobot {
clickAddAddressButton()
}
}
Log.i(TAG, "fillAndSaveAddress: Looking for \"First Name\" text input")
Log.i(TAG, "fillAndSaveAddress: Waiting for $waitingTime ms for \"First Name\" text field to exist")
firstNameTextInput().waitForExists(waitingTime)
Log.i(TAG, "fillAndSaveAddress: Waited for $waitingTime ms for \"First 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")
Log.i(TAG, "fillAndSaveAddress: Clicked device back button to dismiss keyboard using device back button")
Log.i(TAG, "fillAndSaveAddress: Trying to set \"First Name\" to $firstName")
firstNameTextInput().setText(firstName)
Log.i(TAG, "fillAndSaveAddress: \"First Name\" set to $firstName")
Log.i(TAG, "fillAndSaveAddress: \"First Name\" was set to $firstName")
Log.i(TAG, "fillAndSaveAddress: Trying to set \"Middle Name\" to $middleName")
middleNameTextInput().setText(middleName)
Log.i(TAG, "fillAndSaveAddress: \"Middle Name\" set to $middleName")
Log.i(TAG, "fillAndSaveAddress: \"Middle Name\" was set to $middleName")
Log.i(TAG, "fillAndSaveAddress: Trying to set \"Last Name\" to $lastName")
lastNameTextInput().setText(lastName)
Log.i(TAG, "fillAndSaveAddress: \"Last Name\" set to $lastName")
Log.i(TAG, "fillAndSaveAddress: \"Last Name\" was set to $lastName")
Log.i(TAG, "fillAndSaveAddress: Trying to set \"Street Address\" to $streetAddress")
streetAddressTextInput().setText(streetAddress)
Log.i(TAG, "fillAndSaveAddress: \"Street Address\" set to $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\" set to $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\"")
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\" set to $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")
Log.i(TAG, "fillAndSaveAddress: Trying to set \"Phone\" to $phoneNumber")
phoneTextInput().setText(phoneNumber)
Log.i(TAG, "fillAndSaveAddress: \"Phone\" set to $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\" set to $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 \"Save\" button")
Log.i(TAG, "fillAndSaveAddress: Looking for \"Manage addressese\" button")
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() = addCreditCardButton().click()
fun clickManageSavedCreditCardsButton() = manageSavedCreditCardsButton().click()
fun clickSecuredCreditCardsLaterButton() = securedCreditCardsLaterButton().click()
fun clickSavedCreditCard() = savedCreditCardNumber().clickAndWaitForNewWindow(waitingTime)
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() {
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() {
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 fillAndSaveCreditCard(cardNumber: String, cardName: String, expiryMonth: String, expiryYear: String) {
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)
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)
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 {
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 {
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,
@ -425,9 +520,12 @@ class SettingsSubMenuAutofillRobot {
deleteCreditCardToolbarButton(),
saveCreditCardToolbarButton(),
)
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(
@ -458,30 +556,36 @@ class SettingsSubMenuAutofillRobot {
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 {
Log.i(TAG, "goBackToAutofillSettings: Trying to click the navigate up toolbar button")
navigateBackButton().click()
Log.i(TAG, "goBackToAutofillSettings: Clicked \"Navigate back\" toolbar button")
Log.i(TAG, "goBackToAutofillSettings: Clicked the navigate up toolbar button")
SettingsSubMenuAutofillRobot().interact()
return SettingsSubMenuAutofillRobot.Transition()
}
fun goBackToSavedCreditCards(interact: SettingsSubMenuAutofillRobot.() -> Unit): SettingsSubMenuAutofillRobot.Transition {
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()

Loading…
Cancel
Save