mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 932208 - Part 3: Fix testBookmarksPanel. r=liuche CLOSED TREE
This commit is contained in:
parent
39bc9c42e0
commit
1ab3fd23c5
@ -3,6 +3,7 @@ package org.mozilla.gecko.tests;
|
||||
import org.mozilla.gecko.Actions;
|
||||
import org.mozilla.gecko.Element;
|
||||
import org.mozilla.gecko.R;
|
||||
import org.mozilla.gecko.util.StringUtils;
|
||||
|
||||
public class testBookmarksPanel extends AboutHomeTest {
|
||||
public void testBookmarksPanel() {
|
||||
@ -18,13 +19,10 @@ public class testBookmarksPanel extends AboutHomeTest {
|
||||
isBookmarkDisplayed(url);
|
||||
}
|
||||
|
||||
// Open the context menu for the first bookmark in the list
|
||||
openBookmarkContextMenu(StringHelper.DEFAULT_BOOKMARKS_URLS[0]);
|
||||
assertAllContextMenuOptionsArePresent(StringHelper.DEFAULT_BOOKMARKS_URLS[1],
|
||||
StringHelper.DEFAULT_BOOKMARKS_URLS[0]);
|
||||
|
||||
// Test that the options are all displayed
|
||||
for (String contextMenuOption : StringHelper.BOOKMARK_CONTEXT_MENU_ITEMS) {
|
||||
mAsserter.ok(mSolo.searchText(contextMenuOption), "Checking that the context menu option is present", contextMenuOption + " is present");
|
||||
}
|
||||
openBookmarkContextMenu(StringHelper.DEFAULT_BOOKMARKS_URLS[1]);
|
||||
|
||||
// Test that "Open in New Tab" works
|
||||
final Element tabCount = mDriver.findElement(getActivity(), R.id.tabs_counter);
|
||||
@ -55,6 +53,44 @@ public class testBookmarksPanel extends AboutHomeTest {
|
||||
mAsserter.ok(!mDatabaseHelper.isBookmark(editedBookmarkValues[1]), "Checking that the bookmark was removed", "The bookmark was removed");
|
||||
}
|
||||
|
||||
/**
|
||||
* Asserts that all context menu items are present on the given links. For one link,
|
||||
* the context menu is expected to not have the "Share" context menu item.
|
||||
*
|
||||
* @param shareableURL A URL that is expected to have the "Share" context menu item
|
||||
* @param nonShareableURL A URL that is expected not to have the "Share" context menu item.
|
||||
*/
|
||||
private void assertAllContextMenuOptionsArePresent(final String shareableURL,
|
||||
final String nonShareableURL) {
|
||||
mAsserter.ok(StringUtils.isShareableUrl(shareableURL), "Ensuring url is shareable", "");
|
||||
mAsserter.ok(!StringUtils.isShareableUrl(nonShareableURL), "Ensuring url is not shareable", "");
|
||||
|
||||
openBookmarkContextMenu(shareableURL);
|
||||
for (String contextMenuOption : StringHelper.BOOKMARK_CONTEXT_MENU_ITEMS) {
|
||||
mAsserter.ok(mSolo.searchText(contextMenuOption),
|
||||
"Checking that the context menu option is present",
|
||||
contextMenuOption + " is present");
|
||||
}
|
||||
|
||||
// Close the menu.
|
||||
mActions.sendSpecialKey(Actions.SpecialKey.BACK);
|
||||
|
||||
openBookmarkContextMenu(nonShareableURL);
|
||||
for (String contextMenuOption : StringHelper.BOOKMARK_CONTEXT_MENU_ITEMS) {
|
||||
// This link is not shareable: skip the "Share" option.
|
||||
if ("Share".equals(contextMenuOption)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
mAsserter.ok(mSolo.searchText(contextMenuOption),
|
||||
"Checking that the context menu option is present",
|
||||
contextMenuOption + " is present");
|
||||
}
|
||||
|
||||
// Close the menu.
|
||||
mActions.sendSpecialKey(Actions.SpecialKey.BACK);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bookmarkUrl URL of the bookmark to edit
|
||||
* @param values String array with the new values for all fields
|
||||
|
Loading…
Reference in New Issue
Block a user