Last Comment Bug 500469 - Mozmill tests for Calendar
: Mozmill tests for Calendar
Status: RESOLVED FIXED
:
Product: Calendar
Classification: Client Software
Component: General (show other bugs)
: unspecified
: All All
: -- normal with 1 vote (vote)
: ---
Assigned To: Merike Sell (:merike)
:
:
Mentors:
Depends on: 505336 505545
Blocks:
  Show dependency treegraph
 
Reported: 2009-06-25 11:42 PDT by Merike Sell (:merike)
Modified: 2010-10-19 10:34 PDT (History)
9 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---


Attachments
Smoke test v1 (6.27 KB, text/plain)
2009-06-25 11:49 PDT, Merike Sell (:merike)
cmtalbert: review+
Details
Day view test (9.22 KB, text/plain)
2009-07-08 12:58 PDT, Merike Sell (:merike)
cmtalbert: review+
Details
Week view test (8.32 KB, application/x-javascript)
2009-07-09 07:56 PDT, Merike Sell (:merike)
cmtalbert: review+
Details
Test multiweek view (8.19 KB, text/plain)
2009-07-13 12:24 PDT, Merike Sell (:merike)
cmtalbert: review+
Details
Test month view (8.14 KB, text/plain)
2009-07-13 12:29 PDT, Merike Sell (:merike)
cmtalbert: review+
Details
Day view test v2 (8.97 KB, text/plain)
2009-07-16 09:13 PDT, Merike Sell (:merike)
no flags Details
Week view test v2 (8.03 KB, text/plain)
2009-07-16 10:27 PDT, Merike Sell (:merike)
no flags Details
Today pane test (12.55 KB, text/plain)
2009-07-20 11:22 PDT, Merike Sell (:merike)
cmtalbert: review+
Details
Multiweek view test v2 (8.25 KB, text/plain)
2009-07-21 12:52 PDT, Merike Sell (:merike)
no flags Details
Month view test v2 (8.22 KB, text/plain)
2009-07-21 12:57 PDT, Merike Sell (:merike)
no flags Details
Event dialog test v1 (15.50 KB, text/plain)
2009-07-23 02:20 PDT, Merike Sell (:merike)
cmtalbert: review-
Details
Today pane test v2 (12.62 KB, text/plain)
2009-07-24 10:22 PDT, Merike Sell (:merike)
no flags Details
Event dialog test v2 (14.08 KB, text/plain)
2009-07-28 13:15 PDT, Merike Sell (:merike)
cmtalbert: review+
Details
CalendarUtils module (3.55 KB, text/plain)
2009-07-28 13:17 PDT, Merike Sell (:merike)
cmtalbert: review+
Details
Task view test (9.21 KB, text/plain)
2009-07-30 10:24 PDT, Merike Sell (:merike)
cmtalbert: review+
Details

Description Merike Sell (:merike) 2009-06-25 11:42:34 PDT
User-Agent:       Mozilla/5.0 (X11; U; Linux i686; et; rv:1.9.1) Gecko/20090616 Firefox/3.5
Build Identifier: 

This bug is needed to track writing testscripts specified here: https://wiki.mozilla.org/Calendar:QA/Automation_Wish_List

Reproducible: Always
Comment 1 Merike Sell (:merike) 2009-06-25 11:49:41 PDT
Created attachment 385167 [details]
Smoke test v1
Comment 2 cmtalbert 2009-06-29 09:14:26 PDT
Comment on attachment 385167 [details]
Smoke test v1

r=ctalbert, This looks great.  I would change its name from testSmokeTest to something more descriptive that tells us what it is testing.  Perhaps testCalendarUI since this test just goes through the UI and ensures that everything is visible and working properly.  Great first effort!
Comment 3 cmtalbert 2009-06-29 09:14:52 PDT
Also, going to confirm this bug.
Comment 4 Merike Sell (:merike) 2009-07-08 12:58:59 PDT
Created attachment 387513 [details]
Day view test
Comment 5 Merike Sell (:merike) 2009-07-09 07:56:13 PDT
Created attachment 387640 [details]
Week view test
Comment 6 Merike Sell (:merike) 2009-07-13 12:24:36 PDT
Created attachment 388275 [details]
Test multiweek view
Comment 7 Merike Sell (:merike) 2009-07-13 12:29:38 PDT
Created attachment 388276 [details]
Test month view

For some reason view won't switch if multiweek view is the last view used before running the test.
Comment 8 Merike Sell (:merike) 2009-07-14 03:15:58 PDT
Smoke test will need the following changed
-controller.rightClick(new elementslib.Lookup(controller.window.document, path 
    + '/id("ltnSidebar")/id("calendar-panel")/id("calendar-list-pane")/id("calendar-listtree-pane")/'
    + 'id("calendar-list-tree-widget")/anon({"anonid":"tree"})/anon({"anonid":"treechildren"})'));
+controller.rightClick(new elementslib.Lookup(controller.window.document, path 
    + '/id("ltnSidebar")/id("calendar-panel")/id("calendar-list-pane")/id("calendar-listtree-pane")/'
    + 'id("calendar-list-tree-widget")/anon({"anonid":"tree"})/anon({"anonid":"treechildren"})'));
+  controller.click(new elementslib.ID(controller.window.document, "list-calendars-context-new"));

This is because doubleclick now specifies its position and 0,0 trigger default Home calendar modification dialog on this treeview and the test never finishes. It also needs either a name that will be alphabetically the first when running test folder commandline or run separately as it needs to be run first to create Mozmill calendar.
Comment 9 cmtalbert 2009-07-15 17:33:33 PDT
Comment on attachment 387513 [details]
Day view test

Looks good.  You need to add yourself as a contributor on all these tests, so put two spaces to indent yourself under "Contributor:" in the license and type in your information in this format: "Clint Talbert <ctalbert@mozilla.com>" otherwise, looks great.
Comment 10 cmtalbert 2009-07-15 17:34:25 PDT
Comment on attachment 387640 [details]
Week view test

r+ on the approach.  But, what do you mean by "Hangs the application" in the "Delete Event" comment?  If it is hanging the app, we need to know what is going on there.
Comment 11 Henrik Skupin (:whimboo) 2009-07-16 02:15:13 PDT
Comment on attachment 385167 [details]
Smoke test v1

Let me just throw in some general comments which will apply to all tests which looks indeed great.

>var mozmill = {}; Components.utils.import('resource://mozmill/modules/mozmill.js', mozmill);
>var elementslib = {}; Components.utils.import('resource://mozmill/modules/elementslib.js', elementslib);

Both lines aren't needed anymore. The import will be made by Mozmill itself.

>  module.modalDialogAPI = collector.getModule('ModalDialogAPI');

The collector also assigns collected modules on its own. There is no need anymore for this line of code. You can access shared functions the same way as you already do.

>function handleDialog(controller) { 
>  let wizardPath = '/id("calendar-wizard")/anon({"anonid":"Buttons"})/'
>    + 'anon({"class":"wizard-buttons-box-1"})/{"class":"wizard-buttons-box-2"}/'
>    + 'anon({"anonid":"WizardButtonDeck"})/';
>  
>  // click next
>  controller.click(new elementslib.Lookup(controller.window.document, wizardPath
>    + '[1]/{"dlgtype":"next"}'));

Under some situations it can happen that you will be too fast here. Means wizardPath doesn't yet exist. For Firefox we are using waitThenClick just to make sure we really click an existent item.
Comment 12 Henrik Skupin (:whimboo) 2009-07-16 02:19:11 PDT
Comment on attachment 387513 [details]
Day view test

>  // pick day
>  controller.click(new elementslib.Lookup(controller.window.document, miniMonth
>    + 'anon({"anonid":"minimonth-calendar"})/[1]/{"value":"1"}'));
>  controller.sleep(5000);

Why do you need such a long delay?
Comment 13 Henrik Skupin (:whimboo) 2009-07-16 03:21:09 PDT
Comment on attachment 388275 [details]
Test multiweek view

>  controller.assertJS(day.getNode().mDate.icalString == "20090101");

Doesn't it always pass true/false to the assertJS function? Do you use it to throw a failure instead of doing it on your own with throw? Looks to be nice way we should also adopt for our Firefox tests.
Comment 14 Henrik Skupin (:whimboo) 2009-07-16 03:22:56 PDT
Comment on attachment 388276 [details]
Test month view

>  // check if name was saved
>  controller.assertProperty(new elementslib.Lookup(controller.window.document, eventBox
>    + '/{"flex":"1"}/anon({"anonid":"event-name"})/anon({"anonid":"event-name-div"})'),
>    "textContent",
>    title2);

Isn't that simply assertText?
Comment 15 Merike Sell (:merike) 2009-07-16 09:13:04 PDT
Created attachment 388924 [details]
Day view test v2

Fixed licence, odd sleep and changed from assertProperty to assertText. Added sleep after delete to be safer and removed imports.

And yes, assertJS gives you usual mozmill pass or fail, no need to throw yourself.
Comment 16 Merike Sell (:merike) 2009-07-16 10:27:48 PDT
Created attachment 388936 [details]
Week view test v2

Fixed licence, removed imports, assertText. Hanging comment isn't valid any more, I had a mistake in lookup there.
Comment 17 Merike Sell (:merike) 2009-07-20 11:22:15 PDT
Created attachment 389517 [details]
Today pane test

The test currently fails because click on - sign to collapse tomorrow or soon takes sometimes two clicks to work. Seems that this only happens when an event is focused right before the click. I'm unsure if this should be ui bug or not but I'd expect + and - signs to act on first click independent of what is focused.
Comment 18 Merike Sell (:merike) 2009-07-21 12:52:12 PDT
Created attachment 389741 [details]
Multiweek view test v2

Apparently event start time logic is different if current time is between 23:00 and 00:00.
Comment 19 Merike Sell (:merike) 2009-07-21 12:57:13 PDT
Created attachment 389744 [details]
Month view test v2

Also fixing event start time.
Comment 20 Merike Sell (:merike) 2009-07-23 02:20:15 PDT
Created attachment 390184 [details]
Event dialog test v1

Once the attendee adding and popup closing issues get sorted it should run without problems. It may need adjustments to sleep durations though since I tested actions in smaller groups and not whole test at a time.
Comment 21 cmtalbert 2009-07-24 09:02:11 PDT
Comment on attachment 389517 [details]
Today pane test

  
>  // verify tomorrow and soon collapsed
>  let tomorrow = (new elementslib.Lookup(controller.window.document,
>    '/id("messengerWindow")/id("tabmail-container")/id("today-pane-panel")/[1]/id("agenda-panel")/'
>    + '{"flex":"1"}/id("agenda-listbox")/[1]/anon({"class":"agenda-checkbox"})')).getNode();
>  let soon = (new elementslib.Lookup(controller.window.document,
>    '/id("messengerWindow")/id("tabmail-container")/id("today-pane-panel")/[1]/id("agenda-panel")/'
>    + '{"flex":"1"}/id("agenda-listbox")/[2]/anon({"class":"agenda-checkbox"})')).getNode();
>  controller.assertJS(tomorrow.getAttribute("checked") == "false");
>  controller.assertJS(soon.getAttribute("checked") == "false");

The way the checked attribute works is not exactly intuitive.  If a node as checked with a value of 'true' then the node is checked.  If the node has a value of checked with ANY other value OR if the checked attribute is removed, then the node is considered 'unchecked'.  So, this test runs great except these asserts fail because when the calendar code 'unchecks' the item, it removes the checked attribute rather than setting it to false.  So I think these should be changed to assert that the 'checked' attribute has been removed.

Also, the double-click needed on the ">" item to expand the node's selection seems to be a product bug.  I can make that happen just manually.  Would you mind filing a Calendar/UI bug for that?

Otherwise, this is an awesome test. I like the way you handled the scrolling of the day view to create the events.  Very nicely done.

r=ctalbert with those changes.
Comment 22 Merike Sell (:merike) 2009-07-24 10:22:59 PDT
Created attachment 390496 [details]
Today pane test v2
Comment 23 cmtalbert 2009-07-24 17:07:09 PDT
Comment on attachment 390184 [details]
Event dialog test v1


>var sleep = 500;
>var calendar = "Mozmill";
I think you should use "Home" as that is the default name of the default calendar.


>var testEventDialog = function () {

What follows is all very date intensive.  I wonder if there is a way to generalize this type of code such that other people writing calendar tests can make use of it.  I'm not sure there is unless we wire the test into the view creation mechanism which is not something we'd want.  Merike, any ideas?  This is not too important, and is not required for r+, but it is something that is worth thinking about.
>  // 31st of January is Saturday so there's four more full rows to check
>  let date = 4;
>  for(row = 1; row < 5; row++){
>    for(col = 0; col < 7; col++){
>        controller.assertNode(new elementslib.Lookup(controller.window.document, 
>          eventBox.replace("rowNumber", row).replace("columnNumber", col)));
>        checkIcon(eventBox, row, col);
>        checkTooltip(monthView, row, col, date, startTime, endTime);
>        date++;
>    }
>  }
>  
>  // delete and verify deleted 2nd Jan
>  let md4 = new ModalDialogAPI.modalDialog(handleOcurrenceDeletion);
>  md4.start();
>  controller.click(new elementslib.Lookup(controller.window.document, 
>    eventBox.replace("rowNumber", "0").replace("columnNumber", "5")));
>  controller.keypress(new elementslib.ID(controller.window.document, "month-view"),
>    "VK_DELETE", {});
>  controller.sleep;
>  
>
The following handle* functions might all make for good calendar shared modules, but they are so specific to calendar, I'm not entirely sure how to package them up (and you'd have to use modal dialog as well). It might be something good to think about though.   Maybe we should put them in a calendar-utils file inside the shared-modules folder?

>function handleAttendees(attendees){
>
>function handleAttachment(attachment){
>
>function handleMail(dialog){
>
>function handleOcurrenceDeletion(dialog){

>function handleParentDeletion(dialog){

>function checkIcon(eventBox, row, col){

>function checkTooltip(monthView, row, col, date, startTime, endTime){

It looks good; however, the test will simply not run for me all the way through, and I'm not sure what is wrong.  It keeps hanging on the attendee creation step.

I'm going to r- on this one for now as it doesn't run.  For review, you'll need to make the change to the "home" calendar, repack the handle* functions into a shared module.  I don't want other people to have to copy/paste or worse, re-write, these functions when they are writing tests. And of course, we have to figure out why it isn't running all the way through.
Comment 24 Merike Sell (:merike) 2009-07-27 05:08:00 PDT
(In reply to comment #23)
> (From update of attachment 390184 [details])
> I think you should use "Home" as that is the default name of the default
> calendar.
And not specifically created Mozmill calendar as in all other tests? Why?

> What follows is all very date intensive.  I wonder if there is a way to
> generalize this type of code such that other people writing calendar tests can
> make use of it.  I'm not sure there is unless we wire the test into the view
> creation mechanism which is not something we'd want.  Merike, any ideas?  This
> is not too important, and is not required for r+, but it is something that is
> worth thinking about.
I can't see a good solution to this. The combinations of day boxes that people need to test will vary and so will the information in tooltips and event boxes.
It would be nice if there were a function along the lines "verify event present/not present from x to y" but it still needs to know about the layout of days and months and if that part would use calendar code it would bypass its possible errors also.

> The following handle* functions might all make for good calendar shared
> modules, but they are so specific to calendar, I'm not entirely sure how to
> package them up (and you'd have to use modal dialog as well). It might be
> something good to think about though.   Maybe we should put them in a
> calendar-utils file inside the shared-modules folder?
I'm all for it, except perhaps attendees part. This test adds just one, but others might want to add several and use additional actions available in that dialog. If someone would want to use this function to add multiple attendees it wouldn't work since it always expects to type email into second row in the list of attendees. Do you think it should be generalised to recognise the first empty row and type email in there? This would of course depend on bug #505336.

> It looks good; however, the test will simply not run for me all the way
> through, and I'm not sure what is wrong.  It keeps hanging on the attendee
> creation step.
That's because of bug #505336. If it is not solved then the part that creates element for textbox and type call need to be commented out to make it run.
Comment 25 cmtalbert 2009-07-27 13:43:51 PDT
(In reply to comment #24)
> (In reply to comment #23)
> > (From update of attachment 390184 [details] [details])
> > I think you should use "Home" as that is the default name of the default
> > calendar.
> And not specifically created Mozmill calendar as in all other tests? Why?

Oops because I forgot that you create the "mozmill" calendar when you first start out on the first test.  Never mind this comment.

> > What follows is all very date intensive.  I wonder if there is a way to
> > generalize this type of code such that other people writing calendar tests can
> > make use of it.  I'm not sure there is unless we wire the test into the view
> > creation mechanism which is not something we'd want.  Merike, any ideas?  This
> > is not too important, and is not required for r+, but it is something that is
> > worth thinking about.
> I can't see a good solution to this. The combinations of day boxes that people
> need to test will vary and so will the information in tooltips and event boxes.
> It would be nice if there were a function along the lines "verify event
> present/not present from x to y" but it still needs to know about the layout of
> days and months and if that part would use calendar code it would bypass its
> possible errors also.
> 
True.  That's pretty much where I left it as well when I looked at your code a long while.  Oh well.  At least everyone will have an example of how to do it in your test here.

> > The following handle* functions might all make for good calendar shared
> > modules, but they are so specific to calendar, I'm not entirely sure how to
> > package them up (and you'd have to use modal dialog as well). It might be
> > something good to think about though.   Maybe we should put them in a
> > calendar-utils file inside the shared-modules folder?
> I'm all for it, except perhaps attendees part. This test adds just one, but
> others might want to add several and use additional actions available in that
> dialog. If someone would want to use this function to add multiple attendees it
> wouldn't work since it always expects to type email into second row in the list
> of attendees. Do you think it should be generalised to recognise the first
> empty row and type email in there? This would of course depend on bug #505336.
> 
Yeah, I agree.  Let's make all the other handle functions shared module items.  If it weren't for the fact that it is a modal dialog, we could parameterize the list of attendees and solve the problem that way, but alas, we can't.  So, let's leave the handleAttendees out, but make the rest into a utility module.

> > It looks good; however, the test will simply not run for me all the way
> > through, and I'm not sure what is wrong.  It keeps hanging on the attendee
> > creation step.
> That's because of bug #505336. If it is not solved then the part that creates
> element for textbox and type call need to be commented out to make it run.
Ah gotcha.  I'll ping Mikeal again to see if he can figure that one out.
Comment 26 Merike Sell (:merike) 2009-07-28 13:15:32 PDT
Created attachment 391169 [details]
Event dialog test v2
Comment 27 Merike Sell (:merike) 2009-07-28 13:17:05 PDT
Created attachment 391170 [details]
CalendarUtils module
Comment 28 cmtalbert 2009-07-29 16:46:53 PDT
Both these files look good, Merike.  Only the event dialog test doesn't run all the way through for me.  Does it run all the way through for you?  Perhaps I should try on Windows?

The only feedback I have on the patches is that we should add the bug reference for the attendee panel bug so that other observers will know why those two lines are commented out.  Otherwise r=ctalbert, except that they don't run :/

I'll try them on windows.
Comment 29 Merike Sell (:merike) 2009-07-30 10:19:27 PDT
(In reply to comment #28)
> Both these files look good, Merike.  Only the event dialog test doesn't run all
> the way through for me.  Does it run all the way through for you?  Perhaps I
> should try on Windows?
Hmm, it does run for me, both with a calendar having email set and not set. The latter case runs longer though, I believe it's because of waiting for email dialog, which won't appear in such case.
Comment 30 Merike Sell (:merike) 2009-07-30 10:24:23 PDT
Created attachment 391640 [details]
Task view test
Comment 31 cmtalbert 2009-08-05 16:59:27 PDT
Comment on attachment 391169 [details]
Event dialog test v2

r=ctalbert
Comment 32 cmtalbert 2009-08-05 17:03:01 PDT
Comment on attachment 391170 [details]
CalendarUtils module

r=ctalbert, looks great, thanks
Comment 33 cmtalbert 2009-08-05 17:41:40 PDT
Comment on attachment 391640 [details]
Task view test

>  // verify that tooltip shows status, priority and percent complete
>  let toolTipNode = new elementslib.Lookup(controller.window.document, toolTip).getNode();
>  toolTipNode.ownerDocument.defaultView.showToolTip(toolTipNode, taskTreeNode.getTaskAtRow(0));
>  
>  let toolTipName = new elementslib.Lookup(controller.window.document, toolTipGrid + '[1]/[0]/[1]');
>  let toolTipPriority = new elementslib.Lookup(controller.window.document, toolTipGrid + '[1]/[1]/[1]');
>  let toolTipStatus = new elementslib.Lookup(controller.window.document, toolTipGrid + '[1]/[2]/[1]');
>  let toolTipComplete = new elementslib.Lookup(controller.window.document, toolTipGrid + '[1]/[3]/[1]');
>  let priority = UtilsAPI.getProperty("chrome://calendar/locale/calendar.properties",
>    "highPriority");
>  
Merike, I can't believe this actually works.  It seems to on run.

I had a hiccup with the lookup at the "verify description and status in detail pane" segment (line 147).  But then it worked. Strange.  

r=ctalbert  

We will have to go back through these tests on each platform and be sure they all run end-to-end.  They have all worked on mac, but these hiccups still exist.  But I think some of this might be mozmill related.  

Great work getting these smoke tests done.  On to phase II.

And I have to figure out how to check these in.
Comment 34 cmtalbert 2009-08-20 12:07:02 PDT
Ok.  Martin and I conferred this morning and got these checked in.  I checked in the latest version of each of the above patches.  For our discussion on the repo structure it was here in IRC:
mschroeder was promoted to operator by ChanServ.
[10:03am] mschroeder: ctalbert: hey. regarding merike's mozmill tests: I think you are go to check them in on comm-central/calendar/test/mozmill/. maybe i'll have a look at needed changes for client.py later, so we can proceed with getting them in the tree and running.
[10:04am] ctalbert: mschroeder: thank you!
[10:04am] ctalbert: mschroeder: this is something in the back of my mind constantly, but I haven't had a chance to do anything about it.
[10:04am] ctalbert: I'll try to get those checked in today
[10:06am] mschroeder: ctalbert: I read through the emails again, and decided this has to be done now. 
[10:06am] mschroeder: ctalbert: maybe the relative path to the shared modules has to be adjusted later
[10:08am] ctalbert: yeah, me too.  Yeah I think once you figure out how to tweak client.py to pull the proper stuff from hg.mozilla.org/qa/mozmill-tests and merge the shared modules directory together, it will just work.
[10:08am] ctalbert: So I'll put the tests in calendar/test/mozmill
[10:09am] ctalbert: and the shared modules in calendar/test/mozmill/shared_modules
[10:09am] ctalbert: sound good?
[10:11am] mschroeder: perfect 

Pushed ae4488b6fe3f --> FIXED

Note You need to log in before you can comment on or make changes to this bug.