Closed Bug 1393756 Opened 7 years ago Closed 7 years ago

[Form Autofill] Complete the rest of mochitest test cases for credit card doorhanger

Categories

(Toolkit :: Form Manager, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
mozilla58
Tracking Status
firefox58 --- fixed

People

(Reporter: steveck, Assigned: steveck)

References

(Blocks 1 open bug)

Details

(Whiteboard: [form autofill:M4])

Attachments

(2 files)

We already add some mochitest in Bug #1371113, but there's still some features that need to be verified:
- With masterpassword case
- Never save credit card case since we still have some problem while waiting for menu list or something.
Assignee: nobody → schung
Comment on attachment 8910183 [details]
Bug 1393756 - Part 1: Add mochitest for credit card doorhanger never save option.

https://reviewboard.mozilla.org/r/181680/#review188636
Attachment #8910183 - Flags: review?(lchang) → review+
Comment on attachment 8910587 [details]
Bug 1393756 - Part 2: Add mochitest for credit card doorhanger saving with masterpassword.

https://reviewboard.mozilla.org/r/182026/#review188652

::: browser/extensions/formautofill/test/browser/browser_creditCard_doorhanger.js:126
(Diff revision 1)
> +      await TestUtils.topicObserved("formautofill-storage-changed");
> +    }
> +  );
> +
> +  let creditCards = await getCreditCards();
> +  is(creditCards.length, 2, "2 address in storage");

2 "credit cards" in storage

::: browser/extensions/formautofill/test/browser/browser_creditCard_doorhanger.js:127
(Diff revision 1)
> +    }
> +  );
> +
> +  let creditCards = await getCreditCards();
> +  is(creditCards.length, 2, "2 address in storage");
> +  is(creditCards[1]["cc-name"], "User 0", "Verify the name field");

I suggest verifying masked number as well.

::: browser/extensions/formautofill/test/browser/browser_creditCard_doorhanger.js:161
(Diff revision 1)
> +    }
> +  );
> +
> +  await sleep(1000);
> +  let creditCards = await getCreditCards();
> +  is(creditCards.length, 2, "Still 2 address in storage");

Still 2 "credit cards" in storage

::: browser/extensions/formautofill/test/browser/head.js:86
(Diff revision 1)
>  
>  const MAIN_BUTTON = "button";
>  const SECONDARY_BUTTON = "secondaryButton";
>  const MENU_BUTTON = "menubutton";
>  
> +let masterPassword = {

I think you can use `resource://testing-common/LoginTestUtils.jsm` directly.

::: browser/extensions/formautofill/test/browser/head.js:124
(Diff revision 1)
> +  // Wait for master password dialog and cancel to close it.
> +  waitForDialog(enter) {

This comment needs to be updated according to `enter` parameter. Also, I would prefer to rename the function as it isn't just waiting.
Attachment #8910587 - Flags: review?(lchang)
Comment on attachment 8910587 [details]
Bug 1393756 - Part 2: Add mochitest for credit card doorhanger saving with masterpassword.

https://reviewboard.mozilla.org/r/182026/#review189686

Looks good.

::: browser/extensions/formautofill/test/browser/head.js:230
(Diff revision 2)
> -// Wait for master password dialog and cancel to close it.
> -function waitForMasterPasswordDialog() {
> +// Wait for master password dialog and
> +// - cancel to close it if password is not provided.
> +// - login with the password in LoginTestUtils.masterPassword

You need to explain what the "login" parameter does. e.g. 

```
Wait for the master password dialog to popup and enter the password to log in if "login" is "true" or dismiss it directly if otherwise.
```
Attachment #8910587 - Flags: review?(lchang) → review+
Thanks!
Keywords: checkin-needed
Pushed by lchang@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/7a98b2ce8a96
Part 1: Add mochitest for credit card doorhanger never save option. r=lchang
https://hg.mozilla.org/integration/autoland/rev/53670ed7793d
Part 2: Add mochitest for credit card doorhanger saving with masterpassword. r=lchang
Keywords: checkin-needed
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: