Index: ui/file_manager/integration_tests/file_manager/directory_tree_context_menu.js |
diff --git a/ui/file_manager/integration_tests/file_manager/directory_tree_context_menu.js b/ui/file_manager/integration_tests/file_manager/directory_tree_context_menu.js |
index 47c6ee8e25aefaff979a7eae8e79b9918f35ad5e..63e0d7140ad9d91dd532f5d6edcd3cacf58e7324 100644 |
--- a/ui/file_manager/integration_tests/file_manager/directory_tree_context_menu.js |
+++ b/ui/file_manager/integration_tests/file_manager/directory_tree_context_menu.js |
@@ -110,6 +110,8 @@ function renamePhotosDirectoryTo(windowId, newName, useKeyboardShortcut) { |
return clickDirectoryTreeContextMenuItem(windowId, '/photos', 'rename'); |
} |
}).then(function() { |
+ return remoteCall.waitForElement(windowId, '.tree-row > input'); |
+ }).then(function() { |
return remoteCall.callRemoteTestUtil( |
'inputText', windowId, ['.tree-row > input', newName]); |
}).then(function() { |
@@ -149,6 +151,44 @@ function renameDirectoryFromDirectoryTreeAndConfirmAlertDialog(newName) { |
} |
/** |
+ * Creates directory from directory tree. |
+ */ |
+function createDirectoryFromDirectoryTree(useKeyboardShortcut) { |
+ var windowId; |
+ return setupForDirectoryTreeContextMenuTest().then(function(id) { |
+ windowId = id; |
+ return navigateWithDirectoryTree(windowId, '/photos'); |
+ }).then(function() { |
+ if (useKeyboardShortcut) { |
+ return remoteCall.callRemoteTestUtil('fakeKeyDown', windowId, |
+ ['body', 'U+0045' /* e */, true /* ctrl */]); |
+ } else { |
+ return clickDirectoryTreeContextMenuItem( |
+ windowId, '/photos', 'new-folder'); |
+ } |
+ }).then(function() { |
+ return remoteCall.waitForElement(windowId, '.tree-row > input'); |
+ }).then(function() { |
+ return remoteCall.callRemoteTestUtil( |
+ 'inputText', windowId, ['.tree-row > input', 'test']); |
+ }).then(function() { |
+ return remoteCall.callRemoteTestUtil( |
+ 'fakeKeyDown', windowId, ['.tree-row > input', 'Enter', false]); |
+ }).then(function() { |
+ // Confirm that new directory is added to the directory tree. |
+ return remoteCall.waitForElement( |
+ windowId, '[full-path-for-testing="/photos/test"]'); |
+ }).then(function() { |
+ // Confirm that current directory is not changed at this timing. |
+ return remoteCall.waitUntilCurrentDirectoryIsChanged( |
+ windowId, '/Downloads/photos'); |
+ }).then(function() { |
+ // Confirm that new directory is actually created by navigating to it. |
+ return navigateWithDirectoryTree(windowId, '/photos/test'); |
+ }); |
+} |
+ |
+/** |
* Test case for copying a directory from directory tree by using context menu. |
*/ |
testcase.copyFromDirectoryTreeWithContextMenu = function() { |
@@ -292,3 +332,20 @@ testcase.renameDirectoryToExistingOneFromDirectoryTree = function() { |
testPromise(renameDirectoryFromDirectoryTreeAndConfirmAlertDialog( |
'destination')); |
}; |
+ |
+/** |
+ * Test case for creating directory from directory tree by using context menu. |
+ */ |
+testcase.createDirectoryFromDirectoryTreeWithContextMenu = function() { |
+ testPromise(createDirectoryFromDirectoryTree( |
+ false /* do not use keyboard shortcut */)); |
+}; |
+ |
+/** |
+ * Test case for creating directory from directory tree by using keyboard |
+ * shortcut. |
+ */ |
+testcase.createDirectoryFromDirectoryTreeWithKeyboardShortcut = function() { |
+ testPromise(createDirectoryFromDirectoryTree( |
+ true /* use keyboard shortcut */)); |
+}; |