@azure/microsoft-playwright-testing 1.0.0-alpha.20240912.2 → 1.0.0-alpha.20240916.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Release History
2
2
 
3
- ## 1.0.0-beta.3 (Unreleased)
3
+ ## 1.0.0-beta.4 (Unreleased)
4
4
 
5
5
  ### Features Added
6
6
 
@@ -10,9 +10,18 @@
10
10
 
11
11
  ### Other Changes
12
12
 
13
+ ## 1.0.0-beta.3 (2024-09-16)
14
+
15
+ This release provides better error messaging and error handling by improving logging.
16
+
17
+ ### Bugs Fixed
18
+
19
+ - Optimized test result publishing by reusing the Sas uri till it's expiry.
20
+ - Fixed unexpected process termination by improving error handling of API used to publish test results.
21
+
13
22
  ## 1.0.0-beta.2 (2024-09-12)
14
23
 
15
- This release updates the Microsoft Playwright Testing library documentation and improves error messages.
24
+ This release updates the Microsoft Playwright Testing library documentation and improves error messages.
16
25
 
17
26
  ### Bugs Fixed
18
27
 
@@ -44,7 +44,7 @@ export declare class Constants {
44
44
  static readonly TEST_FRAMEWORK_RUNNERNAME = "PLAYWRIGHT";
45
45
  static readonly TEST_TYPE = "WebTest";
46
46
  static readonly TEST_SDK_LANGUAGE = "JAVASCRIPT";
47
- static readonly REPORTER_PACKAGE_VERSION = "1.0.0-beta.2";
47
+ static readonly REPORTER_PACKAGE_VERSION = "1.0.0-beta.3";
48
48
  static readonly DEFAULT_DASHBOARD_ENDPOINT = "https://playwright.microsoft.com";
49
49
  static readonly DEFAULT_SERVICE_ENDPOINT = "https://{region}.reporting.api.playwright-test.io";
50
50
  static readonly DEFAULT_REDACTED_MESSAGE = "***REDACTED***";
@@ -52,7 +52,7 @@ Constants.TEST_FRAMEWORK_RUNNERNAME = "PLAYWRIGHT";
52
52
  Constants.TEST_TYPE = "WebTest";
53
53
  Constants.TEST_SDK_LANGUAGE = "JAVASCRIPT";
54
54
  // Placeholder version
55
- Constants.REPORTER_PACKAGE_VERSION = "1.0.0-beta.2";
55
+ Constants.REPORTER_PACKAGE_VERSION = "1.0.0-beta.3";
56
56
  Constants.DEFAULT_DASHBOARD_ENDPOINT = "https://playwright.microsoft.com";
57
57
  Constants.DEFAULT_SERVICE_ENDPOINT = "https://{region}.reporting.api.playwright-test.io";
58
58
  Constants.DEFAULT_REDACTED_MESSAGE = "***REDACTED***";
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/common/constants.ts"],"names":[],"mappings":";;;AAIa,QAAA,2BAA2B,GAAG;IACzC,+CAA+C,EAAE,EAAE;IACnD,KAAK,EAAE,8CAA8C;IACrD,mCAAmC,EAAE,CAAC;CACvC,CAAC;AAEF;;;GAGG;AACU,QAAA,SAAS,GAAG;IACvB,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,SAAS;CACV,CAAC;AAEX;;;GAGG;AACU,QAAA,WAAW,GAAG;IACzB,QAAQ,EAAE,UAAU;IACpB,YAAY,EAAE,cAAc;CACpB,CAAC;AAEX;;;GAGG;AACU,QAAA,0BAA0B,GAAG;IACxC,qBAAqB,EAAE,uBAAuB;IAC9C,yBAAyB,EAAE,2BAA2B;IACtD,sDAAsD,EAAE,mCAAmC;IAC3F,+BAA+B,EAAE,iCAAiC;IAClE,sBAAsB,EAAE,wBAAwB;IAChD,gCAAgC,EAAE,kCAAkC;CACrE,CAAC;AAEW,QAAA,8BAA8B,GAAG;IAC5C,eAAe,EAAE,KAAK;IACtB,eAAe,EAAE,CAAC;IAClB,sBAAsB,EAAE,YAAY;IACpC,kBAAkB,EAAE,iBAAS,CAAC,KAAK;CACpC,CAAC;AAEW,QAAA,WAAW,GAAG,oBAAoB,CAAC;AAEhD,2CAA2C;AAC3C,2FAA2F;AAE3F,MAAa,SAAS;;AAAtB,8BAyGC;AAxGC,2BAA2B;AACJ,6BAAmB,GAAG,YAAY,CAAC;AACnC,mCAAyB,GAAG,YAAY,CAAC;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;KAC7B;IACD;QACE,GAAG,EAAE,iCAAiC;QACtC,OAAO,EAAE,yEAAyE;QAClF,OAAO,EAAE,uEAAuE;QAChF,IAAI,EAAE,qBAAa,CAAC,QAAQ;KAC7B;CACF,CAAC;AAEW,QAAA,4BAA4B,GAAG;IAC1C,sBAAsB,EAAE,yBAAyB;IACjD,qBAAqB,EAAE,wBAAwB;IAC/C,6BAA6B,EAAE,gCAAgC;CAChE,CAAC;AAEW,QAAA,oCAAoC,GAAG,QAAQ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport { ApiErrorMessage } from \"./types\";\n\nexport const EntraIdAccessTokenConstants = {\n LIFETIME_LEFT_THRESHOLD_IN_MINUTES_FOR_ROTATION: 15,\n SCOPE: \"https://management.core.windows.net/.default\",\n ROTATION_INTERVAL_PERIOD_IN_MINUTES: 4,\n};\n\n/** @public\n *\n * OS types supported on Microsoft Playwright Testing cloud hosted browsers\n */\nexport const ServiceOS = {\n LINUX: \"linux\",\n WINDOWS: \"windows\",\n} as const;\n\n/** @public\n *\n * Authentication types supported on Microsoft Playwright Testing\n */\nexport const ServiceAuth = {\n ENTRA_ID: \"ENTRA_ID\",\n ACCESS_TOKEN: \"ACCESS_TOKEN\",\n} as const;\n\n/** @public\n *\n * Environment variables used by Microsoft Playwright Testing\n */\nexport const ServiceEnvironmentVariable = {\n PLAYWRIGHT_SERVICE_OS: \"PLAYWRIGHT_SERVICE_OS\",\n PLAYWRIGHT_SERVICE_RUN_ID: \"PLAYWRIGHT_SERVICE_RUN_ID\",\n PLAYWRIGHT_SERVICE_EXPOSE_NETWORK_ENVIRONMENT_VARIABLE: \"PLAYWRIGHT_SERVICE_EXPOSE_NETWORK\",\n PLAYWRIGHT_SERVICE_ACCESS_TOKEN: \"PLAYWRIGHT_SERVICE_ACCESS_TOKEN\",\n PLAYWRIGHT_SERVICE_URL: \"PLAYWRIGHT_SERVICE_URL\",\n PLAYWRIGHT_SERVICE_REPORTING_URL: \"PLAYWRIGHT_SERVICE_REPORTING_URL\",\n};\n\nexport const DefaultConnectOptionsConstants = {\n DEFAULT_TIMEOUT: 30000,\n DEFAULT_SLOW_MO: 0,\n DEFAULT_EXPOSE_NETWORK: \"<loopback>\",\n DEFAULT_SERVICE_OS: ServiceOS.LINUX,\n};\n\nexport const API_VERSION = \"2023-10-01-preview\";\n\n// Do not put an ending slash for the urls,\n// for example use https://www.microsoft.com/en-in and not https://www.microsoft.com/en-in/\n\nexport class Constants {\n // Config related constants\n public static readonly TEST_FRAMEWORK_NAME = \"PLAYWRIGHT\";\n public static readonly TEST_FRAMEWORK_RUNNERNAME = \"PLAYWRIGHT\";\n public static readonly TEST_TYPE = \"WebTest\";\n public static readonly TEST_SDK_LANGUAGE = \"JAVASCRIPT\";\n // Placeholder version\n public static readonly REPORTER_PACKAGE_VERSION = \"1.0.0-beta.2\";\n public static readonly DEFAULT_DASHBOARD_ENDPOINT = \"https://playwright.microsoft.com\";\n public static readonly DEFAULT_SERVICE_ENDPOINT =\n \"https://{region}.reporting.api.playwright-test.io\";\n public static readonly DEFAULT_REDACTED_MESSAGE = \"***REDACTED***\";\n public static readonly SAS_URI_SEPARATOR = \"?\";\n public static readonly DEFAULT_TEST_RUN_NAME = \"MPTReporterTests\";\n public static readonly TEST_BATCH_SIZE = 50;\n public static readonly UPLOAD_MODE = \"sdk\";\n public static readonly GIT_VERSION_COMMAND = \"git --version\";\n public static readonly GIT_REV_PARSE = \"git rev-parse --is-inside-work-tree\";\n public static readonly GIT_COMMIT_MESSAGE_COMMAND = 'git log -1 --pretty=format:\"%s\"';\n public static readonly ERROR_MESSAGES_MAX_LENGTH = 100;\n public static readonly API_VERSION = \"2024-09-01-preview\";\n public static readonly NON_RETRYABLE_STATUS_CODES = [400, 403, 404, 405, 409];\n public static readonly SupportedRegions: string[] = [\n \"eastus\",\n \"eastasia\",\n \"westeurope\",\n \"westus3\",\n \"centraluseuap\",\n \"eastus2euap\",\n ];\n // Error messages\n public static readonly CONFLICT_409_ERROR_MESSAGE =\n \"Test run with id {runId} already exists. Provide a unique run id.\";\n public static readonly FORBIDDEN_403_ERROR_MESSAGE =\n \"Reporting is not enabled for your workspace {workspaceId}. Enable the Reporting feature under Feature management settings using the Playwright portal: https://playwright.microsoft.com/workspaces/{workspaceId}/settings/general\";\n // API Endpoints\n public static readonly testRunsEndpoint: string = \"workspaces/{workspaceId}/test-runs\";\n public static readonly testRunsShardEndpoint: string =\n \"workspaces/{workspaceId}/test-runs/{testRunId}:updateShardExecutionStatus\";\n public static readonly storageUriEndpoint: string =\n \"workspaces/{workspaceId}/test-runs/{testRunId}:createArtifactsUploadBaseUri\";\n public static readonly testResultsEndpoint: string =\n \"workspaces/{workspaceId}/test-results/upload-batch\";\n public static readonly patchTestRun: string = \"patchTestRun\";\n public static readonly getTestRun: string = \"getTestRun\";\n public static readonly patchTestRunShardStart: string = \"patchTestRunShardStart\";\n public static readonly patchTestRunShardEnd: string = \"patchTestRunShardEnd\";\n public static readonly postTestResults: string = \"postTestResults\";\n public static readonly getStorageUri: string = \"getStorageUri\";\n\n public static readonly ERROR_MESSAGE: ApiErrorMessage = {\n patchTestRun: {\n 400: \"The request made to the server is invalid. Please check the request parameters and try again.\",\n 401: \"The authentication token provided is invalid. Please check the token and try again.\",\n 500: \"An unexpected error occurred on our server. Our team is working to resolve the issue. Please try again later, or contact support if the problem continues.\",\n 429: \"You have exceeded the rate limit for the API. Please wait and try again later.\",\n 504: \"The request to the service timed out. Please try again later.\",\n 503: \"The service is currently unavailable. Please check the service status and try again.\",\n },\n getTestRun: {\n 400: \"The request made to the server is invalid. Please check the request parameters and try again.\",\n 401: \"The authentication token provided is invalid. Please check the token and try again.\",\n 403: \"You do not have the required permissions to run tests. Please contact your workspace administrator.\",\n 500: \"An unexpected error occurred on our server. Our team is working to resolve the issue. Please try again later, or contact support if the problem continues.\",\n 429: \"You have exceeded the rate limit for the API. Please wait and try again later.\",\n 504: \"The request to the service timed out. Please try again later.\",\n 503: \"The service is currently unavailable. Please check the service status and try again.\",\n },\n patchTestRunShardStart: {\n 400: \"The request made to the server is invalid. Please check the request parameters and try again.\",\n 401: \"The authentication token provided is invalid. Please check the token and try again.\",\n 403: \"You do not have the required permissions to run tests. Please contact your workspace administrator.\",\n 500: \"An unexpected error occurred on our server. Our team is working to resolve the issue. Please try again later, or contact support if the problem continues.\",\n 429: \"You have exceeded the rate limit for the API. Please wait and try again later.\",\n 504: \"The request to the service timed out. Please try again later.\",\n 503: \"The service is currently unavailable. Please check the service status and try again.\",\n },\n patchTestRunShardEnd: {\n 400: \"The request made to the server is invalid. Please check the request parameters and try again.\",\n 401: \"The authentication token provided is invalid. Please check the token and try again.\",\n 403: \"You do not have the required permissions to run tests. Please contact your workspace administrator.\",\n 500: \"An unexpected error occurred on our server. Our team is working to resolve the issue. Please try again later, or contact support if the problem continues.\",\n 429: \"You have exceeded the rate limit for the API. Please wait and try again later.\",\n 504: \"The request to the service timed out. Please try again later.\",\n 503: \"The service is currently unavailable. Please check the service status and try again.\",\n },\n postTestResults: {\n 400: \"The request made to the server is invalid. Please check the request parameters and try again.\",\n 401: \"The authentication token provided is invalid. Please check the token and try again.\",\n 403: \"You do not have the required permissions to run tests. Please contact your workspace administrator.\",\n 500: \"An unexpected error occurred on our server. Our team is working to resolve the issue. Please try again later, or contact support if the problem continues.\",\n 429: \"You have exceeded the rate limit for the API. Please wait and try again later.\",\n 504: \"The request to the service timed out. Please try again later.\",\n 503: \"The service is currently unavailable. Please check the service status and try again.\",\n },\n getStorageUri: {\n 400: \"The request made to the server is invalid. Please check the request parameters and try again.\",\n 401: \"The authentication token provided is invalid. Please check the token and try again.\",\n 403: \"You do not have the required permissions to run tests. Please contact your workspace administrator.\",\n 500: \"An unexpected error occurred on our server. Our team is working to resolve the issue. Please try again later, or contact support if the problem continues.\",\n 429: \"You have exceeded the rate limit for the API. Please wait and try again later.\",\n 504: \"The request to the service timed out. Please try again later.\",\n 503: \"The service is currently unavailable. Please check the service status and try again.\",\n },\n };\n}\n\nexport const TestErrorType = {\n Scalable: \"Scalable\",\n Reporting: \"Reporting\",\n};\n\nexport const TestResultErrorConstants = [\n {\n key: \"Unauthorized_Scalable\",\n message: \"The authentication token provided is invalid. Please check the token and try again.\",\n pattern: /(?=.*browserType\\.connect)(?=.*401 Unauthorized)/i,\n type: TestErrorType.Scalable,\n },\n {\n key: \"NoPermissionOnWorkspace_Scalable\",\n message: `You do not have the required permissions to run tests. This could be because:\n\n a. You do not have the required roles on the workspace. Only Owner and Contributor roles can run tests. Contact the service administrator.\n b. The workspace you are trying to run the tests on is in a different Azure tenant than what you are signed into. Check the tenant id from Azure portal (https://aka.ms/mpt/find-tenant-id) and login using the command 'az login --tenant <TENANT_ID>'.\n `,\n pattern:\n /(?=.*browserType\\.connect)(?=.*403 Forbidden)(?=[\\s\\S]*CheckAccess API call with non successful response)/i,\n type: TestErrorType.Scalable,\n },\n {\n key: \"InvalidWorkspace_Scalable\",\n message: \"The specified workspace does not exist. Please verify your workspace settings.\",\n pattern:\n /(?=.*browserType\\.connect)(?=.*403 Forbidden)(?=[\\s\\S]*InvalidAccountOrSubscriptionState)/i,\n type: TestErrorType.Scalable,\n },\n {\n key: \"InvalidAccessToken_Scalable\",\n message:\n \"The provided access token does not match the specified workspace URL. Please verify that both values are correct.\",\n pattern: /(?=.*browserType\\.connect)(?=.*403 Forbidden)(?=[\\s\\S]*InvalidAccessToken)/i,\n type: TestErrorType.Scalable,\n },\n {\n key: \"AccessTokenOrUserOrWorkspaceNotFound_Scalable\",\n message:\n \"The data for the user, workspace or access token was not found. Please check the request or create new token and try again.\",\n pattern: /(?=.*browserType\\.connect)(?=.*404 Not Found)(?=[\\s\\S]*NotFound)/i,\n type: TestErrorType.Scalable,\n },\n {\n key: \"AccessKeyBasedAuthNotSupported_Scalable\",\n message:\n \"Authentication through service access token is disabled for this workspace. Please use Entra ID to authenticate.\",\n pattern:\n /(?=.*browserType\\.connect)(?=.*403 Forbidden)(?=[\\s\\S]*AccessKeyBasedAuthNotSupported)/i,\n type: TestErrorType.Scalable,\n },\n {\n key: \"ServiceUnavailable_Scalable\",\n message: \"The service is currently unavailable. Please check the service status and try again.\",\n pattern: /(?=.*browserType\\.connect)(?=.*503 Service Unavailable)/i,\n type: TestErrorType.Scalable,\n },\n {\n key: \"GatewayTimeout_Scalable\",\n message: \"The request to the service timed out. Please try again later.\",\n pattern: /(?=.*browserType\\.connect)(?=.*504 Gateway Timeout)/i,\n type: TestErrorType.Scalable,\n },\n {\n key: \"QuotaLimitError_Scalable\",\n message:\n \"It is possible that the maximum number of concurrent sessions allowed for your workspace has been exceeded. Check the quota at https://aka.ms/mpt/resource-quota.\",\n pattern: /browserType.connect: Timeout .* exceeded/i,\n type: TestErrorType.Scalable,\n },\n {\n key: \"BrowserConnectionError_Scalable\",\n message: \"The service is currently unavailable. Please try again after some time.\",\n pattern: /browserType.connect: Target page, context or browser has been closed/i,\n type: TestErrorType.Scalable,\n },\n];\n\nexport const InternalEnvironmentVariables = {\n MPT_PLAYWRIGHT_VERSION: \"_MPT_PLAYWRIGHT_VERSION\",\n MPT_SETUP_FATAL_ERROR: \"_MPT_SETUP_FATAL_ERROR\",\n MPT_CLOUD_HOSTED_BROWSER_USED: \"_MPT_CLOUD_HOSTED_BROWSER_USED\",\n};\n\nexport const MINIMUM_SUPPORTED_PLAYWRIGHT_VERSION = \"1.47.0\";\n"]}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/common/constants.ts"],"names":[],"mappings":";;;AAIa,QAAA,2BAA2B,GAAG;IACzC,+CAA+C,EAAE,EAAE;IACnD,KAAK,EAAE,8CAA8C;IACrD,mCAAmC,EAAE,CAAC;CACvC,CAAC;AAEF;;;GAGG;AACU,QAAA,SAAS,GAAG;IACvB,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,SAAS;CACV,CAAC;AAEX;;;GAGG;AACU,QAAA,WAAW,GAAG;IACzB,QAAQ,EAAE,UAAU;IACpB,YAAY,EAAE,cAAc;CACpB,C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O,EAAE,mEAAmE;QAC5E,IAAI,EAAE,qBAAa,CAAC,QAAQ;KAC7B;IACD;QACE,GAAG,EAAE,yCAAyC;QAC9C,OAAO,EACL,kHAAkH;QACpH,OAAO,EACL,yFAAyF;QAC3F,IAAI,EAAE,qBAAa,CAAC,QAAQ;KAC7B;IACD;QACE,GAAG,EAAE,6BAA6B;QAClC,OAAO,EAAE,sFAAsF;QAC/F,OAAO,EAAE,0DAA0D;QACnE,IAAI,EAAE,qBAAa,CAAC,QAAQ;KAC7B;IACD;QACE,GAAG,EAAE,yBAAyB;QAC9B,OAAO,EAAE,+DAA+D;QACxE,OAAO,EAAE,sDAAsD;QAC/D,IAAI,EAAE,qBAAa,CAAC,QAAQ;KAC7B;IACD;QACE,GAAG,EAAE,0BAA0B;QAC/B,OAAO,EACL,mKAAmK;QACrK,OAAO,EAAE,2CAA2C;QACpD,IAAI,EAAE,qBAAa,CAAC,QAAQ;KAC7B;IACD;QACE,GAAG,EAAE,iCAAiC;QACtC,OAAO,EAAE,yEAAyE;QAClF,OAAO,EAAE,uEAAuE;QAChF,IAAI,EAAE,qBAAa,CAAC,QAAQ;KAC7B;CACF,CAAC;AAEW,QAAA,4BAA4B,GAAG;IAC1C,sBAAsB,EAAE,yBAAyB;IACjD,qBAAqB,EAAE,wBAAwB;IAC/C,6BAA6B,EAAE,gCAAgC;CAChE,CAAC;AAEW,QAAA,oCAAoC,GAAG,QAAQ,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\nimport { ApiErrorMessage } from \"./types\";\n\nexport const EntraIdAccessTokenConstants = {\n LIFETIME_LEFT_THRESHOLD_IN_MINUTES_FOR_ROTATION: 15,\n SCOPE: \"https://management.core.windows.net/.default\",\n ROTATION_INTERVAL_PERIOD_IN_MINUTES: 4,\n};\n\n/** @public\n *\n * OS types supported on Microsoft Playwright Testing cloud hosted browsers\n */\nexport const ServiceOS = {\n LINUX: \"linux\",\n WINDOWS: \"windows\",\n} as const;\n\n/** @public\n *\n * Authentication types supported on Microsoft Playwright Testing\n */\nexport const ServiceAuth = {\n ENTRA_ID: \"ENTRA_ID\",\n ACCESS_TOKEN: \"ACCESS_TOKEN\",\n} as const;\n\n/** @public\n *\n * Environment variables used by Microsoft Playwright Testing\n */\nexport const ServiceEnvironmentVariable = {\n PLAYWRIGHT_SERVICE_OS: \"PLAYWRIGHT_SERVICE_OS\",\n PLAYWRIGHT_SERVICE_RUN_ID: \"PLAYWRIGHT_SERVICE_RUN_ID\",\n PLAYWRIGHT_SERVICE_EXPOSE_NETWORK_ENVIRONMENT_VARIABLE: \"PLAYWRIGHT_SERVICE_EXPOSE_NETWORK\",\n PLAYWRIGHT_SERVICE_ACCESS_TOKEN: \"PLAYWRIGHT_SERVICE_ACCESS_TOKEN\",\n PLAYWRIGHT_SERVICE_URL: \"PLAYWRIGHT_SERVICE_URL\",\n PLAYWRIGHT_SERVICE_REPORTING_URL: \"PLAYWRIGHT_SERVICE_REPORTING_URL\",\n};\n\nexport const DefaultConnectOptionsConstants = {\n DEFAULT_TIMEOUT: 30000,\n DEFAULT_SLOW_MO: 0,\n DEFAULT_EXPOSE_NETWORK: \"<loopback>\",\n DEFAULT_SERVICE_OS: ServiceOS.LINUX,\n};\n\nexport const API_VERSION = \"2023-10-01-preview\";\n\n// Do not put an ending slash for the urls,\n// for example use https://www.microsoft.com/en-in and not https://www.microsoft.com/en-in/\n\nexport class Constants {\n // Config related constants\n public static readonly TEST_FRAMEWORK_NAME = \"PLAYWRIGHT\";\n public static readonly TEST_FRAMEWORK_RUNNERNAME = \"PLAYWRIGHT\";\n public static readonly TEST_TYPE = \"WebTest\";\n public static readonly TEST_SDK_LANGUAGE = \"JAVASCRIPT\";\n // Placeholder version\n public static readonly REPORTER_PACKAGE_VERSION = \"1.0.0-beta.3\";\n public static readonly DEFAULT_DASHBOARD_ENDPOINT = \"https://playwright.microsoft.com\";\n public static readonly DEFAULT_SERVICE_ENDPOINT =\n \"https://{region}.reporting.api.playwright-test.io\";\n public static readonly DEFAULT_REDACTED_MESSAGE = \"***REDACTED***\";\n public static readonly SAS_URI_SEPARATOR = \"?\";\n public static readonly DEFAULT_TEST_RUN_NAME = \"MPTReporterTests\";\n public static readonly TEST_BATCH_SIZE = 50;\n public static readonly UPLOAD_MODE = \"sdk\";\n public static readonly GIT_VERSION_COMMAND = \"git --version\";\n public static readonly GIT_REV_PARSE = \"git rev-parse --is-inside-work-tree\";\n public static readonly GIT_COMMIT_MESSAGE_COMMAND = 'git log -1 --pretty=format:\"%s\"';\n public static readonly ERROR_MESSAGES_MAX_LENGTH = 100;\n public static readonly API_VERSION = \"2024-09-01-preview\";\n public static readonly NON_RETRYABLE_STATUS_CODES = [400, 403, 404, 405, 409];\n public static readonly SupportedRegions: string[] = [\n \"eastus\",\n \"eastasia\",\n \"westeurope\",\n \"westus3\",\n \"centraluseuap\",\n \"eastus2euap\",\n ];\n // Error messages\n public static readonly CONFLICT_409_ERROR_MESSAGE =\n \"Test run with id {runId} already exists. Provide a unique run id.\";\n public static readonly FORBIDDEN_403_ERROR_MESSAGE =\n \"Reporting is not enabled for your workspace {workspaceId}. Enable the Reporting feature under Feature management settings using the Playwright portal: https://playwright.microsoft.com/workspaces/{workspaceId}/settings/general\";\n // API Endpoints\n public static readonly testRunsEndpoint: string = \"workspaces/{workspaceId}/test-runs\";\n public static readonly testRunsShardEndpoint: string =\n \"workspaces/{workspaceId}/test-runs/{testRunId}:updateShardExecutionStatus\";\n public static readonly storageUriEndpoint: string =\n \"workspaces/{workspaceId}/test-runs/{testRunId}:createArtifactsUploadBaseUri\";\n public static readonly testResultsEndpoint: string =\n \"workspaces/{workspaceId}/test-results/upload-batch\";\n public static readonly patchTestRun: string = \"patchTestRun\";\n public static readonly getTestRun: string = \"getTestRun\";\n public static readonly patchTestRunShardStart: string = \"patchTestRunShardStart\";\n public static readonly patchTestRunShardEnd: string = \"patchTestRunShardEnd\";\n public static readonly postTestResults: string = \"postTestResults\";\n public static readonly getStorageUri: string = \"getStorageUri\";\n\n public static readonly ERROR_MESSAGE: ApiErrorMessage = {\n patchTestRun: {\n 400: \"The request made to the server is invalid. Please check the request parameters and try again.\",\n 401: \"The authentication token provided is invalid. Please check the token and try again.\",\n 500: \"An unexpected error occurred on our server. Our team is working to resolve the issue. Please try again later, or contact support if the problem continues.\",\n 429: \"You have exceeded the rate limit for the API. Please wait and try again later.\",\n 504: \"The request to the service timed out. Please try again later.\",\n 503: \"The service is currently unavailable. Please check the service status and try again.\",\n },\n getTestRun: {\n 400: \"The request made to the server is invalid. Please check the request parameters and try again.\",\n 401: \"The authentication token provided is invalid. Please check the token and try again.\",\n 403: \"You do not have the required permissions to run tests. Please contact your workspace administrator.\",\n 500: \"An unexpected error occurred on our server. Our team is working to resolve the issue. Please try again later, or contact support if the problem continues.\",\n 429: \"You have exceeded the rate limit for the API. Please wait and try again later.\",\n 504: \"The request to the service timed out. Please try again later.\",\n 503: \"The service is currently unavailable. Please check the service status and try again.\",\n },\n patchTestRunShardStart: {\n 400: \"The request made to the server is invalid. Please check the request parameters and try again.\",\n 401: \"The authentication token provided is invalid. Please check the token and try again.\",\n 403: \"You do not have the required permissions to run tests. Please contact your workspace administrator.\",\n 500: \"An unexpected error occurred on our server. Our team is working to resolve the issue. Please try again later, or contact support if the problem continues.\",\n 429: \"You have exceeded the rate limit for the API. Please wait and try again later.\",\n 504: \"The request to the service timed out. Please try again later.\",\n 503: \"The service is currently unavailable. Please check the service status and try again.\",\n },\n patchTestRunShardEnd: {\n 400: \"The request made to the server is invalid. Please check the request parameters and try again.\",\n 401: \"The authentication token provided is invalid. Please check the token and try again.\",\n 403: \"You do not have the required permissions to run tests. Please contact your workspace administrator.\",\n 500: \"An unexpected error occurred on our server. Our team is working to resolve the issue. Please try again later, or contact support if the problem continues.\",\n 429: \"You have exceeded the rate limit for the API. Please wait and try again later.\",\n 504: \"The request to the service timed out. Please try again later.\",\n 503: \"The service is currently unavailable. Please check the service status and try again.\",\n },\n postTestResults: {\n 400: \"The request made to the server is invalid. Please check the request parameters and try again.\",\n 401: \"The authentication token provided is invalid. Please check the token and try again.\",\n 403: \"You do not have the required permissions to run tests. Please contact your workspace administrator.\",\n 500: \"An unexpected error occurred on our server. Our team is working to resolve the issue. Please try again later, or contact support if the problem continues.\",\n 429: \"You have exceeded the rate limit for the API. Please wait and try again later.\",\n 504: \"The request to the service timed out. Please try again later.\",\n 503: \"The service is currently unavailable. Please check the service status and try again.\",\n },\n getStorageUri: {\n 400: \"The request made to the server is invalid. Please check the request parameters and try again.\",\n 401: \"The authentication token provided is invalid. Please check the token and try again.\",\n 403: \"You do not have the required permissions to run tests. Please contact your workspace administrator.\",\n 500: \"An unexpected error occurred on our server. Our team is working to resolve the issue. Please try again later, or contact support if the problem continues.\",\n 429: \"You have exceeded the rate limit for the API. Please wait and try again later.\",\n 504: \"The request to the service timed out. Please try again later.\",\n 503: \"The service is currently unavailable. Please check the service status and try again.\",\n },\n };\n}\n\nexport const TestErrorType = {\n Scalable: \"Scalable\",\n Reporting: \"Reporting\",\n};\n\nexport const TestResultErrorConstants = [\n {\n key: \"Unauthorized_Scalable\",\n message: \"The authentication token provided is invalid. Please check the token and try again.\",\n pattern: /(?=.*browserType\\.connect)(?=.*401 Unauthorized)/i,\n type: TestErrorType.Scalable,\n },\n {\n key: \"NoPermissionOnWorkspace_Scalable\",\n message: `You do not have the required permissions to run tests. This could be because:\n\n a. You do not have the required roles on the workspace. Only Owner and Contributor roles can run tests. Contact the service administrator.\n b. The workspace you are trying to run the tests on is in a different Azure tenant than what you are signed into. Check the tenant id from Azure portal (https://aka.ms/mpt/find-tenant-id) and login using the command 'az login --tenant <TENANT_ID>'.\n `,\n pattern:\n /(?=.*browserType\\.connect)(?=.*403 Forbidden)(?=[\\s\\S]*CheckAccess API call with non successful response)/i,\n type: TestErrorType.Scalable,\n },\n {\n key: \"InvalidWorkspace_Scalable\",\n message: \"The specified workspace does not exist. Please verify your workspace settings.\",\n pattern:\n /(?=.*browserType\\.connect)(?=.*403 Forbidden)(?=[\\s\\S]*InvalidAccountOrSubscriptionState)/i,\n type: TestErrorType.Scalable,\n },\n {\n key: \"InvalidAccessToken_Scalable\",\n message:\n \"The provided access token does not match the specified workspace URL. Please verify that both values are correct.\",\n pattern: /(?=.*browserType\\.connect)(?=.*403 Forbidden)(?=[\\s\\S]*InvalidAccessToken)/i,\n type: TestErrorType.Scalable,\n },\n {\n key: \"AccessTokenOrUserOrWorkspaceNotFound_Scalable\",\n message:\n \"The data for the user, workspace or access token was not found. Please check the request or create new token and try again.\",\n pattern: /(?=.*browserType\\.connect)(?=.*404 Not Found)(?=[\\s\\S]*NotFound)/i,\n type: TestErrorType.Scalable,\n },\n {\n key: \"AccessKeyBasedAuthNotSupported_Scalable\",\n message:\n \"Authentication through service access token is disabled for this workspace. Please use Entra ID to authenticate.\",\n pattern:\n /(?=.*browserType\\.connect)(?=.*403 Forbidden)(?=[\\s\\S]*AccessKeyBasedAuthNotSupported)/i,\n type: TestErrorType.Scalable,\n },\n {\n key: \"ServiceUnavailable_Scalable\",\n message: \"The service is currently unavailable. Please check the service status and try again.\",\n pattern: /(?=.*browserType\\.connect)(?=.*503 Service Unavailable)/i,\n type: TestErrorType.Scalable,\n },\n {\n key: \"GatewayTimeout_Scalable\",\n message: \"The request to the service timed out. Please try again later.\",\n pattern: /(?=.*browserType\\.connect)(?=.*504 Gateway Timeout)/i,\n type: TestErrorType.Scalable,\n },\n {\n key: \"QuotaLimitError_Scalable\",\n message:\n \"It is possible that the maximum number of concurrent sessions allowed for your workspace has been exceeded. Check the quota at https://aka.ms/mpt/resource-quota.\",\n pattern: /browserType.connect: Timeout .* exceeded/i,\n type: TestErrorType.Scalable,\n },\n {\n key: \"BrowserConnectionError_Scalable\",\n message: \"The service is currently unavailable. Please try again after some time.\",\n pattern: /browserType.connect: Target page, context or browser has been closed/i,\n type: TestErrorType.Scalable,\n },\n];\n\nexport const InternalEnvironmentVariables = {\n MPT_PLAYWRIGHT_VERSION: \"_MPT_PLAYWRIGHT_VERSION\",\n MPT_SETUP_FATAL_ERROR: \"_MPT_SETUP_FATAL_ERROR\",\n MPT_CLOUD_HOSTED_BROWSER_USED: \"_MPT_CLOUD_HOSTED_BROWSER_USED\",\n};\n\nexport const MINIMUM_SUPPORTED_PLAYWRIGHT_VERSION = \"1.47.0\";\n"]}
@@ -253,7 +253,7 @@ class MPTReporter {
253
253
  for (const attachmentPath of testAttachments) {
254
254
  const fileRelativePath = `${testExecutionId}/${reporterUtils_1.default.getFileRelativePath(attachmentPath)}`;
255
255
  if (this.sasUri === undefined ||
256
- !reporterUtils_1.default.isTimeGreaterThanCurrentPlus10Minutes(this.sasUri.expiresAt)) {
256
+ !reporterUtils_1.default.isTimeGreaterThanCurrentPlus10Minutes(this.sasUri)) {
257
257
  // Renew the sas uri
258
258
  this.sasUri = await this.serviceClient.createStorageUri();
259
259
  logger_1.reporterLogger.info(`\nFetched SAS URI with validity: ${this.sasUri.expiresAt} and access: ${this.sasUri.accessLevel}.`);
@@ -262,7 +262,7 @@ class MPTReporter {
262
262
  }
263
263
  const rawTestResult = this.testRawResults.get(testExecutionId);
264
264
  if (this.sasUri === undefined ||
265
- !reporterUtils_1.default.isTimeGreaterThanCurrentPlus10Minutes(this.sasUri.expiresAt)) {
265
+ !reporterUtils_1.default.isTimeGreaterThanCurrentPlus10Minutes(this.sasUri)) {
266
266
  // Renew the sas uri
267
267
  this.sasUri = await this.serviceClient.createStorageUri();
268
268
  }
@@ -1 +1 @@
1
- {"version":3,"file":"mptReporter.js","sourceRoot":"","sources":["../../src/reporter/mptReporter.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAUlC,6CAAkD;AAClD,mDAI6B;AAC7B,yEAAsE;AACtE,iDAA8C;AAE9C,8DAAsE;AAKtE,4DAAiE;AACjE,mFAAmD;AACnD,0DAAuD;AACvD,0DAAuD;AAEvD,iDAAkE;AAElE;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW;IA4Bf,YAAY,MAAk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ACjE,IAAI,CAAC,wBAAwB,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC;oBACjE,CAAC;gBACH,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED;;;;;OAKG;IACH,aAAa;QACX,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AACD,kBAAe,WAAW,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n FullResult,\n TestCase,\n TestResult,\n FullConfig,\n Reporter,\n Suite,\n} from \"@playwright/test/reporter\";\nimport { reporterLogger } from \"../common/logger\";\nimport {\n Constants,\n InternalEnvironmentVariables,\n TestResultErrorConstants,\n} from \"../common/constants\";\nimport { EnvironmentVariables } from \"../common/environmentVariables\";\nimport { MultiMap } from \"../common/multimap\";\nimport { EntraTokenDetails } from \"../model/entraTokenDetails\";\nimport { MPTTokenDetails, TokenType } from \"../model/mptTokenDetails\";\nimport { Shard, UploadMetadata } from \"../model/shard\";\nimport { StorageUri } from \"../model/storageUri\";\nimport { TestResult as MPTTestResult, RawTestResult } from \"../model/testResult\";\nimport { TestRun } from \"../model/testRun\";\nimport { CIInfo, CIInfoProvider } from \"../utils/cIInfoProvider\";\nimport ReporterUtils from \"../utils/reporterUtils\";\nimport { ServiceClient } from \"../utils/serviceClient\";\nimport { StorageClient } from \"../utils/storageClient\";\nimport { MPTReporterConfig } from \"../common/types\";\nimport { ServiceErrorMessageConstants } from \"../common/messages\";\n\n/**\n * @public\n *\n * Extends Playwright's Reporter class to enable Microsoft Playwright Testing's Reporting\n * feature to publish test results and related artifacts and\n * view them in the service portal for faster and easier troubleshooting.\n *\n * @example\n *\n * ```\n * import { defineConfig } from \"@playwright/test\";\n *\n * export default defineConfig({\n * reporter: [[\"@azure/microsoft-playwright-testing/reporter\"]]\n * });\n * ```\n */\nclass MPTReporter implements Reporter {\n private isTokenValid: boolean = true;\n private enableGitHubSummary = true;\n private isRegionValid: boolean = true;\n private shard!: Shard;\n private isTestRunStartSuccess: boolean = false;\n private ciInfo: CIInfo = CIInfoProvider.getCIInfo();\n private serviceClient!: ServiceClient;\n private storageClient!: StorageClient;\n private reporterUtils!: ReporterUtils;\n private envVariables!: EnvironmentVariables;\n private testRawResults = new MultiMap<string, string>();\n private promiseOnBegin!: Promise<boolean>;\n private _testEndPromises: Promise<void>[] = [];\n private testResultBatch: Set<MPTTestResult> = new Set<MPTTestResult>();\n private errorMessages: string[] = [];\n private informationalMessages: string[] = [];\n private processedErrorMessageKeys: string[] = [];\n private sasUri!: StorageUri;\n private uploadMetadata: UploadMetadata = {\n numTestResults: 0,\n numTotalAttachments: 0,\n sizeTotalAttachments: 0,\n };\n private numWorkers: number = -1;\n private testRunUrl: string = \"\";\n private enableResultPublish: boolean = true;\n\n constructor(config: Partial<MPTReporterConfig>) {\n if (config?.enableGitHubSummary !== undefined) {\n this.enableGitHubSummary = config.enableGitHubSummary;\n }\n if (config?.enableResultPublish !== undefined) {\n this.enableResultPublish = config.enableResultPublish;\n }\n }\n private _addError(errorMessage: string): void {\n if (this.errorMessages.length < Constants.ERROR_MESSAGES_MAX_LENGTH) {\n this.errorMessages.push(this.reporterUtils.redactAccessToken(errorMessage));\n }\n }\n\n private _addInformationalMessage = (message: string): void => {\n this.informationalMessages.push(message);\n };\n\n private _addKeyToInformationMessage = (key: string): void => {\n this.processedErrorMessageKeys.push(key);\n };\n\n private _isInformationMessagePresent = (key: string): boolean => {\n return this.processedErrorMessageKeys.includes(key);\n };\n\n /**\n * @public\n *\n * Called once before running tests.\n *\n * @param config - Resolved configuration.\n * @param suite - The root suite that contains all projects, files and test cases.\n */\n onBegin(config: FullConfig, suite: Suite): void {\n if (!this.enableResultPublish) return;\n this.initializeMPTReporter();\n this.reporterUtils = new ReporterUtils(this.envVariables, config, suite);\n if (this.isTokenValid && this.isRegionValid) {\n this.serviceClient = new ServiceClient(\n this.envVariables,\n this.reporterUtils,\n this._addInformationalMessage,\n this._isInformationMessagePresent,\n this._addKeyToInformationMessage,\n );\n this.promiseOnBegin = this._onBegin();\n }\n }\n\n /**\n * @public\n *\n * Called after a test has been finished in the worker process.\n *\n * @param test - Test that has been finished.\n * @param result - Result of the test run.\n */\n onTestEnd(test: TestCase, result: TestResult): void {\n this.numWorkers = Math.max(this.numWorkers, result.parallelIndex + 1);\n this.processTestResult(result);\n if (!this.enableResultPublish) return;\n // Process test result\n this._onTestEnd(test, result);\n // Upload the test results batch\n try {\n if (this.testResultBatch.size >= Constants.TEST_BATCH_SIZE) {\n const currResultBatch: MPTTestResult[] = [...this.testResultBatch];\n if (this.isTestRunStartSuccess) {\n this._testEndPromises.push(this.serviceClient.postTestResults(currResultBatch));\n reporterLogger.info(`\\nAdded test results batch for upload.`);\n this.testResultBatch.clear();\n }\n }\n } catch (err: any) {\n this._addError(`Name: ${err.name}, Message: ${err.message}, Stack: ${err.stack}`);\n reporterLogger.error(`\\nError in uploading test results: ${err.message}.`);\n }\n }\n\n /**\n * @public\n *\n * Called after all tests have been run, or testing has been interrupted. Note that this method may return a [Promise]\n * and Playwright Test will await it. Reporter is allowed to override the status and hence affect the exit code of the\n * test runner.\n *\n * @param result - Result of the full test run, `status` can be one of:\n * - `'passed'` - Everything went as expected.\n * - `'failed'` - Any test has failed.\n * - `'timedout'` - The\n * {@link https://playwright.dev/docs/api/class-testconfig#test-config-global-timeout | testConfig.globalTimeout} has\n * been reached.\n * - `'interrupted'` - Interrupted by the user.\n */\n async onEnd(result: FullResult): Promise<void> {\n if (this.enableResultPublish) {\n await this._onEnd(result);\n if (!this.isTestRunStartSuccess) {\n this._addError(`\\nUnable to initialize test run report.`);\n } else {\n let count: number = 0;\n process.stdout.write(\"\\nUploading test results.\");\n await Promise.allSettled(this._testEndPromises).then((values) => {\n values.forEach((value) => {\n if (value.status === \"fulfilled\") {\n count++;\n this.reporterUtils.progressBar(count, this._testEndPromises.length);\n }\n return value.status;\n });\n reporterLogger.info(`\\nTest result processing completed.`);\n return values;\n });\n try {\n await this.serviceClient.postTestRunShardEnd(\n result,\n this.shard,\n this.errorMessages,\n this.uploadMetadata,\n this.numWorkers,\n );\n reporterLogger.info(`\\nTest run successfully uploaded.`);\n\n if (this.enableGitHubSummary) {\n this.reporterUtils.generateMarkdownSummary(this.testRunUrl);\n }\n\n process.stdout.write(`\\nTest report: ${this.testRunUrl}\\n`);\n } catch (err: any) {\n this._addError(`Name: ${err.name}, Message: ${err.message}, Stack: ${err.stack}`);\n reporterLogger.error(`\\nError in completing test run: ${err.message}`);\n process.stdout.write(`\\nUnable to complete test results upload.`);\n }\n }\n }\n this.displayAdditionalInformation();\n }\n\n private async _onBegin(): Promise<boolean> {\n process.stdout.write(`\\n`);\n try {\n const testRunResponse: TestRun | undefined = await this.serviceClient.patchTestRun(\n this.ciInfo,\n );\n reporterLogger.info(\n `\\nTest run report successfully initialized: ${testRunResponse?.displayName}.`,\n );\n process.stdout.write(\n `Initializing reporting for this test run. You can view the results at: https://playwright.microsoft.com/workspaces/${this.envVariables.accountId}/runs/${this.envVariables.runId}\\n`,\n );\n const shardResponse = await this.serviceClient.postTestRunShardStart();\n this.shard = shardResponse;\n // Set test report link as environment variable. If/else to check if environment variable defined or not.\n if (\n Constants.DEFAULT_SERVICE_ENDPOINT &&\n this.envVariables.accountId &&\n this.envVariables.runId\n ) {\n this.testRunUrl = `${Constants.DEFAULT_DASHBOARD_ENDPOINT}/workspaces/${encodeURI(\n this.envVariables.accountId,\n )}/runs/${encodeURI(this.envVariables.runId)}`;\n }\n return true;\n } catch (err: any) {\n this._addError(`Name: ${err.name}, Message: ${err.message}, Stack: ${err.stack}`);\n reporterLogger.error(`\\nError in initializing test run report: ${err.message}.`);\n return false;\n }\n }\n\n private async _onTestEnd(test: TestCase, result: TestResult): Promise<undefined> {\n try {\n this.isTestRunStartSuccess = await this.promiseOnBegin;\n if (!this.isTestRunStartSuccess) {\n this._addError(`\\nUnable to initialize test run report.`);\n return;\n }\n this.uploadMetadata.numTestResults++;\n const testResultObject: MPTTestResult = this.reporterUtils.getTestResultObject(\n test,\n result,\n this.ciInfo.jobId!,\n );\n this.testResultBatch.add(testResultObject);\n // Store test attachments in array\n const testAttachments: string[] = [];\n for (const attachment of result.attachments) {\n if (attachment.path !== undefined && attachment.path !== \"\") {\n testAttachments.push(attachment.path);\n this.uploadMetadata.numTotalAttachments++;\n this.uploadMetadata.sizeTotalAttachments += ReporterUtils.getFileSize(attachment.path);\n }\n }\n\n // Get raw result object and store it in map\n const rawTestResult: RawTestResult = this.reporterUtils.getRawTestResultObject(result);\n this.testRawResults.set(testResultObject.testExecutionId, JSON.stringify(rawTestResult));\n this._testEndPromises.push(\n this._uploadTestResultAttachments(testResultObject.testExecutionId, testAttachments),\n );\n } catch (err: any) {\n this._addError(`Name: ${err.name}, Message: ${err.message}, Stack: ${err.stack}`);\n reporterLogger.error(`\\nError in processing test result: ${err.message}.`);\n }\n }\n\n private async _onEnd(_: FullResult): Promise<void> {\n this.isTestRunStartSuccess = await this.promiseOnBegin;\n if (!this.isTestRunStartSuccess) {\n this._addError(`\\nUnable to initialize test run report.`);\n return;\n }\n try {\n // Upload the remaining test results\n if (this.testResultBatch.size > 0) {\n await this.serviceClient.postTestResults([...this.testResultBatch]);\n reporterLogger.info(`\\nUploaded test results batch successfully.`);\n this.testResultBatch.clear();\n }\n } catch (err: any) {\n this._addError(`Name: ${err.name}, Message: ${err.message}, Stack: ${err.stack}`);\n reporterLogger.error(`\\nError in uploading test run information: ${err.message}`);\n }\n }\n\n private async _uploadTestResultAttachments(\n testExecutionId: string,\n testAttachments: string[],\n ): Promise<void> {\n try {\n this.isTestRunStartSuccess = await this.promiseOnBegin;\n if (!this.isTestRunStartSuccess) {\n this._addError(`\\nUnable to initialize test run report.`);\n return;\n }\n for (const attachmentPath of testAttachments) {\n const fileRelativePath = `${testExecutionId}/${ReporterUtils.getFileRelativePath(\n attachmentPath,\n )}`;\n if (\n this.sasUri === undefined ||\n !ReporterUtils.isTimeGreaterThanCurrentPlus10Minutes(this.sasUri.expiresAt)\n ) {\n // Renew the sas uri\n this.sasUri = await this.serviceClient.createStorageUri();\n reporterLogger.info(\n `\\nFetched SAS URI with validity: ${this.sasUri.expiresAt} and access: ${this.sasUri.accessLevel}.`,\n );\n }\n this.storageClient.uploadFile(this.sasUri.uri, attachmentPath, fileRelativePath);\n }\n const rawTestResult = this.testRawResults.get(testExecutionId);\n if (\n this.sasUri === undefined ||\n !ReporterUtils.isTimeGreaterThanCurrentPlus10Minutes(this.sasUri.expiresAt)\n ) {\n // Renew the sas uri\n this.sasUri = await this.serviceClient.createStorageUri();\n }\n this.storageClient.uploadBuffer(\n this.sasUri.uri,\n rawTestResult[0]!,\n `${testExecutionId}/rawTestResult.json`,\n );\n } catch (err: any) {\n this._addError(`Name: ${err.name}, Message: ${err.message}, Stack: ${err.stack}`);\n reporterLogger.error(`\\nError in uploading test result attachments: ${err.message}`);\n }\n }\n\n private initializeMPTReporter(): void {\n this.envVariables = new EnvironmentVariables();\n if (process.env[InternalEnvironmentVariables.MPT_SETUP_FATAL_ERROR] === \"true\") {\n this.isTokenValid = false;\n return;\n }\n if (!process.env[\"PLAYWRIGHT_SERVICE_REPORTING_URL\"]) {\n process.stdout.write(\"\\nReporting service url not found.\");\n this.isTokenValid = false;\n return;\n }\n reporterLogger.info(`Reporting url - ${process.env[\"PLAYWRIGHT_SERVICE_REPORTING_URL\"]}`);\n if (this.envVariables.accessToken === undefined || this.envVariables.accessToken === \"\") {\n process.stdout.write(`\\n${ServiceErrorMessageConstants.NO_AUTH_ERROR}`);\n this.isTokenValid = false;\n } else if (ReporterUtils.hasAudienceClaim(this.envVariables.accessToken)) {\n const result = ReporterUtils.populateValuesFromServiceUrl();\n this.envVariables.region = result!.region;\n this.envVariables.accountId = result!.accountId;\n const entraTokenDetails: EntraTokenDetails = ReporterUtils.getTokenDetails<EntraTokenDetails>(\n this.envVariables.accessToken,\n TokenType.ENTRA,\n );\n this.envVariables.userId = entraTokenDetails.oid;\n this.envVariables.userName = entraTokenDetails.name;\n } else {\n const mptTokenDetails: MPTTokenDetails = ReporterUtils.getTokenDetails<MPTTokenDetails>(\n this.envVariables.accessToken,\n TokenType.MPT,\n );\n this.envVariables.accountId = mptTokenDetails.aid;\n this.envVariables.userId = mptTokenDetails.oid;\n this.envVariables.userName = mptTokenDetails.userName;\n this.envVariables.region = ReporterUtils.getRegionFromAccountID(this.envVariables.accountId!);\n }\n this.storageClient = new StorageClient();\n if (\n this.envVariables.region &&\n !Constants.SupportedRegions.includes(this.envVariables.region!) &&\n this.isTokenValid\n ) {\n process.stdout.write(\n `\\nUnsupported region's workspace used to generate the input Access Token; the supported regions are ${Constants.SupportedRegions.join(\n \", \",\n )}`,\n );\n this.isRegionValid = false;\n }\n if (this.envVariables.runId === undefined || this.envVariables.runId === \"\") {\n this.envVariables.runId = ReporterUtils.getRunId(this.ciInfo);\n }\n }\n\n private displayAdditionalInformation(): void {\n if (this.informationalMessages.length > 0) console.info(); // Add a new line before displaying the messages\n this.informationalMessages.forEach((message, index) => {\n console.info(`${index + 1}. ${message}`);\n });\n }\n\n private processTestResult(result: TestResult): void {\n if (\n process.env[InternalEnvironmentVariables.MPT_CLOUD_HOSTED_BROWSER_USED] &&\n result.status !== \"passed\"\n ) {\n result.errors.forEach((error) => {\n TestResultErrorConstants.forEach((testResultErrorParseObj) => {\n if (this.processedErrorMessageKeys.includes(testResultErrorParseObj.key)) {\n return;\n }\n const errorMessage = error.message;\n if (!errorMessage) return;\n const match = errorMessage.match(testResultErrorParseObj.pattern);\n if (match) {\n this.processedErrorMessageKeys.push(testResultErrorParseObj.key);\n this._addInformationalMessage(testResultErrorParseObj.message);\n }\n });\n });\n }\n }\n\n /**\n * @public\n *\n * Whether this reporter uses stdio for reporting. When it does not, Playwright Test could add some output to enhance\n * user experience. If your reporter does not print to the terminal, it is strongly recommended to return `false`.\n */\n printsToStdio(): boolean {\n return true;\n }\n}\nexport default MPTReporter;\n"]}
1
+ {"version":3,"file":"mptReporter.js","sourceRoot":"","sources":["../../src/repor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CAAC,OAAO,CAAC;oBACnC,IAAI,CAAC,YAAY;wBAAE,OAAO;oBAC1B,MAAM,KAAK,GAAG,YAAY,CAAC,KAAK,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC;oBAClE,IAAI,KAAK,EAAE,CAAC;wBACV,IAAI,CAAC,yBAAyB,CAAC,IAAI,CAAC,uBAAuB,CAAC,GAAG,CAAC,CAAC;wBACjE,IAAI,CAAC,wBAAwB,CAAC,uBAAuB,CAAC,OAAO,CAAC,CAAC;oBACjE,CAAC;gBACH,CAAC,CAAC,CAAC;YACL,CAAC,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED;;;;;OAKG;IACH,aAAa;QACX,OAAO,IAAI,CAAC;IACd,CAAC;CACF;AACD,kBAAe,WAAW,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n FullResult,\n TestCase,\n TestResult,\n FullConfig,\n Reporter,\n Suite,\n} from \"@playwright/test/reporter\";\nimport { reporterLogger } from \"../common/logger\";\nimport {\n Constants,\n InternalEnvironmentVariables,\n TestResultErrorConstants,\n} from \"../common/constants\";\nimport { EnvironmentVariables } from \"../common/environmentVariables\";\nimport { MultiMap } from \"../common/multimap\";\nimport { EntraTokenDetails } from \"../model/entraTokenDetails\";\nimport { MPTTokenDetails, TokenType } from \"../model/mptTokenDetails\";\nimport { Shard, UploadMetadata } from \"../model/shard\";\nimport { StorageUri } from \"../model/storageUri\";\nimport { TestResult as MPTTestResult, RawTestResult } from \"../model/testResult\";\nimport { TestRun } from \"../model/testRun\";\nimport { CIInfo, CIInfoProvider } from \"../utils/cIInfoProvider\";\nimport ReporterUtils from \"../utils/reporterUtils\";\nimport { ServiceClient } from \"../utils/serviceClient\";\nimport { StorageClient } from \"../utils/storageClient\";\nimport { MPTReporterConfig } from \"../common/types\";\nimport { ServiceErrorMessageConstants } from \"../common/messages\";\n\n/**\n * @public\n *\n * Extends Playwright's Reporter class to enable Microsoft Playwright Testing's Reporting\n * feature to publish test results and related artifacts and\n * view them in the service portal for faster and easier troubleshooting.\n *\n * @example\n *\n * ```\n * import { defineConfig } from \"@playwright/test\";\n *\n * export default defineConfig({\n * reporter: [[\"@azure/microsoft-playwright-testing/reporter\"]]\n * });\n * ```\n */\nclass MPTReporter implements Reporter {\n private isTokenValid: boolean = true;\n private enableGitHubSummary = true;\n private isRegionValid: boolean = true;\n private shard!: Shard;\n private isTestRunStartSuccess: boolean = false;\n private ciInfo: CIInfo = CIInfoProvider.getCIInfo();\n private serviceClient!: ServiceClient;\n private storageClient!: StorageClient;\n private reporterUtils!: ReporterUtils;\n private envVariables!: EnvironmentVariables;\n private testRawResults = new MultiMap<string, string>();\n private promiseOnBegin!: Promise<boolean>;\n private _testEndPromises: Promise<void>[] = [];\n private testResultBatch: Set<MPTTestResult> = new Set<MPTTestResult>();\n private errorMessages: string[] = [];\n private informationalMessages: string[] = [];\n private processedErrorMessageKeys: string[] = [];\n private sasUri!: StorageUri;\n private uploadMetadata: UploadMetadata = {\n numTestResults: 0,\n numTotalAttachments: 0,\n sizeTotalAttachments: 0,\n };\n private numWorkers: number = -1;\n private testRunUrl: string = \"\";\n private enableResultPublish: boolean = true;\n\n constructor(config: Partial<MPTReporterConfig>) {\n if (config?.enableGitHubSummary !== undefined) {\n this.enableGitHubSummary = config.enableGitHubSummary;\n }\n if (config?.enableResultPublish !== undefined) {\n this.enableResultPublish = config.enableResultPublish;\n }\n }\n private _addError(errorMessage: string): void {\n if (this.errorMessages.length < Constants.ERROR_MESSAGES_MAX_LENGTH) {\n this.errorMessages.push(this.reporterUtils.redactAccessToken(errorMessage));\n }\n }\n\n private _addInformationalMessage = (message: string): void => {\n this.informationalMessages.push(message);\n };\n\n private _addKeyToInformationMessage = (key: string): void => {\n this.processedErrorMessageKeys.push(key);\n };\n\n private _isInformationMessagePresent = (key: string): boolean => {\n return this.processedErrorMessageKeys.includes(key);\n };\n\n /**\n * @public\n *\n * Called once before running tests.\n *\n * @param config - Resolved configuration.\n * @param suite - The root suite that contains all projects, files and test cases.\n */\n onBegin(config: FullConfig, suite: Suite): void {\n if (!this.enableResultPublish) return;\n this.initializeMPTReporter();\n this.reporterUtils = new ReporterUtils(this.envVariables, config, suite);\n if (this.isTokenValid && this.isRegionValid) {\n this.serviceClient = new ServiceClient(\n this.envVariables,\n this.reporterUtils,\n this._addInformationalMessage,\n this._isInformationMessagePresent,\n this._addKeyToInformationMessage,\n );\n this.promiseOnBegin = this._onBegin();\n }\n }\n\n /**\n * @public\n *\n * Called after a test has been finished in the worker process.\n *\n * @param test - Test that has been finished.\n * @param result - Result of the test run.\n */\n onTestEnd(test: TestCase, result: TestResult): void {\n this.numWorkers = Math.max(this.numWorkers, result.parallelIndex + 1);\n this.processTestResult(result);\n if (!this.enableResultPublish) return;\n // Process test result\n this._onTestEnd(test, result);\n // Upload the test results batch\n try {\n if (this.testResultBatch.size >= Constants.TEST_BATCH_SIZE) {\n const currResultBatch: MPTTestResult[] = [...this.testResultBatch];\n if (this.isTestRunStartSuccess) {\n this._testEndPromises.push(this.serviceClient.postTestResults(currResultBatch));\n reporterLogger.info(`\\nAdded test results batch for upload.`);\n this.testResultBatch.clear();\n }\n }\n } catch (err: any) {\n this._addError(`Name: ${err.name}, Message: ${err.message}, Stack: ${err.stack}`);\n reporterLogger.error(`\\nError in uploading test results: ${err.message}.`);\n }\n }\n\n /**\n * @public\n *\n * Called after all tests have been run, or testing has been interrupted. Note that this method may return a [Promise]\n * and Playwright Test will await it. Reporter is allowed to override the status and hence affect the exit code of the\n * test runner.\n *\n * @param result - Result of the full test run, `status` can be one of:\n * - `'passed'` - Everything went as expected.\n * - `'failed'` - Any test has failed.\n * - `'timedout'` - The\n * {@link https://playwright.dev/docs/api/class-testconfig#test-config-global-timeout | testConfig.globalTimeout} has\n * been reached.\n * - `'interrupted'` - Interrupted by the user.\n */\n async onEnd(result: FullResult): Promise<void> {\n if (this.enableResultPublish) {\n await this._onEnd(result);\n if (!this.isTestRunStartSuccess) {\n this._addError(`\\nUnable to initialize test run report.`);\n } else {\n let count: number = 0;\n process.stdout.write(\"\\nUploading test results.\");\n await Promise.allSettled(this._testEndPromises).then((values) => {\n values.forEach((value) => {\n if (value.status === \"fulfilled\") {\n count++;\n this.reporterUtils.progressBar(count, this._testEndPromises.length);\n }\n return value.status;\n });\n reporterLogger.info(`\\nTest result processing completed.`);\n return values;\n });\n try {\n await this.serviceClient.postTestRunShardEnd(\n result,\n this.shard,\n this.errorMessages,\n this.uploadMetadata,\n this.numWorkers,\n );\n reporterLogger.info(`\\nTest run successfully uploaded.`);\n\n if (this.enableGitHubSummary) {\n this.reporterUtils.generateMarkdownSummary(this.testRunUrl);\n }\n\n process.stdout.write(`\\nTest report: ${this.testRunUrl}\\n`);\n } catch (err: any) {\n this._addError(`Name: ${err.name}, Message: ${err.message}, Stack: ${err.stack}`);\n reporterLogger.error(`\\nError in completing test run: ${err.message}`);\n process.stdout.write(`\\nUnable to complete test results upload.`);\n }\n }\n }\n this.displayAdditionalInformation();\n }\n\n private async _onBegin(): Promise<boolean> {\n process.stdout.write(`\\n`);\n try {\n const testRunResponse: TestRun | undefined = await this.serviceClient.patchTestRun(\n this.ciInfo,\n );\n reporterLogger.info(\n `\\nTest run report successfully initialized: ${testRunResponse?.displayName}.`,\n );\n process.stdout.write(\n `Initializing reporting for this test run. You can view the results at: https://playwright.microsoft.com/workspaces/${this.envVariables.accountId}/runs/${this.envVariables.runId}\\n`,\n );\n const shardResponse = await this.serviceClient.postTestRunShardStart();\n this.shard = shardResponse;\n // Set test report link as environment variable. If/else to check if environment variable defined or not.\n if (\n Constants.DEFAULT_SERVICE_ENDPOINT &&\n this.envVariables.accountId &&\n this.envVariables.runId\n ) {\n this.testRunUrl = `${Constants.DEFAULT_DASHBOARD_ENDPOINT}/workspaces/${encodeURI(\n this.envVariables.accountId,\n )}/runs/${encodeURI(this.envVariables.runId)}`;\n }\n return true;\n } catch (err: any) {\n this._addError(`Name: ${err.name}, Message: ${err.message}, Stack: ${err.stack}`);\n reporterLogger.error(`\\nError in initializing test run report: ${err.message}.`);\n return false;\n }\n }\n\n private async _onTestEnd(test: TestCase, result: TestResult): Promise<undefined> {\n try {\n this.isTestRunStartSuccess = await this.promiseOnBegin;\n if (!this.isTestRunStartSuccess) {\n this._addError(`\\nUnable to initialize test run report.`);\n return;\n }\n this.uploadMetadata.numTestResults++;\n const testResultObject: MPTTestResult = this.reporterUtils.getTestResultObject(\n test,\n result,\n this.ciInfo.jobId!,\n );\n this.testResultBatch.add(testResultObject);\n // Store test attachments in array\n const testAttachments: string[] = [];\n for (const attachment of result.attachments) {\n if (attachment.path !== undefined && attachment.path !== \"\") {\n testAttachments.push(attachment.path);\n this.uploadMetadata.numTotalAttachments++;\n this.uploadMetadata.sizeTotalAttachments += ReporterUtils.getFileSize(attachment.path);\n }\n }\n\n // Get raw result object and store it in map\n const rawTestResult: RawTestResult = this.reporterUtils.getRawTestResultObject(result);\n this.testRawResults.set(testResultObject.testExecutionId, JSON.stringify(rawTestResult));\n this._testEndPromises.push(\n this._uploadTestResultAttachments(testResultObject.testExecutionId, testAttachments),\n );\n } catch (err: any) {\n this._addError(`Name: ${err.name}, Message: ${err.message}, Stack: ${err.stack}`);\n reporterLogger.error(`\\nError in processing test result: ${err.message}.`);\n }\n }\n\n private async _onEnd(_: FullResult): Promise<void> {\n this.isTestRunStartSuccess = await this.promiseOnBegin;\n if (!this.isTestRunStartSuccess) {\n this._addError(`\\nUnable to initialize test run report.`);\n return;\n }\n try {\n // Upload the remaining test results\n if (this.testResultBatch.size > 0) {\n await this.serviceClient.postTestResults([...this.testResultBatch]);\n reporterLogger.info(`\\nUploaded test results batch successfully.`);\n this.testResultBatch.clear();\n }\n } catch (err: any) {\n this._addError(`Name: ${err.name}, Message: ${err.message}, Stack: ${err.stack}`);\n reporterLogger.error(`\\nError in uploading test run information: ${err.message}`);\n }\n }\n\n private async _uploadTestResultAttachments(\n testExecutionId: string,\n testAttachments: string[],\n ): Promise<void> {\n try {\n this.isTestRunStartSuccess = await this.promiseOnBegin;\n if (!this.isTestRunStartSuccess) {\n this._addError(`\\nUnable to initialize test run report.`);\n return;\n }\n for (const attachmentPath of testAttachments) {\n const fileRelativePath = `${testExecutionId}/${ReporterUtils.getFileRelativePath(\n attachmentPath,\n )}`;\n if (\n this.sasUri === undefined ||\n !ReporterUtils.isTimeGreaterThanCurrentPlus10Minutes(this.sasUri)\n ) {\n // Renew the sas uri\n this.sasUri = await this.serviceClient.createStorageUri();\n reporterLogger.info(\n `\\nFetched SAS URI with validity: ${this.sasUri.expiresAt} and access: ${this.sasUri.accessLevel}.`,\n );\n }\n this.storageClient.uploadFile(this.sasUri.uri, attachmentPath, fileRelativePath);\n }\n const rawTestResult = this.testRawResults.get(testExecutionId);\n if (\n this.sasUri === undefined ||\n !ReporterUtils.isTimeGreaterThanCurrentPlus10Minutes(this.sasUri)\n ) {\n // Renew the sas uri\n this.sasUri = await this.serviceClient.createStorageUri();\n }\n this.storageClient.uploadBuffer(\n this.sasUri.uri,\n rawTestResult[0]!,\n `${testExecutionId}/rawTestResult.json`,\n );\n } catch (err: any) {\n this._addError(`Name: ${err.name}, Message: ${err.message}, Stack: ${err.stack}`);\n reporterLogger.error(`\\nError in uploading test result attachments: ${err.message}`);\n }\n }\n\n private initializeMPTReporter(): void {\n this.envVariables = new EnvironmentVariables();\n if (process.env[InternalEnvironmentVariables.MPT_SETUP_FATAL_ERROR] === \"true\") {\n this.isTokenValid = false;\n return;\n }\n if (!process.env[\"PLAYWRIGHT_SERVICE_REPORTING_URL\"]) {\n process.stdout.write(\"\\nReporting service url not found.\");\n this.isTokenValid = false;\n return;\n }\n reporterLogger.info(`Reporting url - ${process.env[\"PLAYWRIGHT_SERVICE_REPORTING_URL\"]}`);\n if (this.envVariables.accessToken === undefined || this.envVariables.accessToken === \"\") {\n process.stdout.write(`\\n${ServiceErrorMessageConstants.NO_AUTH_ERROR}`);\n this.isTokenValid = false;\n } else if (ReporterUtils.hasAudienceClaim(this.envVariables.accessToken)) {\n const result = ReporterUtils.populateValuesFromServiceUrl();\n this.envVariables.region = result!.region;\n this.envVariables.accountId = result!.accountId;\n const entraTokenDetails: EntraTokenDetails = ReporterUtils.getTokenDetails<EntraTokenDetails>(\n this.envVariables.accessToken,\n TokenType.ENTRA,\n );\n this.envVariables.userId = entraTokenDetails.oid;\n this.envVariables.userName = entraTokenDetails.name;\n } else {\n const mptTokenDetails: MPTTokenDetails = ReporterUtils.getTokenDetails<MPTTokenDetails>(\n this.envVariables.accessToken,\n TokenType.MPT,\n );\n this.envVariables.accountId = mptTokenDetails.aid;\n this.envVariables.userId = mptTokenDetails.oid;\n this.envVariables.userName = mptTokenDetails.userName;\n this.envVariables.region = ReporterUtils.getRegionFromAccountID(this.envVariables.accountId!);\n }\n this.storageClient = new StorageClient();\n if (\n this.envVariables.region &&\n !Constants.SupportedRegions.includes(this.envVariables.region!) &&\n this.isTokenValid\n ) {\n process.stdout.write(\n `\\nUnsupported region's workspace used to generate the input Access Token; the supported regions are ${Constants.SupportedRegions.join(\n \", \",\n )}`,\n );\n this.isRegionValid = false;\n }\n if (this.envVariables.runId === undefined || this.envVariables.runId === \"\") {\n this.envVariables.runId = ReporterUtils.getRunId(this.ciInfo);\n }\n }\n\n private displayAdditionalInformation(): void {\n if (this.informationalMessages.length > 0) console.info(); // Add a new line before displaying the messages\n this.informationalMessages.forEach((message, index) => {\n console.info(`${index + 1}. ${message}`);\n });\n }\n\n private processTestResult(result: TestResult): void {\n if (\n process.env[InternalEnvironmentVariables.MPT_CLOUD_HOSTED_BROWSER_USED] &&\n result.status !== \"passed\"\n ) {\n result.errors.forEach((error) => {\n TestResultErrorConstants.forEach((testResultErrorParseObj) => {\n if (this.processedErrorMessageKeys.includes(testResultErrorParseObj.key)) {\n return;\n }\n const errorMessage = error.message;\n if (!errorMessage) return;\n const match = errorMessage.match(testResultErrorParseObj.pattern);\n if (match) {\n this.processedErrorMessageKeys.push(testResultErrorParseObj.key);\n this._addInformationalMessage(testResultErrorParseObj.message);\n }\n });\n });\n }\n }\n\n /**\n * @public\n *\n * Whether this reporter uses stdio for reporting. When it does not, Playwright Test could add some output to enhance\n * user experience. If your reporter does not print to the terminal, it is strongly recommended to return `false`.\n */\n printsToStdio(): boolean {\n return true;\n }\n}\nexport default MPTReporter;\n"]}
@@ -5,7 +5,7 @@
5
5
  "toolPackages": [
6
6
  {
7
7
  "packageName": "@microsoft/api-extractor",
8
- "packageVersion": "7.47.8"
8
+ "packageVersion": "7.47.9"
9
9
  }
10
10
  ]
11
11
  }
@@ -6,6 +6,7 @@ import { Shard, UploadMetadata } from "../model/shard";
6
6
  import { TestResult as MPTTestResult, RawTestResult } from "../model/testResult";
7
7
  import { TestRun } from "../model/testRun";
8
8
  import { CIInfo } from "./cIInfoProvider";
9
+ import { StorageUri } from "../model/storageUri";
9
10
  declare class ReporterUtils {
10
11
  private envVariables;
11
12
  private config;
@@ -29,7 +30,7 @@ declare class ReporterUtils {
29
30
  static timestampToRFC3339(timestamp: number): string;
30
31
  static getFileRelativePath(filePath: string): string;
31
32
  static getReporterBackOffOptions: Partial<IBackOffOptions>;
32
- static isTimeGreaterThanCurrentPlus10Minutes(isoString: string): boolean;
33
+ static isTimeGreaterThanCurrentPlus10Minutes(sasUri: StorageUri): boolean;
33
34
  static getFileSize(attachmentPath: string): number;
34
35
  redactAccessToken(info: string | undefined): string;
35
36
  static populateValuesFromServiceUrl(): {
@@ -1 +1 @@
1
- {"version":3,"file":"reporterUtils.d.ts","sourceRoot":"","sources":["../../src/utils/reporterUtils.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,UAAU,EAEV,QAAQ,EACR,UAAU,EAEV,UAAU,EACV,KAAK,EACN,MAAM,2BAA2B,CAAC;AAInC,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAKlD,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAEtE,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AACrD,OA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AED,eAAe,aAAa,CAAC"}
@@ -232,6 +232,7 @@ class ReporterUtils {
232
232
  const payloadObject = JSON.parse(decodedPayload.toString());
233
233
  // Check if the payload has an 'aud' claim
234
234
  return "aud" in payloadObject;
235
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
235
236
  }
236
237
  catch (error) {
237
238
  return false;
@@ -255,20 +256,36 @@ class ReporterUtils {
255
256
  }
256
257
  return filePath;
257
258
  }
258
- static isTimeGreaterThanCurrentPlus10Minutes(isoString) {
259
- // Parse ISO 8601 string into a timestamp
260
- const timestampFromIsoString = Date.parse(isoString);
261
- // Calculate the current timestamp plus 10 minutes
262
- const currentTimestampPlus10Minutes = Date.now() + 10 * 60 * 1000;
263
- // Compare the timestamps
264
- return timestampFromIsoString > currentTimestampPlus10Minutes;
259
+ // eslint-disable-next-line @azure/azure-sdk/ts-use-interface-parameters
260
+ static isTimeGreaterThanCurrentPlus10Minutes(sasUri) {
261
+ try {
262
+ const url = new URL(sasUri.uri);
263
+ const params = new URLSearchParams(url.search);
264
+ const expiryTime = params.get("se"); // 'se' is the query parameter for the expiry time
265
+ if (expiryTime) {
266
+ const timestampFromIsoString = new Date(expiryTime).getTime();
267
+ const currentTimestampPlus10Minutes = Date.now() + 10 * 60 * 1000;
268
+ const isSasValidityGreaterThanCurrentTimePlus10Minutes = timestampFromIsoString > currentTimestampPlus10Minutes;
269
+ if (!isSasValidityGreaterThanCurrentTimePlus10Minutes) {
270
+ logger_1.reporterLogger.info(`Sas rotation required because close to expiry, SasUriValidTillTime: ${timestampFromIsoString}, CurrentTime: ${currentTimestampPlus10Minutes}`);
271
+ }
272
+ return isSasValidityGreaterThanCurrentTimePlus10Minutes;
273
+ }
274
+ logger_1.reporterLogger.error(`Sas rotation required because expiry param not found.`);
275
+ return false;
276
+ }
277
+ catch (error) {
278
+ logger_1.reporterLogger.error(`Sas rotation required because of ${error}.`);
279
+ return false;
280
+ }
265
281
  }
266
282
  static getFileSize(attachmentPath) {
267
283
  try {
268
284
  const stats = fs_1.default.statSync(attachmentPath);
269
285
  return stats.size;
286
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
270
287
  }
271
- catch (err) {
288
+ catch (error) {
272
289
  return 0;
273
290
  }
274
291
  }
@@ -357,6 +374,7 @@ class ReporterUtils {
357
374
  if (obj.tag && Array.isArray(obj.tag)) {
358
375
  tags = tags.concat(obj.tag);
359
376
  }
377
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
360
378
  }
361
379
  catch (error) {
362
380
  // Ignore parsing errors
@@ -1 +1 @@
1
- {"version":3,"file":"reporterUtils.js","sourceRoot":"","sources":["../../src/utils/reporterUtils.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAWlC,iDAAqC;AACrC,6CAAkD;AAClD,mCAAgD;AAEhD,oDAAoB;AACpB,oDAAoB;AACpB,wDAAwB;AACxB,mDAAgD;AAGhD,8DAAqD;AACrD,0CAAsE;AACtE,oDAAiF;AACjF,8CAA0D;AAC1D,qDAAwD;AACxD,qDAAkD;AAElD,MAAM,aAAa;IAWjB,wEAAwE;IACxE,YAAY,YAAkC,EAAE,MAAkB,EAAE,CAAQ;QAC1E,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAE5B,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC;QACpB,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC;QACrB,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC;QACtB,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC;QACrB,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC;IACtB,CAAC;IAEM,KAAK,CAAC,gBAAgB,CAAC,MAAc;QAC1C,MAAM,OAAO,GAAG,IAAI,iBAAO,EAAE,CAAC;QAC9B,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,UAAU,CA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["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n FullResult,\n Location,\n TestCase,\n TestResult,\n TestStep,\n FullConfig,\n Suite,\n} from \"@playwright/test/reporter\";\nimport { exec } from \"child_process\";\nimport { reporterLogger } from \"../common/logger\";\nimport { createHash, randomUUID } from \"crypto\";\nimport { IBackOffOptions } from \"../common/types\";\nimport fs from \"fs\";\nimport os from \"os\";\nimport path from \"path\";\nimport { Constants } from \"../common/constants\";\nimport { EnvironmentVariables } from \"../common/environmentVariables\";\nimport { DedupedStep, RawTestStep } from \"../common/types\";\nimport { TokenType } from \"../model/mptTokenDetails\";\nimport { Shard, TestRunStatus, UploadMetadata } from \"../model/shard\";\nimport { TestResult as MPTTestResult, RawTestResult } from \"../model/testResult\";\nimport { TestRun, TestRunConfig } from \"../model/testRun\";\nimport { CIInfo, CI_PROVIDERS } from \"./cIInfoProvider\";\nimport { CIInfoProvider } from \"./cIInfoProvider\";\n\nclass ReporterUtils {\n private envVariables: EnvironmentVariables;\n\n private config: FullConfig;\n totalTests: number;\n failedTests: number;\n skippedTests: number;\n passedTests: number;\n flakyTests: number;\n startTime: number;\n\n // eslint-disable-next-line @azure/azure-sdk/ts-use-interface-parameters\n constructor(envVariables: EnvironmentVariables, config: FullConfig, _: Suite) {\n this.config = config;\n this.envVariables = envVariables;\n this.startTime = Date.now();\n\n this.totalTests = 0;\n this.failedTests = 0;\n this.skippedTests = 0;\n this.passedTests = 0;\n this.flakyTests = 0;\n }\n\n public async getTestRunObject(ciInfo: CIInfo): Promise<TestRun> {\n const testRun = new TestRun();\n const runName = await this.getRunName(ciInfo);\n if (ReporterUtils.isNullOrEmpty(this.envVariables.runId)) {\n if (!ReporterUtils.isNullOrEmpty(runName)) {\n this.envVariables.runId = runName;\n } else {\n this.envVariables.runId = randomUUID();\n }\n }\n testRun.testRunId = this.envVariables.runId;\n testRun.displayName = ReporterUtils.isNullOrEmpty(runName) ? randomUUID() : runName;\n testRun.creatorName = this.envVariables.userName;\n testRun.creatorId = this.envVariables.userId!;\n testRun.startTime = ReporterUtils.timestampToRFC3339(this.startTime);\n testRun.ciConfig = {\n ciProviderName: ciInfo.provider!,\n branch: ciInfo.branch!,\n author: ciInfo.author!,\n commitId: ciInfo.commitId!,\n revisionUrl: ciInfo.revisionUrl!,\n };\n testRun.testRunConfig = this.getTestRunConfig();\n testRun.cloudReportingEnabled = \"true\";\n return testRun;\n }\n\n public getTestRunShardStartObject(): Shard {\n const shard = new Shard();\n if (this.config.shard !== null && this.config.shard !== undefined) {\n this.envVariables.shardId = this.config.shard.current.toString();\n } else {\n this.envVariables.shardId = \"1\";\n }\n shard.shardId = this.envVariables.shardId;\n shard.summary = {\n startTime: ReporterUtils.timestampToRFC3339(this.startTime),\n };\n shard.uploadCompleted = false;\n return shard;\n }\n\n public getTestRunShardEndObject(\n result: FullResult,\n // eslint-disable-next-line @azure/azure-sdk/ts-use-interface-parameters\n shard: Shard,\n errorMessages: string[],\n attachmentMetadata: UploadMetadata,\n workers: number,\n ): Shard {\n shard.shardId = this.envVariables.shardId ?? \"1\";\n shard.summary.totalTime = result.duration;\n shard.summary.endTime = ReporterUtils.timestampToRFC3339(Date.now());\n shard.summary.status = TestRunStatus.CLIENT_COMPLETE;\n shard.summary.errorMessages = errorMessages;\n shard.summary.uploadMetadata = attachmentMetadata;\n shard.uploadCompleted = true;\n shard.workers = workers;\n return shard;\n }\n\n public getTestResultObject(test: TestCase, result: TestResult, jobName: string): MPTTestResult {\n switch (test.outcome()) {\n case \"skipped\":\n this.skippedTests++;\n this.totalTests++;\n break;\n case \"expected\":\n this.passedTests++;\n this.totalTests++;\n break;\n case \"unexpected\":\n if (result.retry === test.retries) {\n this.failedTests++;\n this.totalTests++;\n }\n break;\n case \"flaky\":\n this.totalTests++;\n this.flakyTests++;\n break;\n default:\n break;\n }\n\n let browserName = test.parent.project()!.use.browserName?.toLowerCase();\n if (!browserName) {\n browserName = test.parent.project()!.use.defaultBrowserType?.toLowerCase();\n }\n const testResult = new MPTTestResult();\n testResult.runId = this.envVariables.runId;\n testResult.shardId = this.envVariables.runId + \"_\" + this.envVariables.shardId;\n testResult.accountId = this.envVariables.accountId!;\n testResult.suiteId = ReporterUtils.calculateSha1(`${test.parent.title}-${test.location.file}`);\n testResult.testId = testResult.suiteId.concat(`-${ReporterUtils.calculateSha1(test.title)}`);\n testResult.testCombinationId = test.id;\n testResult.testExecutionId = randomUUID();\n testResult.testTitle = test.title;\n testResult.suiteTitle = this.extractRootParentTitle(test.parent)!;\n testResult.fileName = test.location.file;\n testResult.status = this.getTestStatus(test, result);\n testResult.lineNumber = test.location.line;\n testResult.retry = result.retry ? result.retry : 0;\n testResult.webTestConfig = {\n jobName: jobName,\n projectName: test.parent.project()!.name,\n browserType: browserName!.toUpperCase(),\n os: this.getOsName(),\n };\n testResult.annotations = this.extractTestAnnotations(test.annotations);\n testResult.tags = this.extractTestTags(test);\n testResult.resultsSummary = {\n status: result.status.toUpperCase(),\n duration: result.duration,\n startTime: result.startTime.toISOString().replace(/\\.\\d+Z$/, \"Z\"),\n attachmentsMetadata: this.getAttachmentStatus(result),\n };\n testResult.artifactsPath = result.attachments\n .filter((attachment) => attachment?.path !== null && attachment?.path !== undefined) // Filter attachments with defined and non-null path property\n .map(\n (attachment) =>\n `${testResult.testExecutionId}/${ReporterUtils.getFileRelativePath(attachment.path!)}`,\n );\n return testResult;\n }\n\n public generateMarkdownSummary(testRunUrl: string): void {\n try {\n if (CIInfoProvider.getCIProvider() === CI_PROVIDERS.GITHUB) {\n const markdownContent = `\n#### Microsoft Playwright Testing run summary\n\n#### Results:\n \n![pass](https://img.shields.io/badge/status-passed-brightgreen) **Passed:** ${this.passedTests}\n \n![fail](https://img.shields.io/badge/status-failed-red) **Failed:** ${this.failedTests}\n \n![flaky](https://img.shields.io/badge/status-flaky-yellow) **Flaky:** ${this.flakyTests}\n \n![skipped](https://img.shields.io/badge/status-skipped-lightgrey) **Skipped:** ${this.skippedTests}\n \n#### For more details, visit the [service dashboard](${testRunUrl}).\n `;\n fs.writeFileSync(process.env[\"GITHUB_STEP_SUMMARY\"]!, markdownContent);\n }\n } catch (err) {\n reporterLogger.error(`\\nCould not generate markdown summary - ${err}`);\n }\n }\n\n public getRawTestResultObject(result: TestResult): RawTestResult {\n const rawTestResult: RawTestResult = {\n steps: this.dedupeSteps(result.steps).map((step) => this.serializeTestStep(step)),\n errors: result.errors ? JSON.stringify(result.errors, null, 2) : \"\",\n stdErr: result.stderr ? JSON.stringify(result.stderr, null, 2) : \"\",\n stdOut: result.stdout ? JSON.stringify(result.stdout, null, 2) : \"\",\n };\n return rawTestResult;\n }\n\n public static getRunId(cIInfo: CIInfo): string {\n if (cIInfo === null || cIInfo.provider === CI_PROVIDERS.DEFAULT) {\n return randomUUID();\n }\n\n const concatString = `${cIInfo.provider}-${cIInfo.repo}-${cIInfo.runId}-${cIInfo.runAttempt}`;\n const runId = ReporterUtils.calculateSha1(concatString);\n return runId;\n }\n\n public static calculateSha1(buffer: Buffer | string): string {\n const hash = createHash(\"sha1\");\n hash.update(buffer);\n return hash.digest(\"hex\");\n }\n\n /*\n public static getTokenDetails(accessToken: string) {\n let tokenDetails = new MPTTokenDetails();\n try {\n const token = accessToken.split('.')[1];\n const _token = Buffer.from(token, 'base64');\n tokenDetails = JSON.parse(_token.toString());\n } catch (err) {\n throw err;\n }\n return tokenDetails;\n }\n */\n\n public static getTokenDetails<T>(accessToken: string, tokenType: TokenType): T {\n const token = accessToken.split(\".\")[1]!;\n const _token = Buffer.from(token, \"base64\");\n const tokenDetails = JSON.parse(_token.toString());\n\n switch (tokenType) {\n case TokenType.MPT:\n return tokenDetails as T;\n case TokenType.ENTRA:\n return tokenDetails as T;\n default:\n throw new Error(\"Unsupported token type\");\n }\n }\n\n public static hasAudienceClaim(token: string): boolean {\n try {\n // Split the token into its three parts\n const parts = token.split(\".\");\n if (parts.length !== 3) {\n throw new Error(\"Invalid token format\");\n }\n\n // Base64 decode the payload\n const payload = parts[1]!;\n const decodedPayload = Buffer.from(payload, \"base64\");\n\n // Parse the decoded payload as JSON\n const payloadObject = JSON.parse(decodedPayload.toString());\n\n // Check if the payload has an 'aud' claim\n return \"aud\" in payloadObject;\n } catch (error) {\n return false;\n }\n }\n\n public static timestampToRFC3339(timestamp: number): string {\n const date = new Date(timestamp);\n const dateString = date.toISOString().replace(/\\.\\d+Z$/, \"Z\");\n return dateString;\n }\n\n public static getFileRelativePath(filePath: string): string {\n if (filePath) {\n let parts = filePath.split(\"/\");\n\n if (parts.length > 1) {\n return parts[parts.length - 1]!;\n }\n\n parts = filePath.split(\"\\\\\");\n\n if (parts.length > 1) {\n return parts[parts.length - 1]!;\n }\n }\n\n return filePath;\n }\n\n public static getReporterBackOffOptions: Partial<IBackOffOptions> = {\n numOfAttempts: 3,\n jitter: \"full\",\n retry: (error) => {\n if (error.response) {\n const status = error.response.status;\n if (Constants.NON_RETRYABLE_STATUS_CODES.includes(status)) {\n return false;\n }\n }\n return true;\n },\n };\n\n public static isTimeGreaterThanCurrentPlus10Minutes(isoString: string): boolean {\n // Parse ISO 8601 string into a timestamp\n const timestampFromIsoString: number = Date.parse(isoString);\n // Calculate the current timestamp plus 10 minutes\n const currentTimestampPlus10Minutes: number = Date.now() + 10 * 60 * 1000;\n // Compare the timestamps\n return timestampFromIsoString > currentTimestampPlus10Minutes;\n }\n\n public static getFileSize(attachmentPath: string): number {\n try {\n const stats = fs.statSync(attachmentPath);\n return stats.size;\n } catch (err) {\n return 0;\n }\n }\n\n public redactAccessToken(info: string | undefined): string {\n if (!info || ReporterUtils.isNullOrEmpty(this.envVariables.accessToken)) {\n return \"\";\n }\n const accessTokenRegex = new RegExp(this.envVariables.accessToken, \"g\");\n return info.replace(accessTokenRegex, Constants.DEFAULT_REDACTED_MESSAGE);\n }\n\n public static populateValuesFromServiceUrl(): {\n region: string;\n accountId: string;\n } | null {\n // Service URL format: wss://<region>.api.playwright.microsoft.com/accounts/<workspace-id>/browsers\n const url = process.env[\"PLAYWRIGHT_SERVICE_URL\"]!;\n if (!ReporterUtils.isNullOrEmpty(url)) {\n const parts = url.split(\"/\");\n\n if (parts.length > 2) {\n const subdomainParts = parts[2]!.split(\".\");\n const region = subdomainParts.length > 0 ? subdomainParts[0] : null;\n const accountId = parts[4];\n\n return { region: region!, accountId: accountId! };\n }\n }\n return null;\n }\n\n public static getRegionFromAccountID(accountId: string): string | undefined {\n if (accountId.includes(\"_\")) {\n return accountId.split(\"_\")[0]!;\n } else {\n return;\n } // Handling for older workspaces without region in id\n }\n\n public progressBar(current: number, total: number): void {\n const width = 40;\n const percent = current / total;\n const completed = Math.round(width * percent);\n const remaining = width - completed;\n\n process.stdout.write(\"\\r\");\n process.stdout.write(\n `[${\"=\".repeat(completed)}${\" \".repeat(remaining)}] ${Math.round(percent * 100)}%`,\n );\n }\n\n private getTestRunConfig(): TestRunConfig {\n const testRunConfig: TestRunConfig = {\n workers: this.config.workers,\n pwVersion: this.config.version,\n timeout: this.config.globalTimeout,\n repeatEach: this.config.projects[0].repeatEach,\n retries: this.config.projects[0].retries,\n shards: this.config.shard ? this.config.shard : { total: 1 },\n testFramework: {\n name: Constants.TEST_FRAMEWORK_NAME,\n version: this.config.version,\n runnerName: Constants.TEST_FRAMEWORK_RUNNERNAME,\n },\n testType: Constants.TEST_TYPE,\n testSdkLanguage: Constants.TEST_SDK_LANGUAGE,\n reporterPackageVersion: Constants.REPORTER_PACKAGE_VERSION,\n };\n return testRunConfig;\n }\n\n private relativeLocation(location: Location | undefined): Location | undefined {\n if (!location) {\n return undefined;\n }\n const file = this.toPosixPath(path.relative(this.config.rootDir, location.file));\n return {\n file,\n line: location.line,\n column: location.column,\n };\n }\n\n private extractTestTags(input: TestCase): string[] {\n let tags: string[] = [];\n if (\"tags\" in input && Array.isArray(input.tags) && input.tags.length > 0) {\n tags = input.tags.map((tag) => tag.slice(1));\n return tags;\n }\n\n // Check if the input string contains tags directly\n const regex = /@(\\w+)/g;\n const matches = input.title.match(regex);\n if (matches) {\n tags = tags.concat(matches.map((match) => match.slice(1)));\n }\n\n // Try parsing the input string as a JavaScript object\n try {\n const obj = JSON.parse(`{${input}}`);\n if (obj.tag && Array.isArray(obj.tag)) {\n tags = tags.concat(obj.tag);\n }\n } catch (error) {\n // Ignore parsing errors\n }\n return tags;\n }\n\n private extractTestAnnotations(annotations: TestCase[\"annotations\"]): string[] {\n const result = annotations.map((annotation) => {\n if (annotation.type && annotation.description) {\n return `${annotation.type}: ${annotation.description}`;\n }\n return annotation.type;\n });\n return result;\n }\n\n private toPosixPath(aPath: string): string {\n return aPath.split(path.sep).join(path.posix.sep);\n }\n\n private getAttachmentStatus(testResult: TestResult): string {\n let attachmentStatus: string = \"\";\n for (const attachment of testResult.attachments) {\n if (attachment.contentType.includes(\"image\")) {\n if (attachmentStatus !== \"\") {\n attachmentStatus += \",\";\n }\n attachmentStatus += \"image\";\n } else if (attachment.contentType.includes(\"video\")) {\n if (attachmentStatus !== \"\") {\n attachmentStatus += \",\";\n }\n attachmentStatus += \"video\";\n } else if (attachment.contentType === \"application/zip\") {\n if (attachmentStatus !== \"\") {\n attachmentStatus += \",\";\n }\n attachmentStatus += \"trace\";\n }\n }\n return attachmentStatus;\n }\n\n private dedupeSteps(steps: TestStep[]): DedupedStep[] {\n const result: DedupedStep[] = [];\n let lastResult = undefined;\n for (const step of steps) {\n const canDedupe =\n !step.error && step.duration >= 0 && step.location?.file && !step.steps.length;\n const lastStep = lastResult?.step;\n if (\n canDedupe &&\n lastResult &&\n lastStep &&\n step.category === lastStep.category &&\n step.title === lastStep.title &&\n step.location?.file === lastStep.location?.file &&\n step.location?.line === lastStep.location?.line &&\n step.location?.column === lastStep.location?.column\n ) {\n ++lastResult.count;\n lastResult.duration += step.duration;\n continue;\n }\n lastResult = { step, count: 1, duration: step.duration };\n result.push(lastResult);\n if (!canDedupe) {\n lastResult = undefined;\n }\n }\n return result;\n }\n\n private serializeTestStep(dedupedStep: DedupedStep): RawTestStep {\n const { step, duration, count } = dedupedStep;\n const result: RawTestStep = {\n title: step.title,\n category: step.category,\n startTime: step.startTime.toISOString(),\n duration,\n error: step.error ? step.error.message : undefined,\n location: this.relativeLocation(step.location),\n steps: this.dedupeSteps(step.steps).map((subStep) => this.serializeTestStep(subStep)),\n count: count,\n };\n return result;\n }\n\n private getTestStatus(test: TestCase, result: TestResult): string {\n if (test.expectedStatus === result.status) {\n if (result.status === \"skipped\") {\n return \"SKIPPED\";\n } else {\n return \"PASSED\";\n }\n } else if (result.status === \"interrupted\") {\n return \"SKIPPED\";\n } else {\n return \"FAILED\";\n }\n }\n\n private extractRootParentTitle(suite: Suite): string | undefined {\n // Traverse through the parent properties until reaching the root parent\n let currentSuite: Suite | undefined = suite;\n let depthCount: number = 0;\n let suiteTitle: string = currentSuite.title;\n const projectName = currentSuite.project()!.name;\n while (currentSuite?.parent && !ReporterUtils.isNullOrEmpty(currentSuite.parent.title)) {\n if (depthCount > 10 || currentSuite.parent.title === projectName) {\n break;\n }\n suiteTitle = suiteTitle + \" > \" + currentSuite.parent.title;\n currentSuite = currentSuite.parent;\n depthCount++;\n }\n return suiteTitle;\n }\n\n private async getRunName(ciInfo: CIInfo): Promise<string> {\n if (\n ciInfo.provider === CI_PROVIDERS.GITHUB &&\n process.env[\"GITHUB_EVENT_NAME\"] === \"pull_request\"\n ) {\n const prNumber: string = `${process.env[\"GITHUB_REF_NAME\"]?.split(\"/\")[0]}`;\n const prLink: string = `${process.env[\"GITHUB_REPOSITORY\"]}/pull/${prNumber}`;\n return `PR# ${prNumber} on Repo: ${process.env[\"GITHUB_REPOSITORY\"]} (${prLink})`;\n }\n\n let gitCommitMessage: string | null = null;\n try {\n const gitVersion = await this.runCommand(Constants.GIT_VERSION_COMMAND);\n if (ReporterUtils.isNullOrEmpty(gitVersion)) {\n throw new Error(\"Git is not installed on the machine\");\n }\n const isInsideWorkTree = await this.runCommand(Constants.GIT_REV_PARSE);\n if (isInsideWorkTree !== \"true\") {\n throw new Error(\"Not inside a git repository\");\n }\n gitCommitMessage = await this.runCommand(Constants.GIT_COMMIT_MESSAGE_COMMAND);\n return gitCommitMessage;\n } catch (err) {\n reporterLogger.error(`\\nError in getting git commit message: ${err}.`);\n return \"\";\n }\n }\n\n private async runCommand(command: string): Promise<string> {\n return new Promise((resolve, reject) => {\n exec(command, (error, stdout, stderr) => {\n if (error) {\n reject(error);\n return;\n }\n if (stderr) {\n reject(new Error(stderr));\n return;\n }\n resolve(stdout.trim());\n });\n });\n }\n\n public static isNullOrEmpty(str: string | null | undefined): boolean {\n return !str || str.trim() === \"\";\n }\n\n private getOsName(): string {\n const osType = os.type();\n switch (osType) {\n case \"Darwin\":\n return \"MAC\";\n case \"Linux\":\n return \"LINUX\";\n case \"Windows_NT\":\n return \"WINDOWS\";\n default:\n return \"UNKNOWN\";\n }\n }\n}\n\nexport default ReporterUtils;\n"]}
1
+ {"version":3,"file":"reporterUtils.js","sourceRoot":"","sources":["../../src/utils/reporterUtils.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAWlC,iDAAqC;AACrC,6CAAkD;AAClD,mCAAgD;AAEhD,oDAAoB;AACpB,oDAAoB;AACpB,wDAAwB;AACxB,mDAAgD;AAGhD,8DAAqD;AACrD,0CAAsE;AACtE,oDAAiF;AACjF,8CAA0D;AAC1D,qDAAwD;AACxD,qDAAkD;AAGlD,MAAM,aAAa;IAWjB,wEAAwE;IACxE,YAAY,YAAkC,EAAE,MAAkB,EAAE,CAAQ;QAC1E,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,YAAY,GAAG,YAAY,CAAC;QACjC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QAE5B,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC;QACpB,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC;QACrB,IAAI,CAAC,YAAY,GAAG,CAAC,CAAC;QACtB,IAAI,CAAC,WAAW,GAAG,CAAC,CAAC;QACrB,IAAI,CAAC,UAAU,GAA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C;YACzB,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC;IAEM,MAAM,CAAC,aAAa,CAAC,GAA8B;QACxD,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,CAAC;IACnC,CAAC;IAEO,SAAS;QACf,MAAM,MAAM,GAAG,YAAE,CAAC,IAAI,EAAE,CAAC;QACzB,QAAQ,MAAM,EAAE,CAAC;YACf,KAAK,QAAQ;gBACX,OAAO,KAAK,CAAC;YACf,KAAK,OAAO;gBACV,OAAO,OAAO,CAAC;YACjB,KAAK,YAAY;gBACf,OAAO,SAAS,CAAC;YACnB;gBACE,OAAO,SAAS,CAAC;QACrB,CAAC;IACH,CAAC;;AA1Ua,uCAAyB,GAA6B;IAClE,aAAa,EAAE,CAAC;IAChB,MAAM,EAAE,MAAM;IACd,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE;QACf,IAAI,KAAK,CAAC,QAAQ,EAAE,CAAC;YACnB,MAAM,MAAM,GAAG,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC;YACrC,IAAI,qBAAS,CAAC,0BAA0B,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC;gBAC1D,OAAO,KAAK,CAAC;YACf,CAAC;QACH,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CACF,CAAC;AAiUJ,kBAAe,aAAa,CAAC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type {\n FullResult,\n Location,\n TestCase,\n TestResult,\n TestStep,\n FullConfig,\n Suite,\n} from \"@playwright/test/reporter\";\nimport { exec } from \"child_process\";\nimport { reporterLogger } from \"../common/logger\";\nimport { createHash, randomUUID } from \"crypto\";\nimport { IBackOffOptions } from \"../common/types\";\nimport fs from \"fs\";\nimport os from \"os\";\nimport path from \"path\";\nimport { Constants } from \"../common/constants\";\nimport { EnvironmentVariables } from \"../common/environmentVariables\";\nimport { DedupedStep, RawTestStep } from \"../common/types\";\nimport { TokenType } from \"../model/mptTokenDetails\";\nimport { Shard, TestRunStatus, UploadMetadata } from \"../model/shard\";\nimport { TestResult as MPTTestResult, RawTestResult } from \"../model/testResult\";\nimport { TestRun, TestRunConfig } from \"../model/testRun\";\nimport { CIInfo, CI_PROVIDERS } from \"./cIInfoProvider\";\nimport { CIInfoProvider } from \"./cIInfoProvider\";\nimport { StorageUri } from \"../model/storageUri\";\n\nclass ReporterUtils {\n private envVariables: EnvironmentVariables;\n\n private config: FullConfig;\n totalTests: number;\n failedTests: number;\n skippedTests: number;\n passedTests: number;\n flakyTests: number;\n startTime: number;\n\n // eslint-disable-next-line @azure/azure-sdk/ts-use-interface-parameters\n constructor(envVariables: EnvironmentVariables, config: FullConfig, _: Suite) {\n this.config = config;\n this.envVariables = envVariables;\n this.startTime = Date.now();\n\n this.totalTests = 0;\n this.failedTests = 0;\n this.skippedTests = 0;\n this.passedTests = 0;\n this.flakyTests = 0;\n }\n\n public async getTestRunObject(ciInfo: CIInfo): Promise<TestRun> {\n const testRun = new TestRun();\n const runName = await this.getRunName(ciInfo);\n if (ReporterUtils.isNullOrEmpty(this.envVariables.runId)) {\n if (!ReporterUtils.isNullOrEmpty(runName)) {\n this.envVariables.runId = runName;\n } else {\n this.envVariables.runId = randomUUID();\n }\n }\n testRun.testRunId = this.envVariables.runId;\n testRun.displayName = ReporterUtils.isNullOrEmpty(runName) ? randomUUID() : runName;\n testRun.creatorName = this.envVariables.userName;\n testRun.creatorId = this.envVariables.userId!;\n testRun.startTime = ReporterUtils.timestampToRFC3339(this.startTime);\n testRun.ciConfig = {\n ciProviderName: ciInfo.provider!,\n branch: ciInfo.branch!,\n author: ciInfo.author!,\n commitId: ciInfo.commitId!,\n revisionUrl: ciInfo.revisionUrl!,\n };\n testRun.testRunConfig = this.getTestRunConfig();\n testRun.cloudReportingEnabled = \"true\";\n return testRun;\n }\n\n public getTestRunShardStartObject(): Shard {\n const shard = new Shard();\n if (this.config.shard !== null && this.config.shard !== undefined) {\n this.envVariables.shardId = this.config.shard.current.toString();\n } else {\n this.envVariables.shardId = \"1\";\n }\n shard.shardId = this.envVariables.shardId;\n shard.summary = {\n startTime: ReporterUtils.timestampToRFC3339(this.startTime),\n };\n shard.uploadCompleted = false;\n return shard;\n }\n\n public getTestRunShardEndObject(\n result: FullResult,\n // eslint-disable-next-line @azure/azure-sdk/ts-use-interface-parameters\n shard: Shard,\n errorMessages: string[],\n attachmentMetadata: UploadMetadata,\n workers: number,\n ): Shard {\n shard.shardId = this.envVariables.shardId ?? \"1\";\n shard.summary.totalTime = result.duration;\n shard.summary.endTime = ReporterUtils.timestampToRFC3339(Date.now());\n shard.summary.status = TestRunStatus.CLIENT_COMPLETE;\n shard.summary.errorMessages = errorMessages;\n shard.summary.uploadMetadata = attachmentMetadata;\n shard.uploadCompleted = true;\n shard.workers = workers;\n return shard;\n }\n\n public getTestResultObject(test: TestCase, result: TestResult, jobName: string): MPTTestResult {\n switch (test.outcome()) {\n case \"skipped\":\n this.skippedTests++;\n this.totalTests++;\n break;\n case \"expected\":\n this.passedTests++;\n this.totalTests++;\n break;\n case \"unexpected\":\n if (result.retry === test.retries) {\n this.failedTests++;\n this.totalTests++;\n }\n break;\n case \"flaky\":\n this.totalTests++;\n this.flakyTests++;\n break;\n default:\n break;\n }\n\n let browserName = test.parent.project()!.use.browserName?.toLowerCase();\n if (!browserName) {\n browserName = test.parent.project()!.use.defaultBrowserType?.toLowerCase();\n }\n const testResult = new MPTTestResult();\n testResult.runId = this.envVariables.runId;\n testResult.shardId = this.envVariables.runId + \"_\" + this.envVariables.shardId;\n testResult.accountId = this.envVariables.accountId!;\n testResult.suiteId = ReporterUtils.calculateSha1(`${test.parent.title}-${test.location.file}`);\n testResult.testId = testResult.suiteId.concat(`-${ReporterUtils.calculateSha1(test.title)}`);\n testResult.testCombinationId = test.id;\n testResult.testExecutionId = randomUUID();\n testResult.testTitle = test.title;\n testResult.suiteTitle = this.extractRootParentTitle(test.parent)!;\n testResult.fileName = test.location.file;\n testResult.status = this.getTestStatus(test, result);\n testResult.lineNumber = test.location.line;\n testResult.retry = result.retry ? result.retry : 0;\n testResult.webTestConfig = {\n jobName: jobName,\n projectName: test.parent.project()!.name,\n browserType: browserName!.toUpperCase(),\n os: this.getOsName(),\n };\n testResult.annotations = this.extractTestAnnotations(test.annotations);\n testResult.tags = this.extractTestTags(test);\n testResult.resultsSummary = {\n status: result.status.toUpperCase(),\n duration: result.duration,\n startTime: result.startTime.toISOString().replace(/\\.\\d+Z$/, \"Z\"),\n attachmentsMetadata: this.getAttachmentStatus(result),\n };\n testResult.artifactsPath = result.attachments\n .filter((attachment) => attachment?.path !== null && attachment?.path !== undefined) // Filter attachments with defined and non-null path property\n .map(\n (attachment) =>\n `${testResult.testExecutionId}/${ReporterUtils.getFileRelativePath(attachment.path!)}`,\n );\n return testResult;\n }\n\n public generateMarkdownSummary(testRunUrl: string): void {\n try {\n if (CIInfoProvider.getCIProvider() === CI_PROVIDERS.GITHUB) {\n const markdownContent = `\n#### Microsoft Playwright Testing run summary\n\n#### Results:\n \n![pass](https://img.shields.io/badge/status-passed-brightgreen) **Passed:** ${this.passedTests}\n \n![fail](https://img.shields.io/badge/status-failed-red) **Failed:** ${this.failedTests}\n \n![flaky](https://img.shields.io/badge/status-flaky-yellow) **Flaky:** ${this.flakyTests}\n \n![skipped](https://img.shields.io/badge/status-skipped-lightgrey) **Skipped:** ${this.skippedTests}\n \n#### For more details, visit the [service dashboard](${testRunUrl}).\n `;\n fs.writeFileSync(process.env[\"GITHUB_STEP_SUMMARY\"]!, markdownContent);\n }\n } catch (err) {\n reporterLogger.error(`\\nCould not generate markdown summary - ${err}`);\n }\n }\n\n public getRawTestResultObject(result: TestResult): RawTestResult {\n const rawTestResult: RawTestResult = {\n steps: this.dedupeSteps(result.steps).map((step) => this.serializeTestStep(step)),\n errors: result.errors ? JSON.stringify(result.errors, null, 2) : \"\",\n stdErr: result.stderr ? JSON.stringify(result.stderr, null, 2) : \"\",\n stdOut: result.stdout ? JSON.stringify(result.stdout, null, 2) : \"\",\n };\n return rawTestResult;\n }\n\n public static getRunId(cIInfo: CIInfo): string {\n if (cIInfo === null || cIInfo.provider === CI_PROVIDERS.DEFAULT) {\n return randomUUID();\n }\n\n const concatString = `${cIInfo.provider}-${cIInfo.repo}-${cIInfo.runId}-${cIInfo.runAttempt}`;\n const runId = ReporterUtils.calculateSha1(concatString);\n return runId;\n }\n\n public static calculateSha1(buffer: Buffer | string): string {\n const hash = createHash(\"sha1\");\n hash.update(buffer);\n return hash.digest(\"hex\");\n }\n\n /*\n public static getTokenDetails(accessToken: string) {\n let tokenDetails = new MPTTokenDetails();\n try {\n const token = accessToken.split('.')[1];\n const _token = Buffer.from(token, 'base64');\n tokenDetails = JSON.parse(_token.toString());\n } catch (err) {\n throw err;\n }\n return tokenDetails;\n }\n */\n\n public static getTokenDetails<T>(accessToken: string, tokenType: TokenType): T {\n const token = accessToken.split(\".\")[1]!;\n const _token = Buffer.from(token, \"base64\");\n const tokenDetails = JSON.parse(_token.toString());\n\n switch (tokenType) {\n case TokenType.MPT:\n return tokenDetails as T;\n case TokenType.ENTRA:\n return tokenDetails as T;\n default:\n throw new Error(\"Unsupported token type\");\n }\n }\n\n public static hasAudienceClaim(token: string): boolean {\n try {\n // Split the token into its three parts\n const parts = token.split(\".\");\n if (parts.length !== 3) {\n throw new Error(\"Invalid token format\");\n }\n\n // Base64 decode the payload\n const payload = parts[1]!;\n const decodedPayload = Buffer.from(payload, \"base64\");\n\n // Parse the decoded payload as JSON\n const payloadObject = JSON.parse(decodedPayload.toString());\n\n // Check if the payload has an 'aud' claim\n return \"aud\" in payloadObject;\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n } catch (error) {\n return false;\n }\n }\n\n public static timestampToRFC3339(timestamp: number): string {\n const date = new Date(timestamp);\n const dateString = date.toISOString().replace(/\\.\\d+Z$/, \"Z\");\n return dateString;\n }\n\n public static getFileRelativePath(filePath: string): string {\n if (filePath) {\n let parts = filePath.split(\"/\");\n\n if (parts.length > 1) {\n return parts[parts.length - 1]!;\n }\n\n parts = filePath.split(\"\\\\\");\n\n if (parts.length > 1) {\n return parts[parts.length - 1]!;\n }\n }\n\n return filePath;\n }\n\n public static getReporterBackOffOptions: Partial<IBackOffOptions> = {\n numOfAttempts: 3,\n jitter: \"full\",\n retry: (error) => {\n if (error.response) {\n const status = error.response.status;\n if (Constants.NON_RETRYABLE_STATUS_CODES.includes(status)) {\n return false;\n }\n }\n return true;\n },\n };\n\n // eslint-disable-next-line @azure/azure-sdk/ts-use-interface-parameters\n public static isTimeGreaterThanCurrentPlus10Minutes(sasUri: StorageUri): boolean {\n try {\n const url = new URL(sasUri.uri);\n const params = new URLSearchParams(url.search);\n const expiryTime = params.get(\"se\"); // 'se' is the query parameter for the expiry time\n if (expiryTime) {\n const timestampFromIsoString = new Date(expiryTime).getTime();\n const currentTimestampPlus10Minutes = Date.now() + 10 * 60 * 1000;\n const isSasValidityGreaterThanCurrentTimePlus10Minutes =\n timestampFromIsoString > currentTimestampPlus10Minutes;\n if (!isSasValidityGreaterThanCurrentTimePlus10Minutes) {\n reporterLogger.info(\n `Sas rotation required because close to expiry, SasUriValidTillTime: ${timestampFromIsoString}, CurrentTime: ${currentTimestampPlus10Minutes}`,\n );\n }\n return isSasValidityGreaterThanCurrentTimePlus10Minutes;\n }\n reporterLogger.error(`Sas rotation required because expiry param not found.`);\n return false;\n } catch (error) {\n reporterLogger.error(`Sas rotation required because of ${error}.`);\n return false;\n }\n }\n\n public static getFileSize(attachmentPath: string): number {\n try {\n const stats = fs.statSync(attachmentPath);\n return stats.size;\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n } catch (error) {\n return 0;\n }\n }\n\n public redactAccessToken(info: string | undefined): string {\n if (!info || ReporterUtils.isNullOrEmpty(this.envVariables.accessToken)) {\n return \"\";\n }\n const accessTokenRegex = new RegExp(this.envVariables.accessToken, \"g\");\n return info.replace(accessTokenRegex, Constants.DEFAULT_REDACTED_MESSAGE);\n }\n\n public static populateValuesFromServiceUrl(): {\n region: string;\n accountId: string;\n } | null {\n // Service URL format: wss://<region>.api.playwright.microsoft.com/accounts/<workspace-id>/browsers\n const url = process.env[\"PLAYWRIGHT_SERVICE_URL\"]!;\n if (!ReporterUtils.isNullOrEmpty(url)) {\n const parts = url.split(\"/\");\n\n if (parts.length > 2) {\n const subdomainParts = parts[2]!.split(\".\");\n const region = subdomainParts.length > 0 ? subdomainParts[0] : null;\n const accountId = parts[4];\n\n return { region: region!, accountId: accountId! };\n }\n }\n return null;\n }\n\n public static getRegionFromAccountID(accountId: string): string | undefined {\n if (accountId.includes(\"_\")) {\n return accountId.split(\"_\")[0]!;\n } else {\n return;\n } // Handling for older workspaces without region in id\n }\n\n public progressBar(current: number, total: number): void {\n const width = 40;\n const percent = current / total;\n const completed = Math.round(width * percent);\n const remaining = width - completed;\n\n process.stdout.write(\"\\r\");\n process.stdout.write(\n `[${\"=\".repeat(completed)}${\" \".repeat(remaining)}] ${Math.round(percent * 100)}%`,\n );\n }\n\n private getTestRunConfig(): TestRunConfig {\n const testRunConfig: TestRunConfig = {\n workers: this.config.workers,\n pwVersion: this.config.version,\n timeout: this.config.globalTimeout,\n repeatEach: this.config.projects[0].repeatEach,\n retries: this.config.projects[0].retries,\n shards: this.config.shard ? this.config.shard : { total: 1 },\n testFramework: {\n name: Constants.TEST_FRAMEWORK_NAME,\n version: this.config.version,\n runnerName: Constants.TEST_FRAMEWORK_RUNNERNAME,\n },\n testType: Constants.TEST_TYPE,\n testSdkLanguage: Constants.TEST_SDK_LANGUAGE,\n reporterPackageVersion: Constants.REPORTER_PACKAGE_VERSION,\n };\n return testRunConfig;\n }\n\n private relativeLocation(location: Location | undefined): Location | undefined {\n if (!location) {\n return undefined;\n }\n const file = this.toPosixPath(path.relative(this.config.rootDir, location.file));\n return {\n file,\n line: location.line,\n column: location.column,\n };\n }\n\n private extractTestTags(input: TestCase): string[] {\n let tags: string[] = [];\n if (\"tags\" in input && Array.isArray(input.tags) && input.tags.length > 0) {\n tags = input.tags.map((tag) => tag.slice(1));\n return tags;\n }\n\n // Check if the input string contains tags directly\n const regex = /@(\\w+)/g;\n const matches = input.title.match(regex);\n if (matches) {\n tags = tags.concat(matches.map((match) => match.slice(1)));\n }\n\n // Try parsing the input string as a JavaScript object\n try {\n const obj = JSON.parse(`{${input}}`);\n if (obj.tag && Array.isArray(obj.tag)) {\n tags = tags.concat(obj.tag);\n }\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n } catch (error) {\n // Ignore parsing errors\n }\n return tags;\n }\n\n private extractTestAnnotations(annotations: TestCase[\"annotations\"]): string[] {\n const result = annotations.map((annotation) => {\n if (annotation.type && annotation.description) {\n return `${annotation.type}: ${annotation.description}`;\n }\n return annotation.type;\n });\n return result;\n }\n\n private toPosixPath(aPath: string): string {\n return aPath.split(path.sep).join(path.posix.sep);\n }\n\n private getAttachmentStatus(testResult: TestResult): string {\n let attachmentStatus: string = \"\";\n for (const attachment of testResult.attachments) {\n if (attachment.contentType.includes(\"image\")) {\n if (attachmentStatus !== \"\") {\n attachmentStatus += \",\";\n }\n attachmentStatus += \"image\";\n } else if (attachment.contentType.includes(\"video\")) {\n if (attachmentStatus !== \"\") {\n attachmentStatus += \",\";\n }\n attachmentStatus += \"video\";\n } else if (attachment.contentType === \"application/zip\") {\n if (attachmentStatus !== \"\") {\n attachmentStatus += \",\";\n }\n attachmentStatus += \"trace\";\n }\n }\n return attachmentStatus;\n }\n\n private dedupeSteps(steps: TestStep[]): DedupedStep[] {\n const result: DedupedStep[] = [];\n let lastResult = undefined;\n for (const step of steps) {\n const canDedupe =\n !step.error && step.duration >= 0 && step.location?.file && !step.steps.length;\n const lastStep = lastResult?.step;\n if (\n canDedupe &&\n lastResult &&\n lastStep &&\n step.category === lastStep.category &&\n step.title === lastStep.title &&\n step.location?.file === lastStep.location?.file &&\n step.location?.line === lastStep.location?.line &&\n step.location?.column === lastStep.location?.column\n ) {\n ++lastResult.count;\n lastResult.duration += step.duration;\n continue;\n }\n lastResult = { step, count: 1, duration: step.duration };\n result.push(lastResult);\n if (!canDedupe) {\n lastResult = undefined;\n }\n }\n return result;\n }\n\n private serializeTestStep(dedupedStep: DedupedStep): RawTestStep {\n const { step, duration, count } = dedupedStep;\n const result: RawTestStep = {\n title: step.title,\n category: step.category,\n startTime: step.startTime.toISOString(),\n duration,\n error: step.error ? step.error.message : undefined,\n location: this.relativeLocation(step.location),\n steps: this.dedupeSteps(step.steps).map((subStep) => this.serializeTestStep(subStep)),\n count: count,\n };\n return result;\n }\n\n private getTestStatus(test: TestCase, result: TestResult): string {\n if (test.expectedStatus === result.status) {\n if (result.status === \"skipped\") {\n return \"SKIPPED\";\n } else {\n return \"PASSED\";\n }\n } else if (result.status === \"interrupted\") {\n return \"SKIPPED\";\n } else {\n return \"FAILED\";\n }\n }\n\n private extractRootParentTitle(suite: Suite): string | undefined {\n // Traverse through the parent properties until reaching the root parent\n let currentSuite: Suite | undefined = suite;\n let depthCount: number = 0;\n let suiteTitle: string = currentSuite.title;\n const projectName = currentSuite.project()!.name;\n while (currentSuite?.parent && !ReporterUtils.isNullOrEmpty(currentSuite.parent.title)) {\n if (depthCount > 10 || currentSuite.parent.title === projectName) {\n break;\n }\n suiteTitle = suiteTitle + \" > \" + currentSuite.parent.title;\n currentSuite = currentSuite.parent;\n depthCount++;\n }\n return suiteTitle;\n }\n\n private async getRunName(ciInfo: CIInfo): Promise<string> {\n if (\n ciInfo.provider === CI_PROVIDERS.GITHUB &&\n process.env[\"GITHUB_EVENT_NAME\"] === \"pull_request\"\n ) {\n const prNumber: string = `${process.env[\"GITHUB_REF_NAME\"]?.split(\"/\")[0]}`;\n const prLink: string = `${process.env[\"GITHUB_REPOSITORY\"]}/pull/${prNumber}`;\n return `PR# ${prNumber} on Repo: ${process.env[\"GITHUB_REPOSITORY\"]} (${prLink})`;\n }\n\n let gitCommitMessage: string | null = null;\n try {\n const gitVersion = await this.runCommand(Constants.GIT_VERSION_COMMAND);\n if (ReporterUtils.isNullOrEmpty(gitVersion)) {\n throw new Error(\"Git is not installed on the machine\");\n }\n const isInsideWorkTree = await this.runCommand(Constants.GIT_REV_PARSE);\n if (isInsideWorkTree !== \"true\") {\n throw new Error(\"Not inside a git repository\");\n }\n gitCommitMessage = await this.runCommand(Constants.GIT_COMMIT_MESSAGE_COMMAND);\n return gitCommitMessage;\n } catch (err) {\n reporterLogger.error(`\\nError in getting git commit message: ${err}.`);\n return \"\";\n }\n }\n\n private async runCommand(command: string): Promise<string> {\n return new Promise((resolve, reject) => {\n exec(command, (error, stdout, stderr) => {\n if (error) {\n reject(error);\n return;\n }\n if (stderr) {\n reject(new Error(stderr));\n return;\n }\n resolve(stdout.trim());\n });\n });\n }\n\n public static isNullOrEmpty(str: string | null | undefined): boolean {\n return !str || str.trim() === \"\";\n }\n\n private getOsName(): string {\n const osType = os.type();\n switch (osType) {\n case \"Darwin\":\n return \"MAC\";\n case \"Linux\":\n return \"LINUX\";\n case \"Windows_NT\":\n return \"WINDOWS\";\n default:\n return \"UNKNOWN\";\n }\n }\n}\n\nexport default ReporterUtils;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"serviceClient.d.ts","sourceRoot":"","sources":["../../src/utils/serviceClient.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAE5D,OAAO,EAAE,oBAAoB,EAAE,MAAM,gCAAgC,CAAC;AAEtE,OAAO,EAAE,KAAK,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,kBAAkB,CAAC;AAC3C,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAC1C,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAG5C,qBAAa,aAAa;IACxB,OAAO,CAA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common/constants");
7
7
  const httpService_1 = require("../common/httpService");
8
+ const logger_1 = require("../common/logger");
8
9
  class ServiceClient {
9
10
  constructor(
10
11
  /* eslint-disable @azure/azure-sdk/ts-use-interface-parameters */
@@ -61,15 +62,19 @@ class ServiceClient {
61
62
  }
62
63
  // eslint-disable-next-line @azure/azure-sdk/ts-use-interface-parameters
63
64
  async postTestResults(testResults) {
64
- const payload = {
65
- value: testResults,
66
- };
67
- const response = await this.httpService.callAPI("POST", `${this.getServiceEndpoint()}/${constants_1.Constants.testResultsEndpoint.replace("{workspaceId}", this.envVariables.accountId)}?api-version=${constants_1.Constants.API_VERSION}`, JSON.stringify(payload), this.envVariables.accessToken, "application/json", this.envVariables.correlationId);
68
- if (response.status === 200) {
69
- return;
65
+ try {
66
+ const payload = {
67
+ value: testResults,
68
+ };
69
+ const response = await this.httpService.callAPI("POST", `${this.getServiceEndpoint()}/${constants_1.Constants.testResultsEndpoint.replace("{workspaceId}", this.envVariables.accountId)}?api-version=${constants_1.Constants.API_VERSION}`, JSON.stringify(payload), this.envVariables.accessToken, "application/json", this.envVariables.correlationId);
70
+ if (response.status === 200) {
71
+ return;
72
+ }
73
+ this.handleErrorResponse(response, constants_1.Constants.postTestResults);
74
+ }
75
+ catch (error) {
76
+ logger_1.reporterLogger.error(`Error occurred while posting test results: ${error}`);
70
77
  }
71
- this.handleErrorResponse(response, constants_1.Constants.postTestResults);
72
- throw new Error(`Received status ${response.status} from service from POST TestResults call.`);
73
78
  }
74
79
  async createStorageUri() {
75
80
  const response = await this.httpService.callAPI("POST", `${this.getServiceEndpoint()}/${constants_1.Constants.storageUriEndpoint.replace("{workspaceId}", this.envVariables.accountId).replace("{testRunId}", this.envVariables.runId)}?api-version=${constants_1.Constants.API_VERSION}`, null, this.envVariables.accessToken, "application/json", this.envVariables.correlationId);
@@ -1 +1 @@
1
- {"version":3,"file":"serviceClient.js","sourceRoot":"","sources":["../../src/utils/serviceClient.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACv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AAC,YAAY,CAAC,WAAW,EAC7B,kBAAkB,EAClB,IAAI,CAAC,YAAY,CAAC,aAAc,CACjC,CAAC;QACF,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;YAC5B,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,UAAW,CAAe,CAAC;QACxD,CAAC;QACD,IAAI,CAAC,mBAAmB,CAAC,QAAQ,EAAE,qBAAS,CAAC,aAAa,CAAC,CAAC;QAE5D,MAAM,IAAI,KAAK,CAAC,mBAAmB,QAAQ,CAAC,MAAM,yCAAyC,CAAC,CAAC;IAC/F,CAAC;IAEO,kBAAkB;QACxB,OAAO,OAAO,CAAC,GAAG,CAAC,kCAAkC,CAAE,CAAC;IAC1D,CAAC;IAEO,mBAAmB,CAAC,QAA0B,EAAE,MAAc;;QACpE,MAAM,UAAU,GAAG,QAAQ,CAAC,MAAM,CAAC;QACnC,MAAM,YAAY,GAAG,MAAA,MAAA,qBAAS,CAAC,aAAa,CAAC,MAAM,CAAC,0CAAG,UAAU,CAAC,mCAAI,wBAAwB,CAAC;QAC/F,IAAI,CAAC,IAAI,CAAC,2BAA2B,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,EAAE,CAAC;YAC7D,IAAI,CAAC,0BAA0B,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC;YACvD,IAAI,CAAC,uBAAuB,CAAC,YAAY,CAAC,CAAC;QAC7C,CAAC;QACD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,YAAY,IAAI,CAAC,CAAC;IAC5C,CAAC;CACF;AAhKD,sCAgKC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { FullResult } from \"@playwright/test/reporter\";\nimport { Constants } from \"../common/constants\";\nimport { EnvironmentVariables } from \"../common/environmentVariables\";\nimport { HttpService } from \"../common/httpService\";\nimport { Shard, UploadMetadata } from \"../model/shard\";\nimport { StorageUri } from \"../model/storageUri\";\nimport { TestResult } from \"../model/testResult\";\nimport { TestRun } from \"../model/testRun\";\nimport { CIInfo } from \"./cIInfoProvider\";\nimport ReporterUtils from \"./reporterUtils\";\nimport { PipelineResponse } from \"@azure/core-rest-pipeline\";\n\nexport class ServiceClient {\n private httpService: HttpService;\n private readonly envVariables: EnvironmentVariables;\n private readonly reporterUtils: ReporterUtils;\n private readonly addInformationalMessage: (errorMessage: string) => void;\n private isInformationMessagePresent: (key: string) => boolean;\n private addKeyToInformationMessage: (key: string) => void;\n constructor(\n /* eslint-disable @azure/azure-sdk/ts-use-interface-parameters */\n envVariables: EnvironmentVariables,\n reporterUtils: ReporterUtils,\n /* eslint-enable @azure/azure-sdk/ts-use-interface-parameters */\n addErrorInformation: (errorMessage: string) => void,\n isInformationMessagePresent: (key: string) => boolean,\n addKeyToInformationMessage: (key: string) => void,\n ) {\n this.httpService = new HttpService();\n this.envVariables = envVariables;\n this.reporterUtils = reporterUtils;\n this.addInformationalMessage = addErrorInformation;\n this.isInformationMessagePresent = isInformationMessagePresent;\n this.addKeyToInformationMessage = addKeyToInformationMessage;\n }\n\n async patchTestRun(ciInfo: CIInfo): Promise<TestRun> {\n const testRun = await this.reporterUtils.getTestRunObject(ciInfo);\n const response: PipelineResponse = await this.httpService.callAPI(\n \"PATCH\",\n `${this.getServiceEndpoint()}/${Constants.testRunsEndpoint.replace(\"{workspaceId}\", this.envVariables.accountId!)}/${this.envVariables.runId}?api-version=${Constants.API_VERSION}`,\n JSON.stringify(testRun),\n this.envVariables.accessToken,\n \"application/merge-patch+json\",\n this.envVariables.correlationId!,\n );\n if (response.status === 200) {\n return JSON.parse(response.bodyAsText!) as TestRun;\n } else if (response.status === 409) {\n const errorMessage = Constants.CONFLICT_409_ERROR_MESSAGE.replace(\n \"{runId}\",\n this.envVariables.runId,\n );\n this.addInformationalMessage(errorMessage);\n process.stdout.write(`\\n${errorMessage}`);\n } else if (response.status === 403) {\n const errorMessage = Constants.FORBIDDEN_403_ERROR_MESSAGE.replace(\n new RegExp(\"{workspaceId}\", \"g\"),\n this.envVariables.accountId!,\n );\n this.addInformationalMessage(errorMessage);\n process.stdout.write(`\\n${errorMessage}`);\n } else {\n this.handleErrorResponse(response, Constants.patchTestRun);\n }\n throw new Error(`Received status ${response.status} from service from PATCH TestRun call.`);\n }\n\n async postTestRunShardStart(): Promise<Shard> {\n const postTestRunShardObject = this.reporterUtils.getTestRunShardStartObject();\n const response: PipelineResponse = await this.httpService.callAPI(\n \"POST\",\n `${this.getServiceEndpoint()}/${Constants.testRunsShardEndpoint.replace(\"{workspaceId}\", this.envVariables.accountId!).replace(\"{testRunId}\", this.envVariables.runId)}/?api-version=${Constants.API_VERSION}`,\n JSON.stringify(postTestRunShardObject),\n this.envVariables.accessToken,\n \"application/json\",\n this.envVariables.correlationId!,\n );\n if (response.status === 200) {\n return JSON.parse(response.bodyAsText!) as Shard;\n }\n this.handleErrorResponse(response, Constants.patchTestRunShardStart);\n\n throw new Error(\n `Received status ${response.status} from service from PATCH TestRun Shard Start call.`,\n );\n }\n\n async postTestRunShardEnd(\n result: FullResult,\n // eslint-disable-next-line @azure/azure-sdk/ts-use-interface-parameters\n shard: Shard,\n errorMessages: string[],\n attachmentMetadata: UploadMetadata,\n workers: number,\n ): Promise<TestRun> {\n const postTestRunShardObject = this.reporterUtils.getTestRunShardEndObject(\n result,\n shard,\n errorMessages,\n attachmentMetadata,\n workers,\n );\n const response: PipelineResponse = await this.httpService.callAPI(\n \"POST\",\n `${this.getServiceEndpoint()}/${Constants.testRunsShardEndpoint.replace(\"{workspaceId}\", this.envVariables.accountId!).replace(\"{testRunId}\", this.envVariables.runId)}/?api-version=${Constants.API_VERSION}`,\n JSON.stringify(postTestRunShardObject),\n this.envVariables.accessToken,\n \"application/json\",\n this.envVariables.correlationId!,\n );\n if (response.status === 200) {\n return JSON.parse(response.bodyAsText!) as TestRun;\n }\n this.handleErrorResponse(response, Constants.patchTestRunShardEnd);\n\n throw new Error(\n `Received status ${response.status} from service from PATCH TestRun Shard End call.`,\n );\n }\n\n // eslint-disable-next-line @azure/azure-sdk/ts-use-interface-parameters\n async postTestResults(testResults: TestResult[]): Promise<void> {\n const payload: any = {\n value: testResults,\n };\n const response: PipelineResponse = await this.httpService.callAPI(\n \"POST\",\n `${this.getServiceEndpoint()}/${Constants.testResultsEndpoint.replace(\"{workspaceId}\", this.envVariables.accountId!)}?api-version=${Constants.API_VERSION}`,\n JSON.stringify(payload),\n this.envVariables.accessToken,\n \"application/json\",\n this.envVariables.correlationId!,\n );\n if (response.status === 200) {\n return;\n }\n this.handleErrorResponse(response, Constants.postTestResults);\n\n throw new Error(`Received status ${response.status} from service from POST TestResults call.`);\n }\n\n async createStorageUri(): Promise<StorageUri> {\n const response: PipelineResponse = await this.httpService.callAPI(\n \"POST\",\n `${this.getServiceEndpoint()}/${Constants.storageUriEndpoint.replace(\"{workspaceId}\", this.envVariables.accountId!).replace(\"{testRunId}\", this.envVariables.runId)}?api-version=${Constants.API_VERSION}`,\n null,\n this.envVariables.accessToken,\n \"application/json\",\n this.envVariables.correlationId!,\n );\n if (response.status === 200) {\n return JSON.parse(response.bodyAsText!) as StorageUri;\n }\n this.handleErrorResponse(response, Constants.getStorageUri);\n\n throw new Error(`Received status ${response.status} from service from GET StorageUri call.`);\n }\n\n private getServiceEndpoint(): string {\n return process.env[\"PLAYWRIGHT_SERVICE_REPORTING_URL\"]!;\n }\n\n private handleErrorResponse(response: PipelineResponse, action: string): void {\n const statusCode = response.status;\n const errorMessage = Constants.ERROR_MESSAGE[action]?.[statusCode] ?? \"Unknown error occured.\";\n if (!this.isInformationMessagePresent(statusCode.toString())) {\n this.addKeyToInformationMessage(statusCode.toString());\n this.addInformationalMessage(errorMessage);\n }\n process.stdout.write(`${errorMessage}\\n`);\n }\n}\n"]}
1
+ {"version":3,"file":"serviceClient.js","sourceRoot":"","sources":["../../src/utils/serviceClient.ts"],"names":[],"mappings":";AAAA,uCAAuC;AACvC,kCAAkC;;;AAGlC,mDAAgD;AAEhD,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AW,EAAE,EAC1M,IAAI,EACJ,IAAI,CAAC,YAAY,CAAC,WAAW,EAC7B,kBAAkB,EAClB,IAAI,CAAC,YAAY,CAAC,aAAc,CACjC,CAAC;QACF,IAAI,QAAQ,CAAC,MAAM,KAAK,GAAG,EAAE,CAAC;YAC5B,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,UAAW,CAAe,CAAC;QACxD,CAAC;QACD,IAAI,CAAC,mBAAmB,CAAC,QAAQ,EAAE,qBAAS,CAAC,aAAa,CAAC,CAAC;QAE5D,MAAM,IAAI,KAAK,CAAC,mBAAmB,QAAQ,CAAC,MAAM,yCAAyC,CAAC,CAAC;IAC/F,CAAC;IAEO,kBAAkB;QACxB,OAAO,OAAO,CAAC,GAAG,CAAC,kCAAkC,CAAE,CAAC;IAC1D,CAAC;IAEO,mBAAmB,CAAC,QAA0B,EAAE,MAAc;;QACpE,MAAM,UAAU,GAAG,QAAQ,CAAC,MAAM,CAAC;QACnC,MAAM,YAAY,GAAG,MAAA,MAAA,qBAAS,CAAC,aAAa,CAAC,MAAM,CAAC,0CAAG,UAAU,CAAC,mCAAI,wBAAwB,CAAC;QAC/F,IAAI,CAAC,IAAI,CAAC,2BAA2B,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,EAAE,CAAC;YAC7D,IAAI,CAAC,0BAA0B,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,CAAC;YACvD,IAAI,CAAC,uBAAuB,CAAC,YAAY,CAAC,CAAC;QAC7C,CAAC;QACD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,YAAY,IAAI,CAAC,CAAC;IAC5C,CAAC;CACF;AAlKD,sCAkKC","sourcesContent":["// Copyright (c) Microsoft Corporation.\n// Licensed under the MIT License.\n\nimport type { FullResult } from \"@playwright/test/reporter\";\nimport { Constants } from \"../common/constants\";\nimport { EnvironmentVariables } from \"../common/environmentVariables\";\nimport { HttpService } from \"../common/httpService\";\nimport { Shard, UploadMetadata } from \"../model/shard\";\nimport { StorageUri } from \"../model/storageUri\";\nimport { TestResult } from \"../model/testResult\";\nimport { TestRun } from \"../model/testRun\";\nimport { CIInfo } from \"./cIInfoProvider\";\nimport ReporterUtils from \"./reporterUtils\";\nimport { PipelineResponse } from \"@azure/core-rest-pipeline\";\nimport { reporterLogger } from \"../common/logger\";\n\nexport class ServiceClient {\n private httpService: HttpService;\n private readonly envVariables: EnvironmentVariables;\n private readonly reporterUtils: ReporterUtils;\n private readonly addInformationalMessage: (errorMessage: string) => void;\n private isInformationMessagePresent: (key: string) => boolean;\n private addKeyToInformationMessage: (key: string) => void;\n constructor(\n /* eslint-disable @azure/azure-sdk/ts-use-interface-parameters */\n envVariables: EnvironmentVariables,\n reporterUtils: ReporterUtils,\n /* eslint-enable @azure/azure-sdk/ts-use-interface-parameters */\n addErrorInformation: (errorMessage: string) => void,\n isInformationMessagePresent: (key: string) => boolean,\n addKeyToInformationMessage: (key: string) => void,\n ) {\n this.httpService = new HttpService();\n this.envVariables = envVariables;\n this.reporterUtils = reporterUtils;\n this.addInformationalMessage = addErrorInformation;\n this.isInformationMessagePresent = isInformationMessagePresent;\n this.addKeyToInformationMessage = addKeyToInformationMessage;\n }\n\n async patchTestRun(ciInfo: CIInfo): Promise<TestRun> {\n const testRun = await this.reporterUtils.getTestRunObject(ciInfo);\n const response: PipelineResponse = await this.httpService.callAPI(\n \"PATCH\",\n `${this.getServiceEndpoint()}/${Constants.testRunsEndpoint.replace(\"{workspaceId}\", this.envVariables.accountId!)}/${this.envVariables.runId}?api-version=${Constants.API_VERSION}`,\n JSON.stringify(testRun),\n this.envVariables.accessToken,\n \"application/merge-patch+json\",\n this.envVariables.correlationId!,\n );\n if (response.status === 200) {\n return JSON.parse(response.bodyAsText!) as TestRun;\n } else if (response.status === 409) {\n const errorMessage = Constants.CONFLICT_409_ERROR_MESSAGE.replace(\n \"{runId}\",\n this.envVariables.runId,\n );\n this.addInformationalMessage(errorMessage);\n process.stdout.write(`\\n${errorMessage}`);\n } else if (response.status === 403) {\n const errorMessage = Constants.FORBIDDEN_403_ERROR_MESSAGE.replace(\n new RegExp(\"{workspaceId}\", \"g\"),\n this.envVariables.accountId!,\n );\n this.addInformationalMessage(errorMessage);\n process.stdout.write(`\\n${errorMessage}`);\n } else {\n this.handleErrorResponse(response, Constants.patchTestRun);\n }\n throw new Error(`Received status ${response.status} from service from PATCH TestRun call.`);\n }\n\n async postTestRunShardStart(): Promise<Shard> {\n const postTestRunShardObject = this.reporterUtils.getTestRunShardStartObject();\n const response: PipelineResponse = await this.httpService.callAPI(\n \"POST\",\n `${this.getServiceEndpoint()}/${Constants.testRunsShardEndpoint.replace(\"{workspaceId}\", this.envVariables.accountId!).replace(\"{testRunId}\", this.envVariables.runId)}/?api-version=${Constants.API_VERSION}`,\n JSON.stringify(postTestRunShardObject),\n this.envVariables.accessToken,\n \"application/json\",\n this.envVariables.correlationId!,\n );\n if (response.status === 200) {\n return JSON.parse(response.bodyAsText!) as Shard;\n }\n this.handleErrorResponse(response, Constants.patchTestRunShardStart);\n\n throw new Error(\n `Received status ${response.status} from service from PATCH TestRun Shard Start call.`,\n );\n }\n\n async postTestRunShardEnd(\n result: FullResult,\n // eslint-disable-next-line @azure/azure-sdk/ts-use-interface-parameters\n shard: Shard,\n errorMessages: string[],\n attachmentMetadata: UploadMetadata,\n workers: number,\n ): Promise<TestRun> {\n const postTestRunShardObject = this.reporterUtils.getTestRunShardEndObject(\n result,\n shard,\n errorMessages,\n attachmentMetadata,\n workers,\n );\n const response: PipelineResponse = await this.httpService.callAPI(\n \"POST\",\n `${this.getServiceEndpoint()}/${Constants.testRunsShardEndpoint.replace(\"{workspaceId}\", this.envVariables.accountId!).replace(\"{testRunId}\", this.envVariables.runId)}/?api-version=${Constants.API_VERSION}`,\n JSON.stringify(postTestRunShardObject),\n this.envVariables.accessToken,\n \"application/json\",\n this.envVariables.correlationId!,\n );\n if (response.status === 200) {\n return JSON.parse(response.bodyAsText!) as TestRun;\n }\n this.handleErrorResponse(response, Constants.patchTestRunShardEnd);\n\n throw new Error(\n `Received status ${response.status} from service from PATCH TestRun Shard End call.`,\n );\n }\n\n // eslint-disable-next-line @azure/azure-sdk/ts-use-interface-parameters\n async postTestResults(testResults: TestResult[]): Promise<void> {\n try {\n const payload: any = {\n value: testResults,\n };\n const response: PipelineResponse = await this.httpService.callAPI(\n \"POST\",\n `${this.getServiceEndpoint()}/${Constants.testResultsEndpoint.replace(\"{workspaceId}\", this.envVariables.accountId!)}?api-version=${Constants.API_VERSION}`,\n JSON.stringify(payload),\n this.envVariables.accessToken,\n \"application/json\",\n this.envVariables.correlationId!,\n );\n if (response.status === 200) {\n return;\n }\n this.handleErrorResponse(response, Constants.postTestResults);\n } catch (error) {\n reporterLogger.error(`Error occurred while posting test results: ${error}`);\n }\n }\n\n async createStorageUri(): Promise<StorageUri> {\n const response: PipelineResponse = await this.httpService.callAPI(\n \"POST\",\n `${this.getServiceEndpoint()}/${Constants.storageUriEndpoint.replace(\"{workspaceId}\", this.envVariables.accountId!).replace(\"{testRunId}\", this.envVariables.runId)}?api-version=${Constants.API_VERSION}`,\n null,\n this.envVariables.accessToken,\n \"application/json\",\n this.envVariables.correlationId!,\n );\n if (response.status === 200) {\n return JSON.parse(response.bodyAsText!) as StorageUri;\n }\n this.handleErrorResponse(response, Constants.getStorageUri);\n\n throw new Error(`Received status ${response.status} from service from GET StorageUri call.`);\n }\n\n private getServiceEndpoint(): string {\n return process.env[\"PLAYWRIGHT_SERVICE_REPORTING_URL\"]!;\n }\n\n private handleErrorResponse(response: PipelineResponse, action: string): void {\n const statusCode = response.status;\n const errorMessage = Constants.ERROR_MESSAGE[action]?.[statusCode] ?? \"Unknown error occured.\";\n if (!this.isInformationMessagePresent(statusCode.toString())) {\n this.addKeyToInformationMessage(statusCode.toString());\n this.addInformationalMessage(errorMessage);\n }\n process.stdout.write(`${errorMessage}\\n`);\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@azure/microsoft-playwright-testing",
3
- "version": "1.0.0-alpha.20240912.2",
3
+ "version": "1.0.0-alpha.20240916.2",
4
4
  "description": "Package to integrate your Playwright test suite with Microsoft Playwright Testing service",
5
5
  "homepage": "https://github.com/Azure/azure-sdk-for-js/tree/main/sdk/playwrighttesting/microsoft-playwright-testing/README.md",
6
6
  "sdk-type": "client",