Open Bug 444638 Opened 16 years ago Updated 2 years ago

Automate litmus test Testcase ID #4615 - Active download - selection order after deletion of Completed items

Categories

(Toolkit :: Downloads API, defect)

defect

Tracking

()

People

(Reporter: poonaatsoc, Unassigned)

References

(Blocks 1 open bug, )

Details

Attachments

(1 file, 8 obsolete files)

Proposed type of test: Chrome

Proposed location of test: I will be adding this to an existing test - http://mxr.mozilla.org/mozilla-central/source/toolkit/mozapps/downloads/tests/chrome/test_delete_key_removes.xul
Summary: Automate litmus test https://litmus.mozilla.org/show_test.cgi?id=4606 → Automate litmus test Testcase ID #4615 - Active download - selection order after deletion of Completed items
Attached patch v1.0 (obsolete) — Splinter Review
Attachment #329098 - Flags: review?(sdwilsh)
Attached patch v2.0 (obsolete) — Splinter Review
Made a small correction
Attachment #329098 - Attachment is obsolete: true
Attachment #329195 - Flags: review?(sdwilsh)
Attachment #329098 - Flags: review?(sdwilsh)
Attached patch v3.0 (obsolete) — Splinter Review
Checked.  The test works.
Attachment #329195 - Attachment is obsolete: true
Attachment #329838 - Flags: review?(sdwilsh)
Attachment #329195 - Flags: review?(sdwilsh)
Comment on attachment 329838 [details] [diff] [review]
v3.0

general nit: line wrapping at 80 characters

>+/**
>+ * This tests if deleting a completed download results in the automatic seletion
>+ * of the next completed download
>+ *
>+ * @param aWin
>+ *        Holds the dm window
>+ */
no need for the params - all the tests are the same and it's obvious

>+function test_selectedNextDownload(aWin)
>+{
>+  let doc = aWin.document;
>+  let richlistbox = doc.getElementById("downloadView");
>+  let downloadToBeDeleted = 1;
>+
>+  // Select an item in the dm
>+  richlistbox.selectedIndex = downloadToBeDeleted;
>+
>+  // Get the dlid for the richlistitem of the download that is after the selected download
>+  let dlid = richlistbox.children[downloadToBeDeleted + 1].getAttribute("dlid");
>+  dlid = "dl" + dlid + " dl" + dlid;
>+
>+  // Delete the currently selected download and then check if the next completed download gets selected
>+  synthesizeKey("VK_DELETE", { }, aWin);
>+
>+  let currentSelectedDl = richlistbox.getAttribute("last-selected");
>+
>+  is(dlid, currentSelectedDl,
>+     "On deletion of a completed download, the next completed download gets selected");
>+}
Although, I don't understand why you can't add a bit more logic to the test function to accomplish what you want (and it'll check every download, not just one).

You'll also want to update http://mxr.mozilla.org/mozilla-central/source/toolkit/mozapps/downloads/tests/chrome/test_backspace_key_removes.xul which is the same test, but with a different key.
Attachment #329838 - Flags: review?(sdwilsh) → review-
Attached patch v4.0 (obsolete) — Splinter Review
Updated.  Integrated my test to work with your previous test.  Tested - passes

I haven't updated - http://mxr.mozilla.org/mozilla-central/source/toolkit/mozapps/downloads/tests/chrome/test_backspace_key_removes.xul

Do you want me to create a new patch for this above file?
Attachment #329838 - Attachment is obsolete: true
Attachment #330017 - Flags: review?(sdwilsh)
Attached patch v5.0 (obsolete) — Splinter Review
I have updated test_backspace_key_removes.xul.

Surprisingly this file wasn't included in the Makefile.in.  I have added this to the Makefile.

Also backspace doesn't delete a download in ff for me!  And so the checks in test_backspace_key_removes.xul fails.

test_delete_key_removes.xul works

Both files tested and both work as expected :)
Attachment #330017 - Attachment is obsolete: true
Attachment #330170 - Flags: review?(sdwilsh)
Attachment #330017 - Flags: review?(sdwilsh)
Attached patch v6.0 (obsolete) — Splinter Review
I had a discussion at irc and they told me that backspace deletion works only in mac.  I still have included the file in the patch.
Attachment #330170 - Attachment is obsolete: true
Attachment #330174 - Flags: review?(sdwilsh)
Attachment #330170 - Flags: review?(sdwilsh)
Attached patch v7.0 (obsolete) — Splinter Review
Made a small attachment.  The test runs except for test_backspace_key_removes.xul
Attachment #330174 - Attachment is obsolete: true
Attachment #330381 - Flags: review?(sdwilsh)
Attachment #330174 - Flags: review?(sdwilsh)
Blocks: 443583
Attached patch v8.0 (obsolete) — Splinter Review
Test updated to accommodate the updated utils.js.  The test passes
Attachment #330381 - Attachment is obsolete: true
Attachment #331486 - Flags: review?(sdwilsh)
Attachment #330381 - Flags: review?(sdwilsh)
Product: Firefox → Toolkit
Comment on attachment 331486 [details] [diff] [review]
v8.0

>+        let downloadToBeDeleted = 1;
>+        for (let i = 0; i < len - 2; i++) {
>+          richlistbox.selectedIndex = downloadToBeDeleted;
>+          let dlid = richlistbox.children[downloadToBeDeleted + 1].getAttribute("dlid");
>+          dlid = "dl" + dlid + " dl" + dlid;
I don't even know what this is supposed to be doing or why.

>           is(stmt.getInt32(0), len - (i + 1),
>-             "The download was properly removed");
>+            "On pressing the delete key, the download was properly removed");
nit: s/delete/backspace/

>+          let currentSelectedDl = richlistbox.getAttribute("last-selected");
>+          is(dlid, currentSelectedDl,
>+            "On deletion of a download, the next completed download gets selected");
I still don't really know what dlid is storing, but shouldn't you just check that the selected index is reduced by one?

>+        is(stmt.getInt32(0), 0,
>+          "On pressing the delete key, the download was properly removed");
nit: s/delete/backspace/
Attachment #331486 - Flags: review?(sdwilsh) → review-
Attached patch v9.0Splinter Review
New patch updated

>>+        let downloadToBeDeleted = 1;
>>+        for (let i = 0; i < len - 2; i++) {
>>+          richlistbox.selectedIndex = downloadToBeDeleted;
>>+          let dlid = richlistbox.children[downloadToBeDeleted + 1].getAttribute("dlid");
>>+          dlid = "dl" + dlid + " dl" + dlid;
>I don't even know what this is supposed to be doing or why.

>>+          let currentSelectedDl = richlistbox.getAttribute("last-selected");
>>+          is(dlid, currentSelectedDl,
>>+            "On deletion of a download, the next completed download gets selected");
>I still don't really know what dlid is storing, but shouldn't you just check
>that the selected index is reduced by one?

Basically I need to check, if pressing delete/backspace results in the selection of the next completed download in the dm list.

So I retrieve the id of the current selected downlod I do -
let currentSelectedDl = richlistbox.getAttribute("last-selected");
Now this holds the dlid in the format "dl1 dl1", where 1 is the download id no.

This is the reason why I am doing this -       
let dlid = richlistbox.children[downloadToBeDeleted + 1].getAttribute("dlid");
dlid = "dl" + dlid + " dl" + dlid;

So first I retrieve the dlid of the next download in the download list and store this in dlid.  Then I delete the current selected download, and then I retrieve the current selected download and compare it with dlid to check if the next download in the list has got selected or not
Attachment #331486 - Attachment is obsolete: true
Attachment #335260 - Flags: review?(sdwilsh)
Attachment #335260 - Flags: review?(sdwilsh)
Comment on attachment 335260 [details] [diff] [review]
v9.0

(In reply to comment #11)
> >I still don't really know what dlid is storing, but shouldn't you just check
> >that the selected index is reduced by one?
> 
> Basically I need to check, if pressing delete/backspace results in the
> selection of the next completed download in the dm list.
This test is still way more complicated than it needs to be.  Why can't you test the selected index?

The bug assignee didn't login in Bugzilla in the last 7 months, so the assignee is being reset.

Assignee: poonaatsoc → nobody
Status: ASSIGNED → NEW
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: