Closed Bug 959499 Opened 11 years ago Closed 10 years ago

B2G Mochitests on Device: Ability to register to a specific wifi network

Categories

(Testing :: Mochitest, defect)

x86
macOS
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED
mozilla29

People

(Reporter: onecyrenus, Assigned: onecyrenus)

References

Details

Attachments

(1 file, 6 obsolete files)

To run mochitests on device you have to have the host machine and the client on the same wifi network. 

Currently there is no mechanism to configure the device to connect to a specific wifi access point. 

The mechanism now is to setup the device manually prior to a test run.
Good idea, we can use https://developer.mozilla.org/en-US/docs/Web/API/WifiManager.associate to try and connect to the network the host is hooked up to.

It would be cool if we could just access the functions in gaiatest's gaia_test.py (https://github.com/mozilla-b2g/gaia/blob/master/tests/python/gaia-ui-tests/gaiatest/gaia_test.py#L333) without needing to import everything else.. but that's another bug for another time.
Attached patch Bug_95499.patch (obsolete) — Splinter Review
Tested seems to work against Mozilla Guest
Attachment #8360886 - Flags: review?(ahalberstadt)
Attached patch Bug_95499.patch (obsolete) — Splinter Review
Slightly better help documentation
Attachment #8360886 - Attachment is obsolete: true
Attachment #8360886 - Flags: review?(ahalberstadt)
Attachment #8360892 - Flags: review?(ahalberstadt)
Comment on attachment 8360892 [details] [diff] [review]
Bug_95499.patch

Review of attachment 8360892 [details] [diff] [review]:
-----------------------------------------------------------------

r+ with a few nits and suggestions. I'd like to see an example of what to type at the command line.. I guess it isn't a huge deal, especially if most people are using mach these days anyway.

::: testing/mochitest/b2g_start_script.js
@@ +85,5 @@
> +  let manager = navigator.mozWifiManager;
> +  let con = manager.connection;
> +  if(wifiSettings) {
> +    if (manager.enabled) {
> +      manager.associate(wifiSettings);    

nit: trailing whitespace

@@ +87,5 @@
> +  if(wifiSettings) {
> +    if (manager.enabled) {
> +      manager.associate(wifiSettings);    
> +    } else {
> +      manager.onenabled = function () {  

nit: trailing whitespace

::: testing/mochitest/mochitest_options.py
@@ +574,5 @@
> +        [["--wifi"],
> +        { "action": "store",
> +          "type": "string",
> +          "dest": "wifi",
> +          "help": "Define mozWifiManager connection: network associate json string expected",

So we need to type json at the command line? That seems a little clunky :/. What's an example value you'd type? Should also mention it only works with a device build, maybe append (device only).

::: testing/mochitest/runtestsb2g.py
@@ +115,5 @@
>          self.buildURLOptions(options, {'MOZ_HIDE_RESULTS_TABLE': '1'})
> +        if not options.emulator:
> +          self.test_script_args.append(True)
> +        else:
> +          self.test_script_args.append(False)

This can be re-written as:
self.test_script_args.append(not options.emulator)
Attachment #8360892 - Flags: review?(ahalberstadt) → review+
Attached patch Bug_95499.patch (obsolete) — Splinter Review
+nit fix
Assignee: nobody → dclarke
Attachment #8360892 - Attachment is obsolete: true
Status: NEW → ASSIGNED
Attachment #8366155 - Flags: review+
Andrew, 
  Possibly the mach command would read in a specific wifi file and pass it to the command line ? I just wasn't sure we needed an entire file for what will probably be a small  json object.. 

https://developer.mozilla.org/en-US/Firefox_OS/Platform/Automated_testing/gaia-ui-tests/Gaia_UI_Tests_Run_Tests#How_to_configure_WiFi_using_testvars.json_%28for_devices%29

The gaia ui tests use a configuration file which passes the same type of object into the test harness. 

The documentation is usually on mdn for this type of feature ? Maybe a follow up bug for documentation?
Keywords: checkin-needed
Attached patch Bug_959499.patch (obsolete) — Splinter Review
Ran this through emulator, and seems fine now. 
Removed some defunk permissions from the manifest.webapp
Added the proxy configuration piece in there as well to make the patch complete.
Attachment #8366155 - Attachment is obsolete: true
Attachment #8367194 - Flags: review?(ahalberstadt)
Comment on attachment 8367194 [details] [diff] [review]
Bug_959499.patch

Review of attachment 8367194 [details] [diff] [review]:
-----------------------------------------------------------------

Thanks, lgtm.. as long as you are sure those permissions are deprecated :)
Attachment #8367194 - Flags: review?(ahalberstadt) → review+
Comment on attachment 8367194 [details] [diff] [review]
Bug_959499.patch

Review of attachment 8367194 [details] [diff] [review]:
-----------------------------------------------------------------

Actually, just noticed that try run is busted, something is up.
Attachment #8367194 - Flags: review+ → review-
JSON.parse probably doesn't like when we pass None into it.
Also for future, you can use the try syntax 'try: -b o -p emulator -u mochitest-1 -t none' to only run emulator mochitests.

In this case, it's the b2g desktop mochitests that have broken so you'd use 'try: -b o -p linux64_gecko -u mochitest -t none'

See http://trychooser.pub.build.mozilla.org/ for help building syntax.
Attached patch Bug_95499.patch (obsolete) — Splinter Review
https://tbpl.mozilla.org/?tree=Try&rev=df0c473829d7

Re-ran the broken tests with the updated patch. 
Added a check for wifiSettings prior to attempting to Parse. 
The default value for wifiSettings is False not None as well.
Attachment #8367194 - Attachment is obsolete: true
Attachment #8368083 - Flags: review?(ahalberstadt)
Comment on attachment 8368083 [details] [diff] [review]
Bug_95499.patch

Review of attachment 8368083 [details] [diff] [review]:
-----------------------------------------------------------------

I think you attached the wrong patch. The one in try looks good, but this one still doesn't check for wifiSettings first.

::: testing/mochitest/b2g_start_script.js
@@ +85,5 @@
> +  let manager = navigator.mozWifiManager;
> +  let con = manager.connection;
> +  if(wifiSettings) {
> +    if (manager.enabled) {
> +      manager.associate(wifiSettings);    

nit: trailing whitespace

@@ +87,5 @@
> +  if(wifiSettings) {
> +    if (manager.enabled) {
> +      manager.associate(wifiSettings);    
> +    } else {
> +      manager.onenabled = function () {  

nit: trailing whitespace
Attachment #8368083 - Flags: review?(ahalberstadt)
Attached patch Bug_95499.patch (obsolete) — Splinter Review
unsure how that happened ? let me try again
Attached patch Bug_959499.patchSplinter Review
problem found, incorrect patch
Attachment #8368083 - Attachment is obsolete: true
Attachment #8368185 - Attachment is obsolete: true
Attachment #8368192 - Flags: review?(ahalberstadt)
Comment on attachment 8368192 [details] [diff] [review]
Bug_959499.patch

Review of attachment 8368192 [details] [diff] [review]:
-----------------------------------------------------------------

Thanks! And try run looks good too.
Attachment #8368192 - Flags: review?(ahalberstadt) → review+
crosses fingers :)
Keywords: checkin-needed
https://hg.mozilla.org/mozilla-central/rev/7b8784894c96
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla29
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: