@@ -6,23 +6,20 @@ import { startProfiling } from './profilers'
66import { reportToConsole } from './reporters/reportToConsole'
77import { reportToDatadog } from './reporters/reportToDatadog'
88import { isContinuousIntegration } from './environment'
9+ import { CLIENT_TOKEN , APPLICATION_ID , DATADOG_SITE , TEST_APP_URL , SDK_BUNDLE_URL } from './configuration'
910
10- const testAppUrl = 'https://df1fyr56hap9d.cloudfront.net/'
11- const sdkBundleUrl = 'https://df1fyr56hap9d.cloudfront.net/datadog-rum.js'
12- const applicationId = '9fa62a5b-8a7e-429d-8466-8b111a4d4693'
13- const clientToken = 'pubab31fd1ab9d01d2b385a8aa3dd403b1d'
14- const datadogSite = 'datadoghq.com'
15- const scenarioConfigurations = [ 'none' , 'rum' , 'rum_replay' , 'rum_profiling' , 'none_with_headers' ] as const
1611
17- type ScenarioConfiguration = ( typeof scenarioConfigurations ) [ number ]
12+ const SCENARIO_CONFIGURATIONS = [ 'none' , 'rum' , 'rum_replay' , 'rum_profiling' , 'none_with_headers' ] as const
13+
14+ type ScenarioConfiguration = ( typeof SCENARIO_CONFIGURATIONS ) [ number ]
1815type TestRunner = ( page : Page , takeMeasurementsAndGoto : ( pageUrl : string ) => Promise < void > , appUrl : string ) => Promise < void > | void
1916
2017
2118export function createBenchmarkTest ( scenarioName : string ) {
2219 return {
2320 run ( runner : TestRunner ) {
2421 const metrics : Record < string , Metrics > = { }
25- scenarioConfigurations . forEach ( ( scenarioConfiguration ) => {
22+ SCENARIO_CONFIGURATIONS . forEach ( ( scenarioConfiguration ) => {
2623 test ( `${ scenarioName } benchmark ${ scenarioConfiguration } ` , async ( { page } ) => {
2724 await page . setExtraHTTPHeaders ( { 'Accept-Language' : 'en-US' } )
2825
@@ -42,7 +39,7 @@ export function createBenchmarkTest(scenarioName: string) {
4239 test . afterAll ( async ( ) => {
4340 reportToConsole ( metrics )
4441 if ( isContinuousIntegration ) {
45- await reportToDatadog ( metrics , applicationId , scenarioName )
42+ await reportToDatadog ( metrics , scenarioName )
4643 }
4744 } )
4845 } ,
@@ -59,9 +56,9 @@ interface PageInitScriptParameters {
5956
6057async function injectSDK ( page : Page , scenarioConfiguration : ScenarioConfiguration , scenarioName : string ) {
6158 const configuration : Partial < RumInitConfiguration > = {
62- clientToken,
63- applicationId,
64- site : datadogSite ,
59+ clientToken : CLIENT_TOKEN ,
60+ applicationId : APPLICATION_ID ,
61+ site : DATADOG_SITE ,
6562 profilingSampleRate : scenarioConfiguration === 'rum_profiling' ? 100 : 0 ,
6663 sessionReplaySampleRate : scenarioConfiguration === 'rum_replay' ? 100 : 0 ,
6764 }
@@ -98,7 +95,7 @@ async function injectSDK(page: Page, scenarioConfiguration: ScenarioConfiguratio
9895 }
9996 } )
10097 } ,
101- { configuration, sdkBundleUrl, scenarioConfiguration, scenarioName }
98+ { configuration, sdkBundleUrl : SDK_BUNDLE_URL , scenarioConfiguration, scenarioName }
10299 )
103100}
104101
@@ -108,7 +105,7 @@ function shouldInjectSDK(scenarioConfiguration: ScenarioConfiguration): boolean
108105
109106
110107function buildAppUrl ( scenarioConfiguration : ScenarioConfiguration ) : string {
111- const url = new URL ( testAppUrl )
108+ const url = new URL ( TEST_APP_URL )
112109 if ( scenarioConfiguration === 'rum_profiling' || scenarioConfiguration === 'none_with_headers' ) {
113110 url . searchParams . set ( 'profiling' , 'true' )
114111 }
0 commit comments