Skip to content

fix(@desktop/wallet): Fix Qml Tests on qt6.9.0 #18044

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions storybook/pages/SwapInputPanelPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ SplitView {
}

currencyStore: d.adaptor.currencyStore
flatNetworksModel: d.adaptor.swapStore.flatNetworks
flatNetworksModel: d.adaptor.networksStore.activeNetworks
processedAssetsModel: d.adaptor.walletAssetsStore.groupedAccountAssetsModel
plainTokensBySymbolModel: plainTokensModel

Expand All @@ -133,7 +133,7 @@ SplitView {
}

currencyStore: d.adaptor.currencyStore
flatNetworksModel: d.adaptor.swapStore.flatNetworks
flatNetworksModel: d.adaptor.networksStore.activeNetworks
processedAssetsModel: d.adaptor.walletAssetsStore.groupedAccountAssetsModel
plainTokensBySymbolModel: plainTokensModel

Expand Down
11 changes: 9 additions & 2 deletions storybook/qmlTests/tests/tst_BuyReceiveBanner.qml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,11 @@ Item {
id: buyReceiveComponent
BuyReceiveBanner {
id: banner
anchors.fill: parent

width: root.width
height: implicitHeight

anchors.centerIn: parent

readonly property SignalSpy buyClickedSpy: SignalSpy { target: banner; signalName: "buyClicked" }
readonly property SignalSpy receiveClickedSpy: SignalSpy { target: banner; signalName: "receiveClicked" }
Expand All @@ -23,6 +27,9 @@ Item {

TestCase {
id: buyReceiveBannerTest

name: "BuyReceiveBannerTest"

when: windowShown

property BuyReceiveBanner componentUnderTest
Expand All @@ -40,7 +47,7 @@ Item {

function test_geometry() {
compare(componentUnderTest.width, root.width)
compare(componentUnderTest.height, root.height)
compare(componentUnderTest.height, 70)
}

function test_buyGeometry() {
Expand Down
6 changes: 3 additions & 3 deletions storybook/qmlTests/tests/tst_DappsComboBox.qml
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ Item {
verify(dappTooltip.height > 0)
verify(dappTooltip.y > controlUnderTest.height)

mouseMove(root)
compare(background.active, false)
compare(dappTooltip.visible, false)
mouseMove(root, 0, 0)
verify(!background.active)
verify(!dappTooltip.visible)
}

function test_clickConnect() {
Expand Down
4 changes: 4 additions & 0 deletions storybook/qmlTests/tests/tst_LazyStackLayout.qml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ Item {
}

function test_itemsInitialization() {
skip("StackLayout combined with Repeater behaves differently on Qt 5 and Qt 6.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, known problem @micieslak ? Worth reporting upstream?

On Qt 6 all entries are initially visible what's not expected and
it's probably Qt bug. Observed only in test environment.")

const layout = createTemporaryObject(nonEmpty, root)

compare(layout.count, 3)
Expand Down
12 changes: 12 additions & 0 deletions storybook/qmlTests/tests/tst_OnboardingLayout.qml
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,7 @@ Item {

// PAGE 1: Welcome
let page = getCurrentPage(stack, WelcomePage)
waitForRendering(page)

const linksText = findChild(controlUnderTest, "approvalLinks")
verify(!!linksText)
Expand Down Expand Up @@ -362,6 +363,7 @@ Item {

// PAGE 1: Welcome
let page = getCurrentPage(stack, WelcomePage)
waitForRendering(page)

const btnCreateProfile = findChild(controlUnderTest, "btnCreateProfile")
verify(!!btnCreateProfile)
Expand Down Expand Up @@ -459,6 +461,8 @@ Item {

// PAGE 1: Welcome
let page = getCurrentPage(stack, WelcomePage)
waitForRendering(page)

const btnCreateProfile = findChild(controlUnderTest, "btnCreateProfile")
verify(!!btnCreateProfile)
mouseClick(btnCreateProfile)
Expand Down Expand Up @@ -605,6 +609,8 @@ Item {

// PAGE 1: Welcome
let page = getCurrentPage(stack, WelcomePage)
waitForRendering(page)

const btnCreateProfile = findChild(controlUnderTest, "btnCreateProfile")
verify(!!btnCreateProfile)
mouseClick(btnCreateProfile)
Expand Down Expand Up @@ -700,6 +706,8 @@ Item {

// PAGE 1: Welcome
let page = getCurrentPage(stack, WelcomePage)
waitForRendering(page)

const btnLogin = findChild(controlUnderTest, "btnLogin")
verify(!!btnLogin)
mouseClick(btnLogin)
Expand Down Expand Up @@ -793,6 +801,8 @@ Item {

// PAGE 1: Welcome
let page = getCurrentPage(stack, WelcomePage)
waitForRendering(page)

const btnLogin = findChild(controlUnderTest, "btnLogin")
verify(!!btnLogin)
mouseClick(btnLogin)
Expand Down Expand Up @@ -886,6 +896,8 @@ Item {

// PAGE 1: Welcome
let page = getCurrentPage(stack, WelcomePage)
waitForRendering(page)

const btnLogin = findChild(controlUnderTest, "btnLogin")
verify(!!btnLogin)
mouseClick(btnLogin)
Expand Down
4 changes: 3 additions & 1 deletion storybook/qmlTests/tests/tst_SendRecipientInput.qml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ Item {
// input's text should be what we typed,
compare(plainText, "0xdeadbeef")
// ... and for each letter pressed the signal `validateInputRequested` should be emitted
compare(signalSpyValidateInputRequested.count, plainText.length)
tryCompare(signalSpyValidateInputRequested, "count", plainText.length)
}

function test_interactive() {
Expand Down Expand Up @@ -160,6 +160,8 @@ Item {

controlUnderTest.text = "0xdeadbeef"

waitForRendering(controlUnderTest)

// clear button should be visible with some text
verify(clearButton.visible)
mouseClick(clearButton)
Expand Down
2 changes: 2 additions & 0 deletions storybook/qmlTests/tests/tst_SimpleSendRecipientInput.qml
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,8 @@ Item {

controlUnderTest.text = "0xdeadbeef"

waitForRendering(controlUnderTest)

// clear button should be visible with some text
verify(clearButton.visible)
mouseClick(clearButton)
Expand Down
3 changes: 2 additions & 1 deletion storybook/qmlTests/tests/tst_SwapInputPanel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import AppLayouts.Wallet.stores 1.0
import AppLayouts.Wallet.panels 1.0
import AppLayouts.Wallet.popups.swap 1.0
import AppLayouts.Wallet.adaptors 1.0
import AppLayouts.Wallet 1.0

import shared.stores 1.0

Expand Down Expand Up @@ -351,7 +352,7 @@ Item {
mouseClick(holdingSelector)
waitForRendering(assetSelectorList)

let delToTest = assetSelectorList.itemAtIndex(i)
const delToTest = findChild(assetSelectorList, "tokenSelectorAssetDelegate_%1".arg(modelItemToTest.name))
verify(!!delToTest)
mouseClick(delToTest)

Expand Down
2 changes: 1 addition & 1 deletion ui/app/AppLayouts/Wallet/controls/AssetSelector.qml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Control {
dropdown.close()
}

onSelected: {
onSelected: function(key) {
const entry = ModelUtils.getByKey(root.model, "tokensKey", key)
highlightedKey = key

Expand Down
4 changes: 2 additions & 2 deletions ui/app/AppLayouts/Wallet/panels/SwapInputPanel.qml
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ Control {
model: d.adaptor.outputAssetsModel
nonInteractiveKey: root.nonInteractiveTokensKey

onSelected: {
onSelected: function(key) {
// Token existance checked with plainTokensBySymbolModel
// This check prevents resetting selection when chain is changed until
// processedAssetsModel is updated
Expand Down Expand Up @@ -329,7 +329,7 @@ Control {

visible: d.isSelectedHoldingValidAsset && root.swapSide === SwapInputPanel.SwapSide.Pay

onClicked: {
onClicked: function() {
if (maxSafeValue)
amountToSendInput.setValue(SQUtils.AmountsArithmetic.fromNumber(maxSafeValue).toString())
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ StatusInput {
}
}

Keys.onTabPressed: event.accepted = true
Keys.onReleased: root.validateInputRequested()
Keys.onTabPressed: (event) => {
event.accepted = true
}
Keys.onReleased: (event) => {
event.accepted = true
root.validateInputRequested()
}
}