Skip to content

Commit

Permalink
Update release-hotfix branch (#787)
Browse files Browse the repository at this point in the history
* Fixed claim tooltip text (#747)

* Create s3-staging.yml

* Create s3-production.yml

* Create s3-hotfix.yml

* Update s3-hotfix.yml

* Update s3-hotfix.yml

* Update s3-hotfix.yml

* Release hotfix merge to master (#746)

* add workflow for release-hotfix

* add on push specific branch

* remove automatic push process

* set inputs on workflow

* add specific branch on dispatch

* Discord link update (#745)

* Create s3-hotfix.yml

* Update s3-hotfix.yml

* Update s3-hotfix.yml

---------

Co-authored-by: Will <korea651@hanmail.net>
Co-authored-by: Ehsan <ehsan.hajian@gmail.com>

* add nft menu on sidebar (#749)

* add nft menu on sidebar

* add customized balloon

* clean up

* Fix total dApps count (#751)

* feat: updated theme color (#741)

* feat: updated theme color on Assets page

* feat: updated theme color on Dashboard page

* feat: updated theme color on dApp staking page

* feat: updated sidebar

* fix: tests

* update css

* update css

* update detail css

* feat: updated header background

* fix: updated hero position on dApp staking page

* update css on feedback

* update detail css

* updates on addItemcard

* update color on tags

* update colors

* feat: updated dark theme

* update uilib & colors

* styles: changed astar-blue-dark to astar-blue

* styles: updated Ecosystem icon

* fix: conflicts

* fix: updated styles

* fix: updated header

* fix: updated modals

* fix: updated play icon

* fix: updated styles on transfer assets page

* fix: updated ui liv

---------

Co-authored-by: Will <korea651@hanmail.net>

* Fix: Use XcmV2WeightLimit in InterlayXcmRepository.ts (#756)

* feat: updated connect wallet drawer (#750)

* feat: updated theme color on Assets page

* feat: updated theme color on Dashboard page

* feat: updated theme color on dApp staking page

* feat: updated sidebar

* fix: tests

* update css

* update css

* update detail css

* feat: updated astar-ui

* feat: updated astar-ui (2)

* feat: updated network modal

* feat: updated 'ip-input' class

* update css on feedback

* update detail css

* updates on addItemcard

* update color on tags

* feat: updated AccountModal logic

* feat: updated account drawer

* feat: updated disconnect button

* feat: updated tests

* fix: test

* fix: conflicts (2)

* fix: store selected address data

* feat: updated drawer

* feat: updated wallet logic

* refactor: clean up

* fix: changed 'disconnect' button position

* feat: store selected theme to local storage

* feat: updated modal drawer

* feat: updated modal drawer

---------

Co-authored-by: Will <korea651@hanmail.net>

* Added github action for broken links (#761)

* Added github action for broken links

* build and check

* e2e tests with  Zombienet (#752)

* Transfer tokens test

* CI integration

* Use env variable po pass BASE_URL to test script

* yaml fix

* Actions script fix

* Another action script fix

* yet another try

* hardcoded versions

* collator version fix

* Links fix

* Github action fix

* It may run now on CI

* Fixed test runner script

* Add asset to a node

* Moved Zombienet tests and configuration to separate folder.

* Stake test

* Increase Playwright test timeout

* Tests and node setup fixes

* Minor fixes

* All tests run stable

* Updated staking test with input validation test

* release hotfix to main (#760)

* add workflow for release-hotfix

* add on push specific branch

* remove automatic push process

* set inputs on workflow

* add specific branch on dispatch

* Discord link update (#745)

* Create s3-hotfix.yml

* Update s3-hotfix.yml

* Update s3-hotfix.yml

* hotfix: added Injective assets (ATOM and INJ) on EVM assets page (#759)

* feat: added ATOM and INJ on EVM assets page

* fix: fetch token data from cbridge API

---------

Co-authored-by: Will <korea651@hanmail.net>
Co-authored-by: Bobo <bobo.kovacevic@gmail.com>
Co-authored-by: Ehsan <ehsan.hajian@gmail.com>

* fix: send non-native tokens with max amount (#768)

* feat: updated XCM logic to V3 for Shiden, Statemine and Kusama (#758)

* wip: KSM xcm V3

* feat: update sdk-core

* feat: updated XCM logic for Kusama to V3

* feat: updated XCM V3 logic for Shiden

* fix: removed console.log

* fix: updated logic for statemine

* fix: updated subscan link for ctust

* feat: updated Bitfrost version to V3

* feat: updated XCM logic for Phala

* refactor: clean up

* fix: enabled XCM deposit/withdrawal on Shiden (#774)

* fix: enabled XCM deposit/withdrawal on Shiden

* test

* test: lint

* fix: clean up

* Update broken-links.yml (#777)

* removed quasar from broken link report (#767)

* dAapp staking e2e tests (#769)

* Unbond test

* Re-stake on/off test

* Claim rewards test, playwright config updates

* On chain check if claim executed

* Added Metamask extension

* Metamask wallet creation

* Trying to fix heap out of memory

* One more try

* One more try to fix CI out of memory

* On more try to fix out of memory error

* Heap size fix

* command fix

* What to say?

* Metamask removed

* Update pull-request-preview.yml

* Pushing commit to rerun ci

* setting up yarn

* Added Metamask back

* Test run on ubuntu-latest

* tsconfig exclude pattern fix

* Linter fixes

---------

Co-authored-by: Ehsan <ehsan.hajian@gmail.com>
Co-authored-by: Nikhil Ranjan <niklabh811@gmail.com>

* feat: added 'help' button on header (#772)

* fix: display EVM withdraw when users have balance in withdrawal

* fix: added help button on header

* fix: removed release note on the template.md

* fix: test

* fix: test (2)

* fix: display ModalConectionTrouble when app is loading

* fix: reset the staking tab after changing accounts (#779)

* Change warning on EVM local transfer (#783)

* update warning message

* update css & only visible on EVM input

* show prev warning

* only visible isH160

* update warning message

* fix: modified header styling for mobile devices (#782)

* fix: updated connect button

* fix: added separator at the top of assets page for mobile devices

* fix: updated header background for mobile devices

* fix: updated margin size inheader

---------

Co-authored-by: Bobo <bobo.kovacevic@gmail.com>
Co-authored-by: Ehsan <ehsan.hajian@gmail.com>
Co-authored-by: Will <korea651@hanmail.net>
Co-authored-by: Brendon Votteler <bvotteler@users.noreply.github.com>
Co-authored-by: Nikhil Ranjan <niklabh811@gmail.com>
  • Loading branch information
6 people committed Jun 13, 2023
1 parent 5aa2a73 commit 11cf375
Show file tree
Hide file tree
Showing 5 changed files with 351 additions and 0 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/pull-request-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,20 @@ jobs:
needs: build_and_preview
steps:
- uses: actions/checkout@v3
- name: Download pre-built linux collator binary
run: |
wget https://github.com/AstarNetwork/Astar/releases/download/v4.47.1/astar-collator-v4.47.1-ubuntu-x86_64.tar.gz
tar -xvf astar-collator-*-ubuntu-x86_64.tar.gz
chmod +x ./astar-collator
- name: Download Polkadot relay chain binary
run: |
wget https://github.com/paritytech/polkadot/releases/download/v0.9.37/polkadot
chmod +x ./polkadot
- name: Download Zombinet testing binary
run: |
wget https://github.com/paritytech/zombienet/releases/download/v1.3.35/zombienet-linux-x64
chmod +x ./zombienet-linux-x64
- uses: actions/setup-node@v3
with:
node-version: 18
Expand Down
62 changes: 62 additions & 0 deletions playwright-report/index.html

Large diffs are not rendered by default.

96 changes: 96 additions & 0 deletions tests/assets.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
import { clickPolicyButton } from 'src/modules/playwright';
import { expect } from '@playwright/test';
import { test } from './fixtures';
import {
ALICE_ACCOUNT_NAME,
ALICE_ACCOUNT_SEED,
BOB_ACCOUNT_NAME,
BOB_ACCOUNT_SEED,
BOB_ADDRESS,
closePolkadotWelcomePopup,
connectToNetwork,
createAccount,
createMetamaskAccount,
selectAccount,
signTransaction,
} from './common';
import { ApiPromise } from '@polkadot/api';
import { chainDecimals, getApi, getBalance } from './common-api';

let api: ApiPromise;
test.beforeAll(async () => {
api = await getApi();
});

test.afterAll(async () => {
await api.disconnect();
});

test.beforeEach(async ({ page, context }) => {
// TODO consider moving this into beforeAll
await page.goto('/astar/assets');
await clickPolicyButton(page);
const closeButton = page.getByText('Polkadot.js');
await closeButton.click();

await closePolkadotWelcomePopup(context);
await createAccount(page, ALICE_ACCOUNT_SEED, ALICE_ACCOUNT_NAME);
await createAccount(page, BOB_ACCOUNT_SEED, BOB_ACCOUNT_NAME);
await page.goto('/astar/assets');
await connectToNetwork(page);
await selectAccount(page, ALICE_ACCOUNT_NAME);
});

test.describe('account panel', () => {
test('should copy wallet address', async ({ page }) => {
await page.locator('#copyAddress').click();
await expect(page.locator('.noti-content')).toBeVisible();
});

// test('token folded info is visible until closed', async ({ page }) => {
// const baloonNativeToken = await page
// .getByText('NEW cancel All utilities for ASTR token are now folded - open up here!')
// .first();
// expect(baloonNativeToken).toBeVisible();
// await page.getByRole('button', { name: 'cancel' }).click();
// await expect(baloonNativeToken).not.toBeVisible();
// });

test('account expander works', async ({ page }) => {
await page.locator('.icon--expand').first().click();
const transferButton = page.locator('#asset-expand').getByRole('button', { name: 'Transfer' });
await expect(transferButton).toBeVisible();

await page.locator('.icon--expand').first().click();
await expect(transferButton).not.toBeVisible();
});

test('should transfer tokens from Alice to Bob', async ({ page, context }) => {
const transferAmount = BigInt(1000);
await page.locator('.icon--expand').first().click();
await page.locator('#asset-expand').getByRole('button', { name: 'Transfer' }).click();

await page.getByPlaceholder('Destination Address').fill(BOB_ADDRESS);
await page.getByPlaceholder('0.0').fill(transferAmount.toString());
await page.getByRole('button', { name: 'Confirm' }).click();

const bobBalanceBeforeTransaction = await getBalance(BOB_ADDRESS);
await signTransaction(context);
await page.waitForSelector('.four', { state: 'hidden' });

await expect(page.getByText('Success')).toBeVisible();
const bobBalanceAfterTransaction = await getBalance(BOB_ADDRESS);
expect(bobBalanceAfterTransaction - bobBalanceBeforeTransaction).toEqual(
transferAmount * BigInt(Math.pow(10, chainDecimals))
);
});

test('EVM sample', async ({ page }) => {
await createMetamaskAccount(
page,
'bottom drive obey lake curtain smoke basket hold race lonely fit walk',
'Test'
);
await page.goto('/astar/assets');
});
});
163 changes: 163 additions & 0 deletions tests/dappstaking-transactions.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
import { BrowserContext, Page, expect } from '@playwright/test';
import {
ALICE_ACCOUNT_NAME,
ALICE_ACCOUNT_SEED,
ALICE_ADDRESS,
closePolkadotWelcomePopup,
connectToNetwork,
createAccount,
selectAccount,
signTransaction,
} from './common';
import { test } from './fixtures';
import {
chainDecimals,
forceNewEra,
getAccountLedger,
getBalance,
getContractEraStake,
getCurrentEra,
getStakedAmount,
} from './common-api';

const TEST_DAPP_ADDRESS = '0x0000000000000000000000000000000000000001';

const stake = async (page: Page, context: BrowserContext, amount: bigint): Promise<void> => {
await page.goto(`/custom-node/dapp-staking/stake?dapp=${TEST_DAPP_ADDRESS}`);
await selectAccount(page, ALICE_ACCOUNT_NAME);
const balance = (await getBalance(ALICE_ADDRESS)) / BigInt(Math.pow(10, chainDecimals));
await page.getByPlaceholder('0.0').fill(amount.toString());
await page.getByRole('button', { name: 'Confirm' }).click();

const stakedAmountBefore = await getStakedAmount(TEST_DAPP_ADDRESS);
await signTransaction(context);
await page.waitForSelector('.four', { state: 'hidden' });

await expect(page.getByText('Success', { exact: true })).toBeVisible();
const stakedAmountAfter = await getStakedAmount(TEST_DAPP_ADDRESS);
expect(stakedAmountAfter - stakedAmountBefore).toEqual(
amount * BigInt(Math.pow(10, chainDecimals))
);
};

test.beforeEach(async ({ page, context }) => {
await page.goto('/astar/dapp-staking/discover');

// Close cookies popup
await page.getByRole('button', { name: 'Accept' }).click();

const closeButton = page.getByText('Polkadot.js');
await closeButton.click();

await closePolkadotWelcomePopup(context);
await createAccount(page, ALICE_ACCOUNT_SEED, ALICE_ACCOUNT_NAME);
await page.goto('/astar/dapp-staking/discover');
await connectToNetwork(page);
});

test.describe('dApp staking transactions', () => {
// Test case: DS001, DS002
test('user should be able to stake on test dApp', async ({ page, context }) => {
const stakeAmount = BigInt(1000);
await page.goto(`/custom-node/dapp-staking/stake?dapp=${TEST_DAPP_ADDRESS}`);
await selectAccount(page, ALICE_ACCOUNT_NAME);
const balance = (await getBalance(ALICE_ADDRESS)) / BigInt(Math.pow(10, chainDecimals));

// Test edge cases
await page.getByPlaceholder('0.0').fill((balance - BigInt(5)).toString());
await expect(
page
.locator('div')
.filter({
hasText: /^Account must hold greater than 10ASTR in transferrable when you stake\.$/,
})
.locator('span')
).toBeVisible();
await page.getByPlaceholder('0.0').fill((balance + BigInt(10)).toString());
await expect(page.getByText('Insufficient ASTR balance')).toBeVisible();
await page.getByPlaceholder('0.0').fill('100');
await expect(
page.getByText('The amount of token to be staking must be greater than 500 ASTR')
).toBeVisible();

await page.getByPlaceholder('0.0').fill(stakeAmount.toString());
await page.getByRole('button', { name: 'Confirm' }).click();

const stakedAmountBefore = await getStakedAmount(TEST_DAPP_ADDRESS);
await signTransaction(context);
await page.waitForSelector('.four', { state: 'hidden' });

await expect(page.getByText('Success', { exact: true })).toBeVisible();
const stakedAmountAfter = await getStakedAmount(TEST_DAPP_ADDRESS);
expect(stakedAmountAfter - stakedAmountBefore).toEqual(
stakeAmount * BigInt(Math.pow(10, chainDecimals))
);
});

// Test case: DS003
test('user should be able to unbond from the test dApp', async ({ page, context }) => {
// Stake first
await stake(page, context, BigInt(1000));

// Unbond
await page.goto('/custom-node/dapp-staking/discover');
await page.getByText('My dApps').click();
await page.getByRole('button', { name: 'Unbond' }).click();
await page.getByPlaceholder('0.0').fill('1.1');
await page.getByRole('button', { name: 'Start unbonding' }).click();
await signTransaction(context);
await page.waitForSelector('.four', { state: 'hidden' });

await expect(page.getByText('Success', { exact: true })).toBeVisible();
const ledger = await getAccountLedger(ALICE_ADDRESS);
expect(ledger.unbondingInfo.unlockingChunks.length).toEqual(1);
expect(ledger.unbondingInfo.unlockingChunks[0].amount.toString()).toEqual(
'1100000000000000000'
);
});

// Test case: DS005
test('user should be able to claim rewards', async ({ page, context }) => {
await stake(page, context, BigInt(1000));

const ledgerBefore = await getAccountLedger(ALICE_ADDRESS);
await forceNewEra();

await page.goto('/custom-node/dapp-staking/discover');
page.getByRole('button', { name: 'Claim' }).click();
await signTransaction(context);
await expect(page.getByText('Success', { exact: true }).first()).toBeVisible();

const ledgerAfter = await getAccountLedger(ALICE_ADDRESS);
expect(ledgerBefore.rewardDestination.toString()).toEqual('StakeBalance');
expect(ledgerBefore.locked < ledgerAfter.locked).toBeTruthy();
});

// Test case: DS006
test('user should be able to turn on/off re-staking', async ({ page, context }) => {
// Stake first. User must be an active staker in order to change reward destination.
await stake(page, context, BigInt(1000));

// Check initial state
await expect(page.getByText('ON', { exact: true })).toBeVisible();
await expect(page.getByRole('button', { name: 'Turn off' })).toBeVisible();
let ledger = await getAccountLedger(ALICE_ADDRESS);
expect(ledger.rewardDestination.toString()).toEqual('StakeBalance');

page.getByRole('button', { name: 'Turn off' }).click();
await signTransaction(context);
await page.waitForSelector('.four', { state: 'hidden' });
await expect(page.getByText('OFF', { exact: true })).toBeVisible();
await expect(page.getByRole('button', { name: 'Turn on' })).toBeVisible();
ledger = await getAccountLedger(ALICE_ADDRESS);
expect(ledger.rewardDestination.toString()).toEqual('FreeBalance');

page.getByRole('button', { name: 'Turn on' }).click();
await signTransaction(context);
await page.waitForSelector('.four', { state: 'hidden' });
await expect(page.getByText('ON', { exact: true })).toBeVisible();
await expect(page.getByRole('button', { name: 'Turn off' })).toBeVisible();
ledger = await getAccountLedger(ALICE_ADDRESS);
expect(ledger.rewardDestination.toString()).toEqual('StakeBalance');
});
});
16 changes: 16 additions & 0 deletions tests/header.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { test, expect } from '@playwright/test';
import { clickPolicyButton } from 'src/modules/playwright';

test.beforeEach(async ({ page }) => {
await page.goto('/astar/assets');
});

test.describe('init screen', () => {
test('has connection trouble', async ({ page }) => {
await clickPolicyButton(page);
const connectionTroubleButton = page.locator('.btn--help');
await connectionTroubleButton.click();
const connectionTroubleModal = page.locator('.wrapper--modal-connection-trouble');
await expect(connectionTroubleModal).toBeVisible();
});
});

0 comments on commit 11cf375

Please sign in to comment.