User Services/Try FMD: Difference between revisions
Rpappalardo (talk | contribs) (adding notes for setting custom simplepush server user_pref) |
|||
(29 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
== Get Find My Device Working == | == Get Find My Device Working == | ||
=== FxOS 2.0 Aurora and 2.1 Master === | |||
Requirement: build flashed after 15:36 PST - 7/10/2014 | |||
# On FxOS, goto Settings > Find My Device | |||
# sign in with existing Firefox Account or create a new one, then enable FMD | |||
# goto https://find.firefox.com | |||
# sign in with the same user as step #2 | |||
# It should locate your device | |||
== End-2-End Test == | |||
FindMyDevice end-to-end test with options! | |||
* launches desktopB2G and uses marionette.js to sign into FXA and enable FMD, leaves window open | |||
* launches webdriver to sign into FMD web site with the same FXA acct | |||
* tells you if your phone was located withing 60 sec (can be changed) | |||
* kicks off Ringer on each test | |||
* specify options: repeat test, FXA server, FMD server, test timeout | |||
'''Installation''' | |||
Pre-requisites: | |||
* virtualenv recommended | |||
* gaia profile generated (if you need to, run make test-integration, then kill when tests begin) | |||
$ mkvirtualenv fmdtest | |||
$ pip install selenium fxa-python-client psutil gaiatest | |||
* if you get pip install errors on Mac, see this page: | |||
** http://chriskief.com/2014/03/25/installing-cryptography-via-pip-with-macports-or-homebrew/ | |||
* Clone my repo/branch, create a new directory if you already have gaia | |||
$ git clone https://github.com/rpappalax/gaia.git | |||
$ cd gaia | |||
$ git checkout fmd-e2e-plus | |||
https:// | |||
* if test doesn't seem to be working, make sure <gaia_root>/b2g exists. If it doesn't do this: | |||
** get your OS's b2g.app - http://ftp.mozilla.org/pub/mozilla.org/b2g/nightly/latest-mozilla-central | |||
** unzip | |||
** on mac change the name from B2G.app to b2g/ | |||
'''Note''' | |||
* if you run into a compiler flag not found error on OSX, you may need to export this env var | |||
$ export ARCHFLAGS="-Wno-error=unused-command-line-argument-hard-error-in-future" | |||
* | |||
'''Run Test(s)''' | |||
To see all options: | |||
$ python fmd_locate.py -h | |||
$ | |||
Example: run a test 3x: | |||
$ python fmd_locate.py -r 3 | |||
optional arguments: | |||
-h, --help show this help message and exit | |||
-x FXA_SERVER, --fxa-server FXA_SERVER | |||
Enter path of Firefox Accounts server (default:https | |||
://api-accounts.stage.mozaws.net/ | |||
-f FMD_SERVER, --fmd-server FMD_SERVER | |||
Enter the URL of the FMD server | |||
(default:https://find.stage.mozaws.net) | |||
-g GAIA_DIR, --gaia-dir GAIA_DIR | |||
Enter path of gaia dir | |||
(default:/Users/rpappalardo/git/B2G/gaia) | |||
-t TEST_TIMEOUT, --test-timeout TEST_TIMEOUT | |||
Enter the test timeout in seconds (default:60) | |||
-r REPEAT, --repeat REPEAT | |||
Enter the number of times to repeat test (default:1) | |||
-s SELENIUM_SERVER, --selenium-server SELENIUM_SERVER | |||
Enter path of selenium jar file | |||
(default:/Users/rpappalardo/git/B2G/gaia/selenium- | |||
server-standalone-2.42.2.jar) | |||
'''Reference''' | |||
Source | |||
* https://github.com/ | * https://github.com/rpappalax/gaia/tree/fmd-e2e-plus | ||
== QA Flash Steps == | == QA Flash Steps == | ||
Line 107: | Line 120: | ||
Note: i haven’t been able to figure out if this can be done at runtime editable file vs build then flash. I wasn’t able to find any files with the fmd endpoint URI | Note: i haven’t been able to figure out if this can be done at runtime editable file vs build then flash. I wasn’t able to find any files with the fmd endpoint URI | ||
==== Set FMD and Gaia URLS ==== | |||
$ git clone https://github.com/mozilla-b2g/gaia.git | $ git clone https://github.com/mozilla-b2g/gaia.git | ||
$ cd gaia | $ cd gaia | ||
Edit / | Edit 3 files defined here: | ||
https://github.com/6a68/gaia/commit/00ec611f5d1dfc3f86bf1c139e460aae178f3d08 | |||
$ make reset-gaia | $ make reset-gaia | ||
If you want to confirm the URLs are written correctly to your phone. | |||
adb shell | |||
adb pull /system/b2g/webapps/findmydevice.gaiamobile.org/application.zip | |||
on desktop unzip and view | |||
js/config.js | |||
==== Set Firefox Account URL ==== | |||
1. set fxa to use stage servers | |||
download this: https://gist.github.com/edmoz/5596162 | |||
$ chmod +x modPref.sh | |||
$ ./modPref.sh pull | |||
edit prefs.js and add this to the bottom on it’s own line: | |||
user_pref("identity.fxaccounts.auth.uri", "https://api-accounts.stage.mozaws.net/v1"); | |||
2. Run this | |||
$ ./modPref.sh push prefs.js | |||
3. on Flame, sign into Fxa, verify email if needed, the verify link should be to | |||
https://accounts.stage.mozaws.net/v1/verify_email?… | |||
Note: even if you have an existing account before, you may not have created one in the Stage Database. Just create it again. | |||
4. sign into: | |||
https://find.stage.mozaws.net | |||
if you look in console i see and it correctly finds my location: | |||
"device:updated" "2731a65040a15a6080c6b48d4231b4d9" Object { | |||
hasPasscode: undefined, | |||
latitude: 37.xx, | |||
longitude: -122.xx, | |||
altitude: 0, | |||
located: true, | |||
time: Date 2014-06-20T21:48:46.000Z | |||
} "{"Latitude":37.xx, | |||
"Longitude":-122.23120187, | |||
"Altitude":0, | |||
"Time":1403300926000, | |||
"Cmd":{"t":{"la":37.xx,"lo":-122.xx,"ok":true,"ti":1.403300926e+12}}}" | |||
device.js:50 | |||
ring, lost mode, erase all work as expected. | |||
==== Set SimplePush URL ==== | |||
If you also need to use a staging or custom SimplePush server, follow same steps as for setting Firefox Account URL (see above) but add user_pref for "services.push.serverURL". | |||
default setting is: | |||
user_pref("services.push.serverURL", "wss://push.services.mozilla.com/"); | |||
== Low Memory Throttling == | |||
All testing should be done with a memory limit on the Flame. Run these cmds: | |||
adb reboot bootloader | |||
*Device will restart* | |||
fastboot oem mem 273 | |||
fastboot reboot | |||
To see what you have it set to: | |||
adb reboot bootloader | |||
fastboot getvar mem | |||
Note: There has been debate about 512MB vs 273MB, 273MB has been confirmed by tchung as the shipping memory target. | |||
== Test Servers == | == Test Servers == | ||
Line 118: | Line 207: | ||
Current 2.1 master src of truth: | Current 2.1 master src of truth: | ||
* | * see Flash Gaia URLS | ||
* http://dxr.mozilla.org/mozilla-central/source/modules/libpref/src/init/all.js#4217 | * http://dxr.mozilla.org/mozilla-central/source/modules/libpref/src/init/all.js#4217 | ||
=== stable env | ==== Flash Gaia URLS ==== | ||
* web app: https:// | To set the URLS in Gaia, edit these files, and run make reset-gaia | ||
apps/findmydevice/build/build.js | |||
apps/settings/build/build.js | |||
customization/findmydevice.json | |||
Here's the last commit - https://github.com/mozilla-b2g/gaia/commit/c710decee223224687c27333fc0d7e12df400c1c | |||
=== prod env === | |||
Default for 2.0 and 2.1 branches | |||
* web app: https://find.firefox.com | |||
* b2g-FTU-fxa: https://api.accounts.firefox.com/v1 | |||
* b2g-fmd-fxa-oauth: https://oauth.accounts.firefox.com/v1 | |||
* b2g-fmd: https://find.firefox.com | |||
=== stable env === | |||
* web app: https://find.stage.mozaws.net | |||
* b2g-FTU-fxa: must push gecko pref: user_pref("identity.fxaccounts.auth.uri", "https://api-accounts.stage.mozaws.net/v1"); | * b2g-FTU-fxa: must push gecko pref: user_pref("identity.fxaccounts.auth.uri", "https://api-accounts.stage.mozaws.net/v1"); | ||
* b2g-fmd-fxa-oauth: https://oauth.stage.mozaws.net/v1 (b2g default) | * b2g-fmd-fxa-oauth: https://oauth.stage.mozaws.net/v1 (b2g default) | ||
* b2g-fmd: https:// | * b2g-fmd: https://find.stage.mozaws.net (b2g default) | ||
=== dev env: === | === dev env: === | ||
* web app: http:// | * web app: http://find.dev.mozaws.net/ | ||
* b2g-FTU-fxa: https://accounts.firefox.com/v1 (b2g default) | * b2g-FTU-fxa: https://accounts.firefox.com/v1 (b2g default) | ||
Must Flash Gaia | Must Flash Gaia URLS (see above) | ||
* b2g-fmd-fxa-oauth: https://oauth.accounts.firefox.com/v1 | * b2g-fmd-fxa-oauth: https://oauth.accounts.firefox.com/v1 | ||
* b2g-fmd: http:// | * b2g-fmd: http://find.dev.mozaws.net/ | ||
=== stage env: === | === stage env: === | ||
* web app: https://find.stage.mozaws.net | * web app: https://find.stage.mozaws.net | ||
* b2g-FTU-fxa: https://accounts.firefox.com/v1 (b2g default) | * b2g-FTU-fxa: https://accounts.firefox.com/v1 (b2g default) | ||
Must Flash Gaia | Must Flash Gaia URLS (see above) | ||
* b2g-fmd-fxa-oauth: https://oauth.accounts.firefox.com/v1 | * b2g-fmd-fxa-oauth: https://oauth.accounts.firefox.com/v1 | ||
* b2g-fmd: https://find.stage.mozaws.net | * b2g-fmd: https://find.stage.mozaws.net | ||
Latest revision as of 02:03, 18 December 2014
Get Find My Device Working
FxOS 2.0 Aurora and 2.1 Master
Requirement: build flashed after 15:36 PST - 7/10/2014
- On FxOS, goto Settings > Find My Device
- sign in with existing Firefox Account or create a new one, then enable FMD
- goto https://find.firefox.com
- sign in with the same user as step #2
- It should locate your device
End-2-End Test
FindMyDevice end-to-end test with options!
- launches desktopB2G and uses marionette.js to sign into FXA and enable FMD, leaves window open
- launches webdriver to sign into FMD web site with the same FXA acct
- tells you if your phone was located withing 60 sec (can be changed)
- kicks off Ringer on each test
- specify options: repeat test, FXA server, FMD server, test timeout
Installation
Pre-requisites:
- virtualenv recommended
- gaia profile generated (if you need to, run make test-integration, then kill when tests begin)
$ mkvirtualenv fmdtest $ pip install selenium fxa-python-client psutil gaiatest
- if you get pip install errors on Mac, see this page:
- Clone my repo/branch, create a new directory if you already have gaia
$ git clone https://github.com/rpappalax/gaia.git $ cd gaia $ git checkout fmd-e2e-plus
- if test doesn't seem to be working, make sure <gaia_root>/b2g exists. If it doesn't do this:
- get your OS's b2g.app - http://ftp.mozilla.org/pub/mozilla.org/b2g/nightly/latest-mozilla-central
- unzip
- on mac change the name from B2G.app to b2g/
Note
- if you run into a compiler flag not found error on OSX, you may need to export this env var
$ export ARCHFLAGS="-Wno-error=unused-command-line-argument-hard-error-in-future"
Run Test(s)
To see all options:
$ python fmd_locate.py -h
Example: run a test 3x:
$ python fmd_locate.py -r 3
optional arguments:
-h, --help show this help message and exit -x FXA_SERVER, --fxa-server FXA_SERVER Enter path of Firefox Accounts server (default:https ://api-accounts.stage.mozaws.net/ -f FMD_SERVER, --fmd-server FMD_SERVER Enter the URL of the FMD server (default:https://find.stage.mozaws.net) -g GAIA_DIR, --gaia-dir GAIA_DIR Enter path of gaia dir (default:/Users/rpappalardo/git/B2G/gaia) -t TEST_TIMEOUT, --test-timeout TEST_TIMEOUT Enter the test timeout in seconds (default:60) -r REPEAT, --repeat REPEAT Enter the number of times to repeat test (default:1) -s SELENIUM_SERVER, --selenium-server SELENIUM_SERVER Enter path of selenium jar file (default:/Users/rpappalardo/git/B2G/gaia/selenium- server-standalone-2.42.2.jar)
Reference
Source
QA Flash Steps
clone this:
git clone https://github.com/Mozilla-TWQA/B2G-flash-tool
run
./auto_flash_from_pvt.sh -w -g -G
choose gaia+gecko
Debugging
Client side on device:
User Build
Enable Developer Menu:
- Check this box: Settings > Device Information > Developer Menu
- Then check the boxes for:
- Settings > Developer > Gaia debug traces
- You may be able to set this via pref: user_pref('browser.dom.window.dump.enabled', true);
- Settings > Developer > Geolocation output in ADB
- Then run this:
adb logcat | grep -e GEO -e findmydevice
- Enable adb access:
- Settings > Debugging via USB - set to 'ADB' or 'ADB and DevTools'
install adb on desktop then run
adb logcat
Engineering Build
Enabled verbose logging by enabling this:
- Settings > Developer > Gaia debug traces.
install adb then run
adb logcat
For the web app, open Tools > Web Developer > Web Console
Geolocation data will print to console.
Custom FMD Server
If you want to flash FMD app to use a specific server, follow these steps:
Note: i haven’t been able to figure out if this can be done at runtime editable file vs build then flash. I wasn’t able to find any files with the fmd endpoint URI
Set FMD and Gaia URLS
$ git clone https://github.com/mozilla-b2g/gaia.git $ cd gaia Edit 3 files defined here:
https://github.com/6a68/gaia/commit/00ec611f5d1dfc3f86bf1c139e460aae178f3d08
$ make reset-gaia
If you want to confirm the URLs are written correctly to your phone.
adb shell adb pull /system/b2g/webapps/findmydevice.gaiamobile.org/application.zip
on desktop unzip and view
js/config.js
Set Firefox Account URL
1. set fxa to use stage servers download this: https://gist.github.com/edmoz/5596162
$ chmod +x modPref.sh $ ./modPref.sh pull
edit prefs.js and add this to the bottom on it’s own line:
user_pref("identity.fxaccounts.auth.uri", "https://api-accounts.stage.mozaws.net/v1");
2. Run this
$ ./modPref.sh push prefs.js
3. on Flame, sign into Fxa, verify email if needed, the verify link should be to
https://accounts.stage.mozaws.net/v1/verify_email?…
Note: even if you have an existing account before, you may not have created one in the Stage Database. Just create it again.
4. sign into:
if you look in console i see and it correctly finds my location:
"device:updated" "2731a65040a15a6080c6b48d4231b4d9" Object { hasPasscode: undefined, latitude: 37.xx, longitude: -122.xx, altitude: 0, located: true, time: Date 2014-06-20T21:48:46.000Z } "{"Latitude":37.xx, "Longitude":-122.23120187, "Altitude":0, "Time":1403300926000, "Cmd":{"t":{"la":37.xx,"lo":-122.xx,"ok":true,"ti":1.403300926e+12}}}" device.js:50
ring, lost mode, erase all work as expected.
Set SimplePush URL
If you also need to use a staging or custom SimplePush server, follow same steps as for setting Firefox Account URL (see above) but add user_pref for "services.push.serverURL".
default setting is:
user_pref("services.push.serverURL", "wss://push.services.mozilla.com/");
Low Memory Throttling
All testing should be done with a memory limit on the Flame. Run these cmds:
adb reboot bootloader *Device will restart* fastboot oem mem 273 fastboot reboot
To see what you have it set to:
adb reboot bootloader fastboot getvar mem
Note: There has been debate about 512MB vs 273MB, 273MB has been confirmed by tchung as the shipping memory target.
Test Servers
FMD uses 2 different apps, Firefox Accounts Settings/FirstTimeUse gecko level code. Which is what you use when you sign into firefox accounts. You can modify this endpoint by pushing user_pref onto your b2g device.
Find My Device - Settings has two endpoints: fxa-oauth and fmd app server which is in the Gaia layer. You can modify this endpoint by flashing a locally modified findmydevice.json Gaia to your phone.
Current 2.1 master src of truth:
- see Flash Gaia URLS
- http://dxr.mozilla.org/mozilla-central/source/modules/libpref/src/init/all.js#4217
Flash Gaia URLS
To set the URLS in Gaia, edit these files, and run make reset-gaia
apps/findmydevice/build/build.js apps/settings/build/build.js customization/findmydevice.json
Here's the last commit - https://github.com/mozilla-b2g/gaia/commit/c710decee223224687c27333fc0d7e12df400c1c
prod env
Default for 2.0 and 2.1 branches
- web app: https://find.firefox.com
- b2g-FTU-fxa: https://api.accounts.firefox.com/v1
- b2g-fmd-fxa-oauth: https://oauth.accounts.firefox.com/v1
- b2g-fmd: https://find.firefox.com
stable env
- web app: https://find.stage.mozaws.net
- b2g-FTU-fxa: must push gecko pref: user_pref("identity.fxaccounts.auth.uri", "https://api-accounts.stage.mozaws.net/v1");
- b2g-fmd-fxa-oauth: https://oauth.stage.mozaws.net/v1 (b2g default)
- b2g-fmd: https://find.stage.mozaws.net (b2g default)
dev env:
- web app: http://find.dev.mozaws.net/
- b2g-FTU-fxa: https://accounts.firefox.com/v1 (b2g default)
Must Flash Gaia URLS (see above)
- b2g-fmd-fxa-oauth: https://oauth.accounts.firefox.com/v1
- b2g-fmd: http://find.dev.mozaws.net/
stage env:
- web app: https://find.stage.mozaws.net
- b2g-FTU-fxa: https://accounts.firefox.com/v1 (b2g default)
Must Flash Gaia URLS (see above)
- b2g-fmd-fxa-oauth: https://oauth.accounts.firefox.com/v1
- b2g-fmd: https://find.stage.mozaws.net