fix: DAppsWorkflow flaky test

This commit is contained in:
Alex Jbanca 2024-10-15 12:38:36 +03:00 committed by Alex Jbanca
parent eeef165743
commit 684d0b4d63
2 changed files with 7 additions and 3 deletions

View File

@ -1129,6 +1129,12 @@ Item {
waitForRendering(controlUnderTest) waitForRendering(controlUnderTest)
const popup = findChild(controlUnderTest, "dappsRequestModal") const popup = findChild(controlUnderTest, "dappsRequestModal")
verify(popup.opened) 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 return popup
} }
@ -1136,11 +1142,10 @@ Item {
const topic = "abcd" const topic = "abcd"
const requestId = "12345" const requestId = "12345"
let popup = showRequestModal(topic, requestId) let popup = showRequestModal(topic, requestId)
let rejectButton = findChild(popup, "rejectButton") let rejectButton = findChild(popup, "rejectButton")
verify(!!rejectButton)
mouseClick(rejectButton) mouseClick(rejectButton)
waitForRendering(controlUnderTest)
compare(signRequestRejectedSpy.count, 1, "expected signRequestRejected signal to be emitted") compare(signRequestRejectedSpy.count, 1, "expected signRequestRejected signal to be emitted")
compare(signRequestAcceptedSpy.count, 0, "expected signRequestAccepted signal to not be emitted") compare(signRequestAcceptedSpy.count, 0, "expected signRequestAccepted signal to not be emitted")
compare(signRequestRejectedSpy.signalArguments[0][0], topic, "expected id to be set") compare(signRequestRejectedSpy.signalArguments[0][0], topic, "expected id to be set")

View File

@ -294,7 +294,6 @@ DappsComboBox {
return return
} }
requestHandled = true requestHandled = true
let userRejected = true
root.signRequestRejected(request.topic, request.id) root.signRequestRejected(request.topic, request.id)
} }