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

View File

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

View File

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

View File

@ -32,6 +32,8 @@ ColumnLayout {
StatusSwitchTabBar { StatusSwitchTabBar {
id: tabBar 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" objectName: "tabBar"
Layout.alignment: Qt.AlignHCenter Layout.alignment: Qt.AlignHCenter
Layout.fillWidth: true Layout.fillWidth: true
@ -53,9 +55,9 @@ ColumnLayout {
model: SortFilterProxyModel { model: SortFilterProxyModel {
sourceModel: root.providersModel sourceModel: root.providersModel
filters: ValueFilter { filters: ValueFilter {
enabled: tabBar.currentIndex roleName: "name"
roleName: "supportsRecurrentPurchase" value: "Mercuryo"
value: true inverted: true
} }
} }
delegate: BuyCryptoProvidersDelegate { delegate: BuyCryptoProvidersDelegate {
@ -63,7 +65,6 @@ ColumnLayout {
width: ListView.view.width width: ListView.view.width
name: model.name name: model.name
description: model.description
logoUrl: model.logoUrl logoUrl: model.logoUrl
fees: model.fees fees: model.fees
urlsNeedParameters: model.urlsNeedParameters urlsNeedParameters: model.urlsNeedParameters