Bug 1550122 - Fix browser_loginItemErrors.js

Differential Revision: https://phabricator.services.mozilla.com/D44107

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Matthew Noorenberghe 2019-08-30 05:23:18 +00:00
Родитель 055e90fdd2
Коммит 8e29ea4464
1 изменённых файлов: 16 добавлений и 8 удалений

Просмотреть файл

@ -15,8 +15,8 @@ add_task(async function setup() {
add_task(async function test_showLoginItemErrors() { add_task(async function test_showLoginItemErrors() {
const browser = gBrowser.selectedBrowser; const browser = gBrowser.selectedBrowser;
let LOGIN_TO_UPDATE = new nsLoginInfo( let LOGIN_TO_UPDATE = new nsLoginInfo(
"https://example.com/", "https://example.com",
"https://example.com/", "https://example.com",
null, null,
"user2", "user2",
"pass2" "pass2"
@ -41,7 +41,7 @@ add_task(async function test_showLoginItemErrors() {
createButton.click(); createButton.click();
const loginUpdates = { const loginUpdates = {
origin: "https://example.com/", origin: "https://example.com",
password: "my1GoodPassword", password: "my1GoodPassword",
username: "user1", username: "user1",
}; };
@ -55,7 +55,7 @@ add_task(async function test_showLoginItemErrors() {
); );
content.dispatchEvent( content.dispatchEvent(
// adds first lgoin // adds first login
new content.CustomEvent("AboutLoginsCreateLogin", event) new content.CustomEvent("AboutLoginsCreateLogin", event)
); );
@ -104,12 +104,20 @@ add_task(async function test_showLoginItemErrors() {
const editButton = loginItem.shadowRoot.querySelector(".edit-button"); const editButton = loginItem.shadowRoot.querySelector(".edit-button");
editButton.click(); editButton.click();
content.dispatchEvent( const updateEvent = Cu.cloneInto(
// attempt to update LOGIN_TO_UPDATE to a username/origin combination that already exists. {
new content.CustomEvent("AboutLoginsUpdateLogin", event) bubbles: true,
detail: Object.assign({guid: loginToUpdate.guid}, loginUpdates),
},
content
); );
const loginAlreadyExistsErrorShownAfterUpdate = ContentTaskUtils.waitForCondition( content.dispatchEvent(
// attempt to update LOGIN_TO_UPDATE to a username/origin combination that already exists.
new content.CustomEvent("AboutLoginsUpdateLogin", updateEvent)
);
const loginAlreadyExistsErrorShownAfterUpdate = await ContentTaskUtils.waitForCondition(
() => { () => {
return !loginItemErrorMessage.hidden; return !loginItemErrorMessage.hidden;
}, },