Browse Source

Puppeteer E2E test: Bug fix (#25389)

* Puppeteer: Bug fix

* Disable MacOS until a proper solution in #25386
Levi Pesin 2 years ago
parent
commit
be7a33dfc1
2 changed files with 10 additions and 2 deletions
  1. 1 1
      .github/workflows/ci.yml
  2. 9 1
      test/e2e/puppeteer.js

+ 1 - 1
.github/workflows/ci.yml

@@ -58,8 +58,8 @@ jobs:
     strategy:
       fail-fast: false
       matrix:
+        os: [ windows-latest, ubuntu-latest ]
         CI: [ 0, 1, 2, 3, 4, 5, 6, 7 ]
-        os: [ windows-latest, ubuntu-latest, macos-latest ]
     env:
       CI: ${{ matrix.CI }}
       FORCE_COLOR: 1

+ 9 - 1
test/e2e/puppeteer.js

@@ -248,7 +248,15 @@ async function preparePage( page, injection, build, errorMessages ) {
 
 		}
 
-		let text = ( await Promise.all( msg.args().map( arg => arg.executionContext().evaluate( arg => arg instanceof Error ? arg.message : arg, arg ) ) ) ).join( ' ' ); // https://github.com/puppeteer/puppeteer/issues/3397#issuecomment-434970058
+		const args = await Promise.all( msg.args().map( async arg => {
+			try {
+				return await arg.executionContext().evaluate( arg => arg instanceof Error ? arg.message : arg, arg );
+			} catch (e) { // Execution context might have been already destroyed
+				return arg;
+			}
+		} ) );
+
+		let text = args.join( ' ' ); // https://github.com/puppeteer/puppeteer/issues/3397#issuecomment-434970058
 
 		text = text.trim();
 		if ( text === '' ) return;