From 22c4bb2846c2a88f79ccb326fbbb885ead077d41 Mon Sep 17 00:00:00 2001 From: Anthony <491074+alaibe@users.noreply.github.com> Date: Mon, 18 Nov 2024 09:48:28 +0100 Subject: [PATCH] feat: hide mercuryo fix #16757 fix #16765 --- .../qmlTests/tests/tst_BuyCryptoModal.qml | 196 +++++++++--------- .../controls/BuyCryptoProvidersDelegate.qml | 2 - .../BuyCryptoProvidersLoadingDelegate.qml | 1 - .../panels/BuyCryptoProvidersListPanel.qml | 9 +- 4 files changed, 103 insertions(+), 105 deletions(-) diff --git a/storybook/qmlTests/tests/tst_BuyCryptoModal.qml b/storybook/qmlTests/tests/tst_BuyCryptoModal.qml index 64c08686ae..1b738401e1 100644 --- a/storybook/qmlTests/tests/tst_BuyCryptoModal.qml +++ b/storybook/qmlTests/tests/tst_BuyCryptoModal.qml @@ -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) - } - } + // // 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() - } + // controlUnderTest.close() + // } + // + // function test_modalContent_recurrent_tab() { + // skip("to be fixed in 16462") + // notificationSpy.clear() + // // Launch modal + // launchPopup() - 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 tab bar - const tabBar = findChild(controlUnderTest, "tabBar") - verify(!!tabBar) + // // find providers list + // const providersList = findChild(controlUnderTest, "providersList") + // verify(!!providersList) - // find providers list - const providersList = findChild(controlUnderTest, "providersList") - verify(!!providersList) + // tryCompare(controlUnderTest, "isBuyProvidersModelLoading", false) - tryCompare(controlUnderTest, "isBuyProvidersModelLoading", false) + // // check data in "Recurrent" tab -------------------------------------------------------- + // mouseClick(tabBar.itemAt(1)) + // compare(tabBar.currentIndex, 1) + // waitForRendering(providersList) + // verify(!!providersList) - // 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) - // verify that 1 item is listed - compare(providersList.count, 1) + // // check if delegate contents are as expected + // testDelegateItems(providersList, controlUnderTest.recurrentOnRampProvidersModel) + // controlUnderTest.close() + // } - // check if delegate contents are as expected - testDelegateItems(providersList, controlUnderTest.recurrentOnRampProvidersModel) - controlUnderTest.close() - } + // function test_modalContent_Recurrent_tab_mouseClicks() { + // notificationSpy.clear() + // // Launch modal + // launchPopup() - function test_modalContent_Recurrent_tab_mouseClicks() { - notificationSpy.clear() - // Launch modal - launchPopup() + // // 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") + // verify(!!providersList) - // find providers list - const providersList = findChild(controlUnderTest, "providersList") - verify(!!providersList) + // mouseClick(tabBar.itemAt(1)) + // compare(tabBar.currentIndex, 1) + // waitForRendering(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) - for(let i =0; i< controlUnderTest.recurrentOnRampProvidersModel.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.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.recurrentOnRampProvidersModel.get(i) + // verify(!!modelData) + // if (modelData.urlsNeedParameters) { + // testDelegateMouseClicksForProvidersThatNeedParams(delegateUnderTest, modelData) + // } else { + // testDelegateMouseClicksForProvidersThatNeedNoParams(delegateUnderTest, modelData) + // } + // } + // } } } diff --git a/ui/app/AppLayouts/Wallet/controls/BuyCryptoProvidersDelegate.qml b/ui/app/AppLayouts/Wallet/controls/BuyCryptoProvidersDelegate.qml index 1e92dab061..c174ba3462 100644 --- a/ui/app/AppLayouts/Wallet/controls/BuyCryptoProvidersDelegate.qml +++ b/ui/app/AppLayouts/Wallet/controls/BuyCryptoProvidersDelegate.qml @@ -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 diff --git a/ui/app/AppLayouts/Wallet/controls/BuyCryptoProvidersLoadingDelegate.qml b/ui/app/AppLayouts/Wallet/controls/BuyCryptoProvidersLoadingDelegate.qml index e64d54995d..0491e96c84 100644 --- a/ui/app/AppLayouts/Wallet/controls/BuyCryptoProvidersLoadingDelegate.qml +++ b/ui/app/AppLayouts/Wallet/controls/BuyCryptoProvidersLoadingDelegate.qml @@ -4,7 +4,6 @@ import utils 1.0 BuyCryptoProvidersDelegate { name: Constants.dummyText - description: Constants.dummyText logoUrl: Constants.dummyText urlsNeedParameters: false fees: Constants.dummyText diff --git a/ui/app/AppLayouts/Wallet/panels/BuyCryptoProvidersListPanel.qml b/ui/app/AppLayouts/Wallet/panels/BuyCryptoProvidersListPanel.qml index 2bf29fe4b0..52d4dc3057 100644 --- a/ui/app/AppLayouts/Wallet/panels/BuyCryptoProvidersListPanel.qml +++ b/ui/app/AppLayouts/Wallet/panels/BuyCryptoProvidersListPanel.qml @@ -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