Bug 1423118 - Add a test for checking that tags can be added to bookmarks using the library window. r=Standard8

--HG--
extra : amend_source : d19fc15afddc933dcf51af75446a56b83807dd4c
This commit is contained in:
Ioana Crisan 2017-12-06 16:01:15 +02:00
parent a121d5218c
commit 62d7a2f07f
2 changed files with 42 additions and 0 deletions

View File

@ -52,6 +52,7 @@ subsuite = clipboard
[browser_drag_bookmarks_on_toolbar.js]
[browser_forgetthissite_single.js]
[browser_history_sidebar_search.js]
[browser_library_add_tags.js]
[browser_library_batch_delete.js]
skip-if = (os == 'win' && ccov) # Bug 1423667
[browser_library_commands.js]

View File

@ -0,0 +1,41 @@
/**
* Tests that multiple tags can be added to a bookmark using the Library.
*/
"use strict";
add_task(async function test_add_tags() {
const uri = "http://example.com/";
// Add a bookmark.
await PlacesUtils.bookmarks.insert({
url: uri,
parentGuid: PlacesUtils.bookmarks.unfiledGuid
});
// Open the Library and select the "UnfilledBookmarks".
let library = await promiseLibrary("UnfiledBookmarks");
let bookmarkNode = library.ContentTree.view.selectedNode;
Assert.equal(bookmarkNode.uri, "http://example.com/", "Found the expected bookmark");
// Add a tag to the bookmark.
fillBookmarkTextField("editBMPanel_tagsField", "tag1", library);
await waitForCondition(() => bookmarkNode.tags === "tag1", "Node tag is correct");
// Add a new tag to the bookmark.
fillBookmarkTextField("editBMPanel_tagsField", "tag1, tag2", library);
await waitForCondition(() => bookmarkNode.tags === "tag1, tag2", "Node tag is correct");
// Check the tag change has been.
let tags = PlacesUtils.tagging.getTagsForURI(Services.io.newURI(uri));
Assert.equal(tags.length, 2, "Found the right number of tags");
Assert.deepEqual(tags, ["tag1", "tag2"], "Found the expected tags");
// Cleanup
registerCleanupFunction(async function() {
await promiseLibraryClosed(library);
await PlacesUtils.bookmarks.eraseEverything();
});
});