From eb5f35db8e41490e97c87d5c13d8ce9a8d893fda Mon Sep 17 00:00:00 2001 From: impelcrypto <92044428+impelcrypto@users.noreply.github.com> Date: Fri, 12 May 2023 21:30:31 -0700 Subject: [PATCH] Update release-hotfix branch (#787) * 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 Co-authored-by: Ehsan * 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 * 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 * 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 Co-authored-by: Bobo Co-authored-by: Ehsan * 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 Co-authored-by: Nikhil Ranjan * 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 Co-authored-by: Ehsan Co-authored-by: Will Co-authored-by: Brendon Votteler Co-authored-by: Nikhil Ranjan --- playwright-report/index.html | 62 +++++++++++ src/components/assets/styles/assets.scss | 15 +++ .../header/modals/ModalInstallWallet.vue | 103 ++++++++++++++++++ .../header/modals/ModalUpdateWallet.vue | 98 +++++++++++++++++ tests/zombienet/e2e.zndsl | 15 +++ tests/zombienet/register-xcasset.js | 46 ++++++++ tests/zombienet/setup-preconditions.js | 31 ++++++ tests/zombienet/start-playwright.js | 43 ++++++++ tests/zombienet/tx-utils.js | 32 ++++++ tests/zombienet/tx-utils.mjs | 32 ++++++ tests/zombienet/wait.js | 12 ++ tests/zombienet/zombienet-config.toml | 52 +++++++++ 12 files changed, 541 insertions(+) create mode 100644 playwright-report/index.html create mode 100644 src/components/header/modals/ModalInstallWallet.vue create mode 100644 src/components/header/modals/ModalUpdateWallet.vue create mode 100644 tests/zombienet/e2e.zndsl create mode 100644 tests/zombienet/register-xcasset.js create mode 100644 tests/zombienet/setup-preconditions.js create mode 100644 tests/zombienet/start-playwright.js create mode 100644 tests/zombienet/tx-utils.js create mode 100644 tests/zombienet/tx-utils.mjs create mode 100644 tests/zombienet/wait.js create mode 100644 tests/zombienet/zombienet-config.toml diff --git a/playwright-report/index.html b/playwright-report/index.html new file mode 100644 index 000000000..a7840590a --- /dev/null +++ b/playwright-report/index.html @@ -0,0 +1,62 @@ + + + + + + + + + Playwright Test Report + + + + +
+ + + + \ No newline at end of file diff --git a/src/components/assets/styles/assets.scss b/src/components/assets/styles/assets.scss index da2a3791f..4ece4afb8 100644 --- a/src/components/assets/styles/assets.scss +++ b/src/components/assets/styles/assets.scss @@ -87,3 +87,18 @@ padding: 0; } } + +.separator { + border-bottom: 1px solid; + border-image: linear-gradient( + 90deg, + #e6007a -4%, + #e6007a -3.88%, + #703ac2 17.01%, + #0070eb 42.25%, + #0297fb 73.9%, + #0ae2ff 97.42% + ); + border-image-slice: 1; + margin-bottom: 20px; +} diff --git a/src/components/header/modals/ModalInstallWallet.vue b/src/components/header/modals/ModalInstallWallet.vue new file mode 100644 index 000000000..92dd5bafd --- /dev/null +++ b/src/components/header/modals/ModalInstallWallet.vue @@ -0,0 +1,103 @@ + + + + + diff --git a/src/components/header/modals/ModalUpdateWallet.vue b/src/components/header/modals/ModalUpdateWallet.vue new file mode 100644 index 000000000..69573ee4a --- /dev/null +++ b/src/components/header/modals/ModalUpdateWallet.vue @@ -0,0 +1,98 @@ + + + + + diff --git a/tests/zombienet/e2e.zndsl b/tests/zombienet/e2e.zndsl new file mode 100644 index 000000000..2db9edddb --- /dev/null +++ b/tests/zombienet/e2e.zndsl @@ -0,0 +1,15 @@ +Description: End to end tests +Network: ./zombienet-config.toml +Creds: config + +{% set nodes = ["relay01", "relay02", "relay03", "relay04"] %} +{% for node in nodes %} + {{node}}: is up + {{node}}: reports node_roles is 4 +{% endfor %} + +astar: js-script ./setup-preconditions.js with "Alice" return is equal to 1 within 200 seconds +astar: js-script ./start-playwright.js with "{{BASE_URL}}" return is equal to 1 within 4000 seconds + +# Uncomment the line below if you want to keep Zombienet running (i.e. some tests are failing and you want to check UI or similar) +# astar: js-script ./wait.js with "600000" return is equal to 1 within 360 seconds \ No newline at end of file diff --git a/tests/zombienet/register-xcasset.js b/tests/zombienet/register-xcasset.js new file mode 100644 index 000000000..8c50edb60 --- /dev/null +++ b/tests/zombienet/register-xcasset.js @@ -0,0 +1,46 @@ +async function run(nodeName, networkInfo, args) { + // networkInfo.nodesByName["astar"].hrmpTo = 2007 + // networkInfo.nodesByName["shiden"].hrmpTo = 2006 + + const { sendTransaction } = await import('./tx-utils.mjs'); + const { wsUri, userDefinedTypes } = networkInfo.nodesByName[nodeName]; + const api = await zombie.connect(wsUri, userDefinedTypes); + const hrmpTo = + nodeName === 'astar' + ? networkInfo.nodesByName['shiden'].parachainId + : networkInfo.nodesByName['astar'].parachainId; + const assetId = hrmpTo; // assetId can be any arbitrary number + + await zombie.util.cryptoWaitReady(); + + // account to submit tx + const keyring = new zombie.Keyring({ type: 'sr25519' }); + const sender = keyring.addFromUri('//' + args[0]); + + const tx0 = await api.tx.assets.forceCreate(assetId, { id: sender.address }, true, 1); + + const assetLocation = `{"v1":{"parents":1,"interior":{"x1":{"parachain":${hrmpTo}}}}}`; + const tx1 = await api.tx.xcAssetConfig.registerAssetLocation(JSON.parse(assetLocation), assetId); + + const unitsPerSecond = 7000000000; + const tx2 = await api.tx.xcAssetConfig.setAssetUnitsPerSecond( + JSON.parse(assetLocation), + unitsPerSecond + ); + + const batch = await api.tx.utility.batch([tx0, tx1, tx2]); + await sendTransaction(api.tx.sudo.sudo(batch), sender); + + const assetIdToLocation = await api.query.xcAssetConfig.assetIdToLocation(assetId); + const location = JSON.stringify(assetIdToLocation); + + const assetLocationUnitsPerSecond = await api.query.xcAssetConfig.assetLocationUnitsPerSecond( + JSON.parse(assetLocation) + ); + const units = JSON.stringify(assetLocationUnitsPerSecond); + + const result = assetLocation === location && unitsPerSecond === units ? 1 : 0; + return result; +} + +module.exports = { run }; diff --git a/tests/zombienet/setup-preconditions.js b/tests/zombienet/setup-preconditions.js new file mode 100644 index 000000000..ce304b33d --- /dev/null +++ b/tests/zombienet/setup-preconditions.js @@ -0,0 +1,31 @@ +const TEST_DAPP_ADDRESS = '0x0000000000000000000000000000000000000001'; + +async function run(nodeName, networkInfo, args) { + const BN = require('bn.js'); + const ONE = new BN(10).pow(new BN(18)); + + const { sendTransaction } = await import('./tx-utils.mjs'); + const { wsUri, userDefinedTypes } = networkInfo.nodesByName[nodeName]; + const api = await zombie.connect(wsUri, userDefinedTypes); + + await zombie.util.cryptoWaitReady(); + + // account to submit tx + const keyring = new zombie.Keyring({ type: 'sr25519' }); + const sender = keyring.addFromUri('//' + args[0]); + + // create asset + console.log('Creating asset with sender: ', sender.address); + await sendTransaction(api.tx.assets.create(999, { Id: sender.address }, ONE), sender); + console.log('Setting metadata with sender: ', sender.address); + await sendTransaction(api.tx.assets.setMetadata(999, 'Test', 'TST', 18), sender); + + // register dApp + const tx4 = api.tx.dappsStaking.register(sender.address, { Evm: TEST_DAPP_ADDRESS }); + await sendTransaction(api.tx.sudo.sudo(tx4), sender); + + const result = 1; + return result; +} + +module.exports = { run }; diff --git a/tests/zombienet/start-playwright.js b/tests/zombienet/start-playwright.js new file mode 100644 index 000000000..066f21f1c --- /dev/null +++ b/tests/zombienet/start-playwright.js @@ -0,0 +1,43 @@ +const util = require('util'); + +const spawn = (cmd) => + new Promise((resolve, reject) => { + const cp = require('child_process').exec(cmd); + const error = []; + const stdout = []; + cp.stdout.on('data', (data) => { + console.log(data.toString()); + stdout.push(data.toString()); + + if (data.toString().includes('Ctrl+C')) { + cp.kill(9); + if (error.length) reject(error.join('')); + else resolve(stdout.join('')); + } + }); + + cp.on('error', (e) => { + error.push(e.toString()); + console.log(e.toString()); + }); + + cp.on('close', () => { + if (error.length) reject(error.join('')); + else resolve(stdout.join('')); + }); + }); + +async function run(nodeName, networkInfo, args) { + console.log('Running Playwright tests on node: ', nodeName, args); + const endpoint = networkInfo.nodesByName[nodeName].wsUri; + + let result = await spawn('npx playwright install --with-deps'); + + result = await spawn( + `BASE_URL=\'${args[0]}\' ENDPOINT=\'${endpoint}\' HEADLESS='true' CI='true' npx playwright test --project=chromium` + ); + + return result?.includes('failed') ? 0 : 1; +} + +module.exports = { run }; diff --git a/tests/zombienet/tx-utils.js b/tests/zombienet/tx-utils.js new file mode 100644 index 000000000..f49fa1735 --- /dev/null +++ b/tests/zombienet/tx-utils.js @@ -0,0 +1,32 @@ +export async function sendTransaction(transaction, sender) { + return new Promise((resolve, reject) => { + let unsubscribe; + let timeout; + const SPAWNING_TIME = 500000; + + transaction + .signAndSend(sender, async (result) => { + console.log(`Current status is ${result?.status}`); + + if (result.isFinalized) { + if (unsubscribe) { + unsubscribe(); + } + + clearTimeout(timeout); + resolve(true); + } + }) + .then((unsub) => { + unsubscribe = unsub; + }) + .catch((error) => { + console.error(error); + reject(error); + }); + + timeout = setTimeout(() => { + reject(new Error('Transaction timeout')); + }, SPAWNING_TIME); + }); +} diff --git a/tests/zombienet/tx-utils.mjs b/tests/zombienet/tx-utils.mjs new file mode 100644 index 000000000..f49fa1735 --- /dev/null +++ b/tests/zombienet/tx-utils.mjs @@ -0,0 +1,32 @@ +export async function sendTransaction(transaction, sender) { + return new Promise((resolve, reject) => { + let unsubscribe; + let timeout; + const SPAWNING_TIME = 500000; + + transaction + .signAndSend(sender, async (result) => { + console.log(`Current status is ${result?.status}`); + + if (result.isFinalized) { + if (unsubscribe) { + unsubscribe(); + } + + clearTimeout(timeout); + resolve(true); + } + }) + .then((unsub) => { + unsubscribe = unsub; + }) + .catch((error) => { + console.error(error); + reject(error); + }); + + timeout = setTimeout(() => { + reject(new Error('Transaction timeout')); + }, SPAWNING_TIME); + }); +} diff --git a/tests/zombienet/wait.js b/tests/zombienet/wait.js new file mode 100644 index 000000000..dfa20e130 --- /dev/null +++ b/tests/zombienet/wait.js @@ -0,0 +1,12 @@ +async function run(nodeName, networkInfo, args) { + console.log('Waiting for ', args, 'ms'); + const timeout = parseInt(args[0]); + + return new Promise((resolve) => { + setTimeout(() => { + resolve(1); + }, timeout); + }); +} + +module.exports = { run }; \ No newline at end of file diff --git a/tests/zombienet/zombienet-config.toml b/tests/zombienet/zombienet-config.toml new file mode 100644 index 000000000..cc47dacf7 --- /dev/null +++ b/tests/zombienet/zombienet-config.toml @@ -0,0 +1,52 @@ +[settings] +timeout = 1000 + +[relaychain] +default_command = "./polkadot" +chain = "rococo-local" + + [[relaychain.nodes]] + name = "relay01" + + [[relaychain.nodes]] + name = "relay02" + + [[relaychain.nodes]] + name = "relay03" + + [[relaychain.nodes]] + name = "relay04" + +[[parachains]] +id = 2006 +chain = "astar-dev" +cumulus_based = true + + [parachains.collator] + name = "astar" + command = "./astar-collator" + rpc_port = 8545 + args = [ "-l=xcm=trace", "--enable-evm-rpc" ] + +[[parachains]] +id = 2007 +chain = "shiden-dev" +cumulus_based = true + + [parachains.collator] + name = "shiden" + command = "./astar-collator" + rpc_port = 8546 + args = [ "-l=xcm=trace", "--enable-evm-rpc" ] + +[[hrmp_channels]] + sender = 2006 + recipient = 2007 + max_capacity = 8 + max_message_size = 512 + +[[hrmp_channels]] + sender = 2007 + recipient = 2006 + max_capacity = 8 + max_message_size = 512 \ No newline at end of file