Closed Bug 926881 Opened 11 years ago Closed 10 years ago

Write test to enable USB storage

Categories

(Firefox OS Graveyard :: Gaia::UI Tests, defect, P2)

Other
Gonk (Firefox OS)
defect

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: zcampbell, Assigned: jlorenzo, Mentored)

References

Details

(Whiteboard: [gaia-ui-test][lang=py])

Attachments

(1 file)

46 bytes, text/x-github-pull-request
martijn.martijn
: review+
viorela
: review+
Details | Review
For device only, write a test to enable USB storage using the Settings app. 1. Start b2g 2. Load settings app 3. Tap "Enable USB Storage" radio box 4. Assert the pref is set 5. Tap 'Media Storage' settings option 6. Assert that "Enable USB storage" is set and "SD Card shared" is showing.
Assignee: nobody → bob.silverberg
Enabling USB storage results in a modal dialog. Are we able to deal with those yet? I recall an outstanding bug for that. Or perhaps we can turn the confirmation screen off? Any ideas, Zac?
Flags: needinfo?(zcampbell)
OK I didn't notice that. I have marked this as depends on the modal dialog stuff. I also notice that the USB logo persists in the status bar even after we stop/start b2g. However after a full adb restart it goes away. I'm not sure what's causing it to stay or whether we can clean up with a software solution. Perhaps we should run this test dead last so that the next step is to restart/reflash the device when the next test run starts.
Depends on: 779284
Flags: needinfo?(zcampbell)
I am seeing other issues with USB storage. It seems like once it's turned on it cannot be turned off from the phone. After turning it on, and then off again, the import from sdcard test started failing, until I rebooted the phone. I think even if we get this test working it may end up causing all kinds of issues for our test runs, so perhaps we should leave this test for now. Either that or take your suggestion to always schedule it last, but I worry that at some point someone will unknowingly change a manifest file to move it from last position.
Status: NEW → ASSIGNED
Assignee: bob.silverberg → nobody
Status: ASSIGNED → NEW
Are we still waiting for something in this bug it looks like we are blocked here for some time. Zac, Bob can we close this Bug?
Flags: needinfo?(zcampbell)
Flags: needinfo?(bob.silverberg)
This is a smoketest so it should be a higher priority than any other new test cases and we should try and do it.
Flags: needinfo?(zcampbell)
Flags: needinfo?(bob.silverberg)
I will change this to a P2
Priority: P4 → P2
nbp has provided a command to remotely disconnect the phone, if this can be adapted into the framework? mozdevice may be able to 'get' the adb serials for us. ------------------------------------------ I my case I have 3 phones which are plug to my computer, and by running the folowing command, I can print the path to the serial file followed by the adb serials of the phone. $ find /sys/devices/pci0000\:00/ -name serial -print -exec cat '{}' \; | \ sed -n 'N; \,\n0000:, { d; }; p' /sys/devices/pci0000:00/0000:00:1a.7/usb3/3-1/3-1.2/serial a12f35f8 /sys/devices/pci0000:00/0000:00:1a.7/usb3/3-1/3-1.3/serial be3675a7 /sys/devices/pci0000:00/0000:00:1d.7/usb4/4-1/4-1.3/serial 781766e8 In each of these directories, there is an "authorized" file which can be set to "0" to unplug the phone, or to "1" to plug it back. # unplug echo 0 > /sys/devices/pci0000:00/0000:00:1a.7/usb3/3-1/3-1.2/authorized # plug echo 1 > /sys/devices/pci0000:00/0000:00:1a.7/usb3/3-1/3-1.2/authorized
Flags: needinfo?(nicolas.b.pierron)
(In reply to Zac C (:zac) from comment #7) > nbp has provided a command to remotely disconnect the phone, if this can be > adapted into the framework? mozdevice may be able to 'get' the adb serials > for us. I do not see any technical issue preventing us to find the pci location of the device and disconnect/reconnect the device. I tried manually, and I think I might have found a subtle issue for testing: I tried multiple things: 1. Enable USB, Disable USB, set authorized to 0, set authorized to 1. 2. Enable USB, set authorized to 0, Disable USB, set authorized to 1. 1/ Is stuck on the message asking to unplug the cable. 2/ The device is fooled into thinking that it is unplugged. Also, note that when authorized is set to 0, adb is no longer able to maintain the connection with the device, including the port forwarding. This means that you might have to use adb with the wireless interface instead of the USB one to maintain a connection with Marionette.
Flags: needinfo?(nicolas.b.pierron)
Thanks nbp. That might be sufficient blocker to achieving this test coverage.
Mentor: zcampbell
Whiteboard: [gaia-ui-test][mentor=zac][lang=py] → [gaia-ui-test][lang=py]
QA Whiteboard: [fxosqa-auto-backlog+]
(In reply to Zac C (:zac) from comment #2) > I also notice that the USB logo persists in the status bar even after we > stop/start b2g. However after a full adb restart it goes away. I checked this follow steps against today's 2.2 eng build: 1. Enable USB storage 2. Disable USB storage 3. adb shell stop b2g => USB storage is still visible on my computer 4. adb shell start b2g => USB storage is disconnect from my Linux 5. Open settings => USB storage is visibly disconnected on the device I guess we're ready to automate this test now ;)
Assignee: nobody → jlorenzo
QA Whiteboard: [fxosqa-auto-backlog+] → [fxosqa-auto-s6+][fxosqa-auto-points=2]
Mentor: zcampbell → nobody
Attached file Gaia PR
Here's a test following the steps described in comment 0. Steps 5 and 6 are missing because the USB switch is not displayed anymore on the Media Storage page.
Attachment #8537925 - Flags: review?(martijn.martijn)
Comment on attachment 8537925 [details] [review] Gaia PR The test looks good to me on itself. Unfortunately, it is failing on my local device: TEST-UNEXPECTED-FAIL | test_settings_usb_storage.py TestUsbStorage.test_toggle_usb_storage | AssertionError: False != True Traceback (most recent call last): File "/Users/mwargers/.virtualenvs/gaia-py-latest/lib/python2.7/site-packages/marionette_client-0.8.4-py2.7.egg/marionette/marionette_test.py", line 264, in run testMethod() File "/Users/mwargers/B2G/gaia_clean/tests/python/gaia-ui-tests/gaiatest/tests/functional/settings/test_settings_usb_storage.py", line 21, in test_toggle_usb_storage self.assertEquals(self.data_layer.get_setting('ums.enabled'), True) So the test finishes, but for some reason the confirmation dialog is still visible. Adding a time.sleep(1) fixes it for me (I don't know if that's the way to go, it seems like the only way. Just add a comment then, why you have to use it). I guess the dialog is already rendered, but the event handlers are not yet registered on the button when element.tap() is being called.
Attachment #8537925 - Flags: review?(martijn.martijn) → review-
I repeated the test 10 times and I haven't seen it once. Is it an intermittent problem on your side?
Attachment #8537925 - Flags: review?(viorela.ioia)
I started this adhoc job to try to point out the issue: http://jenkins1.qa.scl3.mozilla.com/view/UI/job/flame-kk.ui.adhoc/456/console
Comment on attachment 8537925 [details] [review] Gaia PR I left some comments in the PR
Attachment #8537925 - Flags: review?(viorela.ioia) → review-
Comment on attachment 8537925 [details] [review] Gaia PR I addressed the comment in the PR. The last adhoc job didn't point out anything, I triggered a new one[1] with the changes made in the PR. [1] http://jenkins1.qa.scl3.mozilla.com/view/UI/job/flame-kk.ui.adhoc/458/console
Attachment #8537925 - Flags: review?(viorela.ioia)
Attachment #8537925 - Flags: review?(martijn.martijn)
Attachment #8537925 - Flags: review-
Comment on attachment 8537925 [details] [review] Gaia PR r+
Attachment #8537925 - Flags: review?(viorela.ioia) → review+
Johan, I keep getting this failure with the test: TEST-UNEXPECTED-FAIL | test_settings_usb_storage.py TestUsbStorage.test_toggle_usb_storage | AssertionError: False is not true Traceback (most recent call last): File "/Users/mwargers/.virtualenvs/gaia-py-latest/lib/python2.7/site-packages/marionette_client-0.8.4-py2.7.egg/marionette/marionette_test.py", line 264, in run testMethod() File "/Users/mwargers/B2G/gaia_clean/tests/python/gaia-ui-tests/gaiatest/tests/functional/settings/test_settings_usb_storage.py", line 25, in test_toggle_usb_storage self.assertTrue(self.data_layer.get_setting('ums.enabled')) The enable USB storage confirmation dialog stays open. I'm really uncomfortable r+-ing this, when it is failing locally. But I guess on Jenkins, this doesn't cause problems?
Flags: needinfo?(jlorenzo)
Comment on attachment 8537925 [details] [review] Gaia PR Ok, after updating my build on the phone, the test passes. So r+!
Attachment #8537925 - Flags: review?(martijn.martijn) → review+
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Depends on: 1113257
I filed bug 1113257 for some blurry text issue, that I saw after this test has finished running.
Flags: needinfo?(jlorenzo)
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: