diff --git a/test/e2e/lib/framework/createTest.ts b/test/e2e/lib/framework/createTest.ts index 79e5d036b6..22c01e61fa 100644 --- a/test/e2e/lib/framework/createTest.ts +++ b/test/e2e/lib/framework/createTest.ts @@ -209,6 +209,7 @@ function declareTest(title: string, setupOptions: SetupOptions, factory: SetupFa try { await runner(testContext) + tearDownPassedTest(testContext) } finally { await tearDownTest(testContext) } @@ -270,18 +271,15 @@ async function setUpTest(browserLogsManager: BrowserLogsManager, { baseUrl, page await waitForServersIdle() } -async function tearDownTest({ intakeRegistry, withBrowserLogs, flushEvents, deleteAllCookies }: TestContext) { - await flushEvents() - await deleteAllCookies() - - if (test.info().expectedStatus === 'skipped') { - // ignore following expectations if test was skipped - return - } - +function tearDownPassedTest({ intakeRegistry, withBrowserLogs }: TestContext) { expect(intakeRegistry.telemetryErrorEvents).toHaveLength(0) validateRumFormat(intakeRegistry.rumEvents) withBrowserLogs((logs) => { expect(logs.filter((log) => log.level === 'error')).toHaveLength(0) }) } + +async function tearDownTest({ flushEvents, deleteAllCookies }: TestContext) { + await flushEvents() + await deleteAllCookies() +} diff --git a/test/e2e/scenario/rum/init.scenario.ts b/test/e2e/scenario/rum/init.scenario.ts index 3bc081cdc2..4210c305bd 100644 --- a/test/e2e/scenario/rum/init.scenario.ts +++ b/test/e2e/scenario/rum/init.scenario.ts @@ -10,8 +10,6 @@ test.describe('API calls and events around init', () => { ;(window.DD_RUM! as unknown as { init(): void }).init() }) .run(({ withBrowserLogs }) => { - expect([1, 2, 3]).toHaveLength(1) - withBrowserLogs((logs) => { expect(logs).toHaveLength(1) expect(logs[0].message).toEqual(expect.stringContaining('Datadog Browser SDK'))