diff --git a/src/AppInsightsAvailabilityFixture.ts b/src/AppInsightsAvailabilityFixture.ts index 4338e30..dfe2bac 100644 --- a/src/AppInsightsAvailabilityFixture.ts +++ b/src/AppInsightsAvailabilityFixture.ts @@ -8,7 +8,7 @@ const test = baseTest.extend({ page: async ({ page }, use, testInfo) => { console.log(appInsightsAvailabilityTesterTag, testInfo.title); - var pwat = new PlaywrightAvailabilityTester(); + var pwat = new PlaywrightAvailabilityTester(testInfo.title); let browserContext = page.context(); if (browserContext) { diff --git a/src/PlaywrightAvailabilityTester.ts b/src/PlaywrightAvailabilityTester.ts index 817ef1d..b3e632a 100644 --- a/src/PlaywrightAvailabilityTester.ts +++ b/src/PlaywrightAvailabilityTester.ts @@ -36,8 +36,9 @@ export class PlaywrightAvailabilityTester { private options?: PlaywrightAvailabilityTesterOptions; - constructor(options?: PlaywrightAvailabilityTesterOptions) { + constructor(testName: any, options?: PlaywrightAvailabilityTesterOptions) { this.options = options; + this.testName = testName.toString(); if (options?.logDebugToTelemetryClient) { options.log = (...args: any[]) => @@ -181,11 +182,8 @@ export class PlaywrightAvailabilityTester { // Azure Functions uses 'APPSETTING_WEBSITE_SITE_NAME' environment variable to pass the logic app name // APPSETTING_TESTNAME can be used to override that - let testName = this.testName; - if (!testName || testName == "") { - testName = process.env.APPSETTING_TESTNAME || process.env.APPSETTING_WEBSITE_SITE_NAME || "NO_TESTNAME"; - } - bci.testName = testName; + + bci.testName = this.testName; (browserContext)[BrowserContextInsights.browserContextInsightsAttachedPropertyName] = bci; }