fix(wallet)_: Temporarily disable Max Amount button pending #15709

- This commit temporarily disables the MaxAmount button in the `SwapInputPanel` and `SendModal` components.
     - The MaxAmount button will be reintroduced with the correct behavior in issue #15709 for the 2.31 release.

closes: #15710
This commit is contained in:
belalshehab 2024-07-25 02:20:27 +03:00 committed by Belal Shehab
parent db77654274
commit 1aa2221834
4 changed files with 30 additions and 18 deletions

View File

@ -274,7 +274,9 @@ Item {
verify(!maxTagButton.text.endsWith("ETH")) verify(!maxTagButton.text.endsWith("ETH"))
} }
// FIXME: This should be enabled after #15709 is resolved
function test_clickingMaxButton() { function test_clickingMaxButton() {
skip("maxTabButton is diabled")
controlUnderTest = createTemporaryObject(componentUnderTest, root, {tokenKey: "ETH"}) controlUnderTest = createTemporaryObject(componentUnderTest, root, {tokenKey: "ETH"})
verify(!!controlUnderTest) verify(!!controlUnderTest)
waitForRendering(controlUnderTest) waitForRendering(controlUnderTest)
@ -355,21 +357,24 @@ Item {
waitForRendering(controlUnderTest) waitForRendering(controlUnderTest)
verify(maxTagButton.visible) verify(maxTagButton.visible)
// FIXME: maxTagButton should be enabled after #15709 is resolved
verify(!maxTagButton.enabled)
verify(!maxTagButton.text.endsWith(modelItemToTest.symbol)) verify(!maxTagButton.text.endsWith(modelItemToTest.symbol))
tryCompare(maxTagButton, "type", modelItemToTest.currentBalance === 0 ? StatusBaseButton.Type.Danger : StatusBaseButton.Type.Normal) tryCompare(maxTagButton, "type", modelItemToTest.currentBalance === 0 ? StatusBaseButton.Type.Danger : StatusBaseButton.Type.Normal)
// check input value and state // check input value and state
mouseClick(maxTagButton) if (maxTagButton.enabled) {
waitForRendering(amountToSendInput) mouseClick(maxTagButton)
waitForRendering(amountToSendInput)
tryCompare(amountToSendInput.input, "text", modelItemToTest.currentBalance === 0 ? "" : maxTagButton.maxSafeValueAsString)
compare(controlUnderTest.value, maxTagButton.maxSafeValue)
verify(modelItemToTest.currentBalance === 0 ? !controlUnderTest.valueValid : controlUnderTest.valueValid)
const marketPrice = !!amountToSendInput.selectedHolding ? amountToSendInput.selectedHolding.marketDetails.currencyPrice.amount : 0
compare(bottomItemText.text, d.adaptor.formatCurrencyAmount(
maxTagButton.maxSafeValue * marketPrice,
d.adaptor.currencyStore.currentCurrency))
tryCompare(amountToSendInput.input, "text", modelItemToTest.currentBalance === 0 ? "" : maxTagButton.maxSafeValueAsString)
compare(controlUnderTest.value, maxTagButton.maxSafeValue)
verify(modelItemToTest.currentBalance === 0 ? !controlUnderTest.valueValid : controlUnderTest.valueValid)
const marketPrice = !!amountToSendInput.selectedHolding ? amountToSendInput.selectedHolding.marketDetails.currencyPrice.amount : 0
compare(bottomItemText.text, d.adaptor.formatCurrencyAmount(
maxTagButton.maxSafeValue * marketPrice,
d.adaptor.currencyStore.currentCurrency))
}
amountToSendInput.input.input.edit.clear() amountToSendInput.input.input.edit.clear()
} }
} }

View File

@ -1178,6 +1178,8 @@ Item {
// check states for the pay input selector // check states for the pay input selector
verify(maxTagButton.visible) verify(maxTagButton.visible)
// FIXME: maxTagButton should be enabled after #15709 is resolved
verify(!maxTagButton.enabled);
let maxPossibleValue = WalletUtils.calculateMaxSafeSendAmount(expectedToken.currentBalance, expectedToken.symbol) let maxPossibleValue = WalletUtils.calculateMaxSafeSendAmount(expectedToken.currentBalance, expectedToken.symbol)
let truncmaxPossibleValue = Math.trunc(maxPossibleValue*100)/100 let truncmaxPossibleValue = Math.trunc(maxPossibleValue*100)/100
compare(maxTagButton.text, qsTr("Max. %1").arg(truncmaxPossibleValue === 0 ? Qt.locale().zeroDigit compare(maxTagButton.text, qsTr("Max. %1").arg(truncmaxPossibleValue === 0 ? Qt.locale().zeroDigit
@ -1189,15 +1191,16 @@ Item {
compare(amountToSendInput.input.placeholderText, LocaleUtils.numberToLocaleString(0)) compare(amountToSendInput.input.placeholderText, LocaleUtils.numberToLocaleString(0))
tryCompare(bottomItemText, "text", root.swapAdaptor.currencyStore.formatCurrencyAmount(valueToExchange * expectedToken.marketDetails.currencyPrice.amount, root.swapAdaptor.currencyStore.currentCurrency)) tryCompare(bottomItemText, "text", root.swapAdaptor.currencyStore.formatCurrencyAmount(valueToExchange * expectedToken.marketDetails.currencyPrice.amount, root.swapAdaptor.currencyStore.currentCurrency))
// click on max button if (maxTagButton.enabled) {
mouseClick(maxTagButton) // click on max button
waitForItemPolished(payPanel) mouseClick(maxTagButton)
waitForItemPolished(payPanel)
verify(amountToSendInput.interactive)
verify(amountToSendInput.input.input.edit.cursorVisible)
tryCompare(amountToSendInput.input, "text", maxPossibleValue === 0 ? "" : maxPossibleValue.toLocaleString(Qt.locale(), 'f', -128))
tryCompare(bottomItemText, "text", root.swapAdaptor.currencyStore.formatCurrencyAmount(maxPossibleValue * expectedToken.marketDetails.currencyPrice.amount, root.swapAdaptor.currencyStore.currentCurrency))
verify(amountToSendInput.interactive)
verify(amountToSendInput.input.input.edit.cursorVisible)
tryCompare(amountToSendInput.input, "text", maxPossibleValue === 0 ? "" : maxPossibleValue.toLocaleString(Qt.locale(), 'f', -128))
tryCompare(bottomItemText, "text", root.swapAdaptor.currencyStore.formatCurrencyAmount(maxPossibleValue * expectedToken.marketDetails.currencyPrice.amount, root.swapAdaptor.currencyStore.currentCurrency))
}
closeAndVerfyModal() closeAndVerfyModal()
} }

View File

@ -276,6 +276,8 @@ Control {
{ noSymbol: !amountToSendInput.inputIsFiat }) { noSymbol: !amountToSendInput.inputIsFiat })
visible: d.isSelectedHoldingValidAsset && root.swapSide === SwapInputPanel.SwapSide.Pay visible: d.isSelectedHoldingValidAsset && root.swapSide === SwapInputPanel.SwapSide.Pay
// FIXME: This should be enabled after #15709 is resolved
enabled: false
onClicked: { onClicked: {
if (maxSafeValue) if (maxSafeValue)

View File

@ -427,6 +427,8 @@ StatusDialog {
Layout.alignment: Qt.AlignVCenter | Qt.AlignRight Layout.alignment: Qt.AlignVCenter | Qt.AlignRight
visible: d.isSelectedHoldingValidAsset && !d.isCollectiblesTransfer visible: d.isSelectedHoldingValidAsset && !d.isCollectiblesTransfer
// FIXME: This should be enabled after #15709 is resolved
enabled: false
onClicked: { onClicked: {
if (maxSafeValue > 0) { if (maxSafeValue > 0) {