Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: fix e2e soft tests #477

Merged
merged 6 commits into from
Sep 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@
{
"isLive": true,
"name": "OxiSwap",
"url": "https://oxiswap.com",
"url": "https://oxiswap.com/",
"tags": ["DeFi"],
"description": "Lightning-Fast Decentralized Exchange Built On The Fuel Network",
"github": "https://github.com/oxiswap",
Expand Down Expand Up @@ -376,7 +376,7 @@
{
"isLive": true,
"name": "Pyth",
"url": "https://pyth.network/",
"url": "https://www.pyth.network/",
"tags": ["Oracle"],
"description": "Build apps with high-fidelity oracle feeds designed for mission-critical systems.",
"github": "https://github.com/pyth-network",
Expand Down Expand Up @@ -442,7 +442,7 @@
{
"isLive": true,
"name": "SQD",
"url": "https://docs.subsquid.io/fuel-indexing/",
"url": "https://docs.sqd.dev/fuel-indexing/",
"tags": ["Indexer"],
"description": "SQD enables permissionless, cost-efficient access to petabytes of high-value Web3 data.",
"github": "https://github.com/subsquid/squid-sdk/tree/master/fuel",
Expand Down
26 changes: 16 additions & 10 deletions packages/e2e-tests/tests/soft/ecosystem/Ecosystem.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,20 +10,26 @@ test.describe('Ecosystem', () => {
const projects = await page.locator('[as="article"]').all();

for (const project of projects) {
const [openPage] = await Promise.all([
context.waitForEvent('page'),
project.click(),
]);

// regex to get only the domain part of url, but excluding "www." when it shows up
const regex = /(?<=\/\/)(?:www\.)?([^\/]+)/;
const pageLink = await project.getByRole('link').last();
const href = await pageLink.getAttribute('href');
const href = (await pageLink.getAttribute('href')) || '';
const hrefDomain = href.match(regex)?.[1] || '';

const newPage = await openPage;
const openedPage = newPage.url();
// skip domain that are not of project website
if (['twitter.com', 'github.com'].indexOf(hrefDomain) === -1) {
// open project in a new tab
console.log(`opening project ${hrefDomain}`);
project.click();
const newPage = await context.waitForEvent('page');
const openedPage = newPage.url();
const openedPageDomain = openedPage.match(regex)?.[1];

expect(openedPage).toBe(href);
// verify if the domain opened in new page is the same of the link that user has clicked
expect(openedPageDomain).toBe(hrefDomain);

await newPage.close();
await newPage.close();
}
}
});
});
Loading