Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.
TypeScript automationchromechromiume2e-testingelectronend-to-end-testingfirefoxjavascriptplaywrighttesttest-automationtestingtesting-toolswebwebkit
fix(html-reporter): race condition where form submission used stale filterText state (#36260)
Max Schmitt3cb987f3838c
diff --git a/packages/html-reporter/src/headerView.tsx b/packages/html-reporter/src/headerView.tsxindex bea84bcdd0..bd4e178b55 100644--- a/packages/html-reporter/src/headerView.tsx+++ b/packages/html-reporter/src/headerView.tsx@@ -60,13 +60,16 @@ export const GlobalFilterView: React.FC<{event => {event.preventDefault();const url = new URL(window.location.href);- url.hash = filterText ? '?' + new URLSearchParams({ q: filterText }) : '';+ // If <form/> onSubmit happens immediately after <input/> onChange, the filterText state is not updated yet.+ // Using FormData here is a workaround to get the latest value.+ const q = new FormData(event.target as HTMLFormElement).get('q') as string;+ url.hash = q ? '?' + new URLSearchParams({ q }) : '';navigate(url);}}>{icons.search()}{/* Use navigationId to reset defaultValue */}- <input spellCheck={false} className='form-control subnav-search-input input-contrast width-full' value={filterText} onChange={e => {+ <input name='q' spellCheck={false} className='form-control subnav-search-input input-contrast width-full' value={filterText} onChange={e => {setFilterText(e.target.value);}}></input></form>