From 4889d56b797be332b2d12ce49d94fe22898e6ef5 Mon Sep 17 00:00:00 2001 From: Yury Semikhatsky Date: Fri, 2 Aug 2024 10:49:47 -0700 Subject: [PATCH] chore(trace): do not nest API actions based on time --- packages/playwright/src/index.ts | 1 - packages/playwright/src/worker/testInfo.ts | 8 -------- tests/playwright-test/playwright.trace.spec.ts | 4 ++-- 3 files changed, 2 insertions(+), 11 deletions(-) diff --git a/packages/playwright/src/index.ts b/packages/playwright/src/index.ts index 6dbf290d66..9a159c984a 100644 --- a/packages/playwright/src/index.ts +++ b/packages/playwright/src/index.ts @@ -261,7 +261,6 @@ const playwrightFixtures: Fixtures = ({ title: renderApiCall(apiName, params), apiName, params, - canNestByTime: true, }); userData.userObject = step; out.stepId = step.stepId; diff --git a/packages/playwright/src/worker/testInfo.ts b/packages/playwright/src/worker/testInfo.ts index bca8e8d96b..fac773f394 100644 --- a/packages/playwright/src/worker/testInfo.ts +++ b/packages/playwright/src/worker/testInfo.ts @@ -44,9 +44,6 @@ export interface TestStepInternal { infectParentStepsWithError?: boolean; box?: boolean; isStage?: boolean; - // TODO: this сould be decided based on the category, but pw:api - // is from a different abstraction layer. - canNestByTime?: boolean; } export type TestStage = { @@ -255,11 +252,6 @@ export class TestInfoImpl implements TestInfo { parentStep = this._findLastStageStep(); } else { parentStep = zones.zoneData('stepZone'); - if (!parentStep && data.canNestByTime) { - // API steps (but not test.step calls) can be nested by time, instead of by stack. - // However, do not nest chains of route.continue by checking the title. - parentStep = this._findLastNonFinishedStep(step => step.title !== data.title); - } if (!parentStep) { // If no parent step on stack, assume the current stage as parent. parentStep = this._findLastStageStep(); diff --git a/tests/playwright-test/playwright.trace.spec.ts b/tests/playwright-test/playwright.trace.spec.ts index 642a3555ca..e4a1efe4d7 100644 --- a/tests/playwright-test/playwright.trace.spec.ts +++ b/tests/playwright-test/playwright.trace.spec.ts @@ -1216,9 +1216,9 @@ test('should not nest top level expect into unfinished api calls ', { ' browserContext.newPage', 'page.route', 'page.goto', - ' route.fetch', - ' page.unrouteAll', + 'route.fetch', 'expect.toBeVisible', + 'page.unrouteAll', 'After Hooks', ' fixture: page', ' fixture: context',