Open Bug 968530 Opened 6 years ago Updated Last year

Basic robocop test for Home.panels API

Categories

(Firefox for Android :: Testing, defect)

ARM
Android
defect
Not set

Tracking

()

People

(Reporter: Margaret, Assigned: Crts, Mentored)

References

(Blocks 1 open bug)

Details

(Whiteboard: [lang=java][lang=js])

Attachments

(2 files)

Now that bug 964375 landed, we should be able to write a simple robocop test to add a panel and make sure it shows up on about:home, then remove it and make sure it's gone.

See testHomeBanner for inspiration:
https://hg.mozilla.org/mozilla-central/rev/b79bb3ab6ca2
Whiteboard: shovel-ready → shovel-ready [mentor=margaret][lang=js][lang=java]
Assignee: nobody → margaret.leibovic
Whiteboard: shovel-ready [mentor=margaret][lang=js][lang=java] → shovel-ready
Hi Margaret ,

i would like to work on this for getting started with automation.

i a new in Firefox for android automation
please let me know how to proceed with this bug.


Thank you 

BR,
Ashish N
Awesome! First of all, do you have a Firefox for Android development environment set up? If not, you'll need to follow the steps here: https://wiki.mozilla.org/Mobile/Fennec/Android

Once you get that set up, you should make sure you can run robocop tests locally. There are some instructions on that here: https://wiki.mozilla.org/Auto-tools/Projects/Robocop

As I mentioned in the bug description, we could model these tests off the testHomeBanner tests.

There's documentation on the Home.panels API here:
https://developer.mozilla.org/en-US/Add-ons/Firefox_for_Android/API/Home.jsm/panels

And you can see some sample code in these add-ons:
https://github.com/leibovic/hub-boilerplate
https://github.com/leibovic/hub-kitchen-sink

It would also be awesome if you wanted to contribute to my kitchen sink add-on, it's definitely not complete :)
Assignee: margaret.leibovic → ashish28.sirt
Hey Ashish, how's it going? I'm going to unassign this bug for now until you have your build environment set up, let us know if you need help!
Assignee: ashish28.sirt → nobody
Flags: needinfo?(ashish28.sirt)
Whiteboard: shovel-ready
Whiteboard: [mentor=margaret][lang=java][lang=js]
Hi Margaret  ,

After a long struggle , i am now able to build Fenenc on my machine and also able to run 
robocop tests.

now i can start working on this ,

but need some extension to getting started for this bug.

Thank you 

Ashish N
Flags: needinfo?(ashish28.sirt)
(In reply to Ashish Namdev from comment #4)
> Hi Margaret  ,
> 
> After a long struggle , i am now able to build Fenenc on my machine and also
> able to run 
> robocop tests.
> 
> now i can start working on this ,
> 
> but need some extension to getting started for this bug.
> 
> Thank you 
> 
> Ashish N

I'm happy you got your build working! You should follow the links I mentioned in comment 2 to familiarize yourself with robocop and with the Home.panels/HomeProvider APIs.

I think we should start by making a super simple test that adds a panel and checks to make sure that panel is displayed in the home page. This would add a lot of value, so we could land this, then file follow-up bugs to test more parts of the system.
Attached patch proof of conceptSplinter Review
I found this old patch in my patch queue, and you can probably use this as a starting point. I haven't tested it or looked at it closely, so I'm not sure if it's still correct, but the general direction (and file structure) should be what you want.
Mentor: margaret.leibovic
Whiteboard: [mentor=margaret][lang=java][lang=js] → [lang=java][lang=js]
Hi Margarget! 

I'd like to start working on this bug. I've already got Firefox for Android building, and I see you've gotten a lot written here, so I should be good to start.

Thanks!
Excellent! Getting some test coverage here will be really great.

Let me know if you have any questions!
Assignee: nobody → crasmuss
Hi Margaret,

I think I've got what's needed here. I made a mistake when creating my patch so it shows me moving the location in robocop.ini, is there a way to fix this?

Thanks,
Curtis
Attachment #8525551 - Flags: feedback+
Drive-by!

(In reply to Curtis Rasmussen [:Crts] from comment #9)
> I made a mistake when creating my patch so it shows me moving the
> location in robocop.ini, is there a way to fix this?

With the crecord extension enabled (which I believe has to be downloaded independently from hg), you can use `hg qcrefresh` to update the currently applied patch with changes in your working directory (i.e. what's returned from `hg diff`). However, unlike a `git add -p` where you select individual sections to add (or not) to your changes to be committed, you have to re-evaluate all your changes (i.e. changes already in the patch and changes in the working directory) each time so it can become painfully redundant if used multiple times, but it will get the job done.

I'm not sure if there's a fast way to do this with the default mercurial setup (maybe checking out the previous file's revision and `hg qrefresh`? But I don't know the shortcut to indicate a previous revision).

Maybe Margaret has something better. :)
(In reply to Michael Comella (:mcomella) from comment #10)
> Drive-by!
> 
> (In reply to Curtis Rasmussen [:Crts] from comment #9)
> > I made a mistake when creating my patch so it shows me moving the
> > location in robocop.ini, is there a way to fix this?
> 
> With the crecord extension enabled (which I believe has to be downloaded
> independently from hg), you can use `hg qcrefresh` to update the currently
> applied patch with changes in your working directory (i.e. what's returned
> from `hg diff`). However, unlike a `git add -p` where you select individual
> sections to add (or not) to your changes to be committed, you have to
> re-evaluate all your changes (i.e. changes already in the patch and changes
> in the working directory) each time so it can become painfully redundant if
> used multiple times, but it will get the job done.
> 
> I'm not sure if there's a fast way to do this with the default mercurial
> setup (maybe checking out the previous file's revision and `hg qrefresh`?
> But I don't know the shortcut to indicate a previous revision).
> 
> Maybe Margaret has something better. :)

Thanks for jumping in, mcomella!

I think you should be able to run `mach mercurial-setup` to get all the mercurial goodness you want. There are some more directions on that here:
https://developer.mozilla.org/en-US/docs/Installing_Mercurial

However, if your patch is showing that you moved the file, there must be another patch applied to your tree (or a commit) that appears before this one, since something must have added that first [testHomePanels] entry. I would just make sure to fold together all of your changes (using `qfold` if you're using mercurial queues).
Comment on attachment 8525551 [details] [diff] [review]
Starting point for Home.panels API tests.

In the future, you should use the feedback? and review? flags to request feedback/review from other people. And then that person will set feedback+/review+ as appropriate.

I'll flag myself for feedback here, and I'll look at the patch to see if there are any suggestions I have.
Attachment #8525551 - Flags: feedback+ → feedback?(margaret.leibovic)
Comment on attachment 8525551 [details] [diff] [review]
Starting point for Home.panels API tests.

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

This is looking good! I think we should just add some assertions on the Java side to make sure the panel was successfully added and removed, and then we can get ready to land this.

Have you been able to run this locally? Once you add these checks and get the test passing locally, I can help you make a push to our try server to make sure this passes on automation.

::: mobile/android/base/tests/testHomePanels.java
@@ +30,5 @@
> +        eventExpecter.blockForEvent();
> +    }
> +
> +    private void addPanel() {
> +        NavigationHelper.enterAndLoadUrl(TEST_URL + "#addPanel");

I would keep this in the same place as the eventExpecter, since this addPanel method would not be very useful without waiting for a message afterwards. The same goes for the removePanel method down below.
Attachment #8525551 - Flags: feedback?(margaret.leibovic) → feedback+
You need to log in before you can comment on or make changes to this bug.