Closed Bug 1093874 Opened 10 years ago Closed 10 years ago

Create a new test case for loading a mix of valid/invalid image files into Gallery App

Categories

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

ARM
Gonk (Firefox OS)
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: njpark, Assigned: njpark)

Details

Attachments

(1 file, 8 obsolete files)

54 bytes, text/plain
Bebe
: review+
Details
This bug is to automate https://moztrap.mozilla.org/manage/case/8617/ where it tests the loading of blank or empty image file.

In addition, this will also test loading of various types of valid/invalid files, which is known to cause db error in previous occasions.

Tests will use files listed here:
https://github.com/mozilla-b2g/gaia/blob/master/apps/gallery/test/images/README
Summary: Update test_gallery_view to correlate with the manual test → Create a new test case for loading a mix of valid/invalid image files
Assignee: nobody → npark
No longer depends on: 1075504
since push_resource method takes remote directory path, files won't need to be copied to the resource folder I assume?
Summary: Create a new test case for loading a mix of valid/invalid image files → Create a new test case for loading a mix of valid/invalid image files into Gallery App
Since def resource(self, filename) in gaiatest.py explicitly looks for 'resource' folder, I'll copy the files into the resource folder as well.
My first attempt on submitting a new python script.  Could you take a look whether I'm on the right track?  Thanks!
Attachment #8517707 - Flags: review?(zcampbell)
Attachment #8517707 - Flags: review?(florin.strugariu)
New pull request for review
Attachment #8517833 - Flags: review?(zcampbell)
Attachment #8517833 - Flags: review?(florin.strugariu)
Comment on attachment 8517707 [details] [review]
Link to Github pull-request: https://github.com/mozilla-b2g/gaia/pull/25861

This is invalid, please ignore
Attachment #8517707 - Attachment description: Link to Github pull-request: https://github.com/mozilla-b2g/gaia/pull/25855 → Link to Github pull-request: https://github.com/mozilla-b2g/gaia/pull/25861
Attachment #8517707 - Flags: review?(zcampbell)
Attachment #8517707 - Flags: review?(florin.strugariu)
Comment on attachment 8517833 [details] [review]
Link to Github pull-request: https://github.com/mozilla-b2g/gaia/pull/25861

r-,

There should be one test per file format.
Attachment #8517833 - Flags: review?(zcampbell) → review-
Personally I don't think this is a really good use of automated testing, I think it will be very prone to false positives.
(In reply to Zac C (:zac) from comment #7)
> Personally I don't think this is a really good use of automated testing, I
> think it will be very prone to false positives.

So I was concerned about false positives too. (i.e., one of the invalid image can generate a thumbnail +  one of the valid images fail to generate a thumbnail = correct number of thumbnails)  The main reason I thought I could write a test on it was that when a bug happens,
1) invalid images usually cause gallery app to crash when loaded
2) invalid images usually create thumbnails, which upon tapping it, causes the app to crash
3) Decoding bugs usually fail to create thumbnails for valid images

It would been more robust if I tap all valid images and check for the back button, but that would mean I need to create a new method in the app that taps any of the thumbnails in the list, and wasn't sure I can do that.  I think this test could be a quick way to detect image decoding bugs when it happens.

Having said that, having a test script for every single case is sort of messy with a lot of overhead, and I could run this on imagecompare test framework to avoid false positive issue.  If you want me to drop this test case, I can close this bug and work on a different test.
Flags: needinfo?(zcampbell)
actually, there is chance of false negatives, (saying there is no bug when there is), but I don't think there is a chance for false positive unless I missed something.  If this test fails, I think there would definitely be a problem, since all it does is a simple loading of images and checks for the number of thumbnails.
As long as you're clear about the limitations of what bugs it can and can't pick up wrt false positives and negatives.

Having more test cases is not messy; it means if one of the files fails, you do know which one it is. Having 8 checks in one means you don't know if only one failed or 5 failed so you have to run it again locally to find out which one it is which kind of takes away the advantage of running in a CI!
Flags: needinfo?(zcampbell)
(In reply to Zac C (:zac) from comment #10)
> As long as you're clear about the limitations of what bugs it can and can't
> pick up wrt false positives and negatives.
> 
> Having more test cases is not messy; it means if one of the files fails, you
> do know which one it is. Having 8 checks in one means you don't know if only
> one failed or 5 failed so you have to run it again locally to find out which
> one it is which kind of takes away the advantage of running in a CI!

Hmm, that's a good point, I was only concerned about the overhead of running 8 test cases vs. 1, but I forgot about the fact that you have to run it again to make sure which one failed.  I'll update the test scrips.  thanks for the comment!
So I made changes to the pull request.  now it includes 14 test scripts, each takes slightly less than a minute to run.

7 added scripts are testing whether different file types can be opened by the gallery app.  I noticed that we only test opening of JPG files, and not other formats such as BMP, PNG, GIF, progressive JPG, animated JPG/PNG, and PNG with transparent background.  If the script exists and I missed it, I'll take them off.  verifying whether the app correctly loads above files is sort of important at this stage of the app, but we can always deactivate the tests.

The other 7 scripts are testing whether the gallery app correctly ignores the invalid file, rather than trying to create thumbnails for it and end up crashing.  Again, this can also be deactivated once the code matures.

I also made a change to the gallery app code, by adding a reference to the back button per comment.
Attachment #8519088 - Flags: review?(zcampbell)
Attachment #8519088 - Flags: review?(florin.strugariu)
Attachment #8517833 - Flags: review?(florin.strugariu)
Comment on attachment 8519088 [details] [review]
Link to Github pull-request: https://github.com/mozilla-b2g/gaia/pull/25861

r-:
- File missing from manifest files
- Too many abbreviations in test names (bytes are free, use them)
- Validate the image properly, not just the surrounding UI

After adding it to the manifest file, check that Gip is green before r? us again too!
Attachment #8519088 - Flags: review?(zcampbell)
Attachment #8519088 - Flags: review?(florin.strugariu)
Attachment #8519088 - Flags: review-
Try server result:
https://treeherder.mozilla.org/ui/#/jobs?repo=gaia-try&revision=4fc2a7c19c84
(Gip is green)

- manifest adds new test script names
- abbreviations are removed
- now checks for display of the fullscreen view and image view to see the image is being displayed
Attachment #8519088 - Flags: review- → review?(zcampbell)
Comment on attachment 8519088 [details] [review]
Link to Github pull-request: https://github.com/mozilla-b2g/gaia/pull/25861

r-, comments in github:

1. don't use private locator variables from in the test. You need to make a method in the app object that represents the action you're doing on the page. From inside that method you can call the private locator variables.

2. In my previous review what I meant about validating the image properly was to actually check the HTML element that is showing the image to the user. It must have a blob and a size, too.
It's no point checking the back button -  the gallery might fail to show the image completely but the back button will still be there!
Attachment #8519088 - Flags: review?(zcampbell) → review-
Try server result:
https://treeherder.mozilla.org/ui/#/jobs?repo=gaia-try&revision=a9ab7b9f880f

There are some Gij failures, but I think this error is unrelated to my change.

I did:
- Added double_tap_image method in fullscreen_image.py, because this action zooms the image to its original size if the image isn't too big.  Let me know if I need to do this differently.
- checked for the presence of blob, and get the image dimension
- got rid of private var usage

One thing, while I was searching for examples, I ran into this:
https://github.com/mozilla-b2g/gaia/blob/master/tests/python/gaia-ui-tests/gaiatest/apps/keyboard/app.py#L232

Although this method is not being used, this cannot work, because double_tap only belong to the Actions group. (I think) Just to let you know.
Attachment #8517707 - Flags: review?(zcampbell)
Attachment #8517707 - Flags: review?(zcampbell)
Re-adding the pull request.  previous one led to an invalid link
Attachment #8517707 - Attachment is obsolete: true
Attachment #8517833 - Attachment is obsolete: true
Attachment #8519088 - Attachment is obsolete: true
Attachment #8523187 - Attachment is obsolete: true
Attachment #8523188 - Flags: review?(zcampbell)
Blocks: 1100390
No longer blocks: 1100390
Whiteboard: fxosqa-auto-s4
Status: NEW → ASSIGNED
QA Whiteboard: [fxosqa-auto-backlog+] [fxosqa-auto-s4]
Whiteboard: fxosqa-auto-s4
QA Whiteboard: [fxosqa-auto-backlog+] [fxosqa-auto-s4] → [fxosqa-auto-s4]
Attachment #8523188 - Flags: review?(zcampbell) → review?(florin.strugariu)
Comment on attachment 8523188 [details] [review]
Link to Github pull-request: https://github.com/mozilla-b2g/gaia/pull/25861

redirecting review per automation meeting discussion today
Attachment #8523188 - Flags: review?(viorela.ioia)
Comment on attachment 8523188 [details] [review]
Link to Github pull-request: https://github.com/mozilla-b2g/gaia/pull/25861

Let's try not to duplicate the test files
The rest looks OK
Attachment #8523188 - Flags: review?(florin.strugariu) → review-
Comment on attachment 8523188 [details] [review]
Link to Github pull-request: https://github.com/mozilla-b2g/gaia/pull/25861

Comments in PR
Attachment #8523188 - Flags: review?(viorela.ioia) → review-
@parameterized is used, and reduced the number of test cases.
Attachment #8523188 - Attachment is obsolete: true
Attachment #8529866 - Flags: review?(viorela.ioia)
Attachment #8529866 - Flags: review?(florin.strugariu)
Comment on attachment 8529866 [details]
Link to Github pull-request: https://github.com/mozilla-b2g/gaia/pull/25861/commits

Looking good
A few more nits and this is ready
Attachment #8529866 - Flags: review?(florin.strugariu) → review-
setup call/comments removed
Attachment #8529866 - Attachment is obsolete: true
Attachment #8529866 - Flags: review?(viorela.ioia)
Attachment #8531686 - Flags: review?(viorela.ioia)
Attachment #8531686 - Flags: review?(florin.strugariu)
Comment on attachment 8531686 [details]
Link to Github pull-request: https://github.com/mozilla-b2g/gaia/pull/25861/commits

There's one test failing :(
Attachment #8531686 - Flags: review?(viorela.ioia) → review-
commits squashed and Gip tests passed (one Gij failed, but it has nothing to do with my change)
Attachment #8533211 - Flags: review?(viorela.ioia)
Attachment #8533211 - Flags: review?(florin.strugariu)
Comment on attachment 8533211 [details]
Link to Github pull-request: https://github.com/mozilla-b2g/gaia/pull/25861#issuecomment-66125678

r+
Attachment #8533211 - Flags: review?(viorela.ioia) → review+
Comment on attachment 8533211 [details]
Link to Github pull-request: https://github.com/mozilla-b2g/gaia/pull/25861#issuecomment-66125678

No-Jun your commit message is really strange

https://github.com/npark-mozilla/gaia/commit/35364e00c72d0281ed223964c5e6b7ae0915dfb3


The rest looks OK

Can you add a commit message like "Bug 1093874 - Create a new test case for loading a mix of valid/invalid image files into Gallery App"
Attachment #8533211 - Flags: review?(florin.strugariu) → review-
Comment on attachment 8531686 [details]
Link to Github pull-request: https://github.com/mozilla-b2g/gaia/pull/25861/commits

Looks like there are to attachments to the same pull

marking as obsolete
Attachment #8531686 - Attachment is obsolete: true
Attachment #8531686 - Flags: review?(florin.strugariu)
Thanks for pointing out the odd commit message.  here is the updated one
Attachment #8533211 - Attachment is obsolete: true
Attachment #8533922 - Flags: review?(florin.strugariu)
Attachment #8533922 - Flags: review?(florin.strugariu) → review+
https://github.com/mozilla-b2g/gaia/commit/9e62614c692eb875e305dd7de4050880f1a17a2b
Status: ASSIGNED → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: