Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1417)

Unified Diff: ui/file_manager/integration_tests/file_manager/keyboard_operations.js

Issue 1246923003: Files.app: Stop to use autogen IDs of TreeItems to identify tree items. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ui/file_manager/file_manager/background/js/test_util.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/file_manager/integration_tests/file_manager/keyboard_operations.js
diff --git a/ui/file_manager/integration_tests/file_manager/keyboard_operations.js b/ui/file_manager/integration_tests/file_manager/keyboard_operations.js
index f6df025be3602d94fec8368de97939c50b89a031..9429bef42cb0d1ec5e524e83bf7011531fb17a0b 100644
--- a/ui/file_manager/integration_tests/file_manager/keyboard_operations.js
+++ b/ui/file_manager/integration_tests/file_manager/keyboard_operations.js
@@ -5,16 +5,6 @@
'use strict';
/**
- * Constants for interacting with the directory tree on the LHS of Files.
- * When we are not in guest mode, we fill Google Drive with the basic entry set
- * which causes an extra tree-item to be added.
- */
-var PHOTOS_FOLDER;
-var PHOTOS_FOLDER_GUEST = '#tree-item-autogen-id-6';
-var PHOTOS_FOLDER_DOWNLOADS = '#tree-item-autogen-id-7';
-var PHOTOS_FOLDER_DRIVE = '#tree-item-autogen-id-8';
-
-/**
* Waits until a dialog with an OK button is shown and accepts it.
*
* @param {string} windowId Target window ID.
@@ -35,6 +25,55 @@ function waitAndAcceptDialog(windowId) {
}
/**
+ * Obtains visible tree items.
+ *
+ * @param {string} windowId Window ID.
+ * @return {!Promise<!Array<string>>} List of visible item names.
+ */
+function getTreeItems(windowId) {
+ return remoteCall.callRemoteTestUtil('getTreeItems', windowId, []);
+};
+
+/**
+ * Waits until the directory item appears.
+ *
+ * @param {string} windowId Window ID.
+ * @param {string} name Name of item.
+ * @return {!Promise}
+ */
+function waitForDirectoryItem(windowId, name) {
+ return repeatUntil(function() {
+ return getTreeItems(windowId).then(function(items) {
+ if (items.indexOf(name) !== -1) {
+ return true;
+ } else {
+ return pending('Tree item %s is not found.', name);
+ }
+ });
+ });
+}
+
+/**
+ * Waits until the directory item disappears.
+ *
+ * @param {string} windowId Window ID.
+ * @param {string} name Name of item.
+ * @return {!Promise}
+ */
+function waitForDirectoryItemLost(windowId, name) {
+ return repeatUntil(function() {
+ return getTreeItems(windowId).then(function(items) {
+ console.log(items);
+ if (items.indexOf(name) === -1) {
+ return true;
+ } else {
+ return pending('Tree item %s is still exists.', name);
+ }
+ });
+ });
+}
+
+/**
* Tests copying a file to the same directory and waits until the file lists
* changes.
*
@@ -122,7 +161,7 @@ function keyboardDelete(path, treeItem) {
},
function() {
// Check that the directory appears in the LHS tree
- remoteCall.waitForElement(appId, PHOTOS_FOLDER).then(this.next);
+ waitForDirectoryItem(appId, directoryName).then(this.next);
},
// Wait for a file list change.
function() {
@@ -154,7 +193,7 @@ function keyboardDelete(path, treeItem) {
},
function() {
// Check that the directory is removed from the LHS tree
- remoteCall.waitForElementLost(appId, PHOTOS_FOLDER).then(this.next);
+ waitForDirectoryItemLost(appId, directoryName).then(this.next);
},
function() {
checkIfNoErrorsOccured(this.next);
@@ -293,10 +332,6 @@ testcase.keyboardCopyDownloads = function() {
};
testcase.keyboardDeleteDownloads = function() {
- if (chrome.extension.inIncognitoContext)
- PHOTOS_FOLDER = PHOTOS_FOLDER_GUEST;
- else
- PHOTOS_FOLDER = PHOTOS_FOLDER_DOWNLOADS;
keyboardDelete(RootPath.DOWNLOADS, TREEITEM_DOWNLOADS);
};
@@ -305,13 +340,9 @@ testcase.keyboardCopyDrive = function() {
};
testcase.keyboardDeleteDrive = function() {
- PHOTOS_FOLDER = PHOTOS_FOLDER_DRIVE;
keyboardDelete(RootPath.DRIVE, TREEITEM_DRIVE);
};
-testcase.createNewFolderAndCheckFocus = function() {
-};
-
testcase.renameFileDownloads = function() {
testPromise(testRenameFile(RootPath.DOWNLOADS, BASIC_LOCAL_ENTRY_SET));
};
« no previous file with comments | « ui/file_manager/file_manager/background/js/test_util.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698