@cronn/playwright-utils 0.10.0 → 0.10.1

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/dist/index.d.mts CHANGED
@@ -618,9 +618,9 @@ export declare function getCspHeader(response: Response | null): Promise<string>
618
618
  */
619
619
  export declare function cspReport(header: string): string;
620
620
  //#endregion
621
- //#region src/security/response-header-report.d.ts
621
+ //#region src/security/response-headers-report.d.ts
622
622
  type ResponseHeaderType = "document" | "api";
623
- interface ResponseHeaderReportOptions {
623
+ interface ResponseHeadersReportOptions {
624
624
  type: ResponseHeaderType;
625
625
  }
626
626
  /**
@@ -643,12 +643,12 @@ export declare function getResponseHeaders(response: Response | APIResponse | nu
643
643
  * const response = await page.goto("/");
644
644
  * const headers = await getResponseHeaders(response);
645
645
  *
646
- * expect(responseHeaderReport(headers, { type: "document" })).toMatchTextFile({
646
+ * expect(responseHeadersReport(headers, { type: "document" })).toMatchTextFile({
647
647
  * fileExtension: "md",
648
648
  * });
649
649
  * ```
650
650
  */
651
- export declare function responseHeaderReport(headers: Record<string, string>, options: ResponseHeaderReportOptions): string;
651
+ export declare function responseHeadersReport(headers: Record<string, string>, options: ResponseHeadersReportOptions): string;
652
652
  //#endregion
653
653
  //#region src/file.d.ts
654
654
  /**
@@ -789,4 +789,4 @@ export declare function maskedValueWithIndex(name: string): (index: number) => s
789
789
  */
790
790
  type PlaywrightTarget = Page | Locator;
791
791
  //#endregion
792
- export type { ConsoleMessageFilter, ConsoleMessageLevel, CspFixtures, CspViolation, ExtendedLocator, FormFields, HttpMethod, PlaywrightTarget, ResponseHandler, ResponseHeaderReportOptions, ResponseHeaderType, RoleLocators, RouteFilter };
792
+ export type { ConsoleMessageFilter, ConsoleMessageLevel, CspFixtures, CspViolation, ExtendedLocator, FormFields, HttpMethod, PlaywrightTarget, ResponseHandler, ResponseHeaderType, ResponseHeadersReportOptions, RoleLocators, RouteFilter };
package/dist/index.mjs CHANGED
@@ -1028,7 +1028,7 @@ function formatValues(values) {
1028
1028
  return codeOrNone(values.join(" "));
1029
1029
  }
1030
1030
  //#endregion
1031
- //#region src/security/response-header-report.ts
1031
+ //#region src/security/response-headers-report.ts
1032
1032
  const ACTION_ORDER = [
1033
1033
  "add",
1034
1034
  "change",
@@ -1108,12 +1108,12 @@ async function getResponseHeaders(response) {
1108
1108
  * const response = await page.goto("/");
1109
1109
  * const headers = await getResponseHeaders(response);
1110
1110
  *
1111
- * expect(responseHeaderReport(headers, { type: "document" })).toMatchTextFile({
1111
+ * expect(responseHeadersReport(headers, { type: "document" })).toMatchTextFile({
1112
1112
  * fileExtension: "md",
1113
1113
  * });
1114
1114
  * ```
1115
1115
  */
1116
- function responseHeaderReport(headers, options) {
1116
+ function responseHeadersReport(headers, options) {
1117
1117
  const recommendedHeaders = RECOMMENDED_HEADERS[options.type];
1118
1118
  const discouragedHeaders = DISCOURAGED_HEADERS[options.type];
1119
1119
  const headersByName = new Map(Object.entries(headers).map(([name, value]) => [name.toLowerCase(), value]));
@@ -1129,7 +1129,7 @@ function responseHeaderReport(headers, options) {
1129
1129
  action: "remove",
1130
1130
  message: "Remove header"
1131
1131
  }))].sort((a, b) => ACTION_ORDER.indexOf(a.action) - ACTION_ORDER.indexOf(b.action));
1132
- return markdownDocument("Response Header Report", [{
1132
+ return markdownDocument("Response Headers Report", [{
1133
1133
  heading: "Detected Headers",
1134
1134
  content: markdownTableOrNone(["Header", "Value"], detectedHeaders.map((header) => [code(header.name), formatValue(header)]))
1135
1135
  }, {
@@ -1420,4 +1420,4 @@ function identity(value) {
1420
1420
  return value;
1421
1421
  }
1422
1422
  //#endregion
1423
- export { ConsoleCaptor, CspCaptor, RouteInterceptor, RouteInterceptorFixture, captureConsole, captureCspViolations, createFetchAdapter, cspFixtures, cspReport, extendLocator, formFiller, getCspHeader, getResponseHeaders, hasLogLevel, interceptRoute, isCI, maskBaseURL, maskedValue, maskedValueWithIndex, matchPath, modifyJsonBody, modifyTextBody, resolveFromPackageRoot, responseHeaderReport, roleLocators };
1423
+ export { ConsoleCaptor, CspCaptor, RouteInterceptor, RouteInterceptorFixture, captureConsole, captureCspViolations, createFetchAdapter, cspFixtures, cspReport, extendLocator, formFiller, getCspHeader, getResponseHeaders, hasLogLevel, interceptRoute, isCI, maskBaseURL, maskedValue, maskedValueWithIndex, matchPath, modifyJsonBody, modifyTextBody, resolveFromPackageRoot, responseHeadersReport, roleLocators };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cronn/playwright-utils",
3
- "version": "0.10.0",
3
+ "version": "0.10.1",
4
4
  "description": "Utilities for writing tests with Playwright",
5
5
  "keywords": [
6
6
  "playwright",