mirror of
https://github.com/status-im/status-desktop.git
synced 2025-02-01 17:27:53 +00:00
b6bc5d1e29
closes #16912 Sending the dapps events to mixpanel | Event Name | Properties | Possible Values | Notes | | --- | --- | --- | --- | | dapps-health | state | - wc_available - wc_unavailable - chains_down - network_down - pair_error - connection_error - sign_error | | | | error | | string description | | dapps-navigation | flow | - dapps_list_opened - connect_initiated - disconnect_initiated - pair_initiated | | | | connector | - wallet_connect - browser_connect | | | dapps-connection | flow | - proposal_received - proposal_accepted - proposal_rejected - connected - disconnected | | | | networks | networks[string] - array of networks | Array of proposed or connected networks | | | methods | methods[string] - array of methods | Array of proposed methods | | | dapp | dapp uri | | | | connector | - wallet_connect - browser_connect | | | | isSiwe | boolean | | | dapps-sign | flow | - sign_received - sign_accepted - sign_rejected | | | | connector | - wallet_connect - browser_connect | | | | method | - personal_sign - eth_sign - eth_signTypedData_v4 - eth_signTypedData - eth_signTransaction - eth_sendTransaction | | | | dapp | string - dapp uri | | | | chainId | int - chain id | |
124 lines
4.3 KiB
QML
124 lines
4.3 KiB
QML
import QtQuick 2.15
|
|
import QtQml.Models 2.15
|
|
|
|
import QtTest 1.15
|
|
|
|
import AppLayouts.Wallet.controls 1.0
|
|
|
|
Item {
|
|
id: root
|
|
width: 600
|
|
height: 400
|
|
|
|
Component {
|
|
id: componentUnderTest
|
|
DappsComboBox {
|
|
id: controlUnderTest
|
|
property SignalSpy dappListRequestedSpy: SignalSpy { target: controlUnderTest; signalName: "dappListRequested" }
|
|
property SignalSpy connectDappSpy: SignalSpy { target: controlUnderTest; signalName: "connectDapp" }
|
|
property SignalSpy disconnectDappSpy: SignalSpy { target: controlUnderTest; signalName: "disconnectDapp" }
|
|
|
|
anchors.centerIn: parent
|
|
model: ListModel {}
|
|
}
|
|
}
|
|
|
|
property DappsComboBox controlUnderTest: null
|
|
|
|
TestCase {
|
|
name: "DappsComboBox"
|
|
when: windowShown
|
|
|
|
function init() {
|
|
controlUnderTest = createTemporaryObject(componentUnderTest, root)
|
|
}
|
|
|
|
function test_basicGeometry() {
|
|
verify(controlUnderTest.width > 0)
|
|
verify(controlUnderTest.height > 0)
|
|
}
|
|
|
|
function test_showStatusIndicator() {
|
|
const indicator = findChild(controlUnderTest, "dappBadge")
|
|
compare(indicator.visible, false)
|
|
|
|
controlUnderTest.model.append({name: "Test dApp 1", url: "https://dapp.test/1", iconUrl: "https://se-sdk-dapp.vercel.app/assets/eip155:1.png", connectorBadge: "status"})
|
|
compare(indicator.visible, true)
|
|
|
|
controlUnderTest.model.clear()
|
|
compare(indicator.visible, false)
|
|
}
|
|
|
|
function test_dappIcon() {
|
|
const icon = findChild(controlUnderTest, "dappIcon")
|
|
compare(icon.icon, "dapp")
|
|
compare(icon.width, 16)
|
|
compare(icon.height, 16)
|
|
compare(icon.status, Image.Ready)
|
|
}
|
|
|
|
function test_openingPopup() {
|
|
mouseClick(controlUnderTest)
|
|
const popup = findChild(controlUnderTest, "dappsListPopup")
|
|
compare(popup.visible, true)
|
|
compare(popup.x, controlUnderTest.width - popup.width)
|
|
compare(popup.y, controlUnderTest.height + 4)
|
|
compare(popup.width, 312)
|
|
verify(popup.height > 0)
|
|
compare(controlUnderTest.dappListRequestedSpy.count, 1)
|
|
|
|
const background = findChild(controlUnderTest, "dappsBackground")
|
|
compare(background.active, true)
|
|
|
|
mouseClick(controlUnderTest)
|
|
compare(popup.visible, false)
|
|
compare(background.active, false)
|
|
}
|
|
|
|
function test_hoverState() {
|
|
const background = findChild(controlUnderTest, "dappsBackground")
|
|
compare(background.active, false)
|
|
|
|
mouseMove(controlUnderTest, controlUnderTest.width/2, controlUnderTest.height/2)
|
|
compare(background.active, true)
|
|
compare(controlUnderTest.hovered, true)
|
|
const dappTooltip = findChild(controlUnderTest, "dappTooltip")
|
|
wait(dappTooltip.delay + 50)
|
|
compare(dappTooltip.visible, true)
|
|
compare(dappTooltip.text, "dApp connections")
|
|
verify(dappTooltip.width > 0)
|
|
verify(dappTooltip.height > 0)
|
|
verify(dappTooltip.y > controlUnderTest.height)
|
|
|
|
mouseMove(root)
|
|
compare(background.active, false)
|
|
compare(dappTooltip.visible, false)
|
|
}
|
|
|
|
function test_clickConnect() {
|
|
mouseClick(controlUnderTest)
|
|
waitForRendering(controlUnderTest, 200)
|
|
|
|
|
|
const connectButton = findChild(controlUnderTest, "connectDappButton")
|
|
verify(!!connectButton)
|
|
|
|
mouseClick(connectButton)
|
|
compare(controlUnderTest.connectDappSpy.count, 1)
|
|
}
|
|
|
|
function test_disconnect() {
|
|
controlUnderTest.model.append({name: "Test dApp 1", url: "https://dapp.test/1", iconUrl: "https://se-sdk-dapp.vercel.app/assets/eip155:1.png", connectorBadge: "status"})
|
|
mouseClick(controlUnderTest)
|
|
waitForRendering(controlUnderTest, 200)
|
|
|
|
const dapplist = findChild(controlUnderTest, "dappsListPopup")
|
|
const disconnectButton = findChild(dapplist.contentItem, "disconnectDappButton")
|
|
verify(!!disconnectButton)
|
|
|
|
mouseClick(disconnectButton)
|
|
compare(controlUnderTest.disconnectDappSpy.count, 1)
|
|
}
|
|
}
|
|
}
|