Skip to content

Commit

Permalink
Further e2e fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
swissspidy committed Sep 29, 2023
1 parent e4898a0 commit 6957bc9
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
11 changes: 10 additions & 1 deletion packages/e2e-tests/src/plugins/disable-gravatar.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,22 @@

namespace Google\Web_Stories\E2E\BlockDirectory;

// Hat tip https://github.com/norcross/airplane-mode

add_filter(
'get_avatar',
static function ( $avatar, $id_or_email, $size, $default, $alt ) {
// Hat tip https://github.com/norcross/airplane-mode
$image = 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';
return "<img alt='{$alt}' src='{$image}' class='avatar avatar-{$size} photo' height='{$size}' width='{$size}' style='background:#eee;' />";
},
1,
5
);

add_filter(
'get_avatar_url',
static function () {
return 'data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw==';
},
1
);
13 changes: 3 additions & 10 deletions patches/expect-puppeteer+9.0.0.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
diff --git a/node_modules/expect-puppeteer/dist/index.js b/node_modules/expect-puppeteer/dist/index.js
index 9db58ab..e1718b8 100644
index 9db58ab..dd27744 100644
--- a/node_modules/expect-puppeteer/dist/index.js
+++ b/node_modules/expect-puppeteer/dist/index.js
@@ -4,13 +4,13 @@ const checkIsPuppeteerInstance = (instance)=>{
Expand All @@ -10,19 +10,12 @@ index 9db58ab..e1718b8 100644
+ return checkIsPuppeteerInstance(instance) && (instance?.constructor?.name === "CDPPage" || instance?.constructor?.name === "CdpPage");
};
const checkIsFrame = (instance)=>{
return checkIsPuppeteerInstance(instance) && instance?.constructor?.name === "Frame";
- return checkIsPuppeteerInstance(instance) && instance?.constructor?.name === "Frame";
+ return checkIsPuppeteerInstance(instance) && (instance?.constructor?.name === "CDPFrame" || instance?.constructor?.name === "CdpFrame");
};
const checkIsElementHandle = (instance)=>{
- return checkIsPuppeteerInstance(instance) && instance?.constructor?.name === "CDPElementHandle";
+ return checkIsPuppeteerInstance(instance) && (instance?.constructor?.name === "CDPElementHandle" || instance?.constructor?.name === "CdpElementHandle");
};
const getContext = async (instance, pageFunction)=>{
if (checkIsFrame(instance) || checkIsPage(instance)) {
@@ -485,6 +485,7 @@ const expectPuppeteerInstance = (actual)=>{
if (checkIsElementHandle(actual)) {
return createExpect(actual, elementHandleMatchers);
}
+ console.log(actual, actual?.constructor?.name);
throw new Error(`${actual} is not supported`);
};
const expectPuppeteer = (actual)=>{

0 comments on commit 6957bc9

Please sign in to comment.