Commit b89b0038 authored by Satoshi Niwa's avatar Satoshi Niwa Committed by Commit Bot

Add an integration test for LaunchParams.searchQuery

CL that implements the feature : crrev.com/c/2408502
Doc about the feature : go/arc-r-documents-ui

Cq-Depend: chromium:2434070
Bug: 1126742
Test: browser_tests --gtest_filter="*FilesApp*SearchQueryLaunchParam"
Change-Id: I7d241f9e9e42b5669be6a4a012296537aad9f218
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2434008
Commit-Queue: Satoshi Niwa <niwa@chromium.org>
Auto-Submit: Satoshi Niwa <niwa@chromium.org>
Reviewed-by: default avatarLuciano Pacheco <lucmult@chromium.org>
Cr-Commit-Position: refs/heads/master@{#811764}
parent 57676566
......@@ -999,7 +999,8 @@ WRAPPED_INSTANTIATE_TEST_SUITE_P(
TestCase("searchDownloadsClearSearch"),
TestCase("searchHidingViaTab"),
TestCase("searchHidingTextEntryField"),
TestCase("searchButtonToggles")));
TestCase("searchButtonToggles"),
TestCase("searchQueryLaunchParam")));
WRAPPED_INSTANTIATE_TEST_SUITE_P(
Metrics, /* metrics.js */
......
......@@ -244,4 +244,47 @@
}
});
};
/**
* Tests that Files app performs a search at app start up when
* LaunchParam.searchQuery is specified.
*/
testcase.searchQueryLaunchParam = async () => {
addEntries(['local'], BASIC_LOCAL_ENTRY_SET);
addEntries(['drive'], BASIC_DRIVE_ENTRY_SET);
// Open Files app with LaunchParam.searchQuery='gdoc'.
const query = 'gdoc';
const appState = {searchQuery: query};
const appId =
await remoteCall.callRemoteTestUtil('openMainWindow', null, [appState]);
// Check: search box should be filled with the query.
const caller = getCaller();
await repeatUntil(async () => {
const searchBoxInput =
await remoteCall.waitForElement(appId, '#search-box cr-input');
if (searchBoxInput.value !== query) {
return pending(
caller, 'Waiting search box to be filled with the query.');
}
});
// Check: "My Drive" directory should be selected because it is the sole
// directory that contains query-matched files (*.gdoc).
const selectedTreeRow = await remoteCall.waitForElement(
appId, '#directory-tree .tree-row[selected][active]');
chrome.test.assertTrue(selectedTreeRow.text.includes('My Drive'));
// Check: Query-matched files should be shown in the files list.
await repeatUntil(async () => {
const filenameLabel =
await remoteCall.waitForElement(appId, '#file-list .filename-label');
if (!filenameLabel.text.includes(query)) {
// Pre-search results might be shown only for a moment before the search
// spinner is shown.
return pending(caller, 'Waiting files list to be updated.');
}
});
};
})();
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