@@ -3,7 +3,6 @@ import type { RumInitConfiguration, RemoteConfiguration } from '@datadog/browser
33import { DefaultPrivacyLevel } from '@datadog/browser-rum'
44import type { BrowserContext , Page } from '@playwright/test'
55import { test , expect } from '@playwright/test'
6- import { createExtensionTest } from '../helpers/extensionFixture'
76import { addTag , addTestOptimizationTags } from '../helpers/tags'
87import { getRunId } from '../../../envUtils'
98import type { BrowserLog } from '../helpers/browser'
@@ -16,9 +15,10 @@ import { flushEvents } from './flushEvents'
1615import type { Servers } from './httpServers'
1716import { getTestServers , waitForServersIdle } from './httpServers'
1817import type { SetupFactory , SetupOptions } from './pageSetups'
19- import { DEFAULT_SETUPS , extensionSetup , npmSetup , reactSetup } from './pageSetups'
18+ import { asyncSetup , DEFAULT_SETUPS , npmSetup , reactSetup } from './pageSetups'
2019import { createIntakeServerApp } from './serverApps/intake'
2120import { createMockServerApp } from './serverApps/mock'
21+ import type { Extension } from './createExtension'
2222
2323export const DEFAULT_RUM_CONFIGURATION = {
2424 applicationId : APPLICATION_ID ,
@@ -76,6 +76,10 @@ class TestBuilder {
7676 private eventBridge = false
7777 private setups : Array < { factory : SetupFactory ; name ?: string } > = DEFAULT_SETUPS
7878 private testFixture : typeof test = test
79+ private extension : {
80+ rumConfiguration ?: RumInitConfiguration
81+ logsConfiguration ?: LogsInitConfiguration
82+ } = { }
7983
8084 constructor ( private title : string ) { }
8185
@@ -129,9 +133,17 @@ class TestBuilder {
129133 return this
130134 }
131135
132- withExtension ( extensionPath : string ) {
133- this . testFixture = createExtensionTest ( extensionPath )
134- this . setups = [ { factory : ( options , servers ) => extensionSetup ( options , servers ) } ]
136+ withSetup ( setup : SetupFactory ) {
137+ this . setups = [ { factory : setup } ]
138+ return this
139+ }
140+
141+ withExtension ( extension : Extension ) {
142+ this . testFixture = extension . fixture
143+ this . setups = [ { factory : asyncSetup , name : 'async' } ]
144+ this . extension . rumConfiguration = extension . rumConfiguration
145+ this . extension . logsConfiguration = extension . logsConfiguration
146+
135147 return this
136148 }
137149
@@ -157,6 +169,7 @@ class TestBuilder {
157169 test_name : '<PLACEHOLDER>' ,
158170 } ,
159171 testFixture : this . testFixture ,
172+ extension : this . extension ,
160173 }
161174
162175 if ( this . alsoRunWithRumSlim ) {
@@ -203,7 +216,7 @@ function declareTestsForSetups(
203216}
204217
205218function declareTest ( title : string , setupOptions : SetupOptions , factory : SetupFactory , runner : TestRunner ) {
206- const testFixture = setupOptions . testFixture
219+ const testFixture = setupOptions . testFixture ?? test
207220 testFixture ( title , async ( { page, context } ) => {
208221 const browserName = getBrowserName ( test . info ( ) . project . name )
209222 addTag ( 'test.browserName' , browserName )
0 commit comments