Repository: elastic/synthetics
Pull request #848 (2023-10-10 18:42:07)

chore: upgrade playwright to 1.38.1
+ upgrades PW to the latest before doing the release. 


Patch:
diff --git a/bundles/package-lock.json b/bundles/package-lock.json
index 689c2c3..67613dd 100644
--- a/bundles/package-lock.json
+++ b/bundles/package-lock.json
@@ -8,7 +8,7 @@
       "name": "pkg-bundles",
       "version": "0.0.0",
       "dependencies": {
-        "playwright": "=1.38.0"
+        "playwright": "=1.38.1"
       }
     },
     "node_modules/fsevents": {
@@ -25,11 +25,11 @@
       }
     },
     "node_modules/playwright": {
-      "version": "1.38.0",
-      "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.38.0.tgz",
-      "integrity": "sha512-fJGw+HO0YY+fU/F1N57DMO+TmXHTrmr905J05zwAQE9xkuwP/QLDk63rVhmyxh03dYnEhnRbsdbH9B0UVVRB3A==",
+      "version": "1.38.1",
+      "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.38.1.tgz",
+      "integrity": "sha512-oRMSJmZrOu1FP5iu3UrCx8JEFRIMxLDM0c/3o4bpzU5Tz97BypefWf7TuTNPWeCe279TPal5RtPPZ+9lW/Qkow==",
       "dependencies": {
-        "playwright-core": "1.38.0"
+        "playwright-core": "1.38.1"
       },
       "bin": {
         "playwright": "cli.js"
@@ -42,9 +42,9 @@
       }
     },
     "node_modules/playwright-core": {
-      "version": "1.38.0",
-      "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.38.0.tgz",
-      "integrity": "sha512-f8z1y8J9zvmHoEhKgspmCvOExF2XdcxMW8jNRuX4vkQFrzV4MlZ55iwb5QeyiFQgOFCUolXiRHgpjSEnqvO48g==",
+      "version": "1.38.1",
+      "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.38.1.tgz",
+      "integrity": "sha512-tQqNFUKa3OfMf4b2jQ7aGLB8o9bS3bOY0yMEtldtC2+spf8QXG9zvXLTXUeRsoNuxEYMgLYR+NXfAa1rjKRcrg==",
       "bin": {
         "playwright-core": "cli.js"
       },
diff --git a/bundles/package.json b/bundles/package.json
index 0a18d43..d1aac49 100644
--- a/bundles/package.json
+++ b/bundles/package.json
@@ -8,6 +8,6 @@
     "build": "npm run bundle -- --minify"
   },
   "dependencies": {
-    "playwright": "=1.38.0"
+    "playwright": "=1.38.1"
   }
 }
diff --git a/package-lock.json b/package-lock.json
index 3636e40..b4673d5 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -20,8 +20,8 @@
         "micromatch": "^4.0.5",
         "pirates": "^4.0.5",
         "playwright": "=1.38.0",
-        "playwright-chromium": "=1.38.0",
-        "playwright-core": "=1.38.0",
+        "playwright-chromium": "=1.38.1",
+        "playwright-core": "=1.38.1",
         "semver": "^7.5.2",
         "sharp": "^0.32.6",
         "snakecase-keys": "^4.0.1",
@@ -12832,12 +12832,12 @@
       }
     },
     "node_modules/playwright-chromium": {
-      "version": "1.38.0",
-      "resolved": "https://registry.npmjs.org/playwright-chromium/-/playwright-chromium-1.38.0.tgz",
-      "integrity": "sha512-RoqqEMsBwOh7yfnb8hL/QEjd7O767GTqDLL6ZOg8tJtMoHc/66GS6Dl3ODWhLxrkAk6gVkprB0H1RYHnT9F7dg==",
+      "version": "1.38.1",
+      "resolved": "https://registry.npmjs.org/playwright-chromium/-/playwright-chromium-1.38.1.tgz",
+      "integrity": "sha512-97Y6+lN3yOETy/yPQK+LqSCBdldLu5Rkm+Tnj2oGQfcbC5P8R3eWund7GxWqiYFnq0GLwZZ8EnhiBShKnCiVjg==",
       "hasInstallScript": true,
       "dependencies": {
-        "playwright-core": "1.38.0"
+        "playwright-core": "1.38.1"
       },
       "bin": {
         "playwright": "cli.js"
@@ -12847,6 +12847,17 @@
       }
     },
     "node_modules/playwright-core": {
+      "version": "1.38.1",
+      "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.38.1.tgz",
+      "integrity": "sha512-tQqNFUKa3OfMf4b2jQ7aGLB8o9bS3bOY0yMEtldtC2+spf8QXG9zvXLTXUeRsoNuxEYMgLYR+NXfAa1rjKRcrg==",
+      "bin": {
+        "playwright-core": "cli.js"
+      },
+      "engines": {
+        "node": ">=16"
+      }
+    },
+    "node_modules/playwright/node_modules/playwright-core": {
       "version": "1.38.0",
       "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.38.0.tgz",
       "integrity": "sha512-f8z1y8J9zvmHoEhKgspmCvOExF2XdcxMW8jNRuX4vkQFrzV4MlZ55iwb5QeyiFQgOFCUolXiRHgpjSEnqvO48g==",
diff --git a/package.json b/package.json
index a0ba8a7..23475c3 100644
--- a/package.json
+++ b/package.json
@@ -52,8 +52,8 @@
     "micromatch": "^4.0.5",
     "pirates": "^4.0.5",
     "playwright": "=1.38.0",
-    "playwright-chromium": "=1.38.0",
-    "playwright-core": "=1.38.0",
+    "playwright-chromium": "=1.38.1",
+    "playwright-core": "=1.38.1",
     "semver": "^7.5.2",
     "sharp": "^0.32.6",
     "snakecase-keys": "^4.0.1",
diff --git a/src/common_types.ts b/src/common_types.ts
index da50a7a..3b2a0f2 100644
--- a/src/common_types.ts
+++ b/src/common_types.ts
@@ -217,8 +217,6 @@ type BaseArgs = {
   schedule?: MonitorConfig['schedule'];
   locations?: MonitorConfig['locations'];
   privateLocations?: MonitorConfig['privateLocations'];
-  alert?: AlertConfig;
-  retestOnFailure?: MonitorConfig['retestOnFailure'];
 };
 
 export type CliArgs = BaseArgs & {
@@ -249,6 +247,8 @@ export type PushOptions = Partial<ProjectSettings> &
     auth: string;
     kibanaVersion?: string;
     yes?: boolean;
+    alert?: AlertConfig;
+    retestOnFailure?: MonitorConfig['retestOnFailure'];
   };
 
 export type ProjectSettings = {
diff --git a/src/push/monitor.ts b/src/push/monitor.ts
index c95dc03..d104e80 100644
--- a/src/push/monitor.ts
+++ b/src/push/monitor.ts
@@ -242,13 +242,15 @@ export function buildMonitorFromYaml(
     config['private_locations'] ||
     config.privateLocations ||
     options.privateLocations;
-  delete config['private_locations'];
+  const retestOnFailure =
+    config['retest_on_failure'] ?? options.retestOnFailure;
   const alertConfig = parseAlertConfig(config, options.alert);
+
   const mon = new Monitor({
     locations: options.locations,
-    retestOnFailure: options.retestOnFailure,
     tags: options.tags,
-    ...config,
+    ...normalizeConfig(config),
+    retestOnFailure,
     privateLocations,
     schedule: schedule || options.schedule,
     alert: alertConfig,
@@ -264,6 +266,14 @@ export function buildMonitorFromYaml(
   return mon;
 }
 
+// Deletes unncessary fields from the lightweight monitor config
+//  that is not supported by the Kibana API
+function normalizeConfig(config: MonitorConfig) {
+  delete config['private_locations'];
+  delete config['retest_on_failure'];
+  return config;
+}
+
 export const parseAlertConfig = (
   config: MonitorConfig,
   gConfig?: AlertConfig


Test patch:
diff --git a/__tests__/push/monitor.test.ts b/__tests__/push/monitor.test.ts
index f3acff3..13ac783 100644
--- a/__tests__/push/monitor.test.ts
+++ b/__tests__/push/monitor.test.ts
@@ -245,10 +245,11 @@ heartbeat.monitors:
   tags:
     - ltag1
     - ltag2
-  retestOnFailure: true
+  retest_on_failure: true
       `);
 
       const [mon] = await createLightweightMonitors(PROJECT_DIR, {
+        auth: 'foo',
         params: { foo: 'bar' },
         kibanaVersion: '8.8.0',
         locations: ['australia_east'],
@@ -256,7 +257,7 @@ heartbeat.monitors:
         privateLocations: ['gbaz'],
         schedule: 10,
         retestOnFailure: false,
-      } as any);
+      });
 
       expect(mon.config).toEqual({
         id: 'test-icmp',
@@ -280,11 +281,12 @@ heartbeat.monitors:
       `);
 
       const [mon] = await createLightweightMonitors(PROJECT_DIR, {
+        auth: 'foo',
         tags: ['gtag1', 'gtag2'],
         privateLocations: ['gbaz'],
         schedule: 10,
         retestOnFailure: false,
-      } as PushOptions);
+      });
 
       expect(mon.config).toEqual({
         id: 'test-icmp',