Skip to content

Commit

Permalink
Added test result to GH Annotations (#4036)
Browse files Browse the repository at this point in the history
* Added test result to GH Annotations

* Bump Keplr version
  • Loading branch information
yury-dubinin authored Jan 29, 2025
1 parent b1be6c7 commit 098199f
Show file tree
Hide file tree
Showing 9 changed files with 339 additions and 148 deletions.
Binary file not shown.
1 change: 1 addition & 0 deletions packages/e2e/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"setup": "yarn install && npx playwright install --with-deps chromium"
},
"dependencies": {
"@actions/core": "^1.11.1",
"@playwright/test": "1.49.0",
"decompress": "4.2.1",
"dotenv": "16.4.5"
Expand Down
8 changes: 4 additions & 4 deletions packages/e2e/tests/monitoring.limit.wallet.spec.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import * as core from '@actions/core'
import { type BrowserContext, chromium, expect, test } from '@playwright/test'
import { TestConfig } from '../test-config'
import { UnzipExtension } from '../unzip-extension'

import { WalletPage } from '../pages/keplr-page'
import { TradePage } from '../pages/trade-page'
import { TestConfig } from '../test-config'
import { UnzipExtension } from '../unzip-extension'

test.describe('Test Filled Limit Order feature', () => {
let context: BrowserContext
Expand Down Expand Up @@ -44,7 +44,7 @@ test.describe('Test Filled Limit Order feature', () => {
console.log(`Test [${testInfo.title}] status: ${testInfo.status}`)
if (testInfo.status === 'failed') {
const name = testInfo.title
process.env.GITHUB_STEP_SUMMARY = `Test ${name} failed.`
core.notice(`Test ${name} failed.`)
}
})

Expand Down
5 changes: 2 additions & 3 deletions packages/e2e/tests/monitoring.market.wallet.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as core from '@actions/core'
import { type BrowserContext, chromium, expect, test } from '@playwright/test'

import { TestConfig } from '../test-config'
import { UnzipExtension } from '../unzip-extension'

Expand Down Expand Up @@ -46,8 +46,7 @@ test.describe('Test Market Buy/Sell Order feature', () => {
console.log(`Test [${testInfo.title}] status: ${testInfo.status}`)
if (testInfo.status === 'failed') {
const name = testInfo.title
process.env.GITHUB_STEP_SUMMARY = `Test ${name} failed.`
console.log(`GITHUB_STEP_SUMMARY: ${process.env.GITHUB_STEP_SUMMARY}`)
core.notice(`Test ${name} failed.`)
}
})

Expand Down
11 changes: 10 additions & 1 deletion packages/e2e/tests/monitoring.swap.wallet.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as core from '@actions/core'
import { type BrowserContext, chromium, expect, test } from '@playwright/test'

import { WalletPage } from '../pages/keplr-page'
import { TradePage } from '../pages/trade-page'
import { TestConfig } from '../test-config'
Expand Down Expand Up @@ -41,6 +41,15 @@ test.describe('Test Swap Stables feature', () => {
await context.close()
})

// biome-ignore lint/correctness/noEmptyPattern: <explanation>
test.afterEach(async ({}, testInfo) => {
console.log(`Test [${testInfo.title}] status: ${testInfo.status}`)
if (testInfo.status === 'failed') {
const name = testInfo.title
core.notice(`Test ${name} failed.`)
}
})

// biome-ignore lint/complexity/noForEach: <explanation>
;[
{ from: 'USDC', to: 'USDC.eth.axl' },
Expand Down
11 changes: 10 additions & 1 deletion packages/e2e/tests/swap.osmo.wallet.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as core from '@actions/core'
import { type BrowserContext, chromium, expect, test } from '@playwright/test'

import { TestConfig } from '../test-config'
import { UnzipExtension } from '../unzip-extension'

Expand Down Expand Up @@ -44,6 +44,15 @@ test.describe('Test Swap to/from OSMO feature', () => {
await context.close()
})

// biome-ignore lint/correctness/noEmptyPattern: <explanation>
test.afterEach(async ({}, testInfo) => {
console.log(`Test [${testInfo.title}] status: ${testInfo.status}`)
if (testInfo.status === 'failed') {
const name = testInfo.title
core.notice(`Test ${name} failed.`)
}
})

test.skip('User should be able to swap OSMO to WBTC', async () => {
await tradePage.goto()
await tradePage.selectPair('OSMO', 'WBTC')
Expand Down
251 changes: 117 additions & 134 deletions packages/e2e/tests/swap.usdc.wallet.spec.ts
Original file line number Diff line number Diff line change
@@ -1,184 +1,167 @@
import { type BrowserContext, chromium, expect, test } from '@playwright/test'
import * as core from "@actions/core";
import { type BrowserContext, chromium, expect, test } from "@playwright/test";
import { TestConfig } from "../test-config";
import { UnzipExtension } from "../unzip-extension";

import { TestConfig } from '../test-config'
import { UnzipExtension } from '../unzip-extension'
import { WalletPage } from "../pages/keplr-page";
import { TradePage } from "../pages/trade-page";

import { WalletPage } from '../pages/keplr-page'
import { TradePage } from '../pages/trade-page'

test.describe('Test Swap to/from USDC feature', () => {
let context: BrowserContext
test.describe("Test Swap to/from USDC feature", () => {
let context: BrowserContext;
const _walletId =
process.env.WALLET_ID ?? 'osmo1qyc8u7cn0zjxcu9dvrjz5zwfnn0ck92v62ak9l'
const privateKey = process.env.PRIVATE_KEY ?? 'private_key'
let tradePage: TradePage
process.env.WALLET_ID ?? "osmo1qyc8u7cn0zjxcu9dvrjz5zwfnn0ck92v62ak9l";
const privateKey = process.env.PRIVATE_KEY ?? "private_key";
let tradePage: TradePage;
const _USDC =
'ibc/498A0751C798A0D9A389AA3691123DADA57DAA4FE165D5C75894505B876BA6E4'
"ibc/498A0751C798A0D9A389AA3691123DADA57DAA4FE165D5C75894505B876BA6E4";
const _ATOM =
'ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2'
"ibc/27394FB092D2ECCD56123C74F36E4C1F926001CEADA9CA97EA622B25F41E5EB2";
const _TIA =
'ibc/D79E7D83AB399BFFF93433E54FAA480C191248FC556924A2A8351AE2638B3877'
"ibc/D79E7D83AB399BFFF93433E54FAA480C191248FC556924A2A8351AE2638B3877";
const _INJ =
'ibc/64BA6E31FE887D66C6F8F31C7B1A80C7CA179239677B4088BB55F5EA07DBE273'
"ibc/64BA6E31FE887D66C6F8F31C7B1A80C7CA179239677B4088BB55F5EA07DBE273";
const _AKT =
'ibc/1480B8FD20AD5FCAE81EA87584D269547DD4D436843C1D20F15E00EB64743EF4'
"ibc/1480B8FD20AD5FCAE81EA87584D269547DD4D436843C1D20F15E00EB64743EF4";

test.beforeAll(async () => {
const pathToExtension = new UnzipExtension().getPathToExtension()
console.log('\nSetup Wallet Extension before tests.')
const pathToExtension = new UnzipExtension().getPathToExtension();
console.log("\nSetup Wallet Extension before tests.");
// Launch Chrome with a Keplr wallet extension
context = await chromium.launchPersistentContext(
'',
new TestConfig().getBrowserExtensionConfig(false, pathToExtension),
)
"",
new TestConfig().getBrowserExtensionConfig(false, pathToExtension)
);
// Get all new pages (including Extension) in the context and wait
const emptyPage = context.pages()[0]
await emptyPage.waitForTimeout(2000)
const page = context.pages()[1]
const walletPage = new WalletPage(page)
const emptyPage = context.pages()[0];
await emptyPage.waitForTimeout(2000);
const page = context.pages()[1];
const walletPage = new WalletPage(page);
// Import existing Wallet (could be aggregated in one function).
await walletPage.importWalletWithPrivateKey(privateKey)
await walletPage.setWalletNameAndPassword('Test Swaps')
await walletPage.selectChainsAndSave()
await walletPage.finish()
await walletPage.importWalletWithPrivateKey(privateKey);
await walletPage.setWalletNameAndPassword("Test Swaps");
await walletPage.selectChainsAndSave();
await walletPage.finish();
// Switch to Application
tradePage = new TradePage(context.pages()[0])
await tradePage.goto()
await tradePage.connectWallet()
expect(await tradePage.isError(), 'Swap is not available!').toBeFalsy()
})
tradePage = new TradePage(context.pages()[0]);
await tradePage.goto();
await tradePage.connectWallet();
expect(await tradePage.isError(), "Swap is not available!").toBeFalsy();
});

test.afterAll(async () => {
await context.close()
})

test('User should be able to swap OSMO to USDC', async () => {
await tradePage.goto()
await tradePage.selectPair('OSMO', 'USDC')
await tradePage.enterAmount('0.2')
await tradePage.showSwapInfo()
await tradePage.swapAndApprove(context)
//expect(msgContent).toContain(`token_out_denom: ${USDC}`);
//expect(msgContent).toContain(`sender: ${walletId}`);
//expect(msgContent).toContain("denom: uosmo");
await tradePage.isTransactionSuccesful()
await tradePage.getTransactionUrl()
})
await context.close();
});

test('User should be able to swap USDC to OSMO', async () => {
await tradePage.goto()
await tradePage.selectPair('USDC', 'OSMO')
await tradePage.enterAmount('0.1')
await tradePage.showSwapInfo()
await tradePage.swapAndApprove(context)
//expect(msgContent).toContain("token_out_denom: uosmo");
//expect(msgContent).toContain(`sender: ${walletId}`);
//expect(msgContent).toContain(`denom: ${USDC}`);
await tradePage.isTransactionSuccesful()
await tradePage.getTransactionUrl()
})
// biome-ignore lint/correctness/noEmptyPattern: <explanation>
test.afterEach(async ({}, testInfo) => {
console.log(`Test [${testInfo.title}] status: ${testInfo.status}`);
if (testInfo.status === "failed") {
const name = testInfo.title;
core.notice(`Test ${name} failed.`);
}
});

test('User should be able to swap ATOM to USDC', async () => {
await tradePage.goto()
await tradePage.selectPair('ATOM', 'USDC')
await tradePage.enterAmount('0.015')
await tradePage.showSwapInfo()
await tradePage.swapAndApprove(context)
test("User should be able to swap ATOM to USDC", async () => {
await tradePage.goto();
await tradePage.selectPair("ATOM", "USDC");
await tradePage.enterAmount("0.015");
await tradePage.showSwapInfo();
await tradePage.swapAndApprove(context);
//expect(msgContent).toContain(`denom: ${ATOM}`);
//expect(msgContent).toContain(`sender: ${walletId}`);
//expect(msgContent).toContain(`token_out_denom: ${USDC}`);
await tradePage.isTransactionSuccesful()
await tradePage.getTransactionUrl()
})
await tradePage.isTransactionSuccesful();
await tradePage.getTransactionUrl();
});

test('User should be able to swap USDC to ATOM', async () => {
await tradePage.goto()
await tradePage.selectPair('USDC', 'ATOM')
await tradePage.enterAmount('0.1')
await tradePage.showSwapInfo()
await tradePage.swapAndApprove(context)
test("User should be able to swap USDC to ATOM", async () => {
await tradePage.goto();
await tradePage.selectPair("USDC", "ATOM");
await tradePage.enterAmount("0.1");
await tradePage.showSwapInfo();
await tradePage.swapAndApprove(context);
//expect(msgContent).toContain(`denom: ${USDC}`);
//expect(msgContent).toContain(`sender: ${walletId}`);
//expect(msgContent).toContain(`token_out_denom: ${ATOM}`);
await tradePage.isTransactionSuccesful()
await tradePage.getTransactionUrl()
})
await tradePage.isTransactionSuccesful();
await tradePage.getTransactionUrl();
});

test('User should be able to swap USDC to TIA', async () => {
await tradePage.goto()
await tradePage.selectPair('USDC', 'TIA')
await tradePage.enterAmount('0.1')
await tradePage.showSwapInfo()
await tradePage.swapAndApprove(context)
test("User should be able to swap USDC to TIA", async () => {
await tradePage.goto();
await tradePage.selectPair("USDC", "TIA");
await tradePage.enterAmount("0.1");
await tradePage.showSwapInfo();
await tradePage.swapAndApprove(context);
//expect(msgContent).toContain(`denom: ${USDC}`);
//expect(msgContent).toContain(`sender: ${walletId}`);
//expect(msgContent).toContain(`token_out_denom: ${TIA}`);
await tradePage.isTransactionSuccesful()
await tradePage.getTransactionUrl()
})
await tradePage.isTransactionSuccesful();
await tradePage.getTransactionUrl();
});

test('User should be able to swap TIA to USDC', async () => {
await tradePage.goto()
await tradePage.selectPair('TIA', 'USDC')
await tradePage.enterAmount('0.02')
await tradePage.showSwapInfo()
await tradePage.swapAndApprove(context)
test("User should be able to swap TIA to USDC", async () => {
await tradePage.goto();
await tradePage.selectPair("TIA", "USDC");
await tradePage.enterAmount("0.02");
await tradePage.showSwapInfo();
await tradePage.swapAndApprove(context);
//expect(msgContent).toContain(`denom: ${TIA}`);
//expect(msgContent).toContain(`sender: ${walletId}`);
//expect(msgContent).toContain(`token_out_denom: ${USDC}`);
await tradePage.isTransactionSuccesful()
await tradePage.getTransactionUrl()
})
await tradePage.isTransactionSuccesful();
await tradePage.getTransactionUrl();
});

test('User should be able to swap USDC to INJ', async () => {
await tradePage.goto()
await tradePage.selectPair('USDC', 'INJ')
await tradePage.enterAmount('0.2')
await tradePage.showSwapInfo()
await tradePage.swapAndApprove(context)
test("User should be able to swap USDC to INJ", async () => {
await tradePage.goto();
await tradePage.selectPair("USDC", "INJ");
await tradePage.enterAmount("0.2");
await tradePage.showSwapInfo();
await tradePage.swapAndApprove(context);
//expect(msgContent).toContain(`denom: ${USDC}`);
//expect(msgContent).toContain(`sender: ${walletId}`);
//expect(msgContent).toContain(`token_out_denom: ${INJ}`);
await tradePage.isTransactionSuccesful()
await tradePage.getTransactionUrl()
})
await tradePage.isTransactionSuccesful();
await tradePage.getTransactionUrl();
});

test('User should be able to swap INJ to USDC', async () => {
await tradePage.goto()
await tradePage.selectPair('INJ', 'USDC')
await tradePage.enterAmount('0.01')
await tradePage.showSwapInfo()
await tradePage.swapAndApprove(context)
test("User should be able to swap INJ to USDC", async () => {
await tradePage.goto();
await tradePage.selectPair("INJ", "USDC");
await tradePage.enterAmount("0.01");
await tradePage.showSwapInfo();
await tradePage.swapAndApprove(context);
//expect(msgContent).toContain(`denom: ${INJ}`);
//expect(msgContent).toContain(`sender: ${walletId}`);
//expect(msgContent).toContain(`token_out_denom: ${USDC}`);
await tradePage.isTransactionSuccesful()
await tradePage.getTransactionUrl()
})
await tradePage.isTransactionSuccesful();
await tradePage.getTransactionUrl();
});

test('User should be able to swap USDC to AKT', async () => {
await tradePage.goto()
await tradePage.selectPair('USDC', 'AKT')
await tradePage.enterAmount('0.1')
await tradePage.showSwapInfo()
await tradePage.swapAndApprove(context)
test("User should be able to swap USDC to AKT", async () => {
await tradePage.goto();
await tradePage.selectPair("USDC", "AKT");
await tradePage.enterAmount("0.1");
await tradePage.showSwapInfo();
await tradePage.swapAndApprove(context);
//expect(msgContent).toContain(`denom: ${USDC}`);
//expect(msgContent).toContain(`sender: ${walletId}`);
//expect(msgContent).toContain(`token_out_denom: ${AKT}`);
await tradePage.isTransactionSuccesful()
await tradePage.getTransactionUrl()
})
await tradePage.isTransactionSuccesful();
await tradePage.getTransactionUrl();
});

test('User should be able to swap AKT to USDC', async () => {
await tradePage.goto()
await tradePage.selectPair('AKT', 'USDC')
await tradePage.enterAmount('0.025')
await tradePage.showSwapInfo()
await tradePage.swapAndApprove(context)
test("User should be able to swap AKT to USDC", async () => {
await tradePage.goto();
await tradePage.selectPair("AKT", "USDC");
await tradePage.enterAmount("0.025");
await tradePage.showSwapInfo();
await tradePage.swapAndApprove(context);
//expect(msgContent).toContain(`denom: ${AKT}`);
//expect(msgContent).toContain(`sender: ${walletId}`);
//expect(msgContent).toContain(`token_out_denom: ${USDC}`);
await tradePage.isTransactionSuccesful()
await tradePage.getTransactionUrl()
})
})
await tradePage.isTransactionSuccesful();
await tradePage.getTransactionUrl();
});
});
Loading

0 comments on commit 098199f

Please sign in to comment.