From d270b3f9aae7a2f3c282ff5716fe80b82a68c9e7 Mon Sep 17 00:00:00 2001 From: Luiz Gomes <8636507+LuizAsFight@users.noreply.github.com> Date: Sat, 7 Sep 2024 23:56:11 -0300 Subject: [PATCH] fix: check only domainin e2e soft tests --- packages/e2e-tests/tests/soft/ecosystem/Ecosystem.test.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/e2e-tests/tests/soft/ecosystem/Ecosystem.test.ts b/packages/e2e-tests/tests/soft/ecosystem/Ecosystem.test.ts index d187ea51d..6012d560a 100644 --- a/packages/e2e-tests/tests/soft/ecosystem/Ecosystem.test.ts +++ b/packages/e2e-tests/tests/soft/ecosystem/Ecosystem.test.ts @@ -16,12 +16,16 @@ test.describe('Ecosystem', () => { ]); const pageLink = await project.getByRole('link').last(); - const href = await pageLink.getAttribute('href'); + const href = (await pageLink.getAttribute('href')) || ''; const newPage = await openPage; const openedPage = newPage.url(); + // create regex to get only the domain part of url, but excluding www. when it shows up + const regex = /(?<=\/\/)(?:www\.)?([^\/]+)/; + const openedPageDomain = openedPage.match(regex); + const hrefDomain = href.match(regex); - expect(openedPage).toBe(href); + expect(openedPageDomain).toBe(hrefDomain); await newPage.close(); }