Commit 1ba0e279 authored by Noel Gordon's avatar Noel Gordon Committed by Commit Bot

[quickview] Fix info button keyboard toggle test for files-ng

In files-ng, the tool bar info button has a different id #info-button,
than the id #metadata-button used for non-files-ng.

Fix button toggle test: switch on the button name for files-ng. Rename
the test to openQuickViewToggleInfoButtonKeyboard to match the rest of
the test names. Add a openQuickViewToggleInfoButtonClick test to cover
that case while here.

These tests pass in files-ng and not. CL:2082227 deals with the files-
ng case on the bots.

Test: browser_tests --gtest_filter="*QuickViewToogleInfoButton*"
Bug: 992824, 992818
Change-Id: I7b90a70731b2b21d765785930c99e7c5c3f4f0c9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2087296Reviewed-by: default avatarAlex Danilo <adanilo@chromium.org>
Reviewed-by: default avatarNoel Gordon <noel@chromium.org>
Commit-Queue: Noel Gordon <noel@chromium.org>
Cr-Commit-Position: refs/heads/master@{#747021}
parent 60e070e6
...@@ -490,7 +490,8 @@ WRAPPED_INSTANTIATE_TEST_SUITE_P( ...@@ -490,7 +490,8 @@ WRAPPED_INSTANTIATE_TEST_SUITE_P(
TestCase("openQuickViewTabIndexAudio"), TestCase("openQuickViewTabIndexAudio"),
TestCase("openQuickViewTabIndexVideo"), TestCase("openQuickViewTabIndexVideo"),
TestCase("openQuickViewTabIndexDeleteDialog"), TestCase("openQuickViewTabIndexDeleteDialog"),
TestCase("pressEnterOnInfoBoxToOpenClose"), TestCase("openQuickViewToggleInfoButtonKeyboard"),
TestCase("openQuickViewToggleInfoButtonClick"),
TestCase("openQuickViewWithMultipleFiles"), TestCase("openQuickViewWithMultipleFiles"),
TestCase("openQuickViewWithMultipleFilesText"), TestCase("openQuickViewWithMultipleFilesText"),
TestCase("openQuickViewWithMultipleFilesPdf"), TestCase("openQuickViewWithMultipleFilesPdf"),
......
...@@ -1391,15 +1391,10 @@ ...@@ -1391,15 +1391,10 @@
}; };
/** /**
* Tests close/open metadata info via Enter key. * Tests that the metadatabox can be toggled opened/closed by pressing the
* Enter key on the Quick View toolbar info button.
*/ */
testcase.pressEnterOnInfoBoxToOpenClose = async () => { testcase.openQuickViewToggleInfoButtonKeyboard = async () => {
const infoButton = ['#quick-view', '#metadata-button'];
const key = [infoButton, 'Enter', false, false, false];
const infoShown = ['#quick-view', '#contentPanel[metadata-box-active]'];
const infoHidden =
['#quick-view', '#contentPanel:not([metadata-box-active])'];
// Open Files app on Downloads containing ENTRIES.hello. // Open Files app on Downloads containing ENTRIES.hello.
const appId = const appId =
await setupAndWaitUntilReady(RootPath.DOWNLOADS, [ENTRIES.hello], []); await setupAndWaitUntilReady(RootPath.DOWNLOADS, [ENTRIES.hello], []);
...@@ -1407,20 +1402,65 @@ ...@@ -1407,20 +1402,65 @@
// Open the file in Quick View. // Open the file in Quick View.
await openQuickView(appId, ENTRIES.hello.nameText); await openQuickView(appId, ENTRIES.hello.nameText);
// Press Enter on info button to close metadata box. // Check: the metadatabox should be open.
const metaShown = ['#quick-view', '#contentPanel[metadata-box-active]'];
await remoteCall.waitForElement(appId, metaShown);
// The toolbar info button query differs in files-ng.
const quickView = await remoteCall.waitForElement(appId, ['#quick-view']);
let infoButton = ['#quick-view', '#metadata-button'];
if (quickView.attributes['files-ng'] !== undefined) {
infoButton = ['#quick-view', '#info-button'];
}
// Press Enter key on the info button.
const key = [infoButton, 'Enter', false, false, false];
await remoteCall.callRemoteTestUtil('fakeKeyDown', appId, key); await remoteCall.callRemoteTestUtil('fakeKeyDown', appId, key);
// Info should be hidden. // Check: the metadatabox should close.
await remoteCall.waitForElement(appId, infoHidden); await remoteCall.waitForElementLost(appId, metaShown);
// Press Enter on info button to open metadata box. // Press Enter key on the info button.
await remoteCall.callRemoteTestUtil('fakeKeyDown', appId, key); await remoteCall.callRemoteTestUtil('fakeKeyDown', appId, key);
// Info should be shown. // Check: the metadatabox should open.
await remoteCall.waitForElement(appId, infoShown); await remoteCall.waitForElement(appId, metaShown);
};
// Close Quick View. /**
await closeQuickView(appId); * Tests that the metadatabox can be toggled opened/closed by clicking the
* the Quick View toolbar info button.
*/
testcase.openQuickViewToggleInfoButtonClick = async () => {
// Open Files app on Downloads containing ENTRIES.hello.
const appId =
await setupAndWaitUntilReady(RootPath.DOWNLOADS, [ENTRIES.hello], []);
// Open the file in Quick View.
await openQuickView(appId, ENTRIES.hello.nameText);
// Check: the metadatabox should be open.
const metaShown = ['#quick-view', '#contentPanel[metadata-box-active]'];
await remoteCall.waitForElement(appId, metaShown);
// The toolbar info button query differs in files-ng.
const quickView = await remoteCall.waitForElement(appId, ['#quick-view']);
let infoButton = ['#quick-view', '#metadata-button'];
if (quickView.attributes['files-ng'] !== undefined) {
infoButton = ['#quick-view', '#info-button'];
}
// Click the info button.
await remoteCall.waitAndClickElement(appId, infoButton);
// Check: the metadatabox should close.
await remoteCall.waitForElementLost(appId, metaShown);
// Click the info button.
await remoteCall.waitAndClickElement(appId, infoButton);
// Check: the metadatabox should open.
await remoteCall.waitForElement(appId, metaShown);
}; };
/** /**
......
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