desktop-ui-tests/tst_status_chat_info_button...

80 lines
2.1 KiB
QML
Raw Normal View History

2021-10-19 09:11:57 +00:00
import QtQuick 2.14
import QtQuick.Window 2.14
import QtTest 1.14
import "base"
import StatusQ.Controls 0.1
import StatusQ.Popups 0.1
2021-10-19 09:11:57 +00:00
WindowTestCase {
name: "statusChatInfoButton test"
2021-10-19 09:11:57 +00:00
Helpers { id: helpers }
SignalSpy {
id: clickedSpy
target: chatInfoButton
2021-10-19 09:11:57 +00:00
signalName: "clicked"
}
SignalSpy {
id: unmuteSpy
target: chatInfoButton
2021-10-19 09:11:57 +00:00
signalName: "unmute"
}
SignalSpy {
id: pinnedCounterSpy
target: chatInfoButton
2021-10-19 09:11:57 +00:00
signalName: "pinnedMessagesCountClicked"
}
StatusChatInfoButton {
id: chatInfoButton
parent: windowContent
title: "#public-chat"
subTitle: "chat-about-everything"
muted: true
pinnedMessagesCount: 3
}
2021-10-19 09:11:57 +00:00
function test_case1_statusChatInfoButton_signals_valid() {
2021-10-19 09:11:57 +00:00
// checking if signals are present
verify(clickedSpy.valid, "Signal " + clickedSpy.signalName + "is not found")
verify(unmuteSpy.valid, "Signal " + unmuteSpy.signalName + "is not found")
verify(pinnedCounterSpy.valid, "Signal " + pinnedCounterSpy.signalName + "is not found")
2021-10-19 09:11:57 +00:00
}
function test_case2_statusChatInfoButton_clicked() {
compare(clickedSpy.count, 0)
mouseClick(chatInfoButton, 1, 1, Qt.LeftButton)
wait(10000)
compare(clickedSpy.count, 1, "Status Chat info button was not clicked")
}
function test_case3_statusChatInfoButton_unmuted() {
unmuteSpy.clear()
var mutedButton = helpers.getObjectByObjectName(chatInfoButton, "mutedIcon")
verify(mutedButton)
compare(unmuteSpy.count, 0)
2021-10-19 11:19:03 +00:00
mouseClick(mutedButton, 2, 2, Qt.LeftButton)
compare(unmuteSpy.count, 1, "Muted button is not clicked")
2021-10-19 11:19:03 +00:00
}
function test_case4_statusChatInfoButton_pinned() {
2021-10-19 13:50:34 +00:00
pinnedCounterSpy.clear()
var pinButtonCounter = helpers.getObjectByObjectName(chatInfoButton, "pinMessagesCounterSensor")
verify(pinButtonCounter)
compare(pinnedCounterSpy.count, 0)
2021-10-19 13:50:34 +00:00
mouseClick(pinButtonCounter, 1, 1, Qt.LeftButton)
compare(pinnedCounterSpy.count, 1, "Pin counter is not clicked")
2021-10-19 13:50:34 +00:00
}
2021-10-19 09:11:57 +00:00
}