Commit 0824a5ac authored by Joel Hockey's avatar Joel Hockey Committed by Commit Bot

FilesApp create_new_folder test stop using element IDs

Verify that entries have been added or removed using waitForFiles
rather than tree-item-autogen-id values.  This makes the test
more resilient to any changes in the navigation tree that might
cause IDs to change.

Cq-Include-Trybots: master.tryserver.chromium.linux:closure_compilation
Change-Id: I953eb315c77ceaca31a3d7c529d1232a3b362ba3
Reviewed-on: https://chromium-review.googlesource.com/1092560Reviewed-by: default avatarLuciano Pacheco <lucmult@chromium.org>
Commit-Queue: Joel Hockey <joelhockey@chromium.org>
Cr-Commit-Position: refs/heads/master@{#566363}
parent 586e21ec
......@@ -11,18 +11,12 @@
*/
var TREEITEM_DRIVE;
var TREEITEM_DOWNLOADS;
var NEWFOLDER;
var TESTFOLDER;
if (!chrome.extension.inIncognitoContext) {
TREEITEM_DRIVE = '#directory-tree > div:nth-child(1) ';
TREEITEM_DOWNLOADS = '#directory-tree > div:nth-child(2) ';
NEWFOLDER = '#tree-item-autogen-id-9';
TESTFOLDER = '#tree-item-autogen-id-10';
} else {
// In guest mode Google Drive is not mounted so the folder indices differ.
TREEITEM_DOWNLOADS = '#directory-tree > div:nth-child(1) ';
NEWFOLDER = '#tree-item-autogen-id-3';
TESTFOLDER = '#tree-item-autogen-id-4';
}
var EXPAND_ICON = '> .tree-row > .expand-icon';
var EXPANDED_SUBTREE = '> .tree-children[expanded]';
......@@ -90,7 +84,10 @@ function createNewFolder(windowId, path, initialEntrySet) {
chrome.test.assertTrue('renaming' in elements[0].attributes);
}).then(function() {
// Check directory tree for new folder.
return remoteCall.waitForElement(windowId, NEWFOLDER);
var expectedRows = [['New Folder', '--', 'Folder', '']].concat(
TestEntryInfo.getExpectedRows(initialEntrySet));
return remoteCall.waitForFiles(
windowId, expectedRows, {ignoreLastModifiedTime: true});
}).then(function() {
// Type new folder name.
return remoteCall.callRemoteTestUtil(
......@@ -104,12 +101,12 @@ function createNewFolder(windowId, path, initialEntrySet) {
}).then(function() {
// Wait until rename completes.
return remoteCall.waitForElementLost(windowId, 'input.rename');
}).then(function() {
// Once it is renamed, the original 'New Folder' item is removed.
return remoteCall.waitForElementLost(windowId, NEWFOLDER);
}).then(function() {
// A newer entry is then added for the renamed folder.
return remoteCall.waitForElement(windowId, TESTFOLDER);
var expectedRows = [['Test Folder Name', '--', 'Folder', '']].concat(
TestEntryInfo.getExpectedRows(initialEntrySet));
return remoteCall.waitForFiles(
windowId, expectedRows, {ignoreLastModifiedTime: true});
}).then(function() {
var expectedEntryRows = TestEntryInfo.getExpectedRows(initialEntrySet);
expectedEntryRows.push(['Test Folder Name', '--', 'Folder', '']);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment