[Gallery] Update Marionette tests to use marionette-file-manager API

RESOLVED FIXED

Status

Firefox OS
Gaia
RESOLVED FIXED
5 years ago
4 years ago

People

(Reporter: pdahiya, Assigned: pdahiya)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Assignee)

Description

5 years ago
Marionette tests in Video and Gallery are using test_common module that queries Gecko for temporary directory and copies a test file there. Bug 936371 created marionette-file-manager plugin for this feature. Scope of this bug is to update Gallery and Video tests to use marionette-file-manager plugin.

Comment 1

5 years ago
Hi Punam,

Nice to meet you.
For sharing the info to use marionette-file-manager plugin, we could discuss the below questions you asked me in bugzilla.

1.Need to figure out how to unreserve file manager for subsequent tests.

We should add the marionette-file-manager plugin in https://github.com/mozilla-b2g/gaia/blob/master/shared/test/integration/setup.js

2. I have to manually create, device-storage-testing/videos folder, marionette-file-manager plugin is not able to create these folders in temp directory.

Sorry, bad doc for mariomette-file-manager in https://github.com/mozilla-b2g/marionette-file-manager#usage.

Actually, if we would like to add file into the device-storage-testing/videos directory, we could just do `client.fileManager.add({ type: 'videos', filePath: 'path/to/file1' });` to create the videos directory(if it didn't exist yet) and add a files into it.

3. Also, i have seen the plugin creates file marionetteContentScripts under ~/Library/Caches/TemporaryItems, what's the purpose of this script?

Sorry, I didn't see the file before. Could you upload and show the file here?
Thanks.

Really hope the info could help you. :)

Comment 2

5 years ago
Hi Punam,

One more thing.
How do you think if we could add a file in the root directory of device storage(device-storage-testing) with `client.fileManager.add({ filePath: 'path/to/file1' });`(We don't need to give a type, just give the filePath)?

Is it useful for you in the future or now?
Flags: needinfo?(pdahiya)
(Assignee)

Comment 3

5 years ago
(In reply to Evan Tseng [:evanxd] from comment #1)
> Hi Punam,
> 
> Nice to meet you.
> For sharing the info to use marionette-file-manager plugin, we could discuss
> the below questions you asked me in bugzilla.
> 
> 1.Need to figure out how to unreserve file manager for subsequent tests.
> 
> We should add the marionette-file-manager plugin in
> https://github.com/mozilla-b2g/gaia/blob/master/shared/test/integration/
> setup.js

>> This works now, have update the PR, thanks!
> 
> 2. I have to manually create, device-storage-testing/videos folder,
> marionette-file-manager plugin is not able to create these folders in temp
> directory.
> 
> Sorry, bad doc for mariomette-file-manager in
> https://github.com/mozilla-b2g/marionette-file-manager#usage.
> 
> Actually, if we would like to add file into the
> device-storage-testing/videos directory, we could just do
> `client.fileManager.add({ type: 'videos', filePath: 'path/to/file1' });` to
> create the videos directory(if it didn't exist yet) and add a files into it.
> 
>>>debugged and realised the issue is using  client.fileManager.removeAllFiles(); just before the call to add files  client.fileManager.add([
      { type: 'videos', filePath: 'test_media/Movies/elephants-dream.webm',
        filename: 'elephants-dream.webm' }
            ]);
doesn't work. I have updated the pr with a workaround, which is removing all files in the last test, however  i would prefer to start the video tests with a clean slate and that's why removing all files in temp device storage before adding video files. 

> 3. Also, i have seen the plugin creates file marionetteContentScripts under
> ~/Library/Caches/TemporaryItems, what's the purpose of this script?
> 
> Sorry, I didn't see the file before. Could you upload and show the file here?
>> Attaching the marionetteContentScriptsto the bug, you can replicate it by adding below two statements in a test file, 
    client.fileManager.removeAllFiles();
    client.fileManager.add([
      { type: 'videos', filePath: 'test_media/Movies/elephants-dream.webm',
        filename: 'elephants-dream.webm' }
            ]);

> Thanks.
> 
> Really hope the info could help you. :)
Flags: needinfo?(pdahiya)
(Assignee)

Comment 4

5 years ago
Created attachment 8341219 [details]
marionetteContentScripts
(Assignee)

Comment 5

5 years ago
Thanks Evan for your inputs in Comment 1, it was very helpful. It will help if you can look into why add call fails after removeAllFiles. Let me know if i am missing something here.
Flags: needinfo?(evanxd)
(Assignee)

Comment 6

5 years ago
(In reply to Evan Tseng [:evanxd] from comment #2)
> Hi Punam,
> 
> One more thing.
> How do you think if we could add a file in the root directory of device
> storage(device-storage-testing) with `client.fileManager.add({ filePath:
> 'path/to/file1' });`(We don't need to give a type, just give the filePath)?
> 
> Is it useful for you in the future or now?

Its nice to have test files for respective media app in their own sub folders, so if it's possible we would like to keep this feature in the API. Adding file in root directory might be useful in the future.

Comment 7

5 years ago
(In reply to Punam Dahiya from comment #5)
> Thanks Evan for your inputs in Comment 1, it was very helpful. It will help
> if you can look into why add call fails after removeAllFiles. Let me know if
> i am missing something here.

Hi Punam,

Excuse me.
Where could I see the patch?
Flags: needinfo?(evanxd)
(Assignee)

Comment 8

5 years ago
Hi Evan 

Here's the link to the PR  https://github.com/mozilla-b2g/gaia/pull/14084

Running test video list using: 
bin/gaia-marionette apps/video/test/marionette/video_list_test.js

fails at https://github.com/mozilla-b2g/gaia/pull/14084/files#diff-8fbee53f9fed98efa2896fc5305381edR25
as we have removeAllFiles call before add.


Thanks
Flags: needinfo?(evanxd)

Comment 9

5 years ago
Hi Punam,

Sorry, for your issues, I found out a bug in marionette-file-manager.
I think I could fix it tomorrow(Taipei time).

Thanks.
Flags: needinfo?(evanxd)
Bug 948434 is for fixing the issue.

Updated

5 years ago
Depends on: 948434
Hi Punam,

I already fix the issue and you patch work well.
Please update the package.json to use the new version.
as "marionette-file-manager": "0.0.2"
(Assignee)

Comment 13

5 years ago
Awesome, it works! Thanks Evan will update video tests to use marionette-file-manager API.
Hi Punam,

If you have time, we could continue to do works for using the marionette-file-manager in the tests for Gallery app.

Thanks. :)
(Assignee)

Comment 15

5 years ago
(In reply to Evan Tseng [:evanxd] from comment #14)
> Hi Punam,
> 
> If you have time, we could continue to do works for using the
> marionette-file-manager in the tests for Gallery app.
> 
> Thanks. :)

Sure, will update Gallery tests as well to use marionette-file-manager API
(Assignee)

Updated

5 years ago
Assignee: nobody → pdahiya
(Assignee)

Updated

5 years ago
Summary: [Video][Gallery] Update Marionette tests to use marionette-file-manager API → [Gallery] Update Marionette tests to use marionette-file-manager API
Cool! Thanks. :)
(Assignee)

Comment 17

4 years ago
The fix for this bug is submitted with patch for bug 952706
(Assignee)

Comment 18

4 years ago
Marking the bug resolved as the fix is landed on master with fix of bug 952706
Status: NEW → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.