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

add API stubbing for addAsset and test gh action #1748

Closed
wants to merge 1 commit into from
Closed
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
2 changes: 1 addition & 1 deletion .github/workflows/runTests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- run: yarn build:freighter-api
- run: yarn build:extension
- run: yarn test:ci
- run: yarn test:e2e
- run: ${{ github.base_ref == 'master' && 'IS_INTEGRATION_MODE=true' }} yarn test:e2e
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
Expand Down
50 changes: 40 additions & 10 deletions extension/e2e-tests/addAsset.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,43 @@ import { test, expect, expectPageToHaveScreenshot } from "./test-fixtures";
import { loginToTestAccount, PASSWORD } from "./helpers/login";
import { TEST_TOKEN_ADDRESS } from "./helpers/test-token";

test.skip("Adding unverified Soroban token", async ({ page, extensionId }) => {
const USDC_TOKEN_ADDRESS =
"CBIELTK6YBZJU5UP2WWQEUCYKLPU6AUNZ2BQ4WWFEIE3USCIHMXQDAMA";

const STELLAR_EXPERT_ASSET_LIST_JSON = {
name: "StellarExpert Top 50",
provider: "StellarExpert",
description:
"Dynamically generated list based on technical asset metrics, including payments and trading volumes, interoperability, userbase, etc. Assets included in this list were not verified by StellarExpert team. StellarExpert is not affiliated with issuers, and does not endorse or advertise assets in the list. Assets reported for fraudulent activity removed from the list automatically.",
version: "1.0",
network: "testnet",
feedback: "https://stellar.expert",
assets: [
{
code: "USDC",
issuer: "GBBD47IF6LWK7P7MDEVSCWR7DPUWV3NY3DTQEVFL4NAT4AQH3ZLLFLA5",
contract: USDC_TOKEN_ADDRESS,
name: "USDC",
org: "unknown",
domain: "centre.io",
decimals: 7,
},
],
};

test("Adding unverified Soroban token", async ({ page, extensionId }) => {
console.log(process.env.IS_INTEGRATION_MODE);
if (!process.env.IS_INTEGRATION_MODE) {
await page.route("*/**/testnet/asset-list/top50", async (route) => {
const json = [STELLAR_EXPERT_ASSET_LIST_JSON];
await route.fulfill({ json });
});
}
test.slow();
await loginToTestAccount({ page, extensionId });

await page.getByTestId("account-options-dropdown").click();
await page.getByText("Manage Assets").click({ force: true });
await page.getByText("Manage assets").click({ force: true });
await expect(page.getByText("Your assets")).toBeVisible();
await expectPageToHaveScreenshot({
page,
Expand All @@ -34,13 +65,12 @@ test.skip("Adding unverified Soroban token", async ({ page, extensionId }) => {
await expect(page.getByTestId("account-view")).toContainText("E2E");
});
test("Adding Soroban verified token", async ({ page, extensionId }) => {
const assetsList = await fetch(
"https://api.stellar.expert/explorer/testnet/asset-list/top50",
);
const assetsListData = await assetsList.json();
const verifiedToken =
assetsListData?.assets[0]?.contract ||
"CBIELTK6YBZJU5UP2WWQEUCYKLPU6AUNZ2BQ4WWFEIE3USCIHMXQDAMA";
if (!process.env.IS_INTEGRATION_MODE) {
await page.route("*/**/testnet/asset-list/top50", async (route) => {
const json = [STELLAR_EXPERT_ASSET_LIST_JSON];
await route.fulfill({ json });
});
}

test.slow();
await loginToTestAccount({ page, extensionId });
Expand All @@ -51,7 +81,7 @@ test("Adding Soroban verified token", async ({ page, extensionId }) => {
await expect(page.getByText("Your assets")).toBeVisible();
await page.getByText("Add an asset").click({ force: true });
await page.getByText("Add manually").click({ force: true });
await page.getByTestId("search-token-input").fill(verifiedToken);
await page.getByTestId("search-token-input").fill(USDC_TOKEN_ADDRESS);
await expect(page.getByTestId("asset-notification")).toHaveText(
"On your listsFreighter uses asset lists to check assets you interact with. You can define your own assets lists in Settings.",
);
Expand Down
Loading