From 684d0b4d63e2b68123d59f6f1832d1beb2c4457d Mon Sep 17 00:00:00 2001 From: Alex Jbanca Date: Tue, 15 Oct 2024 12:38:36 +0300 Subject: [PATCH] fix: DAppsWorkflow flaky test --- storybook/qmlTests/tests/tst_DAppsWorkflow.qml | 9 +++++++-- ui/app/AppLayouts/Wallet/panels/DAppsWorkflow.qml | 1 - 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/storybook/qmlTests/tests/tst_DAppsWorkflow.qml b/storybook/qmlTests/tests/tst_DAppsWorkflow.qml index 47fd6d79f6..2f72c43dc3 100644 --- a/storybook/qmlTests/tests/tst_DAppsWorkflow.qml +++ b/storybook/qmlTests/tests/tst_DAppsWorkflow.qml @@ -1129,6 +1129,12 @@ Item { waitForRendering(controlUnderTest) const popup = findChild(controlUnderTest, "dappsRequestModal") verify(popup.opened) + + const acceptButton = findChild(popup, "signButton") + const rejectButton = findChild(popup, "rejectButton") + // Workaround for the buttons not being aligned yet + // Removing this could cause the wrong button to be clicked + tryVerify(() => acceptButton.x > rejectButton.x + rejectButton.width) return popup } @@ -1136,11 +1142,10 @@ Item { const topic = "abcd" const requestId = "12345" let popup = showRequestModal(topic, requestId) - let rejectButton = findChild(popup, "rejectButton") + verify(!!rejectButton) mouseClick(rejectButton) - waitForRendering(controlUnderTest) compare(signRequestRejectedSpy.count, 1, "expected signRequestRejected signal to be emitted") compare(signRequestAcceptedSpy.count, 0, "expected signRequestAccepted signal to not be emitted") compare(signRequestRejectedSpy.signalArguments[0][0], topic, "expected id to be set") diff --git a/ui/app/AppLayouts/Wallet/panels/DAppsWorkflow.qml b/ui/app/AppLayouts/Wallet/panels/DAppsWorkflow.qml index 497c4f271c..17f39805dd 100644 --- a/ui/app/AppLayouts/Wallet/panels/DAppsWorkflow.qml +++ b/ui/app/AppLayouts/Wallet/panels/DAppsWorkflow.qml @@ -294,7 +294,6 @@ DappsComboBox { return } requestHandled = true - let userRejected = true root.signRequestRejected(request.topic, request.id) }