Skip to content

Commit

Permalink
test added
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexChetverov committed Oct 30, 2023
1 parent 8491b8f commit b9b22ae
Showing 1 changed file with 41 additions and 2 deletions.
43 changes: 41 additions & 2 deletions test/microapps-ui-xcm/microapps-ui-main.liq.pools.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/
import { jest } from "@jest/globals";
import { WebDriver } from "selenium-webdriver";
import { getApi, initApi } from "../../utils/api";
import { getApi, getMangataInstance, initApi } from "../../utils/api";
import { DriverBuilder } from "../../utils/frontend/utils/Driver";
import { Node } from "../../utils/Framework/Node/Node";
import {
Expand Down Expand Up @@ -113,7 +113,7 @@ describe("Miocroapps UI liq pools tests", () => {
it("User can enter MGX-KSM pool details", async () => {
await setupPageWithState(driver, acc_name);
const sidebar = new Sidebar(driver);
await sidebar.clickNavLiqPools();
await sidebar.clickNavLiqPools;

const poolsList = new LiqPools(driver);
const isPoolsListDisplayed = await poolsList.isDisplayed();
Expand Down Expand Up @@ -386,6 +386,45 @@ describe("Miocroapps UI liq pools tests", () => {
expect(isEstRewardDisplayed).toBeTruthy();
});

it("All promoted pools exist in app", async () => {
const sdk = await getMangataInstance();
const api = await getApi();
const promotedPoolsRewards =
await api.query.proofOfStake.promotedPoolRewards();
const promotedPools = JSON.parse(
JSON.stringify(Object.keys(promotedPoolsRewards.toHuman())),
);
const promotedPoolsLength = promotedPools.length;
const poolsInfo = [];
for (let i = 0; i < promotedPoolsLength; i++) {
const poolName = await sdk.query.getLiquidityPool(promotedPools[i]);
const firstTokenId = await sdk.query.getTokenInfo(poolName[0]);
const secondTokenId = await sdk.query.getTokenInfo(poolName[1]);
const a = {
poolID: promotedPools[i],
firstToken: firstTokenId.symbol,
secondToken: secondTokenId.symbol,
};
poolsInfo.push(a);
}
const poolsInfoLength = poolsInfo.length;

const sidebar = new Sidebar(driver);
await sidebar.clickNavLiqPools();
const poolsList = new LiqPools(driver);

for (let i = 0; i < poolsInfoLength; i++) {
const isPoolVisible =
(await poolsList.isPoolItemDisplayed(
"-" + poolsInfo[i].secondToken + "-" + poolsInfo[i].firstToken,
)) ||
(await poolsList.isPoolItemDisplayed(
"-" + poolsInfo[i].firstToken + "-" + poolsInfo[i].secondToken,
));
expect(isPoolVisible).toBeTruthy();
}
});

afterEach(async () => {
const session = await driver.getSession();
await addExtraLogs(
Expand Down

0 comments on commit b9b22ae

Please sign in to comment.