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
chore: do not select after hooks automatically (#27805)
Pavel Feldman47733b04fbc3
diff --git a/packages/trace-viewer/src/ui/uiModeView.tsx b/packages/trace-viewer/src/ui/uiModeView.tsxindex 498fab951a..bf02e22f5f 100644--- a/packages/trace-viewer/src/ui/uiModeView.tsx+++ b/packages/trace-viewer/src/ui/uiModeView.tsx@@ -254,7 +254,10 @@ export const UIModeView: React.FC<{}> = ({</div>}<ToolbarButton icon='play' title='Run all' onClick={() => runTests('bounce-if-busy', visibleTestIds)} disabled={isRunningTest || isLoading}></ToolbarButton><ToolbarButton icon='debug-stop' title='Stop' onClick={() => sendMessageNoReply('stop')} disabled={!isRunningTest || isLoading}></ToolbarButton>- <ToolbarButton icon='eye' title='Watch all' toggled={watchAll} onClick={() => setWatchAll(!watchAll)}></ToolbarButton>+ <ToolbarButton icon='eye' title='Watch all' toggled={watchAll} onClick={() => {+ setWatchedTreeIds({ value: new Set() });+ setWatchAll(!watchAll);+ }}></ToolbarButton><ToolbarButton icon='collapse-all' title='Collapse all' onClick={() => {setCollapseAllCount(collapseAllCount + 1);}} />diff --git a/packages/trace-viewer/src/ui/workbench.tsx b/packages/trace-viewer/src/ui/workbench.tsxindex 186a555e33..703ff72c50 100644--- a/packages/trace-viewer/src/ui/workbench.tsx+++ b/packages/trace-viewer/src/ui/workbench.tsx@@ -72,12 +72,21 @@ export const Workbench: React.FunctionComponent<{if (selectedAction && model?.actions.includes(selectedAction))return;const failedAction = model?.failedAction();- if (initialSelection && model?.actions.includes(initialSelection))+ if (initialSelection && model?.actions.includes(initialSelection)) {setSelectedAction(initialSelection);- else if (failedAction)+ } else if (failedAction) {setSelectedAction(failedAction);- else if (model?.actions.length)- setSelectedAction(model.actions[model.actions.length - 1]);+ } else if (model?.actions.length) {+ // Select the last non-after hooks item.+ let index = model.actions.length - 1;+ for (let i = 0; i < model.actions.length; ++i) {+ if (model.actions[i].apiName === 'After Hooks' && i) {+ index = i - 1;+ break;+ }+ }+ setSelectedAction(model.actions[index]);+ }}, [model, selectedAction, setSelectedAction, initialSelection]);const onActionSelected = React.useCallback((action: ActionTraceEventInContext) => {diff --git a/tests/playwright-test/ui-mode-test-progress.spec.ts b/tests/playwright-test/ui-mode-test-progress.spec.tsindex 16c88290c1..38091dcd93 100644--- a/tests/playwright-test/ui-mode-test-progress.spec.ts+++ b/tests/playwright-test/ui-mode-test-progress.spec.ts@@ -109,8 +109,6 @@ test('should update trace live', async ({ runUITest, server }) => {/page.gotohttp:\/\/localhost:\d+\/one.html[\d.]+m?s/,/page.gotohttp:\/\/localhost:\d+\/two.html[\d.]+m?s/,/After Hooks[\d.]+m?s/,- /fixture: page[\d.]+m?s/,- /fixture: context[\d.]+m?s/,]);});diff --git a/tests/playwright-test/ui-mode-test-screencast.spec.ts b/tests/playwright-test/ui-mode-test-screencast.spec.tsindex 27e3393e99..7c973f588b 100644--- a/tests/playwright-test/ui-mode-test-screencast.spec.ts+++ b/tests/playwright-test/ui-mode-test-screencast.spec.ts@@ -44,6 +44,6 @@ test('should show screenshots', async ({ runUITest }) => {await page.getByText('test 2', { exact: true }).click();await expect(page.locator('.CodeMirror .source-line-running'),- ).toContainText(`test('test 2', async ({ page }) => {`);+ ).toContainText(`await page.waitForTimeout(1000);`);await expect(page.locator('.film-strip-frame').first()).toBeVisible();});diff --git a/tests/playwright-test/ui-mode-trace.spec.ts b/tests/playwright-test/ui-mode-trace.spec.tsindex c3dad2b786..68b1bd1d97 100644--- a/tests/playwright-test/ui-mode-trace.spec.ts+++ b/tests/playwright-test/ui-mode-trace.spec.ts@@ -45,8 +45,6 @@ test('should merge trace events', async ({ runUITest, server }) => {/locator.clickgetByRole\('button'\)[\d.]+m?s/,/expect.toBe[\d.]+m?s/,/After Hooks[\d.]+m?s/,- /fixture: page[\d.]+m?s/,- /fixture: context[\d.]+m?s/,]);});@@ -72,8 +70,6 @@ test('should merge web assertion events', async ({ runUITest }, testInfo) => {/page.setContent[\d.]+m?s/,/expect.toBeVisiblelocator\('button'\)[\d.]+m?s/,/After Hooks[\d.]+m?s/,- /fixture: page[\d.]+m?s/,- /fixture: context[\d.]+m?s/,]);});@@ -98,9 +94,8 @@ test('should merge screenshot assertions', async ({ runUITest }, testInfo) => {/Before Hooks[\d.]+m?s/,/page.setContent[\d.]+m?s/,/expect.toHaveScreenshot[\d.]+m?s/,+ /attach "trace-test-1-actual.png/,/After Hooks[\d.]+m?s/,- /fixture: page[\d.]+m?s/,- /fixture: context[\d.]+m?s/,]);});@@ -147,8 +142,6 @@ test('should show snapshots for sync assertions', async ({ runUITest, server })/locator\.clickgetByRole\('button'\)[\d.]+m?s/,/expect\.toBe[\d.]+m?s/,/After Hooks[\d.]+m?s/,- /fixture: page[\d.]+m?s/,- /fixture: context[\d.]+m?s/,]);await expect(