Skip to content

Commit

Permalink
fix: check only domainin e2e soft tests
Browse files Browse the repository at this point in the history
  • Loading branch information
LuizAsFight authored Sep 8, 2024
1 parent f658eca commit d270b3f
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/e2e-tests/tests/soft/ecosystem/Ecosystem.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down

0 comments on commit d270b3f

Please sign in to comment.