diff --git a/test/contents/autofillTest.js b/test/contents/autofillTest.js index ccdb098311a..4c9f18ae255 100644 --- a/test/contents/autofillTest.js +++ b/test/contents/autofillTest.js @@ -9,19 +9,38 @@ const saveAddressButton = '[data-test-id="saveAddressButton"]' const addCreditCardButton = '[data-test-id="addCreditCardButton"]' const saveCreditCardButton = '[data-test-id="saveCreditCardButton"]' const name = 'Brave Lion' +const nameInput = '[data-test-id="nameOnAddress"]' const organization = 'Brave' +const organizationInput = '[data-test-id="organization"]' const streetAddress = '1161 Mission Street, #401' +const streetInput = '[data-test-id="streetAddress"]' const city = 'San Francisco' +const cityInput = '[data-test-id="city"]' const state = 'CA' +const stateInput = '[data-test-id="state"]' const postalCode = '94103-1550' +const postalCodeInput = '[data-test-id="postalCode"]' const country = 'US' +const countryInput = '[data-test-id="country"]' const phone = '0987654321' +const phoneInput = '[data-test-id="phone"]' const email = 'press@brave.com' +const emailInput = '[data-test-id="email"]' const cardName = 'Test Card' +const cardNameInput = '[data-test-id="creditCardName"]' const cardNumber = '1234567890' +const cardNumberInput = '[data-test-id="creditCardNumber"]' const expMonth = 9 const expYear = new Date().getFullYear() + 2 +// auto fill form +const formFullNameInput = '[name="04fullname"]' +const formPhoneInput = '[name="23cellphon"]' +const formEmailInput = '[name="24emailadr"]' +const formCardNameInput = '[name="41ccnumber"]' +const formCreditMonthInput = '[name="42ccexp_mm"]' +const formCreditYearInput = '[name="43ccexp_yy"]' + describe('Autofill', function () { function * setup (client) { yield client @@ -44,24 +63,24 @@ describe('Autofill', function () { .click(addAddressButton) .windowByUrl(Brave.browserWindowUrl) .waitForVisible(autofillAddressPanel) - .waitForElementFocus('[data-test-id="nameOnAddress"]') - .keys(name) - .click('[data-test-id="organization"]') - .keys(organization) - .click('[data-test-id="streetAddress"]') - .keys(streetAddress) - .click('[data-test-id="city"]') - .keys(city) - .click('[data-test-id="state"]') - .keys(state) - .click('[data-test-id="postalCode"]') - .keys(postalCode) - .click('[data-test-id="country"]') - .keys(country) - .click('[data-test-id="phone"]') - .keys(phone) - .click('[data-test-id="email"]') - .keys(email) + .waitForElementFocus(nameInput) + .typeText(nameInput, name) + .click(organizationInput) + .typeText(organizationInput, organization) + .click(streetInput) + .typeText(streetInput, streetAddress) + .click(cityInput) + .typeText(cityInput, city) + .click(stateInput) + .typeText(stateInput, state) + .click(postalCodeInput) + .typeText(postalCodeInput, postalCode) + .click(countryInput) + .typeText(countryInput, country) + .click(phoneInput) + .typeText(phoneInput, phone) + .click(emailInput) + .typeText(emailInput, email) .click(saveAddressButton) .waitUntil(function () { return this.getAppState().then((val) => { @@ -75,29 +94,29 @@ describe('Autofill', function () { yield this.app.client .waitForVisible('[data-test-id="autofillPage"]') .waitForTextValue('[data-test-id="addressName"]', name) - .waitForTextValue('[data-test-id="organization"]', organization) - .waitForTextValue('[data-test-id="streetAddress"]', streetAddress) - .waitForTextValue('[data-test-id="city"]', city) - .waitForTextValue('[data-test-id="state"]', state) - .waitForTextValue('[data-test-id="postalCode"]', postalCode) - .waitForTextValue('[data-test-id="country"]', country) - .waitForTextValue('[data-test-id="phone"]', phone) - .waitForTextValue('[data-test-id="email"]', email) + .waitForTextValue(organizationInput, organization) + .waitForTextValue(streetInput, streetAddress) + .waitForTextValue(cityInput, city) + .waitForTextValue(stateInput, state) + .waitForTextValue(postalCodeInput, postalCode) + .waitForTextValue(countryInput, country) + .waitForTextValue(phoneInput, phone) + .waitForTextValue(emailInput, email) }) it('autofills the address', function * () { yield this.app.client .tabByIndex(0) .loadUrl(this.formfill) .waitForVisible('
') - .click('[name="04fullname"]') - .click('[name="04fullname"]') + .click(formFullNameInput) + .click(formFullNameInput) .windowByUrl(Brave.browserWindowUrl) .waitForVisible('.contextMenuItemText') .click('.contextMenuItemText') .tabByUrl(this.formfill) - .waitForInputText('[name="04fullname"]', name) - .waitForInputText('[name="23cellphon"]', phone) - .waitForInputText('[name="24emailadr"]', email) + .waitForInputText(formFullNameInput, name) + .waitForInputText(formPhoneInput, phone) + .waitForInputText(formEmailInput, email) // TODO(bridiver) - this needs to check all fields }) it('autofills the address in a private tab', function * () { @@ -106,15 +125,15 @@ describe('Autofill', function () { .newTab({ url: this.formfill + '?2', isPrivate: true }) .waitForUrl(this.formfill + '?2') .waitForVisible('') - .click('[name="04fullname"]') - .click('[name="04fullname"]') + .click(formFullNameInput) + .click(formFullNameInput) .windowByUrl(Brave.browserWindowUrl) .waitForVisible('.contextMenuItemText') .click('.contextMenuItemText') .tabByUrl(this.formfill) - .waitForInputText('[name="04fullname"]', name) - .waitForInputText('[name="23cellphon"]', phone) - .waitForInputText('[name="24emailadr"]', email) + .waitForInputText(formFullNameInput, name) + .waitForInputText(formPhoneInput, phone) + .waitForInputText(formEmailInput, email) // TODO(bridiver) - this needs to check all fields }) it('autofills the updated address when edited', function * () { @@ -126,12 +145,12 @@ describe('Autofill', function () { .click('[data-test-id="EditAddress"]') .windowByUrl(Brave.browserWindowUrl) .waitForVisible(autofillAddressPanel) - .click('[data-test-id="phone"]') + .click(phoneInput) .keys(Brave.keys.END) - .keys('123') - .click('[data-test-id="email"]') + .typeText(phoneInput, '123', phone) + .click(emailInput) .keys(Brave.keys.END) - .keys('mm') + .typeText(emailInput, 'mm', email) .click(saveAddressButton) .waitUntil(function () { return this.getAppState().then((val) => { @@ -142,26 +161,26 @@ describe('Autofill', function () { .loadUrl(this.autofillPreferences) .waitForVisible('[data-test-id="autofillPage"]') .waitForTextValue('[data-test-id="addressName"]', name) - .waitForTextValue('[data-test-id="organization"]', organization) - .waitForTextValue('[data-test-id="streetAddress"]', streetAddress) - .waitForTextValue('[data-test-id="city"]', city) - .waitForTextValue('[data-test-id="state"]', state) - .waitForTextValue('[data-test-id="postalCode"]', postalCode) - .waitForTextValue('[data-test-id="country"]', country) - .waitForTextValue('[data-test-id="phone"]', phone + '123') - .waitForTextValue('[data-test-id="email"]', email + 'mm') + .waitForTextValue(organizationInput, organization) + .waitForTextValue(streetInput, streetAddress) + .waitForTextValue(cityInput, city) + .waitForTextValue(stateInput, state) + .waitForTextValue(postalCodeInput, postalCode) + .waitForTextValue(countryInput, country) + .waitForTextValue(phoneInput, phone + '123') + .waitForTextValue(emailInput, email + 'mm') // fill out the form .loadUrl(this.formfill) .waitForVisible('') - .click('[name="04fullname"]') - .click('[name="04fullname"]') + .click(formFullNameInput) + .click(formFullNameInput) .windowByUrl(Brave.browserWindowUrl) .waitForVisible('.contextMenuItemText') .click('.contextMenuItemText') .tabByUrl(this.formfill) - .waitForInputText('[name="04fullname"]', name) - .waitForInputText('[name="23cellphon"]', phone + '123') - .waitForInputText('[name="24emailadr"]', email + 'mm') + .waitForInputText(formFullNameInput, name) + .waitForInputText(formPhoneInput, phone + '123') + .waitForInputText(formEmailInput, email + 'mm') // TODO(bridiver) - this needs to check all fields }) it('deletes the address', function * () { @@ -189,10 +208,10 @@ describe('Autofill', function () { .click(addCreditCardButton) .windowByUrl(Brave.browserWindowUrl) .waitForVisible(autofillCreditCardPanel) - .waitForElementFocus('[data-test-id="creditCardName"]') - .keys(cardName) - .click('[data-test-id="creditCardNumber"]') - .keys(cardNumber) + .waitForElementFocus(cardNameInput) + .typeText(cardNameInput, cardName) + .click(cardNumberInput) + .typeText(cardNumberInput, cardNumber) .selectByValue('[data-test-id="expMonthSelect"]', expMonth < 10 ? '0' + expMonth.toString() : expMonth.toString()) .selectByValue('[data-test-id="expYearSelect"]', expYear.toString()) .click(saveCreditCardButton) @@ -207,8 +226,8 @@ describe('Autofill', function () { it('adds an autofill credit card', function * () { yield this.app.client .waitForVisible('[data-test-id="autofillPage"]') - .waitForTextValue('[data-test-id="creditCardName"]', cardName) - .waitForTextValue('[data-test-id="creditCardNumber"]', '***' + cardNumber.slice(-4)) + .waitForTextValue(cardNameInput, cardName) + .waitForTextValue(cardNumberInput, '***' + cardNumber.slice(-4)) .waitForTextValue('[data-test-id="creditCardPExpirationDate"]', (expMonth < 10 ? '0' + expMonth.toString() : expMonth.toString()) + '/' + expYear.toString()) }) @@ -217,15 +236,15 @@ describe('Autofill', function () { .tabByIndex(0) .loadUrl(this.formfill) .waitForVisible('') - .click('[name="41ccnumber"]') - .click('[name="41ccnumber"]') + .click(formCardNameInput) + .click(formCardNameInput) .windowByUrl(Brave.browserWindowUrl) .waitForVisible('.contextMenuItemText') .click('.contextMenuItemText') .tabByUrl(this.formfill) - .waitForInputText('[name="41ccnumber"]', cardNumber) - .waitForInputText('[name="42ccexp_mm"]', expMonth.toString()) - .waitForInputText('[name="43ccexp_yy"]', expYear.toString()) + .waitForInputText(formCardNameInput, cardNumber) + .waitForInputText(formCreditMonthInput, expMonth.toString()) + .waitForInputText(formCreditYearInput, expYear.toString()) }) it.skip('autofills the credit card in a private tab', function * () { yield this.app.client @@ -233,15 +252,15 @@ describe('Autofill', function () { .newTab({ url: this.formfill + '?2', isPrivate: true }) .waitForUrl(this.formfill + '?2') .waitForVisible('') - .click('[name="41ccnumber"]') - .click('[name="41ccnumber"]') + .click(formCardNameInput) + .click(formCardNameInput) .windowByUrl(Brave.browserWindowUrl) .waitForVisible('.contextMenuItemText') .click('.contextMenuItemText') .tabByUrl(this.formfill) - .waitForInputText('[name="41ccnumber"]', cardNumber) - .waitForInputText('[name="42ccexp_mm"]', expMonth.toString()) - .waitForInputText('[name="43ccexp_yy"]', expYear.toString()) + .waitForInputText(formCardNameInput, cardNumber) + .waitForInputText(formCreditMonthInput, expMonth.toString()) + .waitForInputText(formCreditYearInput, expYear.toString()) }) it.skip('autofills the updated credit card when edited', function * () { yield this.app.client @@ -252,10 +271,10 @@ describe('Autofill', function () { .click('[data-test-id="EditCreditCard"]') .windowByUrl(Brave.browserWindowUrl) .waitForVisible(autofillCreditCardPanel) - .waitForElementFocus('[data-test-id="creditCardName"]') + .waitForElementFocus(cardNameInput) .keys(Brave.keys.END) .keys('123') - .click('[data-test-id="creditCardNumber"]') + .click(cardNumberInput) .keys(Brave.keys.END) .keys('123') .selectByValue('[data-test-id="expMonthSelect"]', (expMonth + 1).toString()) @@ -269,21 +288,21 @@ describe('Autofill', function () { .tabByIndex(0) .loadUrl(this.autofillPreferences) .waitForVisible('[data-test-id="autofillPage"]') - .waitForTextValue('[data-test-id="creditCardName"]', cardName + 123) - .waitForTextValue('[data-test-id="creditCardNumber"]', '***' + (cardNumber + 123).slice(-4)) + .waitForTextValue(cardNameInput, cardName + 123) + .waitForTextValue(cardNumberInput, '***' + (cardNumber + 123).slice(-4)) .waitForTextValue('[data-test-id="creditCardPExpirationDate"]', (expMonth + 1).toString() + '/' + (expYear + 1).toString()) .tabByIndex(0) .loadUrl(this.formfill) .waitForVisible('') - .click('[name="41ccnumber"]') - .click('[name="41ccnumber"]') + .click(formCardNameInput) + .click(formCardNameInput) .windowByUrl(Brave.browserWindowUrl) .waitForVisible('.contextMenuItemText') .click('.contextMenuItemText') .tabByUrl(this.formfill) - .waitForInputText('[name="41ccnumber"]', cardNumber + '123') - .waitForInputText('[name="42ccexp_mm"]', (expMonth + 1).toString()) - .waitForInputText('[name="43ccexp_yy"]', (expYear + 1).toString()) + .waitForInputText(formCardNameInput, cardNumber + '123') + .waitForInputText(formCreditMonthInput, (expMonth + 1).toString()) + .waitForInputText(formCreditYearInput, (expYear + 1).toString()) // TODO(bridiver) this needs to check all fields }) it('deletes the credit card', function * () { @@ -311,24 +330,24 @@ describe('Autofill', function () { .click(addAddressButton) .windowByUrl(Brave.browserWindowUrl) .waitForVisible(autofillAddressPanel) - .waitForElementFocus('[data-test-id="nameOnAddress"]') - .keys(name) - .click('[data-test-id="organization"]') - .keys(organization) - .click('[data-test-id="streetAddress"]') - .keys(streetAddress) - .click('[data-test-id="city"]') - .keys(city) - .click('[data-test-id="state"]') - .keys(state) - .click('[data-test-id="postalCode"]') - .keys(postalCode) - .click('[data-test-id="country"]') - .keys(country) - .click('[data-test-id="phone"]') - .keys(phone) - .click('[data-test-id="email"]') - .keys(email) + .waitForElementFocus(nameInput) + .typeText(nameInput, name) + .click(organizationInput) + .typeText(organizationInput, organization) + .click(streetInput) + .typeText(streetInput, streetAddress) + .click(cityInput) + .typeText(cityInput, city) + .click(stateInput) + .typeText(stateInput, state) + .click(postalCodeInput) + .typeText(postalCodeInput, postalCode) + .click(countryInput) + .typeText(countryInput, country) + .click(phoneInput) + .typeText(phoneInput, phone) + .click(emailInput) + .typeText(emailInput, email) .click(saveAddressButton) .waitUntil(function () { return this.getAppState().then((val) => { @@ -341,10 +360,10 @@ describe('Autofill', function () { .click(addCreditCardButton) .windowByUrl(Brave.browserWindowUrl) .waitForVisible(autofillCreditCardPanel) - .waitForElementFocus('[data-test-id="creditCardName"]') - .keys(cardName) - .click('[data-test-id="creditCardNumber"]') - .keys(cardNumber) + .waitForElementFocus(cardNameInput) + .typeText(cardNameInput, cardName) + .click(cardNumberInput) + .typeText(cardNumberInput, cardNumber) .selectByValue('[data-test-id="expMonthSelect"]', expMonth < 10 ? '0' + expMonth.toString() : expMonth.toString()) .selectByValue('[data-test-id="expYearSelect"]', expYear.toString()) .click(saveCreditCardButton) @@ -360,20 +379,20 @@ describe('Autofill', function () { yield this.app.client .waitForVisible('[data-test-id="autofillPage"]') .waitForTextValue('[data-test-id="addressName"]', name) - .waitForTextValue('[data-test-id="organization"]', organization) - .waitForTextValue('[data-test-id="streetAddress"]', streetAddress) - .waitForTextValue('[data-test-id="city"]', city) - .waitForTextValue('[data-test-id="state"]', state) - .waitForTextValue('[data-test-id="postalCode"]', postalCode) - .waitForTextValue('[data-test-id="country"]', country) - .waitForTextValue('[data-test-id="phone"]', phone) - .waitForTextValue('[data-test-id="email"]', email) + .waitForTextValue(organizationInput, organization) + .waitForTextValue(streetInput, streetAddress) + .waitForTextValue(cityInput, city) + .waitForTextValue(stateInput, state) + .waitForTextValue(postalCodeInput, postalCode) + .waitForTextValue(countryInput, country) + .waitForTextValue(phoneInput, phone) + .waitForTextValue(emailInput, email) }) it('adds an autofill credit card', function * () { yield this.app.client .waitForVisible('[data-test-id="autofillPage"]') - .waitForTextValue('[data-test-id="creditCardName"]', cardName) - .waitForTextValue('[data-test-id="creditCardNumber"]', '***' + cardNumber.slice(-4)) + .waitForTextValue(cardNameInput, cardName) + .waitForTextValue(cardNumberInput, '***' + cardNumber.slice(-4)) .waitForTextValue('[data-test-id="creditCardPExpirationDate"]', (expMonth < 10 ? '0' + expMonth.toString() : expMonth.toString()) + '/' + expYear.toString()) }) @@ -382,15 +401,15 @@ describe('Autofill', function () { .tabByIndex(0) .loadUrl(this.formfill) .waitForVisible('') - .click('[name="04fullname"]') - .click('[name="04fullname"]') + .click(formFullNameInput) + .click(formFullNameInput) .windowByUrl(Brave.browserWindowUrl) .waitForVisible('.contextMenuItemText') .click('.contextMenuItemText') .tabByUrl(this.formfill) - .waitForInputText('[name="04fullname"]', name) - .waitForInputText('[name="23cellphon"]', phone) - .waitForInputText('[name="24emailadr"]', email) + .waitForInputText(formFullNameInput, name) + .waitForInputText(formPhoneInput, phone) + .waitForInputText(formEmailInput, email) // TODO(bridiver) - this needs to check all fields }) it.skip('autofills the credit card', function * () { @@ -398,15 +417,15 @@ describe('Autofill', function () { .tabByIndex(0) .loadUrl(this.formfill) .waitForVisible('') - .click('[name="41ccnumber"]') - .click('[name="41ccnumber"]') + .click(formCardNameInput) + .click(formCardNameInput) .windowByUrl(Brave.browserWindowUrl) .waitForVisible('.contextMenuItemText') .click('.contextMenuItemText') .tabByUrl(this.formfill) - .waitForInputText('[name="41ccnumber"]', cardNumber) - .waitForInputText('[name="42ccexp_mm"]', expMonth.toString()) - .waitForInputText('[name="43ccexp_yy"]', expYear.toString()) + .waitForInputText(formCardNameInput, cardNumber) + .waitForInputText(formCreditMonthInput, expMonth.toString()) + .waitForInputText(formCreditYearInput, expYear.toString()) }) it('clear data now', function * () { yield this.app.client @@ -428,17 +447,17 @@ describe('Autofill', function () { .newTab({ url: this.formfill }) .waitForUrl(this.formfill) .waitForVisible('') - .click('[name="04fullname"]') - .click('[name="04fullname"]') + .click(formFullNameInput) + .click(formFullNameInput) .windowByUrl(Brave.browserWindowUrl) .waitForElementCount('contextMenuItemText', 0) .tabByIndex(1) - .waitForInputText('[name="04fullname"]', '') - .click('[name="41ccnumber"]') - .click('[name="41ccnumber"]') + .waitForInputText(formFullNameInput, '') + .click(formCardNameInput) + .click(formCardNameInput) .waitForElementCount('contextMenuItemText', 0) .tabByIndex(1) - .waitForInputText('[name="41ccnumber"]', '') + .waitForInputText(formCardNameInput, '') }) }) @@ -452,20 +471,20 @@ describe('Autofill', function () { .tabByIndex(0) .loadUrl(this.formfill) .waitForVisible('') - .setValue('[name="04fullname"]', 'test') + .setValue(formFullNameInput, 'test') .click('#submit') }) it('autofills in regular tab', function * () { yield this.app.client .tabByIndex(0) .waitForVisible('') - .click('[name="04fullname"]') - .click('[name="04fullname"]') + .click(formFullNameInput) + .click(formFullNameInput) .windowByUrl(Brave.browserWindowUrl) .waitForVisible('.contextMenuItemText') .click('.contextMenuItemText') .tabByIndex(0) - .waitForInputText('[name="04fullname"]', 'test') + .waitForInputText(formFullNameInput, 'test') }) it('autofills in private tab', function * () { yield this.app.client @@ -473,13 +492,13 @@ describe('Autofill', function () { .newTab({ url: this.formfill + '?2', isPrivate: true }) .waitForUrl(this.formfill + '?2') .waitForVisible('') - .click('[name="04fullname"]') - .click('[name="04fullname"]') + .click(formFullNameInput) + .click(formFullNameInput) .windowByUrl(Brave.browserWindowUrl) .waitForVisible('.contextMenuItemText') .click('.contextMenuItemText') .tabByIndex(0) - .waitForInputText('[name="04fullname"]', 'test') + .waitForInputText(formFullNameInput, 'test') }) }) describe('session tab', function () { @@ -491,20 +510,20 @@ describe('Autofill', function () { .tabByIndex(0) .loadUrl(this.formfill) .waitForVisible('') - .setValue('[name="04fullname"]', 'test') + .setValue(formFullNameInput, 'test') .click('#submit') }) it('autofills in regular tab', function * () { yield this.app.client .tabByIndex(0) .waitForVisible('') - .click('[name="04fullname"]') - .click('[name="04fullname"]') + .click(formFullNameInput) + .click(formFullNameInput) .windowByUrl(Brave.browserWindowUrl) .waitForVisible('.contextMenuItemText') .click('.contextMenuItemText') .tabByIndex(0) - .waitForInputText('[name="04fullname"]', 'test') + .waitForInputText(formFullNameInput, 'test') }) it('autofills in session tab', function * () { yield this.app.client @@ -512,13 +531,13 @@ describe('Autofill', function () { .newTab({ url: this.formfill + '?2', partitionNumber: 3 }) .waitForUrl(this.formfill + '?2') .waitForVisible('') - .click('[name="04fullname"]') - .click('[name="04fullname"]') + .click(formFullNameInput) + .click(formFullNameInput) .windowByUrl(Brave.browserWindowUrl) .waitForVisible('.contextMenuItemText') .click('.contextMenuItemText') .tabByIndex(1) - .waitForInputText('[name="04fullname"]', 'test') + .waitForInputText(formFullNameInput, 'test') }) }) describe('private tab', function () { @@ -531,31 +550,31 @@ describe('Autofill', function () { .newTab({ url: this.formfill, isPrivate: true }) .waitForUrl(this.formfill) .waitForVisible('') - .setValue('[name="04fullname"]', 'test') + .setValue(formFullNameInput, 'test') .click('#submit') }) it('does not autofill in private tab', function * () { yield this.app.client .tabByIndex(1) .waitForVisible('') - .click('[name="04fullname"]') - .click('[name="04fullname"]') + .click(formFullNameInput) + .click(formFullNameInput) .windowByUrl(Brave.browserWindowUrl) .waitForElementCount('contextMenuItemText', 0) .tabByIndex(1) - .waitForInputText('[name="04fullname"]', '') + .waitForInputText(formFullNameInput, '') }) it('does not autofill in regular tab', function * () { yield this.app.client .tabByIndex(0) .loadUrl(this.formfill + '?2') .waitForVisible('') - .click('[name="04fullname"]') - .click('[name="04fullname"]') + .click(formFullNameInput) + .click(formFullNameInput) .windowByUrl(Brave.browserWindowUrl) .waitForElementCount('contextMenuItemText', 0) .tabByIndex(0) - .waitForInputText('[name="04fullname"]', '') + .waitForInputText(formFullNameInput, '') }) }) describe('clear autocomplete data', function () { @@ -567,20 +586,20 @@ describe('Autofill', function () { .tabByIndex(0) .loadUrl(this.formfill) .waitForVisible('') - .setValue('[name="04fullname"]', 'test') + .setValue(formFullNameInput, 'test') .click('#submit') }) it('autofills in regular tab', function * () { yield this.app.client .tabByIndex(0) .waitForVisible('') - .click('[name="04fullname"]') - .click('[name="04fullname"]') + .click(formFullNameInput) + .click(formFullNameInput) .windowByUrl(Brave.browserWindowUrl) .waitForVisible('.contextMenuItemText') .click('.contextMenuItemText') .tabByIndex(0) - .waitForInputText('[name="04fullname"]', 'test') + .waitForInputText(formFullNameInput, 'test') }) it('clear data now', function * () { yield this.app.client @@ -602,12 +621,12 @@ describe('Autofill', function () { .newTab({ url: this.formfill }) .waitForUrl(this.formfill) .waitForVisible('') - .click('[name="04fullname"]') - .click('[name="04fullname"]') + .click(formFullNameInput) + .click(formFullNameInput) .windowByUrl(Brave.browserWindowUrl) .waitForElementCount('contextMenuItemText', 0) .tabByIndex(1) - .waitForInputText('[name="04fullname"]', '') + .waitForInputText(formFullNameInput, '') }) }) }) @@ -620,15 +639,15 @@ describe('Autofill', function () { .tabByIndex(0) .loadUrl(this.formfill) .waitForVisible('') - .setValue('[name="04fullname"]', 'test') + .setValue(formFullNameInput, 'test') .click('#submit') }) it('hide when scroll', function * () { yield this.app.client .tabByIndex(0) .waitForVisible('') - .click('[name="04fullname"]') - .click('[name="04fullname"]') + .click(formFullNameInput) + .click(formFullNameInput) .windowByUrl(Brave.browserWindowUrl) .waitForVisible('.contextMenuItemText') .keys(Brave.keys.PAGEDOWN) @@ -638,8 +657,8 @@ describe('Autofill', function () { yield this.app.client .tabByIndex(0) .waitForVisible('') - .click('[name="04fullname"]') - .click('[name="04fullname"]') + .click(formFullNameInput) + .click(formFullNameInput) .windowByUrl(Brave.browserWindowUrl) .waitForVisible('.contextMenuItemText') .windowByUrl(Brave.browserWindowUrl)