Repository: elastic/synthetics
Pull request #871 (2023-12-05 01:50:36)

feat: bump playwright to 1.40.1 and update formatter
+ Part of https://github.com/elastic/synthetics/issues/614
+ Updates PW to the latest version `1.40.1`, Also trigger this as a feat to be included as minor version since there are some major changes on the PW side including the formatter which generates locator related code changes. 


Patch:
diff --git a/bundles/package-lock.json b/bundles/package-lock.json
index 67613dd..fc856eb 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.1"
+        "playwright": "=1.40.1"
       }
     },
     "node_modules/fsevents": {
@@ -25,11 +25,11 @@
       }
     },
     "node_modules/playwright": {
-      "version": "1.38.1",
-      "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.38.1.tgz",
-      "integrity": "sha512-oRMSJmZrOu1FP5iu3UrCx8JEFRIMxLDM0c/3o4bpzU5Tz97BypefWf7TuTNPWeCe279TPal5RtPPZ+9lW/Qkow==",
+      "version": "1.40.1",
+      "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.40.1.tgz",
+      "integrity": "sha512-2eHI7IioIpQ0bS1Ovg/HszsN/XKNwEG1kbzSDDmADpclKc7CyqkHw7Mg2JCz/bbCxg25QUPcjksoMW7JcIFQmw==",
       "dependencies": {
-        "playwright-core": "1.38.1"
+        "playwright-core": "1.40.1"
       },
       "bin": {
         "playwright": "cli.js"
@@ -42,9 +42,9 @@
       }
     },
     "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==",
+      "version": "1.40.1",
+      "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.40.1.tgz",
+      "integrity": "sha512-+hkOycxPiV534c4HhpfX6yrlawqVUzITRKwHAmYfmsVreltEl6fAZJ3DPfLMOODw0H3s1Itd6MDCWmP1fl/QvQ==",
       "bin": {
         "playwright-core": "cli.js"
       },
diff --git a/bundles/package.json b/bundles/package.json
index d1aac49..cf6d1c2 100644
--- a/bundles/package.json
+++ b/bundles/package.json
@@ -8,6 +8,6 @@
     "build": "npm run bundle -- --minify"
   },
   "dependencies": {
-    "playwright": "=1.38.1"
+    "playwright": "=1.40.1"
   }
 }
diff --git a/package-lock.json b/package-lock.json
index 1dd3046..f72e9d0 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -19,9 +19,9 @@
         "kleur": "^4.1.5",
         "micromatch": "^4.0.5",
         "pirates": "^4.0.5",
-        "playwright": "=1.38.1",
-        "playwright-chromium": "=1.38.1",
-        "playwright-core": "=1.38.1",
+        "playwright": "=1.40.1",
+        "playwright-chromium": "=1.40.1",
+        "playwright-core": "=1.40.1",
         "semver": "^7.5.4",
         "sharp": "^0.32.6",
         "snakecase-keys": "^4.0.1",
@@ -12812,11 +12812,11 @@
       }
     },
     "node_modules/playwright": {
-      "version": "1.38.1",
-      "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.38.1.tgz",
-      "integrity": "sha512-oRMSJmZrOu1FP5iu3UrCx8JEFRIMxLDM0c/3o4bpzU5Tz97BypefWf7TuTNPWeCe279TPal5RtPPZ+9lW/Qkow==",
+      "version": "1.40.1",
+      "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.40.1.tgz",
+      "integrity": "sha512-2eHI7IioIpQ0bS1Ovg/HszsN/XKNwEG1kbzSDDmADpclKc7CyqkHw7Mg2JCz/bbCxg25QUPcjksoMW7JcIFQmw==",
       "dependencies": {
-        "playwright-core": "1.38.1"
+        "playwright-core": "1.40.1"
       },
       "bin": {
         "playwright": "cli.js"
@@ -12829,12 +12829,12 @@
       }
     },
     "node_modules/playwright-chromium": {
-      "version": "1.38.1",
-      "resolved": "https://registry.npmjs.org/playwright-chromium/-/playwright-chromium-1.38.1.tgz",
-      "integrity": "sha512-97Y6+lN3yOETy/yPQK+LqSCBdldLu5Rkm+Tnj2oGQfcbC5P8R3eWund7GxWqiYFnq0GLwZZ8EnhiBShKnCiVjg==",
+      "version": "1.40.1",
+      "resolved": "https://registry.npmjs.org/playwright-chromium/-/playwright-chromium-1.40.1.tgz",
+      "integrity": "sha512-3atylP47OCTBW0siGI7LOEG/XKL/vnrFH8xdr4uaTnqMsc0Xq4gOLk2gGwniPJ76LSc++9ASc0w/nfqtLAmm3A==",
       "hasInstallScript": true,
       "dependencies": {
-        "playwright-core": "1.38.1"
+        "playwright-core": "1.40.1"
       },
       "bin": {
         "playwright": "cli.js"
@@ -12844,9 +12844,9 @@
       }
     },
     "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==",
+      "version": "1.40.1",
+      "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.40.1.tgz",
+      "integrity": "sha512-+hkOycxPiV534c4HhpfX6yrlawqVUzITRKwHAmYfmsVreltEl6fAZJ3DPfLMOODw0H3s1Itd6MDCWmP1fl/QvQ==",
       "bin": {
         "playwright-core": "cli.js"
       },
diff --git a/package.json b/package.json
index 3f8b9a6..325ba18 100644
--- a/package.json
+++ b/package.json
@@ -51,9 +51,9 @@
     "kleur": "^4.1.5",
     "micromatch": "^4.0.5",
     "pirates": "^4.0.5",
-    "playwright": "=1.38.1",
-    "playwright-chromium": "=1.38.1",
-    "playwright-core": "=1.38.1",
+    "playwright": "=1.40.1",
+    "playwright-chromium": "=1.40.1",
+    "playwright-core": "=1.40.1",
     "semver": "^7.5.4",
     "sharp": "^0.32.6",
     "snakecase-keys": "^4.0.1",
diff --git a/src/formatter/javascript.ts b/src/formatter/javascript.ts
index a2ac0c3..2b8af6a 100644
--- a/src/formatter/javascript.ts
+++ b/src/formatter/javascript.ts
@@ -101,23 +101,15 @@ function toAssertCall(pageAlias: string, action: Action) {
 }
 
 function toSignalMap(action: Action) {
-  let waitForNavigation: Signal | undefined;
-  let assertNavigation: Signal | undefined;
   let popup: Signal | undefined;
   let download: Signal | undefined;
   let dialog: Signal | undefined;
   for (const signal of action.signals) {
-    if (signal.name === 'navigation' && signal.isAsync)
-      waitForNavigation = signal;
-    else if (signal.name === 'navigation' && !signal.isAsync)
-      assertNavigation = signal;
-    else if (signal.name === 'popup') popup = signal;
+    if (signal.name === 'popup') popup = signal;
     else if (signal.name === 'download') download = signal;
     else if (signal.name === 'dialog') dialog = signal;
   }
   return {
-    waitForNavigation,
-    assertNavigation,
     popup,
     download,
     dialog,
@@ -280,8 +272,7 @@ export class SyntheticsGenerator extends JavaScriptLanguageGenerator {
     if (isAssert && action.command) {
       formatter.add(toAssertCall(pageAlias, action));
     } else {
-      const actionCall = super._generateActionCall(action);
-      formatter.add(`await ${subject}.${actionCall};`);
+      formatter.add(super._generateActionCall(subject, action));
     }
 
     if (signals.popup)


Test patch:
diff --git a/__tests__/options.test.ts b/__tests__/options.test.ts
index 2536fdc..d356870 100644
--- a/__tests__/options.test.ts
+++ b/__tests__/options.test.ts
@@ -66,7 +66,7 @@ describe('options', () => {
         ignoreHTTPSErrors: undefined,
         isMobile: true,
         userAgent:
-          'Mozilla/5.0 (Linux; Android 8.0.0; SM-G965U Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/117.0.5938.62 Mobile Safari/537.36',
+          'Mozilla/5.0 (Linux; Android 8.0.0; SM-G965U Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.6099.28 Mobile Safari/537.36',
         viewport: {
           height: 658,
           width: 320,