feat: hide mercuryo

fix #16757
fix #16765
This commit is contained in:
Anthony 2024-11-18 09:48:28 +01:00 committed by Anthony Laibe
parent 9352c2ad44
commit 22c4bb2846
4 changed files with 103 additions and 105 deletions

View File

@ -141,7 +141,6 @@ Item {
verify(!!delegateUnderTest)
tryCompare(delegateUnderTest, "title", modelToCompareAgainst.get(i).name)
compare(delegateUnderTest.subTitle, modelToCompareAgainst.get(i).description)
compare(delegateUnderTest.asset.name, modelToCompareAgainst.get(i).logoUrl)
compare(delegateUnderTest.isUrlLoading, false)
@ -313,26 +312,26 @@ Item {
verify(controlUnderTest.stackTitle, qsTr("Buy assets for %1").arg(!!controlUnderTest.selectedAccountEntry.item ? controlUnderTest.selectedAccountEntry.item.name: ""))
// find tab bar
const tabBar = findChild(controlUnderTest, "tabBar")
verify(!!tabBar)
// // find tab bar
// const tabBar = findChild(controlUnderTest, "tabBar")
// verify(!!tabBar)
// find providers list
const providersList = findChild(controlUnderTest, "providersList")
waitForRendering(providersList)
verify(!!providersList)
// should have 2 items
compare(tabBar.count, 2)
// // should have 2 items
// compare(tabBar.count, 2)
// current index set should be to 0
compare(tabBar.currentIndex, 0)
// // current index set should be to 0
// compare(tabBar.currentIndex, 0)
// item 0 should have text "One time"
compare(tabBar.itemAt(0).text, qsTr("One time"))
// compare(tabBar.itemAt(0).text, qsTr("One time"))
// item 1 should have text "Recurrent"
compare(tabBar.itemAt(1).text, qsTr("Recurrent"))
// compare(tabBar.itemAt(1).text, qsTr("Recurrent"))
// close popup
controlUnderTest.close()
@ -345,8 +344,8 @@ Item {
launchPopup()
// find tab bar
const tabBar = findChild(controlUnderTest, "tabBar")
verify(!!tabBar)
// const tabBar = findChild(controlUnderTest, "tabBar")
// verify(!!tabBar)
// find providers list
const providersList = findChild(controlUnderTest, "providersList")
@ -354,11 +353,11 @@ Item {
tryCompare(controlUnderTest, "isBuyProvidersModelLoading", false)
mouseClick(tabBar.itemAt(0))
compare(tabBar.currentIndex, 0)
// mouseClick(tabBar.itemAt(0))
// compare(tabBar.currentIndex, 0)
// verify that 4 items are listed
compare(providersList.count, 4)
// verify that 3 items are listed
compare(providersList.count, 3)
// check if delegate contents are as expected
testDelegateItems(providersList, controlUnderTest.buyProvidersModel)
@ -366,107 +365,108 @@ Item {
controlUnderTest.close()
}
function test_modalContent_OneTime_tab_mouseClicks() {
notificationSpy.clear()
// Launch modal
launchPopup()
// Disabled as the recurrent tab is disabled
// function test_modalContent_OneTime_tab_mouseClicks() {
// notificationSpy.clear()
// // Launch modal
// launchPopup()
// find providers list
const providersList = findChild(controlUnderTest, "providersList")
verify(!!providersList)
// // find providers list
// const providersList = findChild(controlUnderTest, "providersList")
// verify(!!providersList)
for(let i =0; i< controlUnderTest.buyProvidersModel.count; i++) {
notificationSpy.clear()
launchPopup()
verify(controlUnderTest.opened)
// for(let i =0; i< controlUnderTest.buyProvidersModel.count; i++) {
// notificationSpy.clear()
// launchPopup()
// verify(controlUnderTest.opened)
tryCompare(controlUnderTest, "isBuyProvidersModelLoading", false)
// tryCompare(controlUnderTest, "isBuyProvidersModelLoading", false)
let delegateUnderTest = providersList.itemAtIndex(i)
verify(!!delegateUnderTest)
waitForRendering(delegateUnderTest)
// let delegateUnderTest = providersList.itemAtIndex(i)
// verify(!!delegateUnderTest)
// waitForRendering(delegateUnderTest)
// test provider that need parameters like network and token to be selected
const modelData = controlUnderTest.buyProvidersModel.get(i)
verify(!!modelData)
if (modelData.urlsNeedParameters) {
testDelegateMouseClicksForProvidersThatNeedParams(delegateUnderTest, modelData)
} else {
testDelegateMouseClicksForProvidersThatNeedNoParams(delegateUnderTest, modelData)
}
}
controlUnderTest.close()
}
function test_modalContent_recurrent_tab() {
skip("to be fixed in 16462")
notificationSpy.clear()
// Launch modal
launchPopup()
// find tab bar
const tabBar = findChild(controlUnderTest, "tabBar")
verify(!!tabBar)
// find providers list
const providersList = findChild(controlUnderTest, "providersList")
verify(!!providersList)
tryCompare(controlUnderTest, "isBuyProvidersModelLoading", false)
// check data in "Recurrent" tab --------------------------------------------------------
mouseClick(tabBar.itemAt(1))
compare(tabBar.currentIndex, 1)
waitForRendering(providersList)
verify(!!providersList)
// verify that 1 item is listed
compare(providersList.count, 1)
// check if delegate contents are as expected
testDelegateItems(providersList, controlUnderTest.recurrentOnRampProvidersModel)
controlUnderTest.close()
}
function test_modalContent_Recurrent_tab_mouseClicks() {
notificationSpy.clear()
// Launch modal
launchPopup()
// find tab bar
const tabBar = findChild(controlUnderTest, "tabBar")
verify(!!tabBar)
// find providers list
const providersList = findChild(controlUnderTest, "providersList")
verify(!!providersList)
mouseClick(tabBar.itemAt(1))
compare(tabBar.currentIndex, 1)
waitForRendering(providersList)
verify(!!providersList)
for(let i =0; i< controlUnderTest.recurrentOnRampProvidersModel.count; i++) {
notificationSpy.clear()
launchPopup()
verify(controlUnderTest.opened)
tryCompare(controlUnderTest, "isBuyProvidersModelLoading", false)
let delegateUnderTest = providersList.itemAtIndex(i)
verify(!!delegateUnderTest)
waitForRendering(delegateUnderTest)
// test provider that need parameters like network and token to be selected
const modelData = controlUnderTest.recurrentOnRampProvidersModel.get(i)
verify(!!modelData)
if (modelData.urlsNeedParameters) {
testDelegateMouseClicksForProvidersThatNeedParams(delegateUnderTest, modelData)
} else {
testDelegateMouseClicksForProvidersThatNeedNoParams(delegateUnderTest, modelData)
}
}
}
// // test provider that need parameters like network and token to be selected
// const modelData = controlUnderTest.buyProvidersModel.get(i)
// verify(!!modelData)
// if (modelData.urlsNeedParameters) {
// testDelegateMouseClicksForProvidersThatNeedParams(delegateUnderTest, modelData)
// } else {
// testDelegateMouseClicksForProvidersThatNeedNoParams(delegateUnderTest, modelData)
// }
// }
// controlUnderTest.close()
// }
//
// function test_modalContent_recurrent_tab() {
// skip("to be fixed in 16462")
// notificationSpy.clear()
// // Launch modal
// launchPopup()
// // find tab bar
// const tabBar = findChild(controlUnderTest, "tabBar")
// verify(!!tabBar)
// // find providers list
// const providersList = findChild(controlUnderTest, "providersList")
// verify(!!providersList)
// tryCompare(controlUnderTest, "isBuyProvidersModelLoading", false)
// // check data in "Recurrent" tab --------------------------------------------------------
// mouseClick(tabBar.itemAt(1))
// compare(tabBar.currentIndex, 1)
// waitForRendering(providersList)
// verify(!!providersList)
// // verify that 1 item is listed
// compare(providersList.count, 1)
// // check if delegate contents are as expected
// testDelegateItems(providersList, controlUnderTest.recurrentOnRampProvidersModel)
// controlUnderTest.close()
// }
// function test_modalContent_Recurrent_tab_mouseClicks() {
// notificationSpy.clear()
// // Launch modal
// launchPopup()
// // find tab bar
// const tabBar = findChild(controlUnderTest, "tabBar")
// verify(!!tabBar)
// // find providers list
// const providersList = findChild(controlUnderTest, "providersList")
// verify(!!providersList)
// mouseClick(tabBar.itemAt(1))
// compare(tabBar.currentIndex, 1)
// waitForRendering(providersList)
// verify(!!providersList)
// for(let i =0; i< controlUnderTest.recurrentOnRampProvidersModel.count; i++) {
// notificationSpy.clear()
// launchPopup()
// verify(controlUnderTest.opened)
// tryCompare(controlUnderTest, "isBuyProvidersModelLoading", false)
// let delegateUnderTest = providersList.itemAtIndex(i)
// verify(!!delegateUnderTest)
// waitForRendering(delegateUnderTest)
// // test provider that need parameters like network and token to be selected
// const modelData = controlUnderTest.recurrentOnRampProvidersModel.get(i)
// verify(!!modelData)
// if (modelData.urlsNeedParameters) {
// testDelegateMouseClicksForProvidersThatNeedParams(delegateUnderTest, modelData)
// } else {
// testDelegateMouseClicksForProvidersThatNeedNoParams(delegateUnderTest, modelData)
// }
// }
// }
}
}

View File

@ -11,7 +11,6 @@ StatusListItem {
id: root
required property string name
required property string description
required property string logoUrl
required property string fees
required property bool urlsNeedParameters
@ -19,7 +18,6 @@ StatusListItem {
property bool isUrlLoading: false
title: root.name
subTitle: root.description
asset.name: root.logoUrl
asset.isImage: true
statusListItemSubTitle.maximumLineCount: 1

View File

@ -4,7 +4,6 @@ import utils 1.0
BuyCryptoProvidersDelegate {
name: Constants.dummyText
description: Constants.dummyText
logoUrl: Constants.dummyText
urlsNeedParameters: false
fees: Constants.dummyText

View File

@ -32,6 +32,8 @@ ColumnLayout {
StatusSwitchTabBar {
id: tabBar
// As we skip Mercuryo and it is the only provider supported for recurrent, we hide the tab bar until there is at least one recurrent provider
visible: false
objectName: "tabBar"
Layout.alignment: Qt.AlignHCenter
Layout.fillWidth: true
@ -53,9 +55,9 @@ ColumnLayout {
model: SortFilterProxyModel {
sourceModel: root.providersModel
filters: ValueFilter {
enabled: tabBar.currentIndex
roleName: "supportsRecurrentPurchase"
value: true
roleName: "name"
value: "Mercuryo"
inverted: true
}
}
delegate: BuyCryptoProvidersDelegate {
@ -63,7 +65,6 @@ ColumnLayout {
width: ListView.view.width
name: model.name
description: model.description
logoUrl: model.logoUrl
fees: model.fees
urlsNeedParameters: model.urlsNeedParameters