Fix flaky TabSearch mocha test.
This CL makes 3 changes: (1) The TabSearch organization mocha tests check focus and blur. This in turn depends on window activation, which is not guaranteed for browser_tests. This CL moves the tests to be interactive_ui_tests (2) This CL updates the mocha test documentation. (3) This CL fixes a null reference that emitted spammy log messages in the tests. Bug: 360760963 Change-Id: I58863d647bd30b1eea2a4956fd83f6e5b2b5e4ce Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5805528 Reviewed-by: Demetrios Papadopoulos <dpapad@chromium.org> Commit-Queue: Erik Chen <erikchen@chromium.org> Cr-Commit-Position: refs/heads/main@{#1345319}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
2ae55d5f6c
commit
382a2085ff
chrome/test/data/webui/tab_search
docs
@ -9,7 +9,7 @@ import {TabOrganizationError, TabOrganizationState, TabSearchApiProxyImpl, TabSe
|
||||
import {assertEquals, assertFalse, assertTrue} from 'chrome://webui-test/chai_assert.js';
|
||||
import {eventToPromise, isVisible, microtasksFinished} from 'chrome://webui-test/test_util.js';
|
||||
|
||||
import {createTab} from './tab_search_test_data.js';
|
||||
import {createProfileData, createTab} from './tab_search_test_data.js';
|
||||
import {TestTabSearchApiProxy} from './test_tab_search_api_proxy.js';
|
||||
import {TestTabSearchSyncBrowserProxy} from './test_tab_search_sync_browser_proxy.js';
|
||||
|
||||
@ -23,6 +23,7 @@ suite('AutoTabGroupsPageTest', () => {
|
||||
document.body.innerHTML = window.trustedTypes!.emptyHTML;
|
||||
|
||||
testApiProxy = new TestTabSearchApiProxy();
|
||||
testApiProxy.setProfileData(createProfileData());
|
||||
const session = createSession();
|
||||
testApiProxy.setSession(session);
|
||||
TabSearchApiProxyImpl.setInstance(testApiProxy);
|
||||
@ -40,6 +41,7 @@ suite('AutoTabGroupsPageTest', () => {
|
||||
document.body.innerHTML = window.trustedTypes!.emptyHTML;
|
||||
|
||||
testApiProxy = new TestTabSearchApiProxy();
|
||||
testApiProxy.setProfileData(createProfileData());
|
||||
const session = createSession();
|
||||
testApiProxy.setSession(session);
|
||||
TabSearchApiProxyImpl.setInstance(testApiProxy);
|
||||
|
@ -39,10 +39,6 @@ IN_PROC_BROWSER_TEST_F(TabSearchTest, MediaTabs) {
|
||||
RunTest("tab_search/tab_search_media_tabs_test.js", "mocha.run()");
|
||||
}
|
||||
|
||||
IN_PROC_BROWSER_TEST_F(TabSearchTest, Organization) {
|
||||
RunTest("tab_search/auto_tab_groups_page_test.js", "mocha.run()");
|
||||
}
|
||||
|
||||
IN_PROC_BROWSER_TEST_F(TabSearchTest, Declutter) {
|
||||
RunTest("tab_search/declutter_page_test.js", "mocha.run()");
|
||||
}
|
||||
|
@ -21,3 +21,9 @@ class TabSearchFocusTest : public WebUIMochaBrowserTest {
|
||||
IN_PROC_BROWSER_TEST_F(TabSearchFocusTest, MAYBE_App) {
|
||||
RunTest("tab_search/tab_search_page_focus_test.js", "mocha.run()");
|
||||
}
|
||||
|
||||
// Some of the organization tests require checking focus and blur logic. This
|
||||
// must be run as an interactive_ui_test.
|
||||
IN_PROC_BROWSER_TEST_F(TabSearchFocusTest, Organization) {
|
||||
RunTest("tab_search/auto_tab_groups_page_test.js", "mocha.run()");
|
||||
}
|
||||
|
@ -329,3 +329,13 @@ IN_PROC_BROWSER_TEST_F(FooDialogBrowserTest, MyTest) {
|
||||
/*skip_test_loader=*/true));
|
||||
}
|
||||
```
|
||||
|
||||
### Common errors
|
||||
|
||||
Tests that rely on focus, blur, or other input-related events need to be added
|
||||
to the interactive_ui_tests build target rather than the browser_tests target.
|
||||
browser_tests are run in parallel, and the window running the test will
|
||||
gain/lose activation at unpredictable times.
|
||||
|
||||
Tests that touch production logic that depends on onFocus, onBlur or similar
|
||||
events also needs to be added to interactive_ui_tests
|
||||
|
Reference in New Issue
Block a user