mirror of
https://github.com/status-im/status-desktop.git
synced 2025-02-13 07:06:58 +00:00
feat(@desktop/wallet): Wrtie Unit tests for SimpleSendModal, SimpleTransactionFees and SendModalFooter
fixes #17123
This commit is contained in:
parent
1668fd384c
commit
19c6e910d8
174
storybook/qmlTests/tests/tst_SendModalFooter.qml
Normal file
174
storybook/qmlTests/tests/tst_SendModalFooter.qml
Normal file
@ -0,0 +1,174 @@
|
|||||||
|
import QtQuick 2.15
|
||||||
|
import QtTest 1.15
|
||||||
|
import QtQml.Models 2.15
|
||||||
|
|
||||||
|
import StatusQ.Core.Theme 0.1
|
||||||
|
|
||||||
|
import AppLayouts.Wallet.views 1.0
|
||||||
|
import AppLayouts.Wallet.controls 1.0
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: root
|
||||||
|
width: 600
|
||||||
|
height: 800
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: componentUnderTest
|
||||||
|
|
||||||
|
SendModalFooter {
|
||||||
|
id: sendModalFooter
|
||||||
|
readonly property SignalSpy reviewSendClickedSpy: SignalSpy {
|
||||||
|
target: sendModalFooter
|
||||||
|
signalName: "reviewSendClicked"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ObjectModel {
|
||||||
|
id: errorTagsModel
|
||||||
|
RouterErrorTag {
|
||||||
|
errorTitle: qsTr("Insufficient funds for send transaction")
|
||||||
|
buttonText: qsTr("Add assets")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TestCase {
|
||||||
|
name: "SendModalFooter"
|
||||||
|
when: windowShown
|
||||||
|
|
||||||
|
property SendModalFooter controlUnderTest: null
|
||||||
|
|
||||||
|
function init() {
|
||||||
|
controlUnderTest = createTemporaryObject(componentUnderTest, root)
|
||||||
|
}
|
||||||
|
|
||||||
|
function test_defaulValues() {
|
||||||
|
verify(!!controlUnderTest)
|
||||||
|
const estTimeLabel = findChild(controlUnderTest, "estTimeLabel")
|
||||||
|
verify(!!estTimeLabel)
|
||||||
|
const estimatedTimeText = findChild(controlUnderTest, "estimatedTimeText")
|
||||||
|
verify(!!estimatedTimeText)
|
||||||
|
const estFeesLabel = findChild(controlUnderTest, "estFeesLabel")
|
||||||
|
verify(!!estFeesLabel)
|
||||||
|
const estimatedFeesText = findChild(controlUnderTest, "estimatedFeesText")
|
||||||
|
verify(!!estimatedFeesText)
|
||||||
|
const transactionModalFooterButton = findChild(controlUnderTest, "transactionModalFooterButton")
|
||||||
|
verify(!!transactionModalFooterButton)
|
||||||
|
|
||||||
|
compare(controlUnderTest.color, Theme.palette.baseColor3)
|
||||||
|
verify(controlUnderTest.dropShadowEnabled)
|
||||||
|
|
||||||
|
compare(estTimeLabel.text, qsTr("Est time"))
|
||||||
|
compare(estimatedTimeText.text, "--")
|
||||||
|
compare(estimatedTimeText.customColor, Theme.palette.directColor5)
|
||||||
|
verify(!estimatedTimeText.loading)
|
||||||
|
|
||||||
|
compare(estFeesLabel.text, qsTr("Est fees"))
|
||||||
|
compare(estimatedFeesText.text, "--")
|
||||||
|
compare(estimatedFeesText.customColor, Theme.palette.directColor5)
|
||||||
|
verify(!estimatedFeesText.loading)
|
||||||
|
|
||||||
|
compare(transactionModalFooterButton.text, qsTr("Review Send"))
|
||||||
|
verify(!transactionModalFooterButton.enabled)
|
||||||
|
compare(transactionModalFooterButton.disabledColor, Theme.palette.directColor8)
|
||||||
|
}
|
||||||
|
|
||||||
|
function test_setValues() {
|
||||||
|
verify(!!controlUnderTest)
|
||||||
|
const estTimeLabel = findChild(controlUnderTest, "estTimeLabel")
|
||||||
|
verify(!!estTimeLabel)
|
||||||
|
const estimatedTimeText = findChild(controlUnderTest, "estimatedTimeText")
|
||||||
|
verify(!!estimatedTimeText)
|
||||||
|
const estFeesLabel = findChild(controlUnderTest, "estFeesLabel")
|
||||||
|
verify(!!estFeesLabel)
|
||||||
|
const estimatedFeesText = findChild(controlUnderTest, "estimatedFeesText")
|
||||||
|
verify(!!estimatedFeesText)
|
||||||
|
const transactionModalFooterButton = findChild(controlUnderTest, "transactionModalFooterButton")
|
||||||
|
verify(!!transactionModalFooterButton)
|
||||||
|
|
||||||
|
controlUnderTest.estimatedTime = "~60s"
|
||||||
|
controlUnderTest.estimatedFees = "1.45 EUR"
|
||||||
|
|
||||||
|
compare(estTimeLabel.text, qsTr("Est time"))
|
||||||
|
compare(estimatedTimeText.text, "~60s")
|
||||||
|
compare(estimatedTimeText.customColor, Theme.palette.directColor1)
|
||||||
|
verify(!estimatedTimeText.loading)
|
||||||
|
|
||||||
|
compare(estFeesLabel.text, qsTr("Est fees"))
|
||||||
|
compare(estimatedFeesText.text, "1.45 EUR")
|
||||||
|
compare(estimatedFeesText.customColor, Theme.palette.directColor1)
|
||||||
|
verify(!estimatedFeesText.loading)
|
||||||
|
|
||||||
|
compare(transactionModalFooterButton.text, qsTr("Review Send"))
|
||||||
|
verify(transactionModalFooterButton.enabled)
|
||||||
|
mouseClick(transactionModalFooterButton)
|
||||||
|
|
||||||
|
controlUnderTest.reviewSendClickedSpy.wait()
|
||||||
|
}
|
||||||
|
|
||||||
|
function test_loadingState() {
|
||||||
|
verify(!!controlUnderTest)
|
||||||
|
const estTimeLabel = findChild(controlUnderTest, "estTimeLabel")
|
||||||
|
verify(!!estTimeLabel)
|
||||||
|
const estimatedTimeText = findChild(controlUnderTest, "estimatedTimeText")
|
||||||
|
verify(!!estimatedTimeText)
|
||||||
|
const estFeesLabel = findChild(controlUnderTest, "estFeesLabel")
|
||||||
|
verify(!!estFeesLabel)
|
||||||
|
const estimatedFeesText = findChild(controlUnderTest, "estimatedFeesText")
|
||||||
|
verify(!!estimatedFeesText)
|
||||||
|
const transactionModalFooterButton = findChild(controlUnderTest, "transactionModalFooterButton")
|
||||||
|
verify(!!transactionModalFooterButton)
|
||||||
|
|
||||||
|
controlUnderTest.loading = true
|
||||||
|
|
||||||
|
compare(estTimeLabel.text, qsTr("Est time"))
|
||||||
|
compare(estimatedTimeText.text, "XXXXXXXXXX")
|
||||||
|
compare(estimatedTimeText.customColor, Theme.palette.directColor5)
|
||||||
|
verify(estimatedTimeText.loading)
|
||||||
|
|
||||||
|
compare(estFeesLabel.text, qsTr("Est fees"))
|
||||||
|
compare(estimatedFeesText.text, "XXXXXXXXXX")
|
||||||
|
compare(estimatedFeesText.customColor, Theme.palette.directColor5)
|
||||||
|
verify(estimatedFeesText.loading)
|
||||||
|
|
||||||
|
compare(transactionModalFooterButton.text, qsTr("Review Send"))
|
||||||
|
verify(!transactionModalFooterButton.enabled)
|
||||||
|
}
|
||||||
|
|
||||||
|
function test_errorState() {
|
||||||
|
verify(!!controlUnderTest)
|
||||||
|
const estTimeLabel = findChild(controlUnderTest, "estTimeLabel")
|
||||||
|
verify(!!estTimeLabel)
|
||||||
|
const estimatedTimeText = findChild(controlUnderTest, "estimatedTimeText")
|
||||||
|
verify(!!estimatedTimeText)
|
||||||
|
const estFeesLabel = findChild(controlUnderTest, "estFeesLabel")
|
||||||
|
verify(!!estFeesLabel)
|
||||||
|
const estimatedFeesText = findChild(controlUnderTest, "estimatedFeesText")
|
||||||
|
verify(!!estimatedFeesText)
|
||||||
|
const transactionModalFooterButton = findChild(controlUnderTest, "transactionModalFooterButton")
|
||||||
|
verify(!!transactionModalFooterButton)
|
||||||
|
|
||||||
|
controlUnderTest.error = true
|
||||||
|
|
||||||
|
waitForRendering(controlUnderTest)
|
||||||
|
|
||||||
|
compare(estTimeLabel.text, qsTr("Est time"))
|
||||||
|
compare(estimatedTimeText.text, "--")
|
||||||
|
compare(estimatedTimeText.customColor, Theme.palette.directColor5)
|
||||||
|
verify(!estimatedTimeText.loading)
|
||||||
|
|
||||||
|
compare(estFeesLabel.text, qsTr("Est fees"))
|
||||||
|
compare(estimatedFeesText.text, "--")
|
||||||
|
tryCompare(estimatedFeesText, "customColor", Theme.palette.dangerColor1)
|
||||||
|
verify(!estimatedFeesText.loading)
|
||||||
|
|
||||||
|
compare(transactionModalFooterButton.text, qsTr("Review Send"))
|
||||||
|
verify(!transactionModalFooterButton.enabled)
|
||||||
|
|
||||||
|
verify(!controlUnderTest.errorTags)
|
||||||
|
|
||||||
|
controlUnderTest.errorTags = errorTagsModel
|
||||||
|
compare(controlUnderTest.errorTags, errorTagsModel)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
951
storybook/qmlTests/tests/tst_SimpleSendModal.qml
Normal file
951
storybook/qmlTests/tests/tst_SimpleSendModal.qml
Normal file
@ -0,0 +1,951 @@
|
|||||||
|
import QtQuick 2.15
|
||||||
|
import QtTest 1.15
|
||||||
|
|
||||||
|
import StatusQ.Core.Theme 0.1
|
||||||
|
import StatusQ.Core.Utils 0.1 as SQUtils
|
||||||
|
|
||||||
|
import Models 1.0
|
||||||
|
import utils 1.0
|
||||||
|
|
||||||
|
import AppLayouts.Wallet.popups.simpleSend 1.0
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: root
|
||||||
|
width: 600
|
||||||
|
height: 800
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: componentUnderTest
|
||||||
|
|
||||||
|
SimpleSendModal {
|
||||||
|
id: simpleSend
|
||||||
|
|
||||||
|
accountsModel: ListModel {
|
||||||
|
readonly property var data: [
|
||||||
|
{
|
||||||
|
"address":"0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8884",
|
||||||
|
"accountBalance":null,
|
||||||
|
"migratedToKeycard":false,
|
||||||
|
"currencyBalance":{"amount":999,"displayDecimals":2,"stripTrailingZeroes":false,"symbol":"USD"},
|
||||||
|
"assets":[
|
||||||
|
{"enabledNetworkBalance":{"amount":3.5,"displayDecimals":2,"stripTrailingZeroes":false,"symbol":"SOX"},"symbol":"socks"}
|
||||||
|
],
|
||||||
|
"currencyBalanceDouble":999,
|
||||||
|
"color":"#C78F67",
|
||||||
|
"colorId":"camel",
|
||||||
|
"emoji":"🔑",
|
||||||
|
"name":"Fab (key)",
|
||||||
|
"position":4,
|
||||||
|
"canSend":true,
|
||||||
|
"walletType":"key"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"address":"0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8882",
|
||||||
|
"accountBalance":null,
|
||||||
|
"migratedToKeycard":false,
|
||||||
|
"currencyBalance":{"amount":110.05,"displayDecimals":2,"stripTrailingZeroes":false,"symbol":"USD"},
|
||||||
|
"assets":[
|
||||||
|
{"enabledNetworkBalance":{"amount":42,"displayDecimals":6,"stripTrailingZeroes":true,"symbol":"AAVE"},"symbol":"Aave"},
|
||||||
|
{"enabledNetworkBalance":{"amount":120.123,"displayDecimals":2,"stripTrailingZeroes":true,"symbol":"DAI"},"symbol":"dai"}
|
||||||
|
],
|
||||||
|
"currencyBalanceDouble":110.05,
|
||||||
|
"color":"#EC266C"
|
||||||
|
,"colorId":"magenta",
|
||||||
|
"emoji":"🎨",
|
||||||
|
"name":"Family (seed)",
|
||||||
|
"position":1,
|
||||||
|
"canSend":true,
|
||||||
|
"walletType":"seed"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"address":"0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8881",
|
||||||
|
"accountBalance":null
|
||||||
|
,"migratedToKeycard":false,
|
||||||
|
"currencyBalance":{"amount":10,"displayDecimals":2,"stripTrailingZeroes":false,"symbol":"USD"},
|
||||||
|
"assets":[
|
||||||
|
{"enabledNetworkBalance":{"amount":1,"displayDecimals":1,"stripTrailingZeroes":true,"symbol":"DBF"},"symbol":"deadbeef"}
|
||||||
|
],
|
||||||
|
"currencyBalanceDouble":10,
|
||||||
|
"color":"#216266",
|
||||||
|
"colorId":"army",
|
||||||
|
"emoji":"🚗",
|
||||||
|
"name":"Hot wallet (generated)",
|
||||||
|
"position":3,"canSend":true,
|
||||||
|
"walletType":"generated"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
Component.onCompleted: append(data)
|
||||||
|
}
|
||||||
|
assetsModel: ListModel {
|
||||||
|
readonly property var data: [
|
||||||
|
{
|
||||||
|
"decimals":18,
|
||||||
|
"addressPerChain":[
|
||||||
|
{address:"0x0000000000000000000000000000000000000000","chainId":1},
|
||||||
|
{address:"0x0000000000000000000000000000000000000000","chainId":5},
|
||||||
|
{address:"0x0000000000000000000000000000000000000000","chainId":10},
|
||||||
|
{address:"0x0000000000000000000000000000000000000000","chainId":11155420},
|
||||||
|
{address:"0x0000000000000000000000000000000000000000","chainId":42161},
|
||||||
|
{address:"0x0000000000000000000000000000000000000000","chainId":421614},
|
||||||
|
{address:"0x0000000000000000000000000000000000000000","chainId":11155111}],
|
||||||
|
"communityId":"","type":1,"websiteUrl":"https://www.ethereum.org/",
|
||||||
|
"description":"Ethereum is a decentralized, open-source blockchain platform that enables developers to build and deploy smart contracts and decentralized applications.",
|
||||||
|
"detailsLoading":false,
|
||||||
|
"marketDetails":{
|
||||||
|
"change24hour":0.9121310349524345,
|
||||||
|
"changePct24hour":0.05209315257442912,
|
||||||
|
"changePctDay":1.19243897022671,"changePctHour":0.3655439934313061,
|
||||||
|
"currencyPrice":{"amount":2098.790000016801,"displayDecimals":2,"stripTrailingZeroes":false,"symbol":"USD"},
|
||||||
|
"highDay":{"amount":2090.658790484828,"displayDecimals":2,"stripTrailingZeroes":false,"symbol":"USD"},
|
||||||
|
"lowDay":{"amount":2059.795033958552,"displayDecimals":2,"stripTrailingZeroes":false,"symbol":"USD"},
|
||||||
|
"marketCap":{"amount":250980621528.3937,"displayDecimals":2,"stripTrailingZeroes":false,"symbol":"USD"}
|
||||||
|
},
|
||||||
|
"marketDetailsLoading":false,
|
||||||
|
"currentBalance":0.1220829289681219,
|
||||||
|
"currencyBalanceAsString":"256,23 USD",
|
||||||
|
"currencyBalance":256.2264304910557,
|
||||||
|
"sectionId":"section_1",
|
||||||
|
"iconSource":"file:///Users/khushboomehta/Documents/status-desktop/ui/StatusQ/src/assets/png/tokens/ETH.png",
|
||||||
|
"sectionName":"Your assets on Mainnet",
|
||||||
|
"balances":[
|
||||||
|
{
|
||||||
|
"balance":"122082928968121891",
|
||||||
|
"balanceAsDouble":0.1220829289681219,
|
||||||
|
"chainId":1,
|
||||||
|
"account":"0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8884",
|
||||||
|
"balanceAsString":"0,12"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"tokensKey":"ETH",
|
||||||
|
"name":"Ether",
|
||||||
|
"sources":";native;",
|
||||||
|
"symbol":"ETH"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"decimals":6,
|
||||||
|
"addressPerChain":[
|
||||||
|
{address:"0x6b175474e89094c44da98b954eedeac495271d0f","chainId":1},
|
||||||
|
{address:"0xda10009cbd5d07dd0cecc66161fc93d7c9000da1","chainId":10},
|
||||||
|
],
|
||||||
|
"communityId":"","type":1,
|
||||||
|
"websiteUrl":"https://makerdao.com/",
|
||||||
|
"description":"Dai (DAI) is a decentralized, stablecoin cryptocurrency built on the Ethereum blockchain.",
|
||||||
|
"detailsLoading":false,
|
||||||
|
"marketDetails":{
|
||||||
|
"change24hour":0.0004424433543155981,
|
||||||
|
"changePct24hour":0.04426443627508443,
|
||||||
|
"changePctDay":0.0008257482387743841,
|
||||||
|
"changePctHour":0.003162399421324529,
|
||||||
|
"currencyPrice":{"amount":0.9999000202515163,"displayDecimals":2,"stripTrailingZeroes":false,"symbol":"USD"},
|
||||||
|
"highDay":{"amount":1.000069852130498,"displayDecimals":2,"stripTrailingZeroes":false,"symbol":"USD"},
|
||||||
|
"lowDay":{"amount":0.9989457077643417,"displayDecimals":2,"stripTrailingZeroes":false,"symbol":"USD"},
|
||||||
|
"marketCap":{"amount":3641953745.413845,"displayDecimals":2,"stripTrailingZeroes":false,"symbol":"USD"}
|
||||||
|
},
|
||||||
|
"marketDetailsLoading":false
|
||||||
|
,"currentBalance":1000,
|
||||||
|
"currencyBalanceAsString":"",
|
||||||
|
"currencyBalance":0,
|
||||||
|
"sectionId":"section_zzz",
|
||||||
|
"iconSource":"file:///Users/khushboomehta/Documents/status-desktop/ui/StatusQ/src/assets/png/tokens/DAI.png",
|
||||||
|
"sectionName":"Popular assets",
|
||||||
|
"balances":[
|
||||||
|
{
|
||||||
|
"balance":"122082928968121891",
|
||||||
|
"balanceAsDouble":1000,
|
||||||
|
"chainId":10,
|
||||||
|
"account":"0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8884",
|
||||||
|
"balanceAsString":"1000"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"tokensKey":"DAI",
|
||||||
|
"name":"Dai Stablecoin",
|
||||||
|
"sources":";uniswap;status;",
|
||||||
|
"symbol":"DAI"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
Component.onCompleted: append(data)
|
||||||
|
}
|
||||||
|
flatCollectiblesModel: ListModel {
|
||||||
|
readonly property var data: [
|
||||||
|
// collection 2
|
||||||
|
{
|
||||||
|
tokenId: "id_3",
|
||||||
|
symbol: "abc",
|
||||||
|
chainId: NetworksModel.mainnetChainId,
|
||||||
|
name: "Multi-seq NFT 1",
|
||||||
|
contractAddress: "contract_2",
|
||||||
|
collectionName: "Multi-sequencer Test NFT",
|
||||||
|
collectionUid: "collection_2",
|
||||||
|
ownership: [
|
||||||
|
{
|
||||||
|
accountAddress: "0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8884",
|
||||||
|
balance: 1,
|
||||||
|
txTimestamp: 1714059810
|
||||||
|
}
|
||||||
|
],
|
||||||
|
imageUrl: Constants.tokenIcon("ETH", false),
|
||||||
|
mediaUrl: Qt.resolvedUrl(""),
|
||||||
|
communityId: "",
|
||||||
|
communityName: "",
|
||||||
|
communityImage: Qt.resolvedUrl(""),
|
||||||
|
tokenType: Constants.TokenType.ERC721
|
||||||
|
},
|
||||||
|
{
|
||||||
|
tokenId: "id_4",
|
||||||
|
symbol: "def",
|
||||||
|
chainId: NetworksModel.mainnetChainId,
|
||||||
|
name: "Multi-seq NFT 2",
|
||||||
|
contractAddress: "contract_2",
|
||||||
|
collectionName: "Multi-sequencer Test NFT",
|
||||||
|
collectionUid: "collection_2",
|
||||||
|
ownership: [
|
||||||
|
{
|
||||||
|
accountAddress: "0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8884",
|
||||||
|
balance: 1,
|
||||||
|
txTimestamp: 1714059811
|
||||||
|
}
|
||||||
|
],
|
||||||
|
imageUrl: Constants.tokenIcon("ETH", false),
|
||||||
|
mediaUrl: Qt.resolvedUrl(""),
|
||||||
|
communityId: "",
|
||||||
|
communityName: "",
|
||||||
|
communityImage: Qt.resolvedUrl(""),
|
||||||
|
tokenType: Constants.TokenType.ERC721
|
||||||
|
},
|
||||||
|
{
|
||||||
|
tokenId: "id_5",
|
||||||
|
symbol: "ghi",
|
||||||
|
chainId: NetworksModel.mainnetChainId,
|
||||||
|
name: "Multi-seq NFT 3",
|
||||||
|
contractAddress: "contract_2",
|
||||||
|
collectionName: "Multi-sequencer Test NFT",
|
||||||
|
collectionUid: "collection_2",
|
||||||
|
ownership: [
|
||||||
|
{
|
||||||
|
accountAddress: "0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8882",
|
||||||
|
balance: 1,
|
||||||
|
txTimestamp: 1714059899
|
||||||
|
}
|
||||||
|
],
|
||||||
|
imageUrl: Constants.tokenIcon("ETH", false),
|
||||||
|
mediaUrl: Qt.resolvedUrl(""),
|
||||||
|
communityId: "",
|
||||||
|
communityName: "",
|
||||||
|
communityImage: Qt.resolvedUrl(""),
|
||||||
|
tokenType: Constants.TokenType.ERC721
|
||||||
|
}
|
||||||
|
]
|
||||||
|
Component.onCompleted: append(data)
|
||||||
|
}
|
||||||
|
collectiblesModel: ListModel {
|
||||||
|
readonly property var data: [
|
||||||
|
{
|
||||||
|
"isRouteEnabled":true,
|
||||||
|
"layer":1,
|
||||||
|
"type":"other",
|
||||||
|
"subitems":[
|
||||||
|
{
|
||||||
|
"isRouteEnabled":true,
|
||||||
|
"layer":1,
|
||||||
|
"key":"abc",
|
||||||
|
"icon":"file:///Users/khushboomehta/Documents/status-desktop/ui/StatusQ/src/assets/png/tokens/ETH.png",
|
||||||
|
"shortName":"eth",
|
||||||
|
"chainColor":"#627EEA",
|
||||||
|
"iconUrl":"network/Network=Ethereum",
|
||||||
|
"blockExplorerURL":"https://etherscan.io/",
|
||||||
|
"isTest":false,
|
||||||
|
"nativeCurrencyDecimals":18,
|
||||||
|
"nativeCurrencySymbol":"ETH",
|
||||||
|
"nativeCurrencyName":"Ether",
|
||||||
|
"communityName":"",
|
||||||
|
"communityId":"",
|
||||||
|
"mediaUrl":"",
|
||||||
|
"imageUrl":"file:///Users/khushboomehta/Documents/status-desktop/ui/StatusQ/src/assets/png/tokens/ETH.png",
|
||||||
|
"chainName":"Mainnet",
|
||||||
|
"tokenType":2,
|
||||||
|
"communityImage":"",
|
||||||
|
"name":"Multi-seq NFT 1",
|
||||||
|
"chainId":1,
|
||||||
|
"symbol":"abc",
|
||||||
|
"tokenId":"id_3",
|
||||||
|
"ownership":[{"txTimestamp":1714059810,"balance":1,"accountAddress":"0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8884"}],
|
||||||
|
"collectionUid":"collection_2",
|
||||||
|
"collectionName":"Multi-sequencer Test NFT",
|
||||||
|
"contractAddress":"contract_2",
|
||||||
|
"groupingValue":"collection_2",
|
||||||
|
"balance":1
|
||||||
|
},
|
||||||
|
{"isRouteEnabled":true,
|
||||||
|
"layer":1,
|
||||||
|
"key":"def",
|
||||||
|
"icon":"file:///Users/khushboomehta/Documents/status-desktop/ui/StatusQ/src/assets/png/tokens/ETH.png",
|
||||||
|
"shortName":"eth",
|
||||||
|
"chainColor":"#627EEA",
|
||||||
|
"iconUrl":"network/Network=Ethereum",
|
||||||
|
"blockExplorerURL":"https://etherscan.io/",
|
||||||
|
"isTest":false,
|
||||||
|
"nativeCurrencyDecimals":18,
|
||||||
|
"nativeCurrencySymbol":"ETH",
|
||||||
|
"nativeCurrencyName":"Ether",
|
||||||
|
"communityName":"",
|
||||||
|
"communityId":"",
|
||||||
|
"mediaUrl":"",
|
||||||
|
"imageUrl":"file:///Users/khushboomehta/Documents/status-desktop/ui/StatusQ/src/assets/png/tokens/ETH.png",
|
||||||
|
"chainName":"Mainnet",
|
||||||
|
"tokenType":2,
|
||||||
|
"communityImage":"",
|
||||||
|
"name":"Multi-seq NFT 2",
|
||||||
|
"chainId":1,
|
||||||
|
"symbol":"def",
|
||||||
|
"tokenId":"id_4",
|
||||||
|
"ownership":[{"txTimestamp":1714059811,"balance":1,"accountAddress":"0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8884"}],
|
||||||
|
"collectionUid":"collection_2",
|
||||||
|
"collectionName":"Multi-sequencer Test NFT",
|
||||||
|
"contractAddress":"contract_2",
|
||||||
|
"groupingValue":"collection_2",
|
||||||
|
"balance":1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"isRouteEnabled":true,
|
||||||
|
"layer":1,
|
||||||
|
"key":"ghi",
|
||||||
|
"icon":"file:///Users/khushboomehta/Documents/status-desktop/ui/StatusQ/src/assets/png/tokens/ETH.png",
|
||||||
|
"shortName":"eth",
|
||||||
|
"chainColor":"#627EEA",
|
||||||
|
"iconUrl":"network/Network=Ethereum",
|
||||||
|
"blockExplorerURL":"https://etherscan.io/",
|
||||||
|
"isTest":false,
|
||||||
|
"nativeCurrencyDecimals":18,
|
||||||
|
"nativeCurrencySymbol":"ETH",
|
||||||
|
"nativeCurrencyName":"Ether",
|
||||||
|
"communityName":"","communityId":"",
|
||||||
|
"mediaUrl":"",
|
||||||
|
"imageUrl":"file:///Users/khushboomehta/Documents/status-desktop/ui/StatusQ/src/assets/png/tokens/ETH.png",
|
||||||
|
"chainName":"Mainnet",
|
||||||
|
"tokenType":2,
|
||||||
|
"communityImage":"",
|
||||||
|
"name":"Multi-seq NFT 3",
|
||||||
|
"chainId":1,
|
||||||
|
"symbol":"ghi",
|
||||||
|
"tokenId":"id_5",
|
||||||
|
"ownership":[{"txTimestamp":1714059899,"balance":1,"accountAddress":"0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8884"}],
|
||||||
|
"collectionUid":"collection_2",
|
||||||
|
"collectionName":"Multi-sequencer Test NFT",
|
||||||
|
"contractAddress":"contract_2",
|
||||||
|
"groupingValue":"collection_2",
|
||||||
|
"balance":1
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"key":"abc","icon":"file:///Users/khushboomehta/Documents/status-desktop/ui/StatusQ/src/assets/png/tokens/ETH.png",
|
||||||
|
"shortName":"eth",
|
||||||
|
"chainColor":"#627EEA",
|
||||||
|
"iconUrl":"network/Network=Ethereum",
|
||||||
|
"blockExplorerURL":"https://etherscan.io/",
|
||||||
|
"isTest":false,
|
||||||
|
"nativeCurrencyDecimals":18,
|
||||||
|
"nativeCurrencySymbol":"ETH",
|
||||||
|
"nativeCurrencyName":"Ether",
|
||||||
|
"communityName":"",
|
||||||
|
"communityId":"",
|
||||||
|
"mediaUrl":"",
|
||||||
|
"imageUrl":"file:///Users/khushboomehta/Documents/status-desktop/ui/StatusQ/src/assets/png/tokens/ETH.png",
|
||||||
|
"chainName":"Mainnet",
|
||||||
|
"tokenType":2,
|
||||||
|
"communityImage":"",
|
||||||
|
"name":"Multi-seq NFT 1",
|
||||||
|
"chainId":1,
|
||||||
|
"symbol":"abc",
|
||||||
|
"tokenId":"id_3",
|
||||||
|
"ownership":[{"txTimestamp":1714059810,"balance":1,"accountAddress":"0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8884"}],
|
||||||
|
"collectionUid":"collection_2",
|
||||||
|
"collectionName":"Multi-sequencer Test NFT",
|
||||||
|
"contractAddress":"contract_2",
|
||||||
|
"groupName":"Multi-sequencer Test NFT",
|
||||||
|
"groupingValue":"collection_2",
|
||||||
|
"balance":1
|
||||||
|
}
|
||||||
|
]
|
||||||
|
Component.onCompleted: append(data)
|
||||||
|
}
|
||||||
|
networksModel: ListModel {
|
||||||
|
readonly property var data: [
|
||||||
|
{
|
||||||
|
|
||||||
|
"layer":1,
|
||||||
|
"isRouteEnabled":true,
|
||||||
|
"chainId":1,
|
||||||
|
"chainName":"Mainnet",
|
||||||
|
"blockExplorerURL":"https://etherscan.io/",
|
||||||
|
"iconUrl":"network/Network=Ethereum",
|
||||||
|
"chainColor":"#627EEA",
|
||||||
|
"shortName":"eth",
|
||||||
|
"nativeCurrencyName":"Ether",
|
||||||
|
"nativeCurrencySymbol":"ETH",
|
||||||
|
"nativeCurrencyDecimals":18,
|
||||||
|
"isTest":false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"layer":2,
|
||||||
|
"isRouteEnabled":true,
|
||||||
|
"chainId":10,
|
||||||
|
"chainName":"Optimism",
|
||||||
|
"blockExplorerURL":"https://optimistic.etherscan.io",
|
||||||
|
"iconUrl":"network/Network=Optimism",
|
||||||
|
"chainColor":"#E90101",
|
||||||
|
"shortName":"oeth",
|
||||||
|
"nativeCurrencyName":"Ether",
|
||||||
|
"nativeCurrencySymbol":"ETH",
|
||||||
|
"nativeCurrencyDecimals":18,
|
||||||
|
"isTest":false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"layer":2,
|
||||||
|
"isRouteEnabled":true,
|
||||||
|
"chainId":42161,
|
||||||
|
"chainName":"Arbitrum",
|
||||||
|
"blockExplorerURL":"https://arbiscan.io/",
|
||||||
|
"iconUrl":"network/Network=Arbitrum",
|
||||||
|
"chainColor":"#51D0F0",
|
||||||
|
"shortName":"arb1",
|
||||||
|
"nativeCurrencyName":"Ether",
|
||||||
|
"nativeCurrencySymbol":"ETH",
|
||||||
|
"nativeCurrencyDecimals":18,
|
||||||
|
"isTest":false
|
||||||
|
}
|
||||||
|
|
||||||
|
]
|
||||||
|
Component.onCompleted: append(data)
|
||||||
|
}
|
||||||
|
recipientsModel: ListModel {
|
||||||
|
Component.onCompleted: {
|
||||||
|
for (let i = 0; i < 10; i++) {
|
||||||
|
append({
|
||||||
|
name: "some saved addr name " + i,
|
||||||
|
ens: "ens %1".arg(i),
|
||||||
|
address: "0x2B748A02e06B159C7C3E98F5064577B96E55A7b%1".arg(i),
|
||||||
|
})
|
||||||
|
|
||||||
|
append({
|
||||||
|
name: "some addr name " + i,
|
||||||
|
ens: "ens %1".arg(i),
|
||||||
|
address: "0x1B748A02e06B159C7C3E69F5064577B96E55A7b%1".arg(i),
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
recipientsFilterModel: recipientsModel
|
||||||
|
currentCurrency: "USD"
|
||||||
|
fnFormatCurrencyAmount: function (amount, symbol, options = null, locale = null) {
|
||||||
|
if (isNaN(amount)) {
|
||||||
|
return "N/A"
|
||||||
|
}
|
||||||
|
var currencyAmount = ({
|
||||||
|
amount: amount,
|
||||||
|
symbol: symbol ? symbol.toUpperCase() : "USD",
|
||||||
|
displayDecimals: 2,
|
||||||
|
stripTrailingZeroes: false
|
||||||
|
})
|
||||||
|
return LocaleUtils.currencyAmountToLocaleString(currencyAmount, options, locale)
|
||||||
|
}
|
||||||
|
|
||||||
|
fnResolveENS: function (ensName, uuid) {}
|
||||||
|
|
||||||
|
readonly property SignalSpy formChangedSpy: SignalSpy {
|
||||||
|
target: simpleSend
|
||||||
|
signalName: "formChanged"
|
||||||
|
}
|
||||||
|
|
||||||
|
readonly property SignalSpy reviewSendClickedSpy: SignalSpy {
|
||||||
|
target: simpleSend
|
||||||
|
signalName: "reviewSendClicked"
|
||||||
|
}
|
||||||
|
|
||||||
|
readonly property SignalSpy launchBuyFlowSpy: SignalSpy {
|
||||||
|
target: simpleSend
|
||||||
|
signalName: "launchBuyFlow"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
TestCase {
|
||||||
|
name: "SimpleSendModal"
|
||||||
|
when: windowShown
|
||||||
|
|
||||||
|
property SimpleSendModal controlUnderTest: null
|
||||||
|
|
||||||
|
function init() {
|
||||||
|
controlUnderTest = createTemporaryObject(componentUnderTest, root)
|
||||||
|
}
|
||||||
|
|
||||||
|
function test_launchPopup() {
|
||||||
|
verify(!!controlUnderTest)
|
||||||
|
controlUnderTest.open()
|
||||||
|
verify(controlUnderTest.opened)
|
||||||
|
}
|
||||||
|
|
||||||
|
function test_closeModal() {
|
||||||
|
// close popup
|
||||||
|
controlUnderTest.close()
|
||||||
|
verify(!controlUnderTest.opened)
|
||||||
|
}
|
||||||
|
|
||||||
|
function test_default_state() {
|
||||||
|
verify(!!controlUnderTest)
|
||||||
|
controlUnderTest.open()
|
||||||
|
verify(controlUnderTest.opened)
|
||||||
|
|
||||||
|
// Default account item from model at 0th position
|
||||||
|
const defaultAccountItem = SQUtils.ModelUtils.get(controlUnderTest.accountsModel, 0)
|
||||||
|
|
||||||
|
// Default network item from model at 0th position
|
||||||
|
const defaultNetworkItem = SQUtils.ModelUtils.get(controlUnderTest.networksModel, 0)
|
||||||
|
|
||||||
|
// Account Selector
|
||||||
|
const accountSelector = findChild(controlUnderTest, "accountSelector")
|
||||||
|
verify(!!accountSelector)
|
||||||
|
const accountSelectorHeaderBackground = findChild(accountSelector, "headerBackground")
|
||||||
|
verify(!!accountSelectorHeaderBackground)
|
||||||
|
const accountSelectorAssetContent = findChild(accountSelector, "assetContent")
|
||||||
|
verify(!!accountSelectorAssetContent)
|
||||||
|
const accountSelectorTextContent = findChild(accountSelector, "textContent")
|
||||||
|
verify(!!accountSelectorTextContent)
|
||||||
|
|
||||||
|
compare(accountSelectorHeaderBackground.color, Utils.getColorForId(defaultAccountItem.colorId))
|
||||||
|
compare(accountSelectorAssetContent.asset.emoji, defaultAccountItem.emoji)
|
||||||
|
compare(accountSelectorAssetContent.asset.color, Utils.getColorForId(defaultAccountItem.colorId))
|
||||||
|
compare(accountSelectorTextContent.text, defaultAccountItem.name)
|
||||||
|
|
||||||
|
// Sticky Header should not be visible when not scrolling
|
||||||
|
const stickySendModalHeader = findChild(controlUnderTest, "stickySendModalHeader")
|
||||||
|
verify(!!stickySendModalHeader)
|
||||||
|
compare(stickySendModalHeader.height, 0)
|
||||||
|
|
||||||
|
// Regular Header
|
||||||
|
const sendModalHeader = findChild(controlUnderTest, "sendModalHeader")
|
||||||
|
verify(!!sendModalHeader)
|
||||||
|
|
||||||
|
// Title
|
||||||
|
const sendModalTitleText = findChild(controlUnderTest, "sendModalTitleText")
|
||||||
|
verify(!!sendModalTitleText)
|
||||||
|
verify(sendModalHeader.visible)
|
||||||
|
compare(sendModalTitleText.text, qsTr("Send"))
|
||||||
|
|
||||||
|
// Token Selector
|
||||||
|
const tokenSelector = findChild(controlUnderTest, "tokenSelector")
|
||||||
|
verify(!!tokenSelector)
|
||||||
|
const tokenSelectorButton = findChild(controlUnderTest, "tokenSelectorButton")
|
||||||
|
verify(!!tokenSelectorButton)
|
||||||
|
verify(!tokenSelectorButton.selected)
|
||||||
|
compare(tokenSelectorButton.name, "")
|
||||||
|
compare(tokenSelectorButton.icon, "")
|
||||||
|
compare(tokenSelectorButton.text, qsTr("Select token"))
|
||||||
|
|
||||||
|
// Network picker
|
||||||
|
const networkFilter = findChild(controlUnderTest, "networkFilter")
|
||||||
|
verify(!!networkFilter)
|
||||||
|
compare(networkFilter.selection, [defaultNetworkItem.chainId])
|
||||||
|
|
||||||
|
// Amount input area
|
||||||
|
const amountToSend = findChild(controlUnderTest, "amountToSend")
|
||||||
|
verify(!!amountToSend)
|
||||||
|
verify(!amountToSend.visible)
|
||||||
|
|
||||||
|
// Recipient Area
|
||||||
|
const recipientsPanel = findChild(controlUnderTest, "recipientsPanel")
|
||||||
|
verify(!!recipientsPanel)
|
||||||
|
compare(recipientsPanel.selectedRecipientType, Constants.RecipientAddressObjectType.RecentsAddress)
|
||||||
|
compare(recipientsPanel.selectedRecipientAddress, "")
|
||||||
|
|
||||||
|
// Fees Layout
|
||||||
|
const feesLayout = findChild(controlUnderTest, "feesLayout")
|
||||||
|
verify(!!feesLayout)
|
||||||
|
verify(!feesLayout.visible)
|
||||||
|
|
||||||
|
// Footer
|
||||||
|
const sendModalFooter = findChild(controlUnderTest, "sendModalFooter")
|
||||||
|
verify(!!sendModalFooter)
|
||||||
|
compare(sendModalFooter.estimatedTime, "")
|
||||||
|
compare(sendModalFooter.estimatedFees, "")
|
||||||
|
verify(!sendModalFooter.loading)
|
||||||
|
verify(!sendModalFooter.error)
|
||||||
|
verify(!sendModalFooter.errorTags)
|
||||||
|
|
||||||
|
// form not filled completely
|
||||||
|
verify(!controlUnderTest.allValuesFilledCorrectly)
|
||||||
|
}
|
||||||
|
|
||||||
|
function test_preset_values() {
|
||||||
|
verify(!!controlUnderTest)
|
||||||
|
controlUnderTest.open()
|
||||||
|
verify(controlUnderTest.opened)
|
||||||
|
|
||||||
|
waitForRendering(controlUnderTest.contentItem)
|
||||||
|
|
||||||
|
controlUnderTest.sendType = Constants.SendType.Transfer
|
||||||
|
controlUnderTest.selectedAccountAddress = "0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8884"
|
||||||
|
controlUnderTest.selectedChainId = 10
|
||||||
|
controlUnderTest.selectedTokenKey = "DAI"
|
||||||
|
controlUnderTest.selectedRawAmount = "10000000" // 10 DAI
|
||||||
|
controlUnderTest.selectedRecipientAddress = "0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8881"
|
||||||
|
|
||||||
|
const selectedAccount = SQUtils.ModelUtils.getByKey(controlUnderTest.accountsModel, "address", controlUnderTest.selectedAccountAddress)
|
||||||
|
const selectedToken = SQUtils.ModelUtils.getByKey(controlUnderTest.assetsModel, "tokensKey", controlUnderTest.selectedTokenKey)
|
||||||
|
|
||||||
|
// Account Selector
|
||||||
|
const accountSelector = findChild(controlUnderTest, "accountSelector")
|
||||||
|
verify(!!accountSelector)
|
||||||
|
const accountSelectorHeaderBackground = findChild(accountSelector, "headerBackground")
|
||||||
|
verify(!!accountSelectorHeaderBackground)
|
||||||
|
const accountSelectorAssetContent = findChild(accountSelector, "assetContent")
|
||||||
|
verify(!!accountSelectorAssetContent)
|
||||||
|
const accountSelectorTextContent = findChild(accountSelector, "textContent")
|
||||||
|
verify(!!accountSelectorTextContent)
|
||||||
|
|
||||||
|
compare(accountSelectorHeaderBackground.color, Utils.getColorForId(selectedAccount.colorId))
|
||||||
|
compare(accountSelectorAssetContent.asset.emoji, selectedAccount.emoji)
|
||||||
|
compare(accountSelectorAssetContent.asset.color, Utils.getColorForId(selectedAccount.colorId))
|
||||||
|
compare(accountSelectorTextContent.text, selectedAccount.name)
|
||||||
|
|
||||||
|
// Sticky Header should not be visible when not scrolling
|
||||||
|
const stickySendModalHeader = findChild(controlUnderTest, "stickySendModalHeader")
|
||||||
|
verify(!!stickySendModalHeader)
|
||||||
|
compare(stickySendModalHeader.height, 0)
|
||||||
|
|
||||||
|
// Regular Header
|
||||||
|
const sendModalHeader = findChild(controlUnderTest, "sendModalHeader")
|
||||||
|
verify(!!sendModalHeader)
|
||||||
|
|
||||||
|
// Token Selector
|
||||||
|
const tokenSelector = findChild(sendModalHeader, "tokenSelector")
|
||||||
|
verify(!!tokenSelector)
|
||||||
|
const tokenSelectorButton = findChild(sendModalHeader, "tokenSelectorButton")
|
||||||
|
verify(!!tokenSelectorButton)
|
||||||
|
verify(tokenSelectorButton.selected)
|
||||||
|
compare(tokenSelectorButton.name, selectedToken.symbol)
|
||||||
|
compare(tokenSelectorButton.icon, Constants.tokenIcon(selectedToken.symbol))
|
||||||
|
|
||||||
|
// Network picker
|
||||||
|
const networkFilter = findChild(controlUnderTest, "networkFilter")
|
||||||
|
verify(!!networkFilter)
|
||||||
|
compare(networkFilter.selection, [controlUnderTest.selectedChainId])
|
||||||
|
|
||||||
|
// Amount input area
|
||||||
|
const amountToSend = findChild(controlUnderTest, "amountToSend")
|
||||||
|
verify(!!amountToSend)
|
||||||
|
verify(amountToSend.visible)
|
||||||
|
verify(amountToSend.cursorVisible)
|
||||||
|
compare(amountToSend.placeholderText, "0")
|
||||||
|
verify(!amountToSend.bottomTextLoading)
|
||||||
|
compare(amountToSend.text, "10")
|
||||||
|
|
||||||
|
// Recipient Area
|
||||||
|
const recipientsPanel = findChild(controlUnderTest, "recipientsPanel")
|
||||||
|
verify(!!recipientsPanel)
|
||||||
|
compare(recipientsPanel.selectedRecipientType, Constants.RecipientAddressObjectType.RecentsAddress)
|
||||||
|
compare(recipientsPanel.selectedRecipientAddress, "0x7F47C2e98a4BBf5487E6fb082eC2D9Ab0E6d8881")
|
||||||
|
|
||||||
|
controlUnderTest.formChangedSpy.wait()
|
||||||
|
tryCompare(controlUnderTest, "allValuesFilledCorrectly", true)
|
||||||
|
|
||||||
|
// set loading state to true, mimicing fectSuggestedRoutes is called
|
||||||
|
controlUnderTest.routesLoading = true
|
||||||
|
|
||||||
|
verify(amountToSend.bottomTextLoading)
|
||||||
|
|
||||||
|
// Fees Layout
|
||||||
|
const feesLayout = findChild(controlUnderTest, "feesLayout")
|
||||||
|
verify(!!feesLayout)
|
||||||
|
const signTransactionFees = findChild(feesLayout, "signTransactionFees")
|
||||||
|
verify(!!signTransactionFees)
|
||||||
|
const cryptoFeesText = findChild(signTransactionFees, "cryptoFeesText")
|
||||||
|
verify(!!cryptoFeesText)
|
||||||
|
const fiatFeesText = findChild(signTransactionFees, "fiatFeesText")
|
||||||
|
verify(!!fiatFeesText)
|
||||||
|
verify(feesLayout.visible)
|
||||||
|
verify(signTransactionFees.loading)
|
||||||
|
verify(cryptoFeesText.loading)
|
||||||
|
compare(cryptoFeesText.customColor, Theme.palette.baseColor1)
|
||||||
|
verify(fiatFeesText.loading)
|
||||||
|
compare(fiatFeesText.customColor, Theme.palette.baseColor1)
|
||||||
|
|
||||||
|
// Footer
|
||||||
|
const sendModalFooter = findChild(controlUnderTest, "sendModalFooter")
|
||||||
|
verify(!!sendModalFooter)
|
||||||
|
compare(sendModalFooter.estimatedTime, "")
|
||||||
|
compare(sendModalFooter.estimatedFees, "")
|
||||||
|
verify(sendModalFooter.loading)
|
||||||
|
verify(!sendModalFooter.error)
|
||||||
|
verify(!sendModalFooter.errorTags)
|
||||||
|
|
||||||
|
// set correct values for router such that a valid route was returned
|
||||||
|
controlUnderTest.routesLoading = false
|
||||||
|
controlUnderTest.estimatedTime = "~60s"
|
||||||
|
controlUnderTest.estimatedFiatFees = "1.45 EUR"
|
||||||
|
controlUnderTest.estimatedCryptoFees = "0.0007 ETH"
|
||||||
|
controlUnderTest.routerErrorCode = ""
|
||||||
|
controlUnderTest.routerError = ""
|
||||||
|
controlUnderTest.routerErrorDetails = ""
|
||||||
|
|
||||||
|
// check route set values
|
||||||
|
verify(!amountToSend.bottomTextLoading)
|
||||||
|
verify(!signTransactionFees.loading)
|
||||||
|
compare(signTransactionFees.cryptoFees, controlUnderTest.estimatedCryptoFees)
|
||||||
|
compare(signTransactionFees.fiatFees, controlUnderTest.estimatedFiatFees)
|
||||||
|
verify(!signTransactionFees.error)
|
||||||
|
compare(cryptoFeesText.customColor, Theme.palette.baseColor1)
|
||||||
|
compare(fiatFeesText.customColor, Theme.palette.baseColor1)
|
||||||
|
compare(sendModalFooter.estimatedTime,controlUnderTest.estimatedTime)
|
||||||
|
compare(sendModalFooter.estimatedFees, controlUnderTest.estimatedFiatFees)
|
||||||
|
verify(!sendModalFooter.loading)
|
||||||
|
verify(!sendModalFooter.error)
|
||||||
|
verify(!sendModalFooter.errorTags)
|
||||||
|
|
||||||
|
// clear amount and check if allValuesFilledCorrectly changes
|
||||||
|
amountToSend.clear()
|
||||||
|
tryCompare(controlUnderTest, "allValuesFilledCorrectly", false)
|
||||||
|
|
||||||
|
controlUnderTest.selectedRawAmount = "110000000" // 11 DAI
|
||||||
|
|
||||||
|
// set error path
|
||||||
|
controlUnderTest.routesLoading = false
|
||||||
|
controlUnderTest.estimatedTime = "~60s"
|
||||||
|
controlUnderTest.estimatedFiatFees = "1.45 EUR"
|
||||||
|
controlUnderTest.estimatedCryptoFees = "0.0007 ETH"
|
||||||
|
controlUnderTest.routerErrorCode = Constants.routerErrorCodes.router.errNotEnoughNativeBalance
|
||||||
|
controlUnderTest.routerError = qsTr("Not enough ETH to pay gas fees")
|
||||||
|
controlUnderTest.routerErrorDetails = ""
|
||||||
|
|
||||||
|
// check error state
|
||||||
|
compare(signTransactionFees.cryptoFees, controlUnderTest.estimatedCryptoFees)
|
||||||
|
compare(signTransactionFees.fiatFees, controlUnderTest.estimatedFiatFees)
|
||||||
|
verify(signTransactionFees.error)
|
||||||
|
compare(cryptoFeesText.customColor, Theme.palette.dangerColor1)
|
||||||
|
compare(fiatFeesText.customColor, Theme.palette.dangerColor1)
|
||||||
|
compare(sendModalFooter.estimatedTime,controlUnderTest.estimatedTime)
|
||||||
|
compare(sendModalFooter.estimatedFees, controlUnderTest.estimatedFiatFees)
|
||||||
|
verify(!sendModalFooter.loading)
|
||||||
|
verify(sendModalFooter.error)
|
||||||
|
compare(sendModalFooter.errorTags.count, 2)
|
||||||
|
}
|
||||||
|
|
||||||
|
function test_scrolling_state() {
|
||||||
|
verify(!!controlUnderTest)
|
||||||
|
controlUnderTest.open()
|
||||||
|
verify(controlUnderTest.opened)
|
||||||
|
|
||||||
|
waitForRendering(controlUnderTest.contentItem)
|
||||||
|
|
||||||
|
// Default network item from model at 0th position
|
||||||
|
const defaultNetworkItem = SQUtils.ModelUtils.get(controlUnderTest.networksModel, 0)
|
||||||
|
|
||||||
|
// Sticky Header should not be visible when not scrolling
|
||||||
|
const stickySendModalHeader = findChild(controlUnderTest, "stickySendModalHeader")
|
||||||
|
verify(!!stickySendModalHeader)
|
||||||
|
verify(stickySendModalHeader.height === 0)
|
||||||
|
|
||||||
|
// Sticky Header Title
|
||||||
|
const stickyHeaderTitleText = findChild(stickySendModalHeader, "sendModalTitleText")
|
||||||
|
verify(!!stickyHeaderTitleText)
|
||||||
|
compare(stickyHeaderTitleText.text, qsTr("Send"))
|
||||||
|
|
||||||
|
// Sticky Header Token Selector
|
||||||
|
const stickyHeaderTokenSelector = findChild(stickySendModalHeader, "tokenSelector")
|
||||||
|
verify(!!stickyHeaderTokenSelector)
|
||||||
|
const stickyHeaderTokenSelectorButton = findChild(stickySendModalHeader, "tokenSelectorButton")
|
||||||
|
verify(!!stickyHeaderTokenSelectorButton)
|
||||||
|
const stickyHeaderTokenSelectorDropdown = findChild(stickySendModalHeader, "dropdown")
|
||||||
|
verify(!!stickyHeaderTokenSelectorDropdown)
|
||||||
|
|
||||||
|
verify(!stickyHeaderTokenSelectorButton.selected)
|
||||||
|
compare(stickyHeaderTokenSelectorButton.name, "")
|
||||||
|
compare(stickyHeaderTokenSelectorButton.icon, "")
|
||||||
|
compare(stickyHeaderTokenSelectorButton.text, qsTr("Select token"))
|
||||||
|
|
||||||
|
// Sticky Header Network picker
|
||||||
|
const stickyHeaderNetworkFilter = findChild(stickySendModalHeader, "networkFilter")
|
||||||
|
verify(!!stickyHeaderNetworkFilter)
|
||||||
|
compare(stickyHeaderNetworkFilter.selection, [defaultNetworkItem.chainId])
|
||||||
|
|
||||||
|
// Regular Header
|
||||||
|
const sendModalHeader = findChild(controlUnderTest, "sendModalHeader")
|
||||||
|
verify(!!sendModalHeader)
|
||||||
|
|
||||||
|
// Regular Header Title
|
||||||
|
const sendModalTitleText = findChild(sendModalHeader, "sendModalTitleText")
|
||||||
|
verify(!!sendModalTitleText)
|
||||||
|
verify(sendModalHeader.visible)
|
||||||
|
compare(sendModalTitleText.text, qsTr("Send"))
|
||||||
|
|
||||||
|
// Regular Header Token Selector
|
||||||
|
const tokenSelector = findChild(sendModalHeader, "tokenSelector")
|
||||||
|
verify(!!tokenSelector)
|
||||||
|
const tokenSelectorButton = findChild(sendModalHeader, "tokenSelectorButton")
|
||||||
|
verify(!!tokenSelectorButton)
|
||||||
|
const tokenSelectorDropdown = findChild(sendModalHeader, "dropdown")
|
||||||
|
verify(!!tokenSelectorDropdown)
|
||||||
|
|
||||||
|
verify(!tokenSelectorButton.selected)
|
||||||
|
compare(tokenSelectorButton.name, "")
|
||||||
|
compare(tokenSelectorButton.icon, "")
|
||||||
|
compare(tokenSelectorButton.text, qsTr("Select token"))
|
||||||
|
|
||||||
|
// Regular Header Network picker
|
||||||
|
const networkFilter = findChild(sendModalHeader, "networkFilter")
|
||||||
|
verify(!!networkFilter)
|
||||||
|
compare(networkFilter.selection, [defaultNetworkItem.chainId])
|
||||||
|
|
||||||
|
// launch token selector dropdown
|
||||||
|
tokenSelectorButton.clicked()
|
||||||
|
verify(tokenSelectorDropdown.opened)
|
||||||
|
|
||||||
|
// scroll
|
||||||
|
const scrollView = findChild(controlUnderTest, "scrollView")
|
||||||
|
verify(!!scrollView)
|
||||||
|
scrollView.scrollEnd()
|
||||||
|
|
||||||
|
// the opened popup should be closed and sticky header should become visible
|
||||||
|
tryCompare(tokenSelectorDropdown, "opened", false)
|
||||||
|
tryVerify(() => stickySendModalHeader.height > 0)
|
||||||
|
|
||||||
|
stickyHeaderTokenSelectorButton.clicked()
|
||||||
|
verify(stickyHeaderTokenSelectorDropdown.opened)
|
||||||
|
|
||||||
|
// scroll back up
|
||||||
|
scrollView.scrollHome()
|
||||||
|
tryCompare(stickyHeaderTokenSelectorDropdown, "opened", false)
|
||||||
|
tryVerify(() => stickySendModalHeader.height === 0)
|
||||||
|
|
||||||
|
// set values for headers using modal api
|
||||||
|
controlUnderTest.selectedChainId = 10
|
||||||
|
controlUnderTest.selectedTokenKey = "DAI"
|
||||||
|
|
||||||
|
const selectedToken = SQUtils.ModelUtils.getByKey(controlUnderTest.assetsModel, "tokensKey", controlUnderTest.selectedTokenKey)
|
||||||
|
|
||||||
|
// Check regular header
|
||||||
|
verify(tokenSelectorButton.selected)
|
||||||
|
compare(tokenSelectorButton.name, selectedToken.symbol)
|
||||||
|
compare(tokenSelectorButton.icon, Constants.tokenIcon(selectedToken.symbol))
|
||||||
|
compare(networkFilter.selection, [10])
|
||||||
|
|
||||||
|
// Check sticky header
|
||||||
|
verify(tokenSelectorButton.selected)
|
||||||
|
compare(tokenSelectorButton.name, selectedToken.symbol)
|
||||||
|
compare(tokenSelectorButton.icon, Constants.tokenIcon(selectedToken.symbol))
|
||||||
|
compare(networkFilter.selection, [10])
|
||||||
|
}
|
||||||
|
|
||||||
|
function test_set_interactive_false() {
|
||||||
|
verify(!!controlUnderTest)
|
||||||
|
controlUnderTest.open()
|
||||||
|
verify(controlUnderTest.opened)
|
||||||
|
|
||||||
|
// waitForRendering(controlUnderTest.contentItem)
|
||||||
|
|
||||||
|
controlUnderTest.interactive = false
|
||||||
|
|
||||||
|
// Sticky Header
|
||||||
|
const stickySendModalHeader = findChild(controlUnderTest, "stickySendModalHeader")
|
||||||
|
verify(!!stickySendModalHeader)
|
||||||
|
const stickyHeaderTokenSelector = findChild(stickySendModalHeader, "tokenSelector")
|
||||||
|
verify(!!stickyHeaderTokenSelector)
|
||||||
|
const stickyHeaderNetworkFilter = findChild(stickySendModalHeader, "networkFilter")
|
||||||
|
verify(!!stickyHeaderNetworkFilter)
|
||||||
|
|
||||||
|
// Regular Header
|
||||||
|
const sendModalHeader = findChild(controlUnderTest, "sendModalHeader")
|
||||||
|
verify(!!sendModalHeader)
|
||||||
|
const tokenSelector = findChild(sendModalHeader, "tokenSelector")
|
||||||
|
verify(!!tokenSelector)
|
||||||
|
const networkFilter = findChild(sendModalHeader, "networkFilter")
|
||||||
|
verify(!!networkFilter)
|
||||||
|
|
||||||
|
// Amount input area
|
||||||
|
const amountToSend = findChild(controlUnderTest, "amountToSend")
|
||||||
|
verify(!!amountToSend)
|
||||||
|
|
||||||
|
// Recipient Panel
|
||||||
|
const recipientsPanel = findChild(controlUnderTest, "recipientsPanel")
|
||||||
|
verify(!!recipientsPanel)
|
||||||
|
|
||||||
|
verify(!stickyHeaderTokenSelector.enabled)
|
||||||
|
verify(!stickyHeaderNetworkFilter.selectionAllowed)
|
||||||
|
|
||||||
|
verify(!tokenSelector.enabled)
|
||||||
|
verify(!networkFilter.selectionAllowed)
|
||||||
|
|
||||||
|
verify(!amountToSend.interactive)
|
||||||
|
|
||||||
|
verify(!recipientsPanel.interactive)
|
||||||
|
}
|
||||||
|
|
||||||
|
function test_displayOnlyAssets() {
|
||||||
|
verify(!!controlUnderTest)
|
||||||
|
controlUnderTest.open()
|
||||||
|
verify(controlUnderTest.opened)
|
||||||
|
|
||||||
|
const sendModalHeader = findChild(controlUnderTest, "sendModalHeader")
|
||||||
|
verify(!!sendModalHeader)
|
||||||
|
const tokenSelector = findChild(sendModalHeader, "tokenSelector")
|
||||||
|
verify(!!tokenSelector)
|
||||||
|
|
||||||
|
verify(tokenSelector.collectiblesModel)
|
||||||
|
|
||||||
|
controlUnderTest.displayOnlyAssets = true
|
||||||
|
|
||||||
|
verify(!tokenSelector.collectiblesModel)
|
||||||
|
}
|
||||||
|
|
||||||
|
function test_transferOwnership() {
|
||||||
|
verify(!!controlUnderTest)
|
||||||
|
controlUnderTest.open()
|
||||||
|
verify(controlUnderTest.opened)
|
||||||
|
|
||||||
|
const stickySendModalHeader = findChild(controlUnderTest, "stickySendModalHeader")
|
||||||
|
verify(!!stickySendModalHeader)
|
||||||
|
const sendModalHeader = findChild(controlUnderTest, "sendModalHeader")
|
||||||
|
verify(!!sendModalHeader)
|
||||||
|
|
||||||
|
verify(stickySendModalHeader.interactive)
|
||||||
|
verify(sendModalHeader.interactive)
|
||||||
|
|
||||||
|
controlUnderTest.transferOwnership = true
|
||||||
|
|
||||||
|
verify(!stickySendModalHeader.interactive)
|
||||||
|
verify(!sendModalHeader.interactive)
|
||||||
|
}
|
||||||
|
|
||||||
|
// verify that when a token is selected from the asset selecte values are set correctly
|
||||||
|
function test_selectAssetOrCollectible() {
|
||||||
|
verify(!!controlUnderTest)
|
||||||
|
controlUnderTest.open()
|
||||||
|
verify(controlUnderTest.opened)
|
||||||
|
|
||||||
|
const sendModalHeader = findChild(controlUnderTest, "sendModalHeader")
|
||||||
|
verify(!!sendModalHeader)
|
||||||
|
|
||||||
|
compare(controlUnderTest.sendType, Constants.SendType.Transfer)
|
||||||
|
compare(controlUnderTest.selectedChainId, 1)
|
||||||
|
compare(controlUnderTest.selectedTokenKey, "")
|
||||||
|
compare(controlUnderTest.selectedRawAmount, "")
|
||||||
|
|
||||||
|
// Asset Selection
|
||||||
|
sendModalHeader.assetSelected("ETH")
|
||||||
|
|
||||||
|
compare(controlUnderTest.sendType, Constants.SendType.Transfer)
|
||||||
|
compare(controlUnderTest.selectedTokenKey, "ETH")
|
||||||
|
compare(controlUnderTest.selectedChainId, 1)
|
||||||
|
compare(controlUnderTest.selectedRawAmount, "")
|
||||||
|
|
||||||
|
// Collectible Selection
|
||||||
|
sendModalHeader.collectibleSelected("abc")
|
||||||
|
|
||||||
|
compare(controlUnderTest.sendType, Constants.SendType.ERC721Transfer)
|
||||||
|
compare(controlUnderTest.selectedTokenKey, "abc")
|
||||||
|
compare(controlUnderTest.selectedChainId, 1)
|
||||||
|
compare(controlUnderTest.selectedRawAmount, "1")
|
||||||
|
|
||||||
|
sendModalHeader.assetSelected("ETH")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
147
storybook/qmlTests/tests/tst_SimpleTransactionsFees.qml
Normal file
147
storybook/qmlTests/tests/tst_SimpleTransactionsFees.qml
Normal file
@ -0,0 +1,147 @@
|
|||||||
|
import QtQuick 2.15
|
||||||
|
import QtTest 1.15
|
||||||
|
|
||||||
|
import StatusQ.Core.Theme 0.1
|
||||||
|
|
||||||
|
import AppLayouts.Wallet.panels 1.0
|
||||||
|
|
||||||
|
Item {
|
||||||
|
id: root
|
||||||
|
width: 600
|
||||||
|
height: 800
|
||||||
|
|
||||||
|
Component {
|
||||||
|
id: componentUnderTest
|
||||||
|
|
||||||
|
SimpleTransactionsFees {}
|
||||||
|
}
|
||||||
|
|
||||||
|
TestCase {
|
||||||
|
name: "SimpleTransactionsFees"
|
||||||
|
when: windowShown
|
||||||
|
|
||||||
|
property SimpleTransactionsFees controlUnderTest: null
|
||||||
|
|
||||||
|
function init() {
|
||||||
|
controlUnderTest = createTemporaryObject(componentUnderTest, root)
|
||||||
|
}
|
||||||
|
|
||||||
|
function test_defaulValues() {
|
||||||
|
verify(!!controlUnderTest)
|
||||||
|
const background = findChild(controlUnderTest, "background")
|
||||||
|
verify(!!background)
|
||||||
|
const gasIcon = findChild(controlUnderTest, "gasIcon")
|
||||||
|
verify(!!gasIcon)
|
||||||
|
const infoText = findChild(controlUnderTest, "infoText")
|
||||||
|
verify(!!infoText)
|
||||||
|
const cryptoFeesText = findChild(controlUnderTest, "cryptoFeesText")
|
||||||
|
verify(!!cryptoFeesText)
|
||||||
|
const fiatFeesText = findChild(controlUnderTest, "fiatFeesText")
|
||||||
|
verify(!!fiatFeesText)
|
||||||
|
|
||||||
|
compare(background.color, Theme.palette.indirectColor1)
|
||||||
|
compare(gasIcon.asset.name, "gas")
|
||||||
|
compare(infoText.text, qsTr("Est Mainnet transaction fee"))
|
||||||
|
compare(cryptoFeesText.text, "XXXXXXXXXX")
|
||||||
|
verify(cryptoFeesText.loading)
|
||||||
|
compare(cryptoFeesText.customColor, Theme.palette.baseColor1)
|
||||||
|
compare(fiatFeesText.text, "XXXXXXXXXX")
|
||||||
|
verify(fiatFeesText.loading)
|
||||||
|
compare(fiatFeesText.customColor, Theme.palette.baseColor1)
|
||||||
|
}
|
||||||
|
|
||||||
|
function test_setValues() {
|
||||||
|
verify(!!controlUnderTest)
|
||||||
|
const background = findChild(controlUnderTest, "background")
|
||||||
|
verify(!!background)
|
||||||
|
const gasIcon = findChild(controlUnderTest, "gasIcon")
|
||||||
|
verify(!!gasIcon)
|
||||||
|
const infoText = findChild(controlUnderTest, "infoText")
|
||||||
|
verify(!!infoText)
|
||||||
|
const cryptoFeesText = findChild(controlUnderTest, "cryptoFeesText")
|
||||||
|
verify(!!cryptoFeesText)
|
||||||
|
const fiatFeesText = findChild(controlUnderTest, "fiatFeesText")
|
||||||
|
verify(!!fiatFeesText)
|
||||||
|
|
||||||
|
controlUnderTest.cryptoFees = "0.0007 ETH"
|
||||||
|
controlUnderTest.fiatFees = "1.45 EUR"
|
||||||
|
|
||||||
|
compare(background.color, Theme.palette.indirectColor1)
|
||||||
|
compare(gasIcon.asset.name, "gas")
|
||||||
|
compare(infoText.text, qsTr("Est Mainnet transaction fee"))
|
||||||
|
compare(cryptoFeesText.text,"0.0007 ETH")
|
||||||
|
verify(!cryptoFeesText.loading)
|
||||||
|
compare(cryptoFeesText.customColor, Theme.palette.baseColor1)
|
||||||
|
compare(fiatFeesText.text, "1.45 EUR")
|
||||||
|
verify(!fiatFeesText.loading)
|
||||||
|
compare(fiatFeesText.customColor, Theme.palette.baseColor1)
|
||||||
|
}
|
||||||
|
|
||||||
|
function test_loadingState() {
|
||||||
|
verify(!!controlUnderTest)
|
||||||
|
const background = findChild(controlUnderTest, "background")
|
||||||
|
verify(!!background)
|
||||||
|
const gasIcon = findChild(controlUnderTest, "gasIcon")
|
||||||
|
verify(!!gasIcon)
|
||||||
|
const infoText = findChild(controlUnderTest, "infoText")
|
||||||
|
verify(!!infoText)
|
||||||
|
const cryptoFeesText = findChild(controlUnderTest, "cryptoFeesText")
|
||||||
|
verify(!!cryptoFeesText)
|
||||||
|
const fiatFeesText = findChild(controlUnderTest, "fiatFeesText")
|
||||||
|
verify(!!fiatFeesText)
|
||||||
|
|
||||||
|
controlUnderTest.loading = true
|
||||||
|
|
||||||
|
compare(background.color, Theme.palette.indirectColor1)
|
||||||
|
compare(gasIcon.asset.name, "gas")
|
||||||
|
compare(infoText.text, qsTr("Est Mainnet transaction fee"))
|
||||||
|
compare(cryptoFeesText.text,"XXXXXXXXXX")
|
||||||
|
verify(cryptoFeesText.loading)
|
||||||
|
compare(cryptoFeesText.customColor, Theme.palette.baseColor1)
|
||||||
|
compare(fiatFeesText.text,"XXXXXXXXXX")
|
||||||
|
verify(fiatFeesText.loading)
|
||||||
|
compare(fiatFeesText.customColor, Theme.palette.baseColor1)
|
||||||
|
|
||||||
|
controlUnderTest.cryptoFees = "0.0007 ETH"
|
||||||
|
controlUnderTest.fiatFees = "1.45 EUR"
|
||||||
|
|
||||||
|
compare(background.color, Theme.palette.indirectColor1)
|
||||||
|
compare(gasIcon.asset.name, "gas")
|
||||||
|
compare(infoText.text, qsTr("Est Mainnet transaction fee"))
|
||||||
|
compare(cryptoFeesText.text,"0.0007 ETH")
|
||||||
|
verify(cryptoFeesText.loading)
|
||||||
|
compare(cryptoFeesText.customColor, Theme.palette.baseColor1)
|
||||||
|
compare(fiatFeesText.text, "1.45 EUR")
|
||||||
|
verify(fiatFeesText.loading)
|
||||||
|
compare(fiatFeesText.customColor, Theme.palette.baseColor1)
|
||||||
|
}
|
||||||
|
|
||||||
|
function test_errorState() {
|
||||||
|
verify(!!controlUnderTest)
|
||||||
|
const background = findChild(controlUnderTest, "background")
|
||||||
|
verify(!!background)
|
||||||
|
const gasIcon = findChild(controlUnderTest, "gasIcon")
|
||||||
|
verify(!!gasIcon)
|
||||||
|
const infoText = findChild(controlUnderTest, "infoText")
|
||||||
|
verify(!!infoText)
|
||||||
|
const cryptoFeesText = findChild(controlUnderTest, "cryptoFeesText")
|
||||||
|
verify(!!cryptoFeesText)
|
||||||
|
const fiatFeesText = findChild(controlUnderTest, "fiatFeesText")
|
||||||
|
verify(!!fiatFeesText)
|
||||||
|
|
||||||
|
controlUnderTest.error = true
|
||||||
|
controlUnderTest.cryptoFees = "0.0007 ETH"
|
||||||
|
controlUnderTest.fiatFees = "1.45 EUR"
|
||||||
|
|
||||||
|
compare(background.color, Theme.palette.indirectColor1)
|
||||||
|
compare(gasIcon.asset.name, "gas")
|
||||||
|
compare(infoText.text, qsTr("Est Mainnet transaction fee"))
|
||||||
|
compare(cryptoFeesText.text,"0.0007 ETH")
|
||||||
|
verify(!cryptoFeesText.loading)
|
||||||
|
compare(cryptoFeesText.customColor, Theme.palette.dangerColor1)
|
||||||
|
compare(fiatFeesText.text, "1.45 EUR")
|
||||||
|
verify(!fiatFeesText.loading)
|
||||||
|
compare(fiatFeesText.customColor, Theme.palette.dangerColor1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -58,6 +58,8 @@ Control {
|
|||||||
contentItem: TokenSelectorButton {
|
contentItem: TokenSelectorButton {
|
||||||
id: tokenSelectorButton
|
id: tokenSelectorButton
|
||||||
|
|
||||||
|
objectName: "tokenSelectorButton"
|
||||||
|
|
||||||
forceHovered: dropdown.opened
|
forceHovered: dropdown.opened
|
||||||
|
|
||||||
onClicked: dropdown.opened ? dropdown.close() : dropdown.open()
|
onClicked: dropdown.opened ? dropdown.close() : dropdown.open()
|
||||||
@ -66,6 +68,8 @@ Control {
|
|||||||
StatusDropdown {
|
StatusDropdown {
|
||||||
id: dropdown
|
id: dropdown
|
||||||
|
|
||||||
|
objectName: "dropdown"
|
||||||
|
|
||||||
y: parent.height + 4
|
y: parent.height + 4
|
||||||
width: 448
|
width: 448
|
||||||
|
|
||||||
|
@ -92,6 +92,8 @@ RowLayout {
|
|||||||
StatusBaseText {
|
StatusBaseText {
|
||||||
id: sendModalTitleText
|
id: sendModalTitleText
|
||||||
|
|
||||||
|
objectName: "sendModalTitleText"
|
||||||
|
|
||||||
Layout.preferredWidth: contentWidth
|
Layout.preferredWidth: contentWidth
|
||||||
|
|
||||||
lineHeightMode: Text.FixedHeight
|
lineHeightMode: Text.FixedHeight
|
||||||
@ -105,6 +107,8 @@ RowLayout {
|
|||||||
TokenSelector {
|
TokenSelector {
|
||||||
id: tokenSelector
|
id: tokenSelector
|
||||||
|
|
||||||
|
objectName: "tokenSelector"
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.maximumWidth: implicitWidth
|
Layout.maximumWidth: implicitWidth
|
||||||
|
|
||||||
@ -142,6 +146,8 @@ RowLayout {
|
|||||||
NetworkFilter {
|
NetworkFilter {
|
||||||
id: networkFilter
|
id: networkFilter
|
||||||
|
|
||||||
|
objectName: "networkFilter"
|
||||||
|
|
||||||
Layout.alignment: Qt.AlignTop
|
Layout.alignment: Qt.AlignTop
|
||||||
|
|
||||||
control.popup.y: networkFilter.height
|
control.popup.y: networkFilter.height
|
||||||
|
@ -31,6 +31,8 @@ Control {
|
|||||||
verticalPadding: 12
|
verticalPadding: 12
|
||||||
|
|
||||||
background: Rectangle {
|
background: Rectangle {
|
||||||
|
objectName: "background"
|
||||||
|
|
||||||
color: Theme.palette.indirectColor1
|
color: Theme.palette.indirectColor1
|
||||||
radius: Theme.radius
|
radius: Theme.radius
|
||||||
}
|
}
|
||||||
@ -40,6 +42,8 @@ Control {
|
|||||||
spacing: 12
|
spacing: 12
|
||||||
|
|
||||||
StatusRoundIcon {
|
StatusRoundIcon {
|
||||||
|
objectName: "gasIcon"
|
||||||
|
|
||||||
Layout.alignment: Qt.AlignTop
|
Layout.alignment: Qt.AlignTop
|
||||||
|
|
||||||
radius: 8
|
radius: 8
|
||||||
@ -52,6 +56,8 @@ Control {
|
|||||||
spacing: 0
|
spacing: 0
|
||||||
|
|
||||||
StatusBaseText {
|
StatusBaseText {
|
||||||
|
objectName: "infoText"
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
lineHeightMode: Text.FixedHeight
|
lineHeightMode: Text.FixedHeight
|
||||||
@ -62,6 +68,8 @@ Control {
|
|||||||
StatusTextWithLoadingState {
|
StatusTextWithLoadingState {
|
||||||
id: cryptoFeesText
|
id: cryptoFeesText
|
||||||
|
|
||||||
|
objectName: "cryptoFeesText"
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
loading: root.loading || !root.cryptoFees
|
loading: root.loading || !root.cryptoFees
|
||||||
@ -77,6 +85,8 @@ Control {
|
|||||||
StatusTextWithLoadingState {
|
StatusTextWithLoadingState {
|
||||||
id: fiatFeesText
|
id: fiatFeesText
|
||||||
|
|
||||||
|
objectName: "fiatFeesText"
|
||||||
|
|
||||||
Layout.alignment: Qt.AlignRight
|
Layout.alignment: Qt.AlignRight
|
||||||
|
|
||||||
loading: root.loading || !root.fiatFees
|
loading: root.loading || !root.fiatFees
|
||||||
|
@ -118,7 +118,7 @@ StatusDialog {
|
|||||||
property bool displayOnlyAssets
|
property bool displayOnlyAssets
|
||||||
|
|
||||||
/** input property true if a community owner token is being transferred **/
|
/** input property true if a community owner token is being transferred **/
|
||||||
property bool transferOwnership
|
property bool transferOwnership
|
||||||
|
|
||||||
/** input property to decide if routes are being fetched **/
|
/** input property to decide if routes are being fetched **/
|
||||||
property bool routesLoading
|
property bool routesLoading
|
||||||
@ -149,6 +149,13 @@ StatusDialog {
|
|||||||
e.g. 1000000000000000000 for 1 ETH **/
|
e.g. 1000000000000000000 for 1 ETH **/
|
||||||
property string selectedRawAmount
|
property string selectedRawAmount
|
||||||
|
|
||||||
|
/** Input / Output property to set and expose currently selected recipient address **/
|
||||||
|
property alias selectedRecipientAddress: recipientsPanel.selectedRecipientAddress
|
||||||
|
/** Output property to indicate currently selected recipient view tab **/
|
||||||
|
readonly property alias selectedRecipientType: recipientsPanel.selectedRecipientType
|
||||||
|
/** Output property to filter recipient model **/
|
||||||
|
readonly property alias recipientSearchPattern: recipientsPanel.searchPattern
|
||||||
|
|
||||||
/** input property holds the publicKey of the user for registering an ENS name **/
|
/** input property holds the publicKey of the user for registering an ENS name **/
|
||||||
property string publicKey
|
property string publicKey
|
||||||
/** input property holds the selected ens name to be registered **/
|
/** input property holds the selected ens name to be registered **/
|
||||||
@ -172,13 +179,6 @@ StatusDialog {
|
|||||||
recipientsPanel.ensNameResolved(resolvedPubKey, resolvedAddress, uuid)
|
recipientsPanel.ensNameResolved(resolvedPubKey, resolvedAddress, uuid)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Input / Output property to set and expose currently selected recipient address **/
|
|
||||||
property alias selectedRecipientAddress: recipientsPanel.selectedRecipientAddress
|
|
||||||
/** Output property to indicate currently selected recipient view tab **/
|
|
||||||
readonly property alias selectedRecipientType: recipientsPanel.selectedRecipientType
|
|
||||||
/** Output property to filter recipient model **/
|
|
||||||
readonly property alias recipientSearchPattern: recipientsPanel.searchPattern
|
|
||||||
|
|
||||||
/** Output signal to request signing of the transaction **/
|
/** Output signal to request signing of the transaction **/
|
||||||
signal reviewSendClicked()
|
signal reviewSendClicked()
|
||||||
/** Output signal to inform that the forms been updated **/
|
/** Output signal to inform that the forms been updated **/
|
||||||
@ -381,6 +381,8 @@ StatusDialog {
|
|||||||
AccountSelectorHeader {
|
AccountSelectorHeader {
|
||||||
id: accountSelector
|
id: accountSelector
|
||||||
|
|
||||||
|
objectName: "accountSelector"
|
||||||
|
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.topMargin: -accountSelector.height - Theme.padding
|
anchors.topMargin: -accountSelector.height - Theme.padding
|
||||||
anchors.left: parent.left
|
anchors.left: parent.left
|
||||||
@ -412,6 +414,8 @@ StatusDialog {
|
|||||||
StickySendModalHeader {
|
StickySendModalHeader {
|
||||||
id: stickySendModalHeader
|
id: stickySendModalHeader
|
||||||
|
|
||||||
|
objectName: "stickySendModalHeader"
|
||||||
|
|
||||||
width: parent.width
|
width: parent.width
|
||||||
|
|
||||||
stickyHeaderVisible: d.stickyHeaderVisible
|
stickyHeaderVisible: d.stickyHeaderVisible
|
||||||
@ -436,6 +440,8 @@ StatusDialog {
|
|||||||
StatusScrollView {
|
StatusScrollView {
|
||||||
id: scrollView
|
id: scrollView
|
||||||
|
|
||||||
|
objectName: "scrollView"
|
||||||
|
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
contentWidth: availableWidth
|
contentWidth: availableWidth
|
||||||
|
|
||||||
@ -458,6 +464,8 @@ StatusDialog {
|
|||||||
SendModalHeader {
|
SendModalHeader {
|
||||||
id: sendModalHeader
|
id: sendModalHeader
|
||||||
|
|
||||||
|
objectName: "sendModalHeader"
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.topMargin: 28
|
Layout.topMargin: 28
|
||||||
|
|
||||||
@ -481,6 +489,8 @@ StatusDialog {
|
|||||||
SendViews.AmountToSend {
|
SendViews.AmountToSend {
|
||||||
id: amountToSend
|
id: amountToSend
|
||||||
|
|
||||||
|
objectName: "amountToSend"
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
interactive: root.interactive
|
interactive: root.interactive
|
||||||
@ -550,7 +560,6 @@ StatusDialog {
|
|||||||
}
|
}
|
||||||
Item {
|
Item {
|
||||||
Layout.alignment: Qt.AlignTop
|
Layout.alignment: Qt.AlignTop
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.bottomMargin: feesLayout.visible ? 0 : Theme.xlPadding
|
Layout.bottomMargin: feesLayout.visible ? 0 : Theme.xlPadding
|
||||||
implicitHeight: recipientsPanel.height
|
implicitHeight: recipientsPanel.height
|
||||||
@ -569,6 +578,9 @@ StatusDialog {
|
|||||||
|
|
||||||
RecipientSelectorPanel {
|
RecipientSelectorPanel {
|
||||||
id: recipientsPanel
|
id: recipientsPanel
|
||||||
|
|
||||||
|
objectName: "recipientsPanel"
|
||||||
|
|
||||||
anchors {
|
anchors {
|
||||||
top: parent.top
|
top: parent.top
|
||||||
left: parent.left
|
left: parent.left
|
||||||
@ -589,6 +601,8 @@ StatusDialog {
|
|||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
id: feesLayout
|
id: feesLayout
|
||||||
|
|
||||||
|
objectName: "feesLayout"
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
Layout.bottomMargin: Theme.xlPadding
|
Layout.bottomMargin: Theme.xlPadding
|
||||||
|
|
||||||
@ -599,6 +613,8 @@ StatusDialog {
|
|||||||
text: qsTr("Fees")
|
text: qsTr("Fees")
|
||||||
}
|
}
|
||||||
SimpleTransactionsFees {
|
SimpleTransactionsFees {
|
||||||
|
objectName: "signTransactionFees"
|
||||||
|
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
|
|
||||||
cryptoFees: root.estimatedCryptoFees
|
cryptoFees: root.estimatedCryptoFees
|
||||||
@ -613,6 +629,8 @@ StatusDialog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
footer: SendModalFooter {
|
footer: SendModalFooter {
|
||||||
|
objectName: "sendModalFooter"
|
||||||
|
|
||||||
width: root.width
|
width: root.width
|
||||||
|
|
||||||
estimatedTime: root.estimatedTime
|
estimatedTime: root.estimatedTime
|
||||||
|
@ -41,6 +41,8 @@ StatusDialogFooter {
|
|||||||
spacing: 0
|
spacing: 0
|
||||||
|
|
||||||
StatusBaseText {
|
StatusBaseText {
|
||||||
|
objectName: "estTimeLabel"
|
||||||
|
|
||||||
font.weight: Font.Medium
|
font.weight: Font.Medium
|
||||||
color: Theme.palette.directColor5
|
color: Theme.palette.directColor5
|
||||||
text: qsTr("Est time")
|
text: qsTr("Est time")
|
||||||
@ -48,6 +50,8 @@ StatusDialogFooter {
|
|||||||
StatusTextWithLoadingState {
|
StatusTextWithLoadingState {
|
||||||
id: estimatedTime
|
id: estimatedTime
|
||||||
|
|
||||||
|
objectName: "estimatedTimeText"
|
||||||
|
|
||||||
font.weight: Font.Medium
|
font.weight: Font.Medium
|
||||||
customColor: !!root.estimatedTime ? Theme.palette.directColor1:
|
customColor: !!root.estimatedTime ? Theme.palette.directColor1:
|
||||||
Theme.palette.directColor5
|
Theme.palette.directColor5
|
||||||
@ -63,6 +67,8 @@ StatusDialogFooter {
|
|||||||
spacing: 0
|
spacing: 0
|
||||||
|
|
||||||
StatusBaseText {
|
StatusBaseText {
|
||||||
|
objectName: "estFeesLabel"
|
||||||
|
|
||||||
font.weight: Font.Medium
|
font.weight: Font.Medium
|
||||||
color: Theme.palette.directColor5
|
color: Theme.palette.directColor5
|
||||||
text: qsTr("Est fees")
|
text: qsTr("Est fees")
|
||||||
@ -70,11 +76,14 @@ StatusDialogFooter {
|
|||||||
StatusTextWithLoadingState {
|
StatusTextWithLoadingState {
|
||||||
id: estimatedFees
|
id: estimatedFees
|
||||||
|
|
||||||
|
objectName: "estimatedFeesText"
|
||||||
|
|
||||||
font.weight: Font.Medium
|
font.weight: Font.Medium
|
||||||
customColor: root.error ? Theme.palette.dangerColor1:
|
customColor: root.error ? Theme.palette.dangerColor1:
|
||||||
!!root.estimatedFees ?
|
!!root.estimatedFees ?
|
||||||
Theme.palette.directColor1:
|
Theme.palette.directColor1:
|
||||||
Theme.palette.directColor5
|
Theme.palette.directColor5
|
||||||
|
|
||||||
loading: root.loading
|
loading: root.loading
|
||||||
|
|
||||||
text: !!root.estimatedFees ? root.estimatedFees:
|
text: !!root.estimatedFees ? root.estimatedFees:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user