Skip to content
Draft
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
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,10 @@
"web3": "^1.10.0"
},
"devDependencies": {
"@actions/core": "^1.10.1",
"@babel/eslint-parser": "^7.13.14",
"@depay/web3-mock": "^13.26.0",
"@playwright/test": "^1.31.0",
"@playwright/test": "1.31.2",
"@polkadot/ts": "^0.4.22",
"@quasar/quasar-app-extension-apollo": "^2.1.0-beta.1",
"@quasar/quasar-app-extension-qmarkdown": "^2.0.0-beta.10",
Expand Down
2 changes: 2 additions & 0 deletions src/components/assets/transfer/XcmBridge.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
:is-selectable="isH160 ? false : true"
:balance="String(fromAddressBalance)"
:symbol="token.metadata.symbol"
data-testid="xcm-select-from-chain"
/>
<select-evm-wallet v-if="isDepositEthChain" :initialize-xcm-api="initializeXcmApi" />
<div v-if="isReverseButton" class="row--reverse">
Expand All @@ -29,6 +30,7 @@
:is-selectable="true"
:balance="String(destAddressBalance)"
:symbol="token.metadata.symbol"
data-testid="xcm-select-to-chain"
/>
<div v-if="isEvmBridge || isWithdrawalEthChain">
<simple-input
Expand Down
2 changes: 1 addition & 1 deletion src/components/dashboard/Inflation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div v-if="pieSectors.length === 0">
<q-skeleton class="skeleton--value-panel" />
</div>
<div v-else class="wrapper--value">
<div v-else class="wrapper--value" data-testid="inflation-panel">
<div class="container container--chart">
<div class="row--title">
<span class="text--accent container--title--color">{{
Expand Down
2 changes: 1 addition & 1 deletion src/components/dashboard/InflationRateChart.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div v-if="!hasData">
<q-skeleton class="skeleton--chart inflation--skeleton" />
</div>
<div v-else>
<div v-else data-testid="inflation-rate-chart">
<div class="container--component">
<div class="row">
<span class="text--accent container--title--color">{{
Expand Down
2 changes: 1 addition & 1 deletion src/components/header/modals/ModalNetworkWallet.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
:is-disabled="isDisabled"
/>
</div>
<div v-else>
<div v-else data-testid="wallet-select">
<div v-if="modalAccountSelect">
<select-account
:selected-wallet="(selectedWallet as SupportWallet)"
Expand Down
1 change: 1 addition & 0 deletions src/modules/xcm/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,7 @@ export let xcmChainObj: XcmChainObj = {
'wss://statemint.api.onfinality.io/public-ws',
'wss://statemint.public.curie.radiumblock.co/ws',
],
chopsticksEndpoint: 'ws://localhost:9956',
subscan: 'https://assethub-polkadot.subscan.io',
isAstarNativeToken: false,
},
Expand Down
7 changes: 6 additions & 1 deletion src/staking-v3/components/Dapps.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,12 @@
:modules="modules"
>
<swiper-slide v-for="(dapp, index) in filteredDapps" :key="index">
<router-link v-if="dapp" class="card--dapp" :to="getDappPageUrl(dapp.basic.address)">
<router-link
v-if="dapp"
class="card--dapp"
:to="getDappPageUrl(dapp.basic.address)"
data-testid="single-dapp"
>
<div class="card__top">
<div class="icon--dapp">
<img :src="dapp.basic.iconUrl" alt="icon" />
Expand Down
1 change: 1 addition & 0 deletions src/staking-v3/components/DynamicAdsArea.vue
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
<swiper-slide v-for="(item, index) in combinedCampaigns" :key="index">
<div
class="card--swiper"
data-testid="staking-banner-card"
@click="item.link !== undefined ? goToLink(item.link) : goDappPageLink(item.address)"
>
<img :src="item.img" class="card__img" />
Expand Down
1 change: 1 addition & 0 deletions src/staking-v3/components/RegisterBanner.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
:to="networkParam + Path.DappStaking + Path.Register"
class="wrapper--register-banner"
:style="{ backgroundImage: `url(${require('src/staking-v3/assets/register_bg.webp')})` }"
data-testid="register-dapp-banner"
>
<div class="congrats">
<div class="text--congrats">&#127881; {{ `${$t('stakingV3.congrats')}` }}</div>
Expand Down
121 changes: 0 additions & 121 deletions tests/assets-transactions-evm.spec.ts

This file was deleted.

29 changes: 29 additions & 0 deletions tests/chopsticks/assethub.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
endpoint: wss://asset-hub-polkadot-rpc.dwellir.com
mock-signature-host: true
block: ${env.ASSETHUB_BLOCK_NUMBER}
db: ./db.sqlite
port: 9956
# wasm-override: acala-2150.wasm

import-storage:
System:
Account:
- - - 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
- providers: 1
data:
free: 1000000000000000
- - - 246gNkjCexYRsCpdjtVhz35sHjcb21jpqipzT9u4uwKV8iEE
- data:
free: 1000000000000000
- - - 249LSvsEyxS4VpEJGg62yhYA7sHy1KcgGW6KzACBCLW1RsZF
- data:
free: 1000000000000000
- - - 21y4X7QDByUjnu5KX9W1H5TbG2wTLPDbhYFHqc4v6Q1nTBnu
- data:
free: 1000000000000000
- - - 265dERKLvMFwWWvtGNUjQBrHFTT88VcEtb5QYh2Zuj79UGMf
- data:
free: 1000000000000000
- - - 21XH88Kd5vDLkrZMb4D2eYJAB9yKbycfkYBqAaD1wQQi1uJ8
- data:
free: 1000000000000000
4 changes: 0 additions & 4 deletions tests/chopsticks/moonbeam.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ import-storage:
- providers: 1
data:
free: '100000000000000000000000'
TechCommitteeCollective:
Members: ['0xf24FF3a9CF04c71Dbc94D0b566f7A27B94566cac']
CouncilCollective:
Members: ['0xf24FF3a9CF04c71Dbc94D0b566f7A27B94566cac']
TreasuryCouncilCollective:
Members: ['0xf24FF3a9CF04c71Dbc94D0b566f7A27B94566cac']
AuthorFilter:
Expand Down
4 changes: 2 additions & 2 deletions tests/chopsticks/setup-preconditions-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ async function run(nodeName, networkInfo, args) {

// register dApp
console.info('Registering dApps with sender: ', sender.address);
const tx4 = api.tx.dappsStaking.register(sender.address, { Evm: TEST_DAPP_ADDRESS });
const tx5 = api.tx.dappsStaking.register(bob.address, { Evm: TEST_DAPP_ADDRESS_2 });
const tx4 = api.tx.dappStaking.register(sender.address, { Evm: TEST_DAPP_ADDRESS });
const tx5 = api.tx.dappStaking.register(bob.address, { Evm: TEST_DAPP_ADDRESS_2 });
await sendTransaction(api.tx.sudo.sudo(tx4), sender);
await sendTransaction(api.tx.sudo.sudo(tx5), sender);

Expand Down
5 changes: 4 additions & 1 deletion tests/chopsticks/start-chopsticks.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,11 @@ const spawnDetached = (cmd) => {
// Execute the run function with the given parameters
async function executeRun() {
try {
// const childProcess = spawnDetached(
// 'npx @acala-network/chopsticks@latest xcm -p=tests/chopsticks/astar.yml -p=tests/chopsticks/moonbeam.yml -p=tests/chopsticks/acala.yml -p=tests/chopsticks/interlay.yml -p=tests/chopsticks/bifrost.yml -r=tests/chopsticks/polkadot.yml'
// );
const childProcess = spawnDetached(
'npx @acala-network/chopsticks@latest xcm -p=tests/chopsticks/astar.yml -p=tests/chopsticks/moonbeam.yml -p=tests/chopsticks/acala.yml -p=tests/chopsticks/interlay.yml -p=tests/chopsticks/bifrost.yml -r=tests/chopsticks/polkadot.yml'
'npx @acala-network/chopsticks@latest xcm -p=tests/chopsticks/astar.yml -p=tests/chopsticks/acala.yml -p=tests/chopsticks/assethub.yml -r=tests/chopsticks/polkadot.yml'
);
console.info('Chopsticks started with pid:', childProcess.pid);

Expand Down
18 changes: 15 additions & 3 deletions tests/chopsticks/start-playwright.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
const core = require('@actions/core');

/* eslint-disable @typescript-eslint/no-var-requires */
const spawn = (cmd) =>
new Promise((resolve, reject) => {
Expand All @@ -6,7 +8,7 @@ const spawn = (cmd) =>
const stdout = [];
cp.stdout.on('data', (data) => {
stdout.push(data.toString());
console.info(data.toString())
console.info(data.toString());

if (data.toString().includes('Ctrl+C')) {
cp.kill(9);
Expand All @@ -32,16 +34,26 @@ async function run(nodeName, networkInfo, args) {
console.info('endpoint :', endpoint);

let result = await spawn('npx playwright install --with-deps');

// Print playwright version
await spawn('npx playwright --version');

// Start tests
result = await spawn(
`BASE_URL=\'${args[0]}\' ENDPOINT=\'${endpoint}\' HEADLESS='true' CI='true' npx playwright test tests/test_specs --project=chromium`
);

// MEMO: for debugging specific test case
// result = await spawn(
// `BASE_URL=\'${args[0]}\' ENDPOINT=\'${endpoint}\' npx playwright test tests/assets-transactions-evm.spec.ts --project=chromium --debug`
// `BASE_URL=\'${args[0]}\' ENDPOINT=\'${endpoint}\' HEADLESS='true' npx playwright test test_specs/assets-transactions.spec.ts --project=chromium`
// );

return result?.includes('failed') ? 0 : 1;
const runResult = result?.includes('failed') || result?.includes('flaky') ? 1 : 0;
if (runResult !== 0) {
core.setFailed('One or more playwright tests failed.');
}

return runResult;
}

module.exports = { run };
5 changes: 0 additions & 5 deletions tests/chopsticks/tx-utils.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ export async function sendTransaction(transaction, sender) {
unsubscribe();
}

clearTimeout(timeout);
resolve(true);
}
})
Expand All @@ -24,9 +23,5 @@ export async function sendTransaction(transaction, sender) {
console.error(error);
reject(error);
});

timeout = setTimeout(() => {
reject(new Error('Transaction timeout'));
}, SPAWNING_TIME);
});
}
Loading
Loading