Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Autofill should focus on first entry Fix #8280 #8510

Merged
merged 2 commits into from
May 3, 2017

Conversation

kumarrishav
Copy link
Contributor

@kumarrishav kumarrishav commented Apr 26, 2017

Test Plan:

  1. Open browser and type about:autofill
  2. Click on Add Address or Add Credit Card
  3. Cursor will focus on first input field

Description

Fix #8280

  • Submitted a ticket for my issue if one did not already exist.
  • Used Github auto-closing keywords in the commit message.
  • Added/updated tests for this change (for new code or code which already has tests).
  • Ran git rebase -i to squash commits (if needed).

screen shot 2017-04-26 at 11 10 15 pm

screen shot 2017-04-26 at 11 10 51 pm

screen shot 2017-04-26 at 11 11 04 pm

@@ -136,7 +138,7 @@ class AutofillAddressPanel extends ImmutableComponent {
)}
data-test-id='nameOnAddress'
spellCheck='false' onKeyDown={this.onKeyDown} onChange={this.onNameChange}
value={this.props.currentDetail.get('name')}
value={this.props.currentDetail.get('name') || ''}
Copy link
Contributor Author

@kumarrishav kumarrishav Apr 26, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added default value as {this.props.currentDetail.get('name') || ''} to avoid the warning (because of react 15 upgrade).
warning.js?8a56:36
Warning: AutofillAddressPanel is changing an uncontrolled input of type undefined to be controlled. Input elements should not switch from uncontrolled to controlled (or vice versa). Decide between using a controlled or uncontrolled input element for the lifetime of the component. More info: https://fb.me/react-controlled-components.

@@ -115,7 +118,7 @@ class AutofillCreditCardPanel extends ImmutableComponent {
spellCheck='false'
onKeyDown={this.onKeyDown}
onChange={this.onNameChange}
value={this.props.currentDetail.get('name')}
value={this.props.currentDetail.get('name') || ''}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here.

@kumarrishav
Copy link
Contributor Author

screen shot 2017-04-27 at 12 01 51 am

Warning in console

@bsclifton bsclifton added this to the 0.15.1 milestone Apr 26, 2017
@darkdh darkdh self-requested a review April 26, 2017 20:50
Copy link
Member

@darkdh darkdh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kumarrishav could you also add test to test/contents/autofillTest.js ?

@kumarrishav
Copy link
Contributor Author

@darkdh will test/contents/autofillTest.js be right place to test this? As name suggests this is to test the content in input field. I tried to find autofill related test test/app/renderer/components/ but couldn't find any.

@darkdh
Copy link
Member

darkdh commented Apr 26, 2017

@kumarrishav you can add test there for now. All the autofill tests are in test/contents/autofillTest.js but we can do refactor later.

@kumarrishav
Copy link
Contributor Author

@darkdh sure will do.
Btw i am facing this issue. what can be possible issue? https://community.brave.com/t/unable-to-run-test/2370

@darkdh
Copy link
Member

darkdh commented Apr 26, 2017

sorry for the inconvenience. please do the following steps

  1. make sure you have node v7.9.0
  2. make sure your .npmrc contains this change 3f589aa
$ npm clean cache
$ rm -rf ~/.node-gyp
$ rm -rf ~/.electron
$ rm -rf node_modules
$ npm install 

@kumarrishav
Copy link
Contributor Author

@darkdh sorry it failed again.
Currently i am on master branch (latest code).
This time different error:

brave@0.15.0 test /Users/krishav/Documents/FOSS/Brave/browser-laptop
cross-env NODE_ENV=test mocha "test/**/*Test.js"

/Users/krishav/Documents/FOSS/Brave/browser-laptop/node_modules/bindings/bindings.js:83
throw e
^

Error: The module '/Users/krishav/Documents/FOSS/Brave/browser-laptop/node_modules/leveldown/build/Release/leveldown.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 55. This version of Node.js requires
NODE_MODULE_VERSION 51. Please try re-compiling or re-installing
the module (for instance, using npm rebuild ornpm install).
at Object.Module._extensions..node (module.js:598:18)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at bindings (/Users/krishav/Documents/FOSS/Brave/browser-laptop/node_modules/bindings/bindings.js:76:44)
at Object. (/Users/krishav/Documents/FOSS/Brave/browser-laptop/node_modules/leveldown/leveldown.js:4:46)
at Module._compile (module.js:571:32)
at Module._extensions..js (module.js:580:10)

@kumarrishav
Copy link
Contributor Author

why this version issue is happening?

@darkdh
Copy link
Member

darkdh commented Apr 27, 2017

@kumarrishav it is because we have different ABI version. Please contain this commit 576921b and try again.

@kumarrishav
Copy link
Contributor Author

@darkdh this fixes the issue.

@kumarrishav
Copy link
Contributor Author

kumarrishav commented Apr 28, 2017

@darkdh I am not sure how to test the 'focus' thing in integration test. Also, i am getting this error while running test. I think unit test is right place to test it.
screen shot 2017-04-28 at 6 24 53 pm

@darkdh
Copy link
Member

darkdh commented Apr 30, 2017

@kumarrishav please rebase to master and try again. There will be some intermittent errors but at least Autofill address and Autofill credit card is testable
You can use waitForElementFocus to check element is focused and just add a it('check focus', function * () {}) to Autofill address and Autofill credit card before adds section.

@kumarrishav
Copy link
Contributor Author

@darkdh sorry, but still same error. It fails at beforeEach hook. Though it fills the form, but fails at first it.('adds an autofill address' function * () {}) itself

@NejcZdovc
Copy link
Contributor

@kumarrishav I just try running test on the master and it's working for me

image

@luixxiul
Copy link
Contributor

luixxiul commented May 1, 2017

@kumarrishav to run webdriver test open a console, run npm run watch-test. open another console and run the test specified above. It should work.

@darkdh
Copy link
Member

darkdh commented May 1, 2017

@kumarrishav you can also run npm run watch-all which allows you to run test and launch browser-laptop

@kumarrishav
Copy link
Contributor Author

Sorry @darkdh Still same error. Don't know why it's not working in my system (Mac OS, Node -v : 7.9.0 and npm 4.2.0). Can we move this test later to UT (and file another issue for same)

@darkdh
Copy link
Member

darkdh commented May 3, 2017

@kumarrishav , I've added the test in d1f502a
Thanks for your work.

@darkdh darkdh self-assigned this May 3, 2017
@bsclifton bsclifton self-requested a review May 3, 2017 20:25
Copy link
Member

@bsclifton bsclifton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look great! Tested manually and also ran npm run test -- --grep="Autofill"; everything is looking good 😄

@bsclifton
Copy link
Member

Thanks, @kumarrishav! 😄

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants