From e10e44078755439e6fe8e67f66b8023490a2dc2e Mon Sep 17 00:00:00 2001 From: Pablo Costa Date: Wed, 17 Apr 2024 19:32:45 -0300 Subject: [PATCH] Fix Facebook share test --- .../cypress/e2e/integration/socialShareButtons.cy.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/site/gatsby-site/cypress/e2e/integration/socialShareButtons.cy.js b/site/gatsby-site/cypress/e2e/integration/socialShareButtons.cy.js index 815c784dff..3f960c0c42 100644 --- a/site/gatsby-site/cypress/e2e/integration/socialShareButtons.cy.js +++ b/site/gatsby-site/cypress/e2e/integration/socialShareButtons.cy.js @@ -116,7 +116,14 @@ describe('Social Share buttons on pages', { retries: { runMode: 4 } }, () => { cy.get('[data-cy=btn-share-facebook]').first().click(); cy.get('@popup_facebook', { timeout: 8000 }).should('be.called'); - cy.url().should('contain', `https://www.facebook.com/sharer/sharer.php?u=${canonicalUrl}`); + // Take into consideration that the Facebook share button can open a new window with two different URLs depending on the environment + cy.url().should( + 'satisfy', + (url) => + (url.includes('https://www.facebook.com/login.php') && + url.includes('next=https%3A%2F%2Fwww.facebook.com%2Fsharer%2Fsharer.php')) || + url.includes(`https://www.facebook.com/sharer/sharer.php?u=${canonicalUrl}`) + ); }); }); });